Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: update rust toolchains #1945

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure about beta though?..

Copy link
Member

@volhovm volhovm Mar 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plus do we have to support 1.71 still? CI might not like building 75% more versions than it does now.

# 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
Expand Down
2 changes: 1 addition & 1 deletion kimchi/src/circuits/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn compute_ffadd_values<F: PrimeField>(
/// opcode: true for addition, false for subtraction
/// modulus: modulus of the foreign field
pub fn create_chain<F: PrimeField>(
inputs: &Vec<BigUint>,
inputs: &[BigUint],
opcodes: &[FFOps],
modulus: BigUint,
) -> [Vec<F>; COLUMNS] {
Expand Down
12 changes: 6 additions & 6 deletions kimchi/src/tests/foreign_field_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ fn full_circuit<F: PrimeField + SquareRootField>(

// Creates the witness with the public input for FFAdd containing the 1 value
fn short_witness<F: PrimeField>(
inputs: &Vec<BigUint>,
inputs: &[BigUint],
opcodes: &[FFOps],
modulus: BigUint,
) -> [Vec<F>; COLUMNS] {
Expand All @@ -278,7 +278,7 @@ fn short_witness<F: PrimeField>(
// opcode: true for addition, false for subtraction
// modulus: modulus of the foreign field
fn long_witness<F: PrimeField>(
inputs: &Vec<BigUint>,
inputs: &[BigUint],
opcodes: &[FFOps],
modulus: BigUint,
) -> [Vec<F>; COLUMNS] {
Expand Down Expand Up @@ -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(),
);
Expand Down Expand Up @@ -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::<Fp>(&vec![left, right], operation, modulus);
let add_witness = witness::create_chain::<Fp>(&[left, right], operation, modulus);
for col in 0..COLUMNS {
witness[col].extend(add_witness[col].iter());
}
Expand Down Expand Up @@ -1548,7 +1548,7 @@ fn test_gate_invalid_foreign_field_modulus() {
#[test]
fn test_witness_max_foreign_field_modulus() {
short_witness::<PallasField>(
&vec![BigUint::zero(), BigUint::zero()],
&[BigUint::zero(), BigUint::zero()],
&[FFOps::Add],
BigUint::max_foreign_field_modulus::<PallasField>(),
);
Expand All @@ -1558,7 +1558,7 @@ fn test_witness_max_foreign_field_modulus() {
#[should_panic]
fn test_witness_invalid_foreign_field_modulus() {
short_witness::<PallasField>(
&vec![BigUint::zero(), BigUint::zero()],
&[BigUint::zero(), BigUint::zero()],
&[FFOps::Add],
BigUint::max_foreign_field_modulus::<PallasField>() + BigUint::one(),
);
Expand Down
4 changes: 2 additions & 2 deletions msm/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn prove<
>(
domain: EvaluationDomains<G::ScalarField>,
srs: &OpeningProof::SRS,
constraints: &Vec<MSMExpr<G::ScalarField>>,
constraints: &[MSMExpr<G::ScalarField>],
inputs: ProofInputs<N, G, ID>,
rng: &mut RNG,
) -> Result<Proof<N, G, OpeningProof>, ProverError>
Expand Down Expand Up @@ -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?
Expand Down
8 changes: 5 additions & 3 deletions msm/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn verify<
>(
domain: EvaluationDomains<G::ScalarField>,
srs: &OpeningProof::SRS,
constraint_exprs: &Vec<MSMExpr<G::ScalarField>>,
constraint_exprs: &[MSMExpr<G::ScalarField>],
proof: &Proof<N, G, OpeningProof>,
) -> bool {
let Proof {
Expand Down Expand Up @@ -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,
Expand Down
58 changes: 29 additions & 29 deletions optimism/src/cannon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>);

impl Preimage {
pub fn create(v: Vec<u8>) -> Self {
Preimage(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}

pub struct Hint(Vec<u8>);

impl Hint {
pub fn create(v: Vec<u8>) -> Self {
Hint(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}

#[cfg(test)]
mod tests {

Expand Down Expand Up @@ -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<u8>);

impl Preimage {
pub fn create(v: Vec<u8>) -> Self {
Preimage(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}

pub struct Hint(Vec<u8>);

impl Hint {
pub fn create(v: Vec<u8>) -> Self {
Hint(v)
}

pub fn get(self) -> Vec<u8> {
self.0
}
}
2 changes: 1 addition & 1 deletion poly-commitment/src/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ pub fn combine_commitments<G: CommitmentCurve>(
}

pub fn combine_evaluations<G: CommitmentCurve>(
evaluations: &Vec<Evaluation<G>>,
evaluations: &[Evaluation<G>],
polyscale: G::ScalarField,
) -> Vec<G::ScalarField> {
let mut xi_i = G::ScalarField::one();
Expand Down
8 changes: 4 additions & 4 deletions poly-commitment/src/pairing_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ impl<
}
pub fn verify(
&self,
srs: &PairingSRS<Pair>, // SRS
evaluations: &Vec<Evaluation<G>>, // commitments to the polynomials
polyscale: F, // scaling factor for polynoms
elm: &[F], // vector of evaluation points
srs: &PairingSRS<Pair>, // SRS
evaluations: &[Evaluation<G>], // commitments to the polynomials
polyscale: F, // scaling factor for polynoms
elm: &[F], // vector of evaluation points
) -> bool {
let poly_commitment = {
let mut scalars: Vec<F> = Vec::new();
Expand Down
4 changes: 1 addition & 3 deletions utils/src/field_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ pub trait FieldHelpers<F> {
where
F: PrimeField,
{
big.clone()
.try_into()
.map_err(|_| FieldHelpersError::DeserializeBytes)
F::from_biguint(big).map_err(|_| FieldHelpersError::DeserializeBytes)
}

/// Serialize to bytes
Expand Down
Loading