From 52d719ce96da9151baa41bc19cc1110ec38291a0 Mon Sep 17 00:00:00 2001 From: han0110 Date: Mon, 28 Aug 2023 03:32:53 +0000 Subject: [PATCH] feat: expose `transcript_repr` of `VerifyingKey` and reduce the trait constraint --- 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