Skip to content

Commit

Permalink
chores: trait bound using where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
hero78119 committed Feb 1, 2024
1 parent efb09f9 commit b2a1117
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
2 changes: 1 addition & 1 deletion snark-verifier-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
7 changes: 1 addition & 6 deletions snark-verifier-sdk/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -128,11 +127,7 @@ where
Rc<EvmLoader>,
VerifyingKey = KzgAsVerifyingKey,
Accumulator = KzgAccumulator<G1Affine, Rc<EvmLoader>>,
> + AccumulationDecider<
G1Affine,
Rc<EvmLoader>,
DecidingKey = KzgDecidingKey<Bn256, <Bn256 as Engine>::G1Affine>,
>,
> + AccumulationDecider<G1Affine, Rc<EvmLoader>, DecidingKey = KzgDecidingKey<Bn256>>,
{
let protocol = compile(
params,
Expand Down
2 changes: 1 addition & 1 deletion snark-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
19 changes: 11 additions & 8 deletions snark-verifier/src/pcs/kzg/decider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ use std::marker::PhantomData;

/// KZG deciding key.
#[derive(Debug, Clone, Copy)]
pub struct KzgDecidingKey<M: MultiMillerLoop, C: CurveAffine> {
pub struct KzgDecidingKey<M: MultiMillerLoop>
where
M::G1Affine: CurveAffine,
{
/// KZG succinct verifying key.
pub svk: KzgSuccinctVerifyingKey<C>,
pub svk: KzgSuccinctVerifyingKey<M::G1Affine>,
/// Generator on G2.
pub g2: M::G2Affine,
/// Generator to the trusted-setup secret on G2.
pub s_g2: M::G2Affine,
_marker: PhantomData<M>,
}

impl<C: CurveAffine, M: MultiMillerLoop<G1Affine = C>> KzgDecidingKey<M, C>
impl<C: CurveAffine, M: MultiMillerLoop<G1Affine = C>> KzgDecidingKey<M>
where
M::G1Affine: CurveAffine,
M::G2Affine: CurveAffine,
Expand All @@ -36,18 +39,18 @@ where
}

impl<C: CurveAffine, M: MultiMillerLoop<G1Affine = C>> From<(M::G1Affine, M::G2Affine, M::G2Affine)>
for KzgDecidingKey<M, C>
for KzgDecidingKey<M>
where
M::G1Affine: CurveAffine,
M::G2Affine: CurveAffine,
{
fn from((g1, g2, s_g2): (M::G1Affine, M::G2Affine, M::G2Affine)) -> KzgDecidingKey<M, C> {
fn from((g1, g2, s_g2): (M::G1Affine, M::G2Affine, M::G2Affine)) -> KzgDecidingKey<M> {
KzgDecidingKey::new(g1, g2, s_g2)
}
}

impl<C: CurveAffine, M: MultiMillerLoop<G1Affine = C>> AsRef<KzgSuccinctVerifyingKey<M::G1Affine>>
for KzgDecidingKey<M, C>
for KzgDecidingKey<M>
{
fn as_ref(&self) -> &KzgSuccinctVerifyingKey<M::G1Affine> {
&self.svk
Expand Down Expand Up @@ -79,7 +82,7 @@ mod native {
M::Fr: PrimeField,
MOS: Clone + Debug,
{
type DecidingKey = KzgDecidingKey<M, M::G1Affine>;
type DecidingKey = KzgDecidingKey<M>;

fn decide(
dk: &Self::DecidingKey,
Expand Down Expand Up @@ -135,7 +138,7 @@ mod evm {
<M::G1Affine as CurveAffine>::ScalarExt: PrimeField<Repr = [u8; 0x20]>,
MOS: Clone + Debug,
{
type DecidingKey = KzgDecidingKey<M, M::G1Affine>;
type DecidingKey = KzgDecidingKey<M>;

fn decide(
dk: &Self::DecidingKey,
Expand Down

0 comments on commit b2a1117

Please sign in to comment.