From d19480ab4982fe104520b45686afd31b506d13d7 Mon Sep 17 00:00:00 2001 From: Han Date: Mon, 4 Sep 2023 16:56:29 +0800 Subject: [PATCH] feat: expose `transcript_repr` of `VerifyingKey` and reduce the trait constraint (#200) --- halo2_proofs/src/plonk.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/halo2_proofs/src/plonk.rs b/halo2_proofs/src/plonk.rs index 62c684ceb4..3d9167f0cd 100644 --- a/halo2_proofs/src/plonk.rs +++ b/halo2_proofs/src/plonk.rs @@ -161,10 +161,7 @@ where } } -impl VerifyingKey -where - C::ScalarExt: FromUniformBytes<64>, -{ +impl VerifyingKey { fn bytes_length(&self) -> usize { 8 + (self.fixed_commitments.len() * C::default().to_bytes().as_ref().len()) + self.permutation.bytes_length() @@ -182,8 +179,11 @@ where fixed_commitments: Vec, permutation: permutation::VerifyingKey, cs: ConstraintSystem, - //selectors: Vec>, - ) -> Self { + // selectors: Vec>, + ) -> Self + where + C::ScalarExt: FromUniformBytes<64>, + { // Compute cached values. let cs_degree = cs.degree(); @@ -251,6 +251,11 @@ where pub fn cs(&self) -> &ConstraintSystem { &self.cs } + + /// Returns representative of this `VerifyingKey` in transcripts + pub fn transcript_repr(&self) -> C::Scalar { + self.transcript_repr + } } /// Minimal representation of a verification key that can be used to identify