From b2a11174f2f684de8735fd818fe24d05976b5151 Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Thu, 1 Feb 2024 10:09:55 +0800 Subject: [PATCH] chores: trait bound using where clause --- Cargo.toml | 4 ---- snark-verifier-sdk/Cargo.toml | 2 +- snark-verifier-sdk/src/evm.rs | 7 +------ snark-verifier/Cargo.toml | 2 +- snark-verifier/src/pcs/kzg/decider.rs | 19 +++++++++++-------- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 24af7417..425d57f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,4 @@ members = [ ] [patch.crates-io] -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } halo2curves = { git = "https://github.com/privacy-scaling-explorations/halo2curves", tag = "v0.6.0" } - -[patch."https://github.com/privacy-scaling-explorations/halo2wrong"] -halo2_wrong_ecc = { git = "https://www.github.com/privacy-scaling-explorations/halo2wrong", tag = "v2024_01_31", package = "ecc", optional = true} diff --git a/snark-verifier-sdk/Cargo.toml b/snark-verifier-sdk/Cargo.toml index a51fb46e..05db64a8 100644 --- a/snark-verifier-sdk/Cargo.toml +++ b/snark-verifier-sdk/Cargo.toml @@ -25,7 +25,7 @@ halo2curves = { git = "https://github.com/privacy-scaling-explorations/halo2curv # loader_halo2 halo2_wrong_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2024_01_31", package = "ecc", optional = true } -poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon", tag = "v2023_04_20", optional = true } +poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon", tag = "v2024_01_31", optional = true } # loader_evm ethereum-types = { version = "0.14", default-features = false, features = [ diff --git a/snark-verifier-sdk/src/evm.rs b/snark-verifier-sdk/src/evm.rs index 3ec21ff0..8cb703ce 100644 --- a/snark-verifier-sdk/src/evm.rs +++ b/snark-verifier-sdk/src/evm.rs @@ -18,7 +18,6 @@ use halo2_proofs::{ }, transcript::{TranscriptReadBuffer, TranscriptWriterBuffer}, }; -use halo2curves::pairing::Engine; use itertools::Itertools; use rand::{rngs::StdRng, SeedableRng}; pub use snark_verifier::loader::evm::encode_calldata; @@ -128,11 +127,7 @@ where Rc, VerifyingKey = KzgAsVerifyingKey, Accumulator = KzgAccumulator>, - > + AccumulationDecider< - G1Affine, - Rc, - DecidingKey = KzgDecidingKey::G1Affine>, - >, + > + AccumulationDecider, DecidingKey = KzgDecidingKey>, { let protocol = compile( params, diff --git a/snark-verifier/Cargo.toml b/snark-verifier/Cargo.toml index 26cc9734..6ba54d8a 100644 --- a/snark-verifier/Cargo.toml +++ b/snark-verifier/Cargo.toml @@ -25,7 +25,7 @@ revm = { version = "3.5.0", optional = true, default-features = false } # loader_halo2 halo2_wrong_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2024_01_31", package = "ecc", optional = true } -poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon", tag = "v2023_04_20", optional = true } +poseidon = { git = "https://github.com/privacy-scaling-explorations/poseidon", tag = "v2024_01_31", optional = true } # derive_serde serde = { version = "1.0", features = ["derive"], optional = true } diff --git a/snark-verifier/src/pcs/kzg/decider.rs b/snark-verifier/src/pcs/kzg/decider.rs index dbdb4172..cfc64005 100644 --- a/snark-verifier/src/pcs/kzg/decider.rs +++ b/snark-verifier/src/pcs/kzg/decider.rs @@ -5,9 +5,12 @@ use std::marker::PhantomData; /// KZG deciding key. #[derive(Debug, Clone, Copy)] -pub struct KzgDecidingKey { +pub struct KzgDecidingKey +where + M::G1Affine: CurveAffine, +{ /// KZG succinct verifying key. - pub svk: KzgSuccinctVerifyingKey, + pub svk: KzgSuccinctVerifyingKey, /// Generator on G2. pub g2: M::G2Affine, /// Generator to the trusted-setup secret on G2. @@ -15,7 +18,7 @@ pub struct KzgDecidingKey { _marker: PhantomData, } -impl> KzgDecidingKey +impl> KzgDecidingKey where M::G1Affine: CurveAffine, M::G2Affine: CurveAffine, @@ -36,18 +39,18 @@ where } impl> From<(M::G1Affine, M::G2Affine, M::G2Affine)> - for KzgDecidingKey + for KzgDecidingKey where M::G1Affine: CurveAffine, M::G2Affine: CurveAffine, { - fn from((g1, g2, s_g2): (M::G1Affine, M::G2Affine, M::G2Affine)) -> KzgDecidingKey { + fn from((g1, g2, s_g2): (M::G1Affine, M::G2Affine, M::G2Affine)) -> KzgDecidingKey { KzgDecidingKey::new(g1, g2, s_g2) } } impl> AsRef> - for KzgDecidingKey + for KzgDecidingKey { fn as_ref(&self) -> &KzgSuccinctVerifyingKey { &self.svk @@ -79,7 +82,7 @@ mod native { M::Fr: PrimeField, MOS: Clone + Debug, { - type DecidingKey = KzgDecidingKey; + type DecidingKey = KzgDecidingKey; fn decide( dk: &Self::DecidingKey, @@ -135,7 +138,7 @@ mod evm { ::ScalarExt: PrimeField, MOS: Clone + Debug, { - type DecidingKey = KzgDecidingKey; + type DecidingKey = KzgDecidingKey; fn decide( dk: &Self::DecidingKey,