From e6cf4bf14e14329cb1f79fff0a7b3b3c9f00eaae 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 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/halo2_proofs/src/plonk.rs b/halo2_proofs/src/plonk.rs index 5b22acfc74..2a3e11caf2 100644 --- a/halo2_proofs/src/plonk.rs +++ b/halo2_proofs/src/plonk.rs @@ -167,10 +167,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() @@ -188,7 +185,10 @@ where permutation: permutation::VerifyingKey, cs: ConstraintSystem, selectors: Vec>, - ) -> Self { + ) -> Self + where + C::ScalarExt: FromUniformBytes<64>, + { // Compute cached values. let cs_degree = cs.degree(); @@ -256,6 +256,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