Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ed255 committed Jan 3, 2024
1 parent c272378 commit 6037910
Show file tree
Hide file tree
Showing 15 changed files with 623 additions and 309 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ members = [
"halo2_gadgets",
"halo2_proofs",
]
resolver = "2"
18 changes: 11 additions & 7 deletions halo2_proofs/src/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,16 @@ impl Queries {
}
}

// TODO: Remove in favour of VerifyingKey
/// This is a verifying key which allows for the verification of proofs for a
/// particular circuit.
#[derive(Clone, Debug)]
pub struct VerifyingKeyV2<C: CurveAffine> {
domain: EvaluationDomain<C::Scalar>,
fixed_commitments: Vec<C>,
permutation: permutation::VerifyingKey<C>,
cs: ConstraintSystemV2Backend<C::Scalar>,
queries: Queries,
cs: ConstraintSystem<C::Scalar>,
// queries: Queries,
/// Cached maximum degree of `cs` (which doesn't change after construction).
cs_degree: usize,
/// The representative of this `VerifyingKey` in transcripts.
Expand All @@ -165,21 +166,21 @@ impl<C: CurveAffine> VerifyingKeyV2<C> {
domain: EvaluationDomain<C::Scalar>,
fixed_commitments: Vec<C>,
permutation: permutation::VerifyingKey<C>,
cs: ConstraintSystemV2Backend<C::Scalar>,
cs: ConstraintSystem<C::Scalar>,
) -> Self
where
C::ScalarExt: FromUniformBytes<64>,
{
// Compute cached values.
let cs_degree = cs.degree();
let queries = cs.collect_queries();
// let queries = cs.collect_queries();

let mut vk = Self {

Check warning on line 178 in halo2_proofs/src/plonk.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

variable does not need to be mutable

warning: variable does not need to be mutable --> halo2_proofs/src/plonk.rs:178:13 | 178 | let mut vk = Self { | ----^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default

Check warning on line 178 in halo2_proofs/src/plonk.rs

View workflow job for this annotation

GitHub Actions / Clippy (beta)

variable does not need to be mutable

warning: variable does not need to be mutable --> halo2_proofs/src/plonk.rs:178:13 | 178 | let mut vk = Self { | ----^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default
domain,
fixed_commitments,
permutation,
cs,
queries,
// queries,
cs_degree,
// Temporary, this is not pinned.
transcript_repr: C::Scalar::ZERO,
Expand All @@ -199,7 +200,9 @@ impl<C: CurveAffine> VerifyingKeyV2<C> {
hasher.update(s.as_bytes());

// Hash in final Blake2bState
vk.transcript_repr = C::Scalar::from_uniform_bytes(hasher.finalize().as_array());
// TODO: Uncomment
// vk.transcript_repr = C::Scalar::from_uniform_bytes(hasher.finalize().as_array());
dbg!(&vk.transcript_repr);

vk
}
Expand Down Expand Up @@ -425,7 +428,8 @@ impl<C: CurveAffine> VerifyingKey<C> {
hasher.update(s.as_bytes());

// Hash in final Blake2bState
vk.transcript_repr = C::Scalar::from_uniform_bytes(hasher.finalize().as_array());
// TODO: Uncomment
// vk.transcript_repr = C::Scalar::from_uniform_bytes(hasher.finalize().as_array());

vk
}
Expand Down
Loading

0 comments on commit 6037910

Please sign in to comment.