diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d2524fc531..1e2cb8b1b7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,7 +15,7 @@ jobs: run_checks: strategy: matrix: - rust_toolchain_version: ["1.71", "1.72", "1.73", "1.74"] + rust_toolchain_version: ["1.71", "1.72", "1.73", "1.74", "1.75", "1.76", "beta"] # FIXME: currently not available for 5.0.0. # It might be related to boxroot dependency, and we would need to bump # up the ocaml-rs dependency diff --git a/kimchi/src/circuits/constraints.rs b/kimchi/src/circuits/constraints.rs index 386fb261e0..ed0e59d9f7 100644 --- a/kimchi/src/circuits/constraints.rs +++ b/kimchi/src/circuits/constraints.rs @@ -322,7 +322,7 @@ impl< } // for public gates, only the left wire is toggled - if row < self.cs.public && gate.coeffs.get(0) != Some(&F::one()) { + if row < self.cs.public && gate.coeffs.first() != Some(&F::one()) { return Err(GateError::IncorrectPublic(row)); } diff --git a/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs b/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs index 950f7a265d..489bc31619 100644 --- a/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs +++ b/kimchi/src/circuits/polynomials/foreign_field_add/witness.rs @@ -127,7 +127,7 @@ fn compute_ffadd_values( /// opcode: true for addition, false for subtraction /// modulus: modulus of the foreign field pub fn create_chain( - inputs: &Vec, + inputs: &[BigUint], opcodes: &[FFOps], modulus: BigUint, ) -> [Vec; COLUMNS] { diff --git a/kimchi/src/tests/foreign_field_add.rs b/kimchi/src/tests/foreign_field_add.rs index 3831641706..e0fcd3b6ad 100644 --- a/kimchi/src/tests/foreign_field_add.rs +++ b/kimchi/src/tests/foreign_field_add.rs @@ -260,7 +260,7 @@ fn full_circuit( // Creates the witness with the public input for FFAdd containing the 1 value fn short_witness( - inputs: &Vec, + inputs: &[BigUint], opcodes: &[FFOps], modulus: BigUint, ) -> [Vec; COLUMNS] { @@ -278,7 +278,7 @@ fn short_witness( // opcode: true for addition, false for subtraction // modulus: modulus of the foreign field fn long_witness( - inputs: &Vec, + inputs: &[BigUint], opcodes: &[FFOps], modulus: BigUint, ) -> [Vec; COLUMNS] { @@ -1401,7 +1401,7 @@ where // Compute addition witness let witness = short_witness( - &vec![left_input, right_input], + &[left_input, right_input], &[FFOps::Add], foreign_field_modulus.clone(), ); @@ -1476,7 +1476,7 @@ fn test_ffadd_finalization() { let left = modulus.clone() - BigUint::one(); let right = modulus.clone() - BigUint::one(); // create a chain of 1 addition - let add_witness = witness::create_chain::(&vec![left, right], operation, modulus); + let add_witness = witness::create_chain::(&[left, right], operation, modulus); for col in 0..COLUMNS { witness[col].extend(add_witness[col].iter()); } @@ -1548,7 +1548,7 @@ fn test_gate_invalid_foreign_field_modulus() { #[test] fn test_witness_max_foreign_field_modulus() { short_witness::( - &vec![BigUint::zero(), BigUint::zero()], + &[BigUint::zero(), BigUint::zero()], &[FFOps::Add], BigUint::max_foreign_field_modulus::(), ); @@ -1558,7 +1558,7 @@ fn test_witness_max_foreign_field_modulus() { #[should_panic] fn test_witness_invalid_foreign_field_modulus() { short_witness::( - &vec![BigUint::zero(), BigUint::zero()], + &[BigUint::zero(), BigUint::zero()], &[FFOps::Add], BigUint::max_foreign_field_modulus::() + BigUint::one(), ); diff --git a/msm/src/prover.rs b/msm/src/prover.rs index 0bc2369b76..f874d3d2e6 100644 --- a/msm/src/prover.rs +++ b/msm/src/prover.rs @@ -52,7 +52,7 @@ pub fn prove< >( domain: EvaluationDomains, srs: &OpeningProof::SRS, - constraints: &Vec>, + constraints: &[MSMExpr], inputs: ProofInputs, rng: &mut RNG, ) -> Result, ProverError> @@ -205,7 +205,7 @@ where } let combined_expr = - Expr::combine_constraints(0..(constraints.len() as u32), constraints.clone()); + Expr::combine_constraints(0..(constraints.len() as u32), constraints.to_owned()); // An evaluation of our expression E(vec X) on witness columns // Every witness column w_i(X) is evaluated first at D1, so we get E(vec w_i(X)) = 0? diff --git a/msm/src/verifier.rs b/msm/src/verifier.rs index 1371694dbe..ec844f658e 100644 --- a/msm/src/verifier.rs +++ b/msm/src/verifier.rs @@ -25,7 +25,7 @@ pub fn verify< >( domain: EvaluationDomains, srs: &OpeningProof::SRS, - constraint_exprs: &Vec>, + constraint_exprs: &[MSMExpr], proof: &Proof, ) -> bool { let Proof { @@ -155,8 +155,10 @@ pub fn verify< zk_rows: 0, }; - let combined_expr = - Expr::combine_constraints(0..(constraint_exprs.len() as u32), constraint_exprs.clone()); + let combined_expr = Expr::combine_constraints( + 0..(constraint_exprs.len() as u32), + constraint_exprs.to_owned(), + ); let ft_eval0 = -PolishToken::evaluate( combined_expr.to_polish().as_slice(), domain.d1, diff --git a/optimism/src/cannon.rs b/optimism/src/cannon.rs index 512743e5c9..faebda0811 100644 --- a/optimism/src/cannon.rs +++ b/optimism/src/cannon.rs @@ -285,6 +285,35 @@ impl Meta { } } +pub const HINT_CLIENT_READ_FD: i32 = 3; +pub const HINT_CLIENT_WRITE_FD: i32 = 4; +pub const PREIMAGE_CLIENT_READ_FD: i32 = 5; +pub const PREIMAGE_CLIENT_WRITE_FD: i32 = 6; + +pub struct Preimage(Vec); + +impl Preimage { + pub fn create(v: Vec) -> Self { + Preimage(v) + } + + pub fn get(self) -> Vec { + self.0 + } +} + +pub struct Hint(Vec); + +impl Hint { + pub fn create(v: Vec) -> Self { + Hint(v) + } + + pub fn get(self) -> Vec { + self.0 + } +} + #[cfg(test)] mod tests { @@ -456,32 +485,3 @@ mod tests { assert!(PreimageKey::from_str("0x01").is_err()); } } - -pub const HINT_CLIENT_READ_FD: i32 = 3; -pub const HINT_CLIENT_WRITE_FD: i32 = 4; -pub const PREIMAGE_CLIENT_READ_FD: i32 = 5; -pub const PREIMAGE_CLIENT_WRITE_FD: i32 = 6; - -pub struct Preimage(Vec); - -impl Preimage { - pub fn create(v: Vec) -> Self { - Preimage(v) - } - - pub fn get(self) -> Vec { - self.0 - } -} - -pub struct Hint(Vec); - -impl Hint { - pub fn create(v: Vec) -> Self { - Hint(v) - } - - pub fn get(self) -> Vec { - self.0 - } -} diff --git a/poly-commitment/src/commitment.rs b/poly-commitment/src/commitment.rs index fdb8502fc3..fa32ea3aff 100644 --- a/poly-commitment/src/commitment.rs +++ b/poly-commitment/src/commitment.rs @@ -507,7 +507,7 @@ pub fn combine_commitments( } pub fn combine_evaluations( - evaluations: &Vec>, + evaluations: &[Evaluation], polyscale: G::ScalarField, ) -> Vec { let mut xi_i = G::ScalarField::one(); diff --git a/poly-commitment/src/pairing_proof.rs b/poly-commitment/src/pairing_proof.rs index 4ffe72f566..31fadc3348 100644 --- a/poly-commitment/src/pairing_proof.rs +++ b/poly-commitment/src/pairing_proof.rs @@ -296,10 +296,10 @@ impl< } pub fn verify( &self, - srs: &PairingSRS, // SRS - evaluations: &Vec>, // commitments to the polynomials - polyscale: F, // scaling factor for polynoms - elm: &[F], // vector of evaluation points + srs: &PairingSRS, // SRS + evaluations: &[Evaluation], // commitments to the polynomials + polyscale: F, // scaling factor for polynoms + elm: &[F], // vector of evaluation points ) -> bool { let poly_commitment = { let mut scalars: Vec = Vec::new(); diff --git a/utils/src/field_helpers.rs b/utils/src/field_helpers.rs index ed6a91b8c7..2ef76a1db4 100644 --- a/utils/src/field_helpers.rs +++ b/utils/src/field_helpers.rs @@ -84,9 +84,7 @@ pub trait FieldHelpers { where F: PrimeField, { - big.clone() - .try_into() - .map_err(|_| FieldHelpersError::DeserializeBytes) + F::from_biguint(big).map_err(|_| FieldHelpersError::DeserializeBytes) } /// Serialize to bytes