From c1276e25e163d135b262cbd95176682abdf7b9e8 Mon Sep 17 00:00:00 2001 From: han0110 Date: Wed, 31 Jan 2024 07:53:11 +0000 Subject: [PATCH 1/3] feat: upgrade `halo2_proofs` to `v0.3.0` --- halo2wrong/Cargo.toml | 2 +- halo2wrong/src/utils.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/halo2wrong/Cargo.toml b/halo2wrong/Cargo.toml index 7e97c378..3d4bc917 100644 --- a/halo2wrong/Cargo.toml +++ b/halo2wrong/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" num-bigint = { version = "0.4", features = ["rand"] } num-integer = "0.1" num-traits = "0.2" -halo2 = { package = "halo2_proofs", git = "https://github.com/privacy-scaling-explorations/halo2", tag = "v2023_04_20" } +halo2 = { package = "halo2_proofs", git = "https://github.com/privacy-scaling-explorations/halo2", tag = "v0.3.0" } [dev-dependencies] rand = "0.8" diff --git a/halo2wrong/src/utils.rs b/halo2wrong/src/utils.rs index 41a660dc..a03e458c 100644 --- a/halo2wrong/src/utils.rs +++ b/halo2wrong/src/utils.rs @@ -72,7 +72,7 @@ pub fn mock_prover_verify + Ord, C: Circuit>( let prover = MockProver::run(dimension.k(), circuit, instance) .unwrap_or_else(|err| panic!("{:#?}", err)); assert_eq!( - prover.verify_at_rows_par(dimension.advice_range(), dimension.advice_range()), + prover.verify_at_rows(dimension.advice_range(), dimension.advice_range()), Ok(()) ) } From b6dcd31a5ed3271949f525f3bd3e502043678428 Mon Sep 17 00:00:00 2001 From: han0110 Date: Wed, 31 Jan 2024 07:53:46 +0000 Subject: [PATCH 2/3] fix: clippy and specify `resolver = "2"` --- Cargo.toml | 3 ++- integer/src/chip.rs | 4 ++-- integer/src/rns.rs | 6 +++--- maingate/src/instructions.rs | 2 +- maingate/src/range.rs | 4 ++-- transcript/src/transcript.rs | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a0a5a1f6..b580f278 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,6 @@ members = [ "halo2wrong", "ecc", "ecdsa", - "transcript" + "transcript", ] +resolver = "2" diff --git a/integer/src/chip.rs b/integer/src/chip.rs index b87a4fb7..2fa3ffce 100644 --- a/integer/src/chip.rs +++ b/integer/src/chip.rs @@ -642,12 +642,12 @@ mod tests { pub(crate) fn rand_in_remainder_range( &self, ) -> Integer { - let el = OsRng.gen_biguint(self.rns.max_remainder.bits() as u64); + let el = OsRng.gen_biguint(self.rns.max_remainder.bits()); Integer::from_big(el, Rc::clone(&self.rns)) } pub(crate) fn rand_in_operand_range(&self) -> Integer { - let el = OsRng.gen_biguint(self.rns.max_operand.bits() as u64); + let el = OsRng.gen_biguint(self.rns.max_operand.bits()); Integer::from_big(el, Rc::clone(&self.rns)) } diff --git a/integer/src/rns.rs b/integer/src/rns.rs index b5875598..4b410805 100644 --- a/integer/src/rns.rs +++ b/integer/src/rns.rs @@ -237,7 +237,7 @@ impl [big_uint; NUMBER_OF_LIMBS] { let two = N::from(2); - let r = &fe_to_big(two.pow(&[BIT_LEN_LIMB as u64, 0, 0, 0])); + let r = &fe_to_big(two.pow([BIT_LEN_LIMB as u64])); let wrong_modulus = modulus::(); let wrong_modulus: Vec = decompose_big(wrong_modulus, NUMBER_OF_LIMBS, BIT_LEN_LIMB); @@ -536,14 +536,14 @@ impl>() .try_into() .unwrap(); // Left shifts field element by `u * BIT_LEN_LIMB` bits let left_shifters = (0..NUMBER_OF_LIMBS) - .map(|i| two.pow(&[(i * BIT_LEN_LIMB) as u64, 0, 0, 0])) + .map(|i| two.pow([(i * BIT_LEN_LIMB) as u64])) .collect::>() .try_into() .unwrap(); diff --git a/maingate/src/instructions.rs b/maingate/src/instructions.rs index abf186d8..cdd09730 100644 --- a/maingate/src/instructions.rs +++ b/maingate/src/instructions.rs @@ -1000,7 +1000,7 @@ pub trait MainGateInstructions: Chip { let terms = bits .iter() - .zip(bases.into_iter()) + .zip(bases) .map(|(bit, base)| Term::Assigned(bit, base)) .collect::>(); let result = self.compose(ctx, &terms, F::ZERO)?; diff --git a/maingate/src/range.rs b/maingate/src/range.rs index 3647209b..7385d4b8 100644 --- a/maingate/src/range.rs +++ b/maingate/src/range.rs @@ -214,7 +214,7 @@ impl RangeChip { None } else { let bases = (0..F::NUM_BITS as usize / bit_len) - .map(|i| F::from(2).pow(&[(bit_len * i) as u64, 0, 0, 0])) + .map(|i| F::from(2).pow([(bit_len * i) as u64])) .collect(); Some((bit_len, bases)) } @@ -520,7 +520,7 @@ mod tests { let inputs = (2..20) .map(|number_of_limbs| { let bit_len = LIMB_BIT_LEN * number_of_limbs + OVERFLOW_BIT_LEN; - let value = Fp::from(2).pow(&[bit_len as u64, 0, 0, 0]) - Fp::one(); + let value = Fp::from(2).pow([bit_len as u64]) - Fp::one(); Input { value: Value::known(value), limb_bit_len: LIMB_BIT_LEN, diff --git a/transcript/src/transcript.rs b/transcript/src/transcript.rs index be5e9e31..7adb568a 100644 --- a/transcript/src/transcript.rs +++ b/transcript/src/transcript.rs @@ -276,7 +276,7 @@ mod tests { ctx, &self.spec, ecc_chip.clone(), - LimbRepresentation::default(), + LimbRepresentation, )?; for e in self.inputs.as_ref().transpose_vec(self.n) { From 7aa484484aabdfb98d0312e1bbaebe8f264672b1 Mon Sep 17 00:00:00 2001 From: han0110 Date: Wed, 31 Jan 2024 08:50:05 +0000 Subject: [PATCH 3/3] feat: use upgraded `poseidon` tag --- transcript/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transcript/Cargo.toml b/transcript/Cargo.toml index 53187838..11dad6d0 100644 --- a/transcript/Cargo.toml +++ b/transcript/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] ecc = { path = "../ecc", default-features = false } -poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon.git", tag = "v2023_04_20" } +poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon.git", tag = "v2024_01_31" } subtle = { version = "2.3", default-features = false } [dev-dependencies]