From 1403aedaf82d30d151c287d715d6ad006ce9aacf Mon Sep 17 00:00:00 2001 From: Paul-Henry Kajfasz Date: Tue, 18 Jun 2024 16:05:30 +0100 Subject: [PATCH] Updated cargo.toml's + added toolchain --- Cargo.toml | 10 +++++++ air/Cargo.toml | 13 ++++---- air/src/constraints/chiplets/hasher/mod.rs | 4 +-- air/src/constraints/stack/field_ops/mod.rs | 12 ++++---- air/src/constraints/stack/overflow/mod.rs | 7 ++--- .../stack/stack_manipulation/mod.rs | 8 ++--- air/src/constraints/stack/u32_ops/mod.rs | 4 +-- air/src/options.rs | 4 +-- assembly/Cargo.toml | 13 ++++---- assembly/src/ast/module.rs | 4 +-- core/Cargo.toml | 13 ++++---- miden/Cargo.toml | 13 ++++---- processor/Cargo.toml | 13 ++++---- processor/src/chiplets/mod.rs | 30 +++++++++---------- processor/src/host/advice/injectors/dsa.rs | 4 +-- processor/src/operations/comb_ops.rs | 8 ++--- prover/Cargo.toml | 13 ++++---- rust-toolchain | 1 + scripts/check-rust-version.sh | 13 ++++++++ stdlib/Cargo.toml | 11 +++---- test-utils/Cargo.toml | 13 ++++---- test-utils/src/lib.rs | 4 +-- verifier/Cargo.toml | 13 ++++---- 23 files changed, 130 insertions(+), 98 deletions(-) create mode 100644 rust-toolchain create mode 100644 scripts/check-rust-version.sh diff --git a/Cargo.toml b/Cargo.toml index 55bb2d18ab..70a84db171 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,16 @@ members = [ ] resolver = "2" +[workspace.package] +edition = "2021" +rust-version = "1.78" +license = "MIT" +readme = "README.md" +authors = ["Miden contributors"] +homepage = "https://polygon.technology/polygon-miden" +repository = "https://github.com/0xPolygonMiden/miden-vm" +exclude = [".github/"] + [profile.optimized] inherits = "release" codegen-units = 1 diff --git a/air/Cargo.toml b/air/Cargo.toml index 63bb5e29c7..267be62ba6 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-air" version = "0.9.2" description = "Algebraic intermediate representation of Miden VM processor" -authors = ["miden contributors"] -readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-air/0.9.2" categories = ["cryptography", "no-std"] keywords = ["air", "arithmetization", "crypto", "miden"] -edition = "2021" -rust-version = "1.75" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [lib] bench = false diff --git a/air/src/constraints/chiplets/hasher/mod.rs b/air/src/constraints/chiplets/hasher/mod.rs index 8df5fca0cb..9e2a3a2dac 100644 --- a/air/src/constraints/chiplets/hasher/mod.rs +++ b/air/src/constraints/chiplets/hasher/mod.rs @@ -100,8 +100,8 @@ pub fn get_transition_constraint_count() -> usize { /// Enforces constraints for the hasher chiplet. /// -/// - The `hasher_flag` determines if the hasher chiplet is currently enabled. It should be -/// computed by the caller and set to `Felt::ONE` +/// - The `hasher_flag` determines if the hasher chiplet is currently enabled. It should be computed +/// by the caller and set to `Felt::ONE` /// - The `transition_flag` indicates whether this is the last row this chiplet's execution trace, /// and therefore the constraints should not be enforced. pub fn enforce_constraints>( diff --git a/air/src/constraints/stack/field_ops/mod.rs b/air/src/constraints/stack/field_ops/mod.rs index f185e255c9..74871b1bc0 100644 --- a/air/src/constraints/stack/field_ops/mod.rs +++ b/air/src/constraints/stack/field_ops/mod.rs @@ -187,8 +187,8 @@ pub fn enforce_incr_constraints( /// in the stack with its bitwise not value. Therefore, the following constraints are /// enforced: /// - The top element should be a binary. It is enforced as a general constraint. -/// - The first element of the next frame should be a binary not of the first element of -/// the current frame. s0` + s0 = 1. +/// - The first element of the next frame should be a binary not of the first element of the current +/// frame. s0` + s0 = 1. pub fn enforce_not_constraints( frame: &EvaluationFrame, result: &mut [E], @@ -206,8 +206,8 @@ pub fn enforce_not_constraints( /// Enforces constraints of the AND operation. The AND operation computes the bitwise and of the /// first two elements in the current trace. Therefore, the following constraints are enforced: -/// - The top two element in the current frame of the stack should be binary. s0^2 - s0 = 0, -/// s1^2 - s1 = 0. The top element is binary or not is enforced as a general constraint. +/// - The top two element in the current frame of the stack should be binary. s0^2 - s0 = 0, s1^2 - +/// s1 = 0. The top element is binary or not is enforced as a general constraint. /// - The first element of the next frame should be a binary and of the first two elements in the /// current frame. s0` - s0 * s1 = 0. pub fn enforce_and_constraints( @@ -233,8 +233,8 @@ pub fn enforce_and_constraints( /// Enforces constraints of the OR operation. The OR operation computes the bitwise or of the /// first two elements in the current trace. Therefore, the following constraints are enforced: -/// - The top two element in the current frame of the stack should be binary. s0^2 - s0 = 0, -/// s1^2 - s1 = 0. The top element is binary or not is enforced as a general constraint. +/// - The top two element in the current frame of the stack should be binary. s0^2 - s0 = 0, s1^2 - +/// s1 = 0. The top element is binary or not is enforced as a general constraint. /// - The first element of the next frame should be a binary or of the first two elements in the /// current frame. s0` - ( s0 + s1 - s0 * s1 ) = 0. pub fn enforce_or_constraints( diff --git a/air/src/constraints/stack/overflow/mod.rs b/air/src/constraints/stack/overflow/mod.rs index 4cc319711c..7a54be3136 100644 --- a/air/src/constraints/stack/overflow/mod.rs +++ b/air/src/constraints/stack/overflow/mod.rs @@ -92,8 +92,7 @@ pub fn enforce_stack_depth_constraints( /// Enforces constraints on the overflow flag h0. Therefore, the following constraints /// are enforced: -/// - If overflow table has values, then, h0 should be set to ONE, otherwise it should -/// be ZERO. +/// - If overflow table has values, then, h0 should be set to ONE, otherwise it should be ZERO. pub fn enforce_overflow_flag_constraints( frame: &EvaluationFrame, result: &mut [E], @@ -107,8 +106,8 @@ pub fn enforce_overflow_flag_constraints( } /// Enforces constraints on the bookkeeping index `b1`. The following constraints are enforced: -/// - In the case of a right shift operation, the next b1 index should be updated with current -/// `clk` value. +/// - In the case of a right shift operation, the next b1 index should be updated with current `clk` +/// value. /// - In the case of a left shift operation, the last stack item should be set to ZERO when the /// depth of the stack is 16. pub fn enforce_overflow_index_constraints( diff --git a/air/src/constraints/stack/stack_manipulation/mod.rs b/air/src/constraints/stack/stack_manipulation/mod.rs index 0678fe615e..89359b6c1a 100644 --- a/air/src/constraints/stack/stack_manipulation/mod.rs +++ b/air/src/constraints/stack/stack_manipulation/mod.rs @@ -93,8 +93,8 @@ pub fn enforce_pad_constraints( /// Enforces constraints of the DUPn and MOVUPn operations. The DUPn operation copies the element /// at depth n in the stack and pushes the copy onto the stack, whereas MOVUPn opearation moves the /// element at depth n to the top of the stack. Therefore, the following constraints are enforced: -/// - The top element in the next frame should be equal to the element at depth n in the -/// current frame. s0` - sn = 0. +/// - The top element in the next frame should be equal to the element at depth n in the current +/// frame. s0` - sn = 0. pub fn enforce_dup_movup_n_constraints( frame: &EvaluationFrame, result: &mut [E], @@ -244,8 +244,8 @@ pub fn enforce_swapwx_constraints( /// Enforces constraints of the MOVDNn operation. The MOVDNn operation moves the top element /// to depth n in the stack. Therefore, the following constraints are enforced: -/// - The top element in the current frame should be equal to the element at depth n in the -/// next frame. s0 - sn` = 0. +/// - The top element in the current frame should be equal to the element at depth n in the next +/// frame. s0 - sn` = 0. pub fn enforce_movdnn_constraints( frame: &EvaluationFrame, result: &mut [E], diff --git a/air/src/constraints/stack/u32_ops/mod.rs b/air/src/constraints/stack/u32_ops/mod.rs index 5f26692fdf..3604b43873 100644 --- a/air/src/constraints/stack/u32_ops/mod.rs +++ b/air/src/constraints/stack/u32_ops/mod.rs @@ -119,8 +119,8 @@ pub fn enforce_u32split_constraints>( /// Enforces constraints of the U32ADD operation. The U32ADD operation adds the top two /// elements in the current trace of the stack. Therefore, the following constraints are /// enforced: -/// - The aggregation of limbs from the helper registers is equal to the sum of the top two -/// element in the stack. +/// - The aggregation of limbs from the helper registers is equal to the sum of the top two element +/// in the stack. pub fn enforce_u32add_constraints>( frame: &EvaluationFrame, result: &mut [E], diff --git a/air/src/options.rs b/air/src/options.rs index 2798a75d24..3062a11afe 100644 --- a/air/src/options.rs +++ b/air/src/options.rs @@ -227,8 +227,8 @@ impl ExecutionOptions { /// /// In debug mode the VM does the following: /// - Executes `debug` instructions (these are ignored in regular mode). - /// - Records additional info about program execution (e.g., keeps track of stack state at - /// every cycle of the VM) which enables stepping through the program forward and backward. + /// - Records additional info about program execution (e.g., keeps track of stack state at every + /// cycle of the VM) which enables stepping through the program forward and backward. pub fn with_debugging(mut self) -> Self { self.enable_debugging = true; self diff --git a/assembly/Cargo.toml b/assembly/Cargo.toml index e6288abb93..85aa65b7a2 100644 --- a/assembly/Cargo.toml +++ b/assembly/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-assembly" version = "0.9.2" description = "Miden VM assembly language" -authors = ["miden contributors"] -readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-assembly/0.9.2" categories = ["compilers", "no-std"] keywords = ["assembler", "assembly", "language", "miden"] -edition = "2021" -rust-version = "1.76" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [lib] bench = false diff --git a/assembly/src/ast/module.rs b/assembly/src/ast/module.rs index 1a5b6af251..af6544d0af 100644 --- a/assembly/src/ast/module.rs +++ b/assembly/src/ast/module.rs @@ -46,8 +46,8 @@ pub enum ModuleKind { /// A kernel is like a library module, but is special in a few ways: /// /// * Its code always executes in the root context, so it is stateful in a way that normal - /// libraries cannot replicate. This can be used to provide core services that would otherwise - /// not be possible to implement. + /// libraries cannot replicate. This can be used to provide core services that would + /// otherwise not be possible to implement. /// /// * The procedures exported from the kernel may be the target of the `syscall` instruction, /// and in fact _must_ be called that way. diff --git a/core/Cargo.toml b/core/Cargo.toml index 80a1beadd0..25a02a3073 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-core" version = "0.9.1" description = "Miden VM core components" -authors = ["miden contributors"] -readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-core/0.9.1" categories = ["emulators", "no-std"] keywords = ["instruction-set", "miden", "program"] -edition = "2021" -rust-version = "1.75" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [lib] bench = false diff --git a/miden/Cargo.toml b/miden/Cargo.toml index dd5a187eb6..acd2f7edb6 100644 --- a/miden/Cargo.toml +++ b/miden/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-vm" version = "0.9.1" description="Miden virtual machine" -authors = ["miden contributors"] -readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-vm/0.9.1" categories = ["cryptography", "emulators", "no-std"] keywords = ["miden", "stark", "virtual-machine", "zkp"] -edition = "2021" -rust-version = "1.75" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [[bin]] name = "miden" diff --git a/processor/Cargo.toml b/processor/Cargo.toml index 83da03a0cf..f7e31acebd 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-processor" version = "0.9.2" description = "Miden VM processor" -authors = ["miden contributors"] -readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-processor/0.9.2" categories = ["emulators", "no-std"] keywords = ["miden", "virtual-machine"] -edition = "2021" -rust-version = "1.75" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [lib] bench = false diff --git a/processor/src/chiplets/mod.rs b/processor/src/chiplets/mod.rs index 137edc24f3..aedbbbefbe 100644 --- a/processor/src/chiplets/mod.rs +++ b/processor/src/chiplets/mod.rs @@ -37,39 +37,39 @@ mod tests; /// chiplet selectors. /// /// The module's trace can be thought of as 5 stacked chiplet segments in the following form: -/// * Hasher segment: contains the trace and selector for the hasher chiplet * -/// This segment fills the first rows of the trace up to the length of the hasher `trace_len`. +/// * Hasher segment: contains the trace and selector for the hasher chiplet * This segment fills +/// the first rows of the trace up to the length of the hasher `trace_len`. /// - column 0: selector column with values set to ZERO /// - columns 1-17: execution trace of hash chiplet /// -/// * Bitwise segment: contains the trace and selectors for the bitwise chiplet * -/// This segment begins at the end of the hasher segment and fills the next rows of the trace for -/// the `trace_len` of the bitwise chiplet. +/// * Bitwise segment: contains the trace and selectors for the bitwise chiplet * This segment +/// begins at the end of the hasher segment and fills the next rows of the trace for the +/// `trace_len` of the bitwise chiplet. /// - column 0: selector column with values set to ONE /// - column 1: selector column with values set to ZERO /// - columns 2-14: execution trace of bitwise chiplet /// - columns 15-17: unused columns padded with ZERO /// -/// * Memory segment: contains the trace and selectors for the memory chiplet * -/// This segment begins at the end of the bitwise segment and fills the next rows of the trace for -/// the `trace_len` of the memory chiplet. +/// * Memory segment: contains the trace and selectors for the memory chiplet * This segment begins +/// at the end of the bitwise segment and fills the next rows of the trace for the `trace_len` of +/// the memory chiplet. /// - column 0-1: selector columns with values set to ONE /// - column 2: selector column with values set to ZERO /// - columns 3-14: execution trace of memory chiplet /// - columns 15-17: unused column padded with ZERO /// -/// * Kernel ROM segment: contains the trace and selectors for the kernel ROM chiplet * -/// This segment begins at the end of the memory segment and fills the next rows of the trace for -/// the `trace_len` of the kernel ROM chiplet. +/// * Kernel ROM segment: contains the trace and selectors for the kernel ROM chiplet * This segment +/// begins at the end of the memory segment and fills the next rows of the trace for the +/// `trace_len` of the kernel ROM chiplet. /// - column 0-2: selector columns with values set to ONE /// - column 3: selector column with values set to ZERO /// - columns 4-9: execution trace of kernel ROM chiplet /// - columns 10-17: unused column padded with ZERO /// -/// * Padding segment: unused * -/// This segment begins at the end of the kernel ROM segment and fills the rest of the execution -/// trace minus the number of random rows. When it finishes, the execution trace should have -/// exactly enough rows remaining for the specified number of random rows. +/// * Padding segment: unused * This segment begins at the end of the kernel ROM segment and fills +/// the rest of the execution trace minus the number of random rows. When it finishes, the +/// execution trace should have exactly enough rows remaining for the specified number of random +/// rows. /// - columns 0-3: selector columns with values set to ONE /// - columns 3-17: unused columns padded with ZERO /// diff --git a/processor/src/host/advice/injectors/dsa.rs b/processor/src/host/advice/injectors/dsa.rs index be11d1bd6f..e0f8056134 100644 --- a/processor/src/host/advice/injectors/dsa.rs +++ b/processor/src/host/advice/injectors/dsa.rs @@ -9,8 +9,8 @@ use super::super::{ExecutionError, Felt, Word}; /// 1. The nonce represented as 8 field elements. /// 2. The expanded public key represented as the coefficients of a polynomial of degree < 512. /// 3. The signature represented as the coefficients of a polynomial of degree < 512. -/// 4. The product of the above two polynomials in the ring of polynomials with coefficients -/// in the Miden field. +/// 4. The product of the above two polynomials in the ring of polynomials with coefficients in the +/// Miden field. /// /// # Errors /// Will return an error if either: diff --git a/processor/src/operations/comb_ops.rs b/processor/src/operations/comb_ops.rs index c3754baca1..d88ed0a192 100644 --- a/processor/src/operations/comb_ops.rs +++ b/processor/src/operations/comb_ops.rs @@ -52,10 +52,10 @@ where /// with common denominator (x - gz). /// 4. x_addr is the memory address from which we are loading the Ti's using the MSTREAM /// instruction. - /// 5. z_addr is the memory address to the i-th OOD evaluations at z and gz - /// i.e. T_i(z):= (T_i(z)0, T_i(z)1) and T_i(gz):= (T_i(gz)0, T_i(gz)1). - /// 6. a_addr is the memory address of the i-th random element alpha_i used in batching - /// the trace polynomial quotients. + /// 5. z_addr is the memory address to the i-th OOD evaluations at z and gz i.e. T_i(z):= + /// (T_i(z)0, T_i(z)1) and T_i(gz):= (T_i(gz)0, T_i(gz)1). + /// 6. a_addr is the memory address of the i-th random element alpha_i used in batching the + /// trace polynomial quotients. /// /// The instruction also makes use of the helper registers to hold the values of T_i(z), T_i(gz) /// and alpha_i during the course of its execution. diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 31a412729f..741246e87c 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-prover" version = "0.9.1" description = "Miden VM prover" -authors = ["miden contributors"] -readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-prover/0.9.1" categories = ["cryptography", "emulators", "no-std"] keywords = ["miden", "prover", "stark", "zkp"] -edition = "2021" -rust-version = "1.75" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [features] concurrent = ["processor/concurrent", "std", "winter-prover/concurrent"] diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000000..8e95c75dac --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +1.78 diff --git a/scripts/check-rust-version.sh b/scripts/check-rust-version.sh new file mode 100644 index 0000000000..f84634cc31 --- /dev/null +++ b/scripts/check-rust-version.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Check rust-toolchain file +TOOLCHAIN_VERSION=$(cat rust-toolchain) + +# Check workspace Cargo.toml file +CARGO_VERSION=$(cat Cargo.toml | grep "rust-version" | cut -d '"' -f 2) +if [ "$CARGO_VERSION" != "$TOOLCHAIN_VERSION" ]; then + echo "Mismatch in Cargo.toml: Expected $TOOLCHAIN_VERSION, found $CARGO_VERSION" + exit 1 +fi + +echo "Rust versions match ✅" diff --git a/stdlib/Cargo.toml b/stdlib/Cargo.toml index 15f1196bd6..55a3849b80 100644 --- a/stdlib/Cargo.toml +++ b/stdlib/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-stdlib" version = "0.9.2" description = "Miden VM standard library" -authors = ["miden contributors"] readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-stdlib/0.9.2" categories = ["cryptography", "mathematics"] keywords = ["miden", "program", "stdlib"] -edition = "2021" -rust-version = "1.75" +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [lib] bench = false diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 70f73f59e0..0873c88315 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -2,14 +2,15 @@ name = "miden-test-utils" version = "0.1.0" description = "Test utilities for Miden VM programs" -authors = ["miden contributors"] -readme = "README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" categories = ["development-tools::testing", "no-std"] keywords = ["miden", "test", "virtual-machine"] -edition = "2021" -rust-version = "1.75" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [features] default = ["std"] diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index 3b72a4fe44..945cbb975e 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -166,8 +166,8 @@ macro_rules! assert_assembler_diagnostic { /// - Proptest: run an execution test inside a proptest. /// /// Types of failure tests: -/// - Assembly error test: check that attempting to compile the given source causes an -/// AssemblyError which contains the specified substring. +/// - Assembly error test: check that attempting to compile the given source causes an AssemblyError +/// which contains the specified substring. /// - Execution error test: check that running a program compiled from the given source causes an /// ExecutionError which contains the specified substring. pub struct Test { diff --git a/verifier/Cargo.toml b/verifier/Cargo.toml index 2a6ae7bb76..be80abd163 100644 --- a/verifier/Cargo.toml +++ b/verifier/Cargo.toml @@ -2,15 +2,16 @@ name = "miden-verifier" version = "0.9.1" description="Miden VM execution verifier" -authors = ["miden contributors"] -readme="README.md" -license = "MIT" -repository = "https://github.com/0xPolygonMiden/miden-vm" documentation = "https://docs.rs/miden-verifier/0.9.1" categories = ["cryptography", "no-std"] keywords = ["miden", "stark", "verifier", "zkp"] -edition = "2021" -rust-version = "1.75" +readme.workspace = true +license.workspace = true +authors.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true +edition.workspace = true [lib] bench = false