Skip to content

Commit

Permalink
chore: add missing derive
Browse files Browse the repository at this point in the history
  • Loading branch information
hackaugusto committed Nov 30, 2023
1 parent 4582326 commit 4b56fac
Show file tree
Hide file tree
Showing 60 changed files with 93 additions and 59 deletions.
2 changes: 1 addition & 1 deletion air/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::fmt::{Display, Formatter};
// EXECUTION ERROR
// ================================================================================================

#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum ExecutionOptionsError {
ExpectedCyclesTooBig(u32, u32),
MaxCycleNumTooSmall(u32),
Expand Down
3 changes: 2 additions & 1 deletion air/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub use winter_air::FieldExtension;
// ================================================================================================

/// TODO: add docs
#[derive(Clone, PartialEq, Eq)]
pub struct ProcessorAir {
context: AirContext<Felt>,
stack_inputs: StackInputs,
Expand Down Expand Up @@ -250,7 +251,7 @@ impl Air for ProcessorAir {
// PUBLIC INPUTS
// ================================================================================================

#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PublicInputs {
program_info: ProgramInfo,
stack_inputs: StackInputs,
Expand Down
4 changes: 2 additions & 2 deletions air/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::{
// ================================================================================================

/// A set of parameters specifying how Miden VM execution proofs are to be generated.
#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ProvingOptions {
exec_options: ExecutionOptions,
proof_options: WinterProofOptions,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl From<ProvingOptions> for WinterProofOptions {
///
/// - `max_cycles` specifies the maximum number of cycles a program is allowed to execute.
/// - `expected_cycles` specifies the number of cycles a program is expected to execute.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ExecutionOptions {
max_cycles: u32,
expected_cycles: u32,
Expand Down
2 changes: 1 addition & 1 deletion air/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<E: FieldElement> EvaluationResult<E> for Vec<E> {

/// Manages the starting index and length of transition constraints for individual processors so
/// indices can be handled easily during transition evaluation.
#[derive(Debug)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct TransitionConstraintRange {
pub(super) stack: Range<usize>,
pub(super) range_checker: Range<usize>,
Expand Down
6 changes: 3 additions & 3 deletions assembly/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl std::error::Error for AssemblyError {}
// ================================================================================================

/// An error which can be generated while parsing a Miden assembly source code into an AST.
#[derive(Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq, Hash)]
pub struct ParsingError {
message: String,
location: SourceLocation,
Expand Down Expand Up @@ -679,7 +679,7 @@ impl std::error::Error for ParsingError {}
// NAME ERROR
// ================================================================================================

#[derive(Debug, Clone, Eq, PartialEq)]
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub enum LabelError {
EmptyLabel,
RpoDigestHexLabelIncorrectLength(usize),
Expand Down Expand Up @@ -943,7 +943,7 @@ impl From<PathError> for LibraryError {
// PATH ERROR
// ================================================================================================

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum PathError {
ComponentInvalidChar { component: String },
ComponentInvalidFirstChar { component: String },
Expand Down
4 changes: 2 additions & 2 deletions assembly/src/procedures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use core::{
/// Procedure metadata includes:
/// - Number of procedure locals available to the procedure.
/// - A set of MAST roots of procedures which are invoked from this procedure.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Procedure {
num_locals: u32,
code: CodeBlock,
Expand Down Expand Up @@ -56,7 +56,7 @@ impl Procedure {
/// - Procedure name.
/// - A boolean flag indicating whether the procedure is exported from a module.
/// - A set of MAST roots of procedures which are invoked from this procedure.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct NamedProcedure {
name: ProcedureName,
is_export: bool,
Expand Down
2 changes: 1 addition & 1 deletion core/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::fmt;
// INPUT ERROR
// ================================================================================================

#[derive(Clone, Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InputError {
NotFieldElement(u64, &'static str),
DuplicateAdviceRoot([u8; 32]),
Expand Down
2 changes: 1 addition & 1 deletion core/src/operations/decorators/assembly_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::fmt;
// ================================================================================================

/// Contains information corresponding to an assembly instruction (only applicable in debug mode).
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct AssemblyOp {
context_name: String,
num_cycles: u8,
Expand Down
2 changes: 1 addition & 1 deletion core/src/operations/decorators/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::fmt;
///
/// These options define the debug info which gets printed out when the Debug decorator is
/// executed.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum DebugOptions {
/// Print out the entire contents of the stack for the current execution context.
StackAll,
Expand Down
4 changes: 2 additions & 2 deletions core/src/program/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod tests;
/// A program is described by a Merkelized Abstract Syntax Tree (MAST), where each node is a
/// [CodeBlock]. Internal nodes describe control flow semantics of the program, while leaf nodes
/// contain linear sequences of instructions which contain no control flow.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Program {
root: CodeBlock,
kernel: Kernel,
Expand Down Expand Up @@ -87,7 +87,7 @@ impl fmt::Display for Program {
/// This table is used to hold code blocks which are referenced from the program MAST but are
/// actually not a part of the MAST itself. Thus, for example, multiple nodes in the MAST can
/// reference the same code block in the table.
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct CodeBlockTable(BTreeMap<[u8; 32], CodeBlock>);

impl CodeBlockTable {
Expand Down
1 change: 1 addition & 0 deletions core/src/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const HALF_RATE_WIDTH: usize = (Rpo256::RATE_RANGE.end - Rpo256::RATE_RANGE.star
/// This is possible because in our case we never reseed with more than 4 field elements.
/// 2. As a result of the previous point, we dont make use of an input buffer to accumulate seed
/// material.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct RpoRandomCoin {
state: [Felt; STATE_WIDTH],
current: usize,
Expand Down
2 changes: 1 addition & 1 deletion core/src/stack/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use core::slice;
///
/// The program execution expects the inputs to be a stack on the VM, and it will be stored in
/// reversed order on this struct.
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct StackInputs {
values: Vec<Felt>,
}
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use assembly::{LibraryNamespace, MaslLibrary, Version};
use clap::Parser;
use std::path::PathBuf;

#[derive(Debug, Clone, Parser)]
#[derive(Debug, Clone, Parser, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[clap(
name = "Compile Library",
about = "Bundles .masm files into a single .masl library"
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use clap::Parser;
use super::data::{Debug, Libraries, ProgramFile};
use std::path::PathBuf;

#[derive(Debug, Clone, Parser)]
#[derive(Debug, Clone, Parser, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[clap(about = "Compile a miden program")]
pub struct CompileCmd {
/// Path to .masm assembly file
Expand Down
9 changes: 6 additions & 3 deletions miden/src/cli/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use stdlib::StdLibrary;
// ================================================================================================

/// Indicates whether debug mode is on or off.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Debug {
On,
Off,
Expand All @@ -37,7 +38,7 @@ impl Debug {

/// Struct used to deserialize merkle data from input file. Merkle data can be represented as a
/// merkle tree or a Sparse Merkle Tree.
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum MerkleData {
/// String representation of a merkle tree. The merkle tree is represented as a vector of
/// 32 byte hex strings where each string represents a leaf in the tree.
Expand Down Expand Up @@ -65,7 +66,7 @@ pub enum MerkleData {
/// - advice_stack
/// - advice_map
/// - merkle_store
#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct InputFile {
/// String representation of the initial operand stack, composed of chained field elements.
pub operand_stack: Vec<String>,
Expand Down Expand Up @@ -295,7 +296,7 @@ impl InputFile {
// ================================================================================================

/// Output file struct
#[derive(Deserialize, Serialize, Debug)]
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct OutputFile {
pub stack: Vec<String>,
pub overflow_addrs: Vec<String>,
Expand Down Expand Up @@ -371,6 +372,7 @@ impl OutputFile {
// PROGRAM FILE
// ================================================================================================

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ProgramFile {
ast: ProgramAst,
path: PathBuf,
Expand Down Expand Up @@ -527,6 +529,7 @@ impl ProgramHash {

// LIBRARY FILE
// ================================================================================================
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Libraries {
pub libraries: Vec<MaslLibrary>,
}
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/debug/command.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// debug commands supported by the debugger
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum DebugCommand {
Continue,
Next(usize),
Expand Down
1 change: 1 addition & 0 deletions miden/src/cli/debug/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use miden::{
};

/// Holds debugger state and iterator used for debugging.
#[derive(Debug, Clone)]
pub struct DebugExecutor {
vm_state_iter: VmStateIterator,
vm_state: VmState,
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use command::DebugCommand;
mod executor;
use executor::DebugExecutor;

#[derive(Debug, Clone, Parser)]
#[derive(Debug, Clone, Parser, PartialEq, Eq)]
#[clap(about = "Debug a miden program")]
pub struct DebugCmd {
/// Path to .masm assembly file
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use processor::{DefaultHost, ExecutionOptions, ExecutionOptionsError};
use std::{io::Write, path::PathBuf, time::Instant};

// TODO check if clap is supporting automatic generation of list values of hash function
#[derive(Debug, Clone, Parser)]
#[derive(Parser, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[clap(about = "Prove a miden program")]
pub struct ProveCmd {
/// Path to .masm assembly file
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::PathBuf;

use crate::repl::start_repl;

#[derive(Debug, Clone, Parser)]
#[derive(Parser, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[clap(about = "Initiates the Miden REPL tool")]
pub struct ReplCmd {
/// Paths to .masl library files
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use clap::Parser;
use processor::{DefaultHost, ExecutionOptions};
use std::{path::PathBuf, time::Instant};

#[derive(Debug, Clone, Parser)]
#[derive(Parser, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[clap(about = "Run a miden program")]
pub struct RunCmd {
/// Path to .masm assembly file
Expand Down
2 changes: 1 addition & 1 deletion miden/src/cli/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use clap::Parser;
use miden::{Kernel, ProgramInfo};
use std::{path::PathBuf, time::Instant};

#[derive(Debug, Clone, Parser)]
#[derive(Parser, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[clap(about = "Verify a miden program")]
pub struct VerifyCmd {
/// Path to input file
Expand Down
4 changes: 2 additions & 2 deletions miden/src/examples/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ where
// EXAMPLE OPTIONS
// ================================================================================================

#[derive(Debug, Clone, Parser)]
#[derive(Debug, Clone, Parser, PartialEq, Eq)]
#[clap(about = "Run an example miden program")]
pub struct ExampleOptions {
#[clap(subcommand)]
Expand All @@ -46,7 +46,7 @@ pub struct ExampleOptions {
security: String,
}

#[derive(Debug, Clone, Parser)]
#[derive(Debug, Clone, Parser, PartialEq, Eq)]
//#[clap(about = "available examples")]
pub enum ExampleType {
/// Compute a Fibonacci sequence of the specified length
Expand Down
2 changes: 1 addition & 1 deletion miden/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct Cli {
}

/// CLI actions
#[derive(Debug, Parser)]
#[derive(Debug, Parser, PartialEq, Eq)]
pub enum Actions {
Analyze(tools::Analyze),
Compile(cli::CompileCmd),
Expand Down
2 changes: 1 addition & 1 deletion miden/src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use stdlib::StdLibrary;
// ================================================================================================

/// Defines cli interface
#[derive(Debug, Clone, Parser)]
#[derive(Debug, Clone, Parser, PartialEq, Eq)]
#[clap(about = "Analyze a miden program")]
pub struct Analyze {
/// Path to .masm assembly file
Expand Down
2 changes: 1 addition & 1 deletion processor/src/chiplets/aux_trace/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::{
/// attributed to the correct chiplet and operation, a unique chiplet operation label must be
/// included in the lookup row value when it is computed.
#[derive(Default)]
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct ChipletsBus {
lookup_hints: BTreeMap<u32, ChipletsBusRow>,
requests: Vec<ChipletLookup>,
Expand Down
4 changes: 3 additions & 1 deletion processor/src/chiplets/aux_trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub(crate) use virtual_table::{ChipletsVTableRow, ChipletsVTableUpdate};

/// Contains all relevant information and describes how to construct the execution trace for
/// chiplets-related auxiliary columns (used in multiset checks).
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AuxTraceBuilder {
bus_builder: BusTraceBuilder,
table_builder: ChipletsVTableTraceBuilder,
Expand Down Expand Up @@ -45,6 +46,7 @@ impl AuxTraceBuilder {
// ================================================================================================

/// Describes how to construct the execution trace of the chiplets bus auxiliary trace column.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BusTraceBuilder {
pub(super) lookup_hints: Vec<(u32, ChipletsBusRow)>,
pub(super) requests: Vec<ChipletLookup>,
Expand Down Expand Up @@ -137,7 +139,7 @@ impl AuxColumnBuilder<ChipletsBusRow, ChipletLookup, u32> for BusTraceBuilder {
/// procedures contained in the kernel ROM. Thus, it is expected that the initial value is ONE, the
/// value after all sibling table updates are completed is again ONE, and the value at the end of
/// the trace is the product of the representations of the kernel ROM procedures.
#[derive(Debug, Clone, Default)]
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct ChipletsVTableTraceBuilder {
pub(super) hints: Vec<(u32, ChipletsVTableUpdate)>,
pub(super) rows: Vec<ChipletsVTableRow>,
Expand Down
2 changes: 1 addition & 1 deletion processor/src/chiplets/aux_trace/virtual_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::trace::LookupTableRow;
/// - The kernel procedure table contains all kernel procedures along with the address where they
/// first appear in the kernel ROM trace. Each kernel procedure is expected to be included exactly
/// once, regardless of whether it is ever called or not.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum ChipletsVTableUpdate {
SiblingAdded(u32),
SiblingRemoved(u32),
Expand Down
1 change: 1 addition & 0 deletions processor/src/chiplets/bitwise/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const INIT_TRACE_CAPACITY: usize = 128;
/// significant 4-bit limbs of the input values. With every subsequent row, the next most
/// significant 4-bit limb of the result is appended to it. Thus, by the 8th row, column `z`
/// contains the full result of the bitwise operation.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Bitwise {
trace: [Vec<Felt>; TRACE_WIDTH],
}
Expand Down
2 changes: 1 addition & 1 deletion processor/src/chiplets/hasher/lookups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const NUM_HEADER_ALPHAS: usize = 4;
/// Specifies the context of the [HasherLookup], indicating whether it describes the beginning of a
/// hash operation, the return of a specified result, or the absorption of additional elements,
/// initiating a new hash cycle with the provided [HasherState].
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum HasherLookupContext {
Start,
Absorb,
Expand Down
Loading

0 comments on commit 4b56fac

Please sign in to comment.