Skip to content

Commit

Permalink
feat(halo2_proofs): add bytes_length_including_cs()
Browse files Browse the repository at this point in the history
`bytes_length()` is better to remain the same.
  • Loading branch information
chokobole committed Aug 2, 2024
1 parent 28ceefb commit 63aa419
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion halo2_proofs/src/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,15 @@ impl<C: CurveAffine> VerifyingKey<C>
where
C::ScalarExt: FromUniformBytes<64>,
{
fn bytes_length(&self) -> usize {
pub fn bytes_length_including_cs(&self) -> usize {
8 + (self.fixed_commitments.len() * C::default().to_bytes().as_ref().len())
+ self.permutation.bytes_length()
+ self.cs.bytes_length()
}

fn bytes_length(&self) -> usize {
8 + (self.fixed_commitments.len() * C::default().to_bytes().as_ref().len())
+ self.permutation.bytes_length()
// scroll/halo2: we don’t need to store
// + self.selectors.len()
// * (self
Expand Down Expand Up @@ -323,6 +328,18 @@ where
&self.vk
}

/// Gets the total number of bytes in the serialization of `self` including constraint system
pub fn bytes_length_including_cs(&self) -> usize {
let scalar_len: usize = C::Scalar::default().to_repr().as_ref().len();
self.vk.bytes_length_including_cs()
+ 12
+ scalar_len * (self.l0.len() + self.l_last.len() + self.l_active_row.len())
+ polynomial_slice_byte_length(&self.fixed_values)
+ polynomial_slice_byte_length(&self.fixed_polys)
//+ polynomial_slice_byte_length(&self.fixed_cosets)
+ self.permutation.bytes_length()
}

/// Gets the total number of bytes in the serialization of `self`
fn bytes_length(&self) -> usize {
let scalar_len = C::Scalar::default().to_repr().as_ref().len();
Expand Down

0 comments on commit 63aa419

Please sign in to comment.