Skip to content

Commit

Permalink
Impl padded_circuit_size for VerifierKey
Browse files Browse the repository at this point in the history
  • Loading branch information
CPerezz committed Mar 4, 2021
1 parent bbd8db9 commit 196f06c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/proof_system/widget/mod.rs
Expand Up @@ -20,7 +20,7 @@ use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
/// PLONK circuit proving key
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct ProverKey {
/// Circuit size
/// Circuit size (Not padded to a power of two).
pub n: usize,
/// ProverKey for arithmetic gate
pub arithmetic: arithmetic::ProverKey,
Expand All @@ -44,7 +44,7 @@ pub struct ProverKey {
/// PLONK circuit verification key
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub struct VerifierKey {
/// Circuit size
/// Circuit size (not padded to a power of two).
pub n: usize,
/// VerifierKey for arithmetic gates
pub arithmetic: arithmetic::VerifierKey,
Expand All @@ -64,6 +64,11 @@ impl_serde!(ProverKey);
impl_serde!(VerifierKey);

impl VerifierKey {
/// Returns the Circuit size padded to the next power of two.
pub const fn padded_circuit_size(&self) -> usize {
self.n.next_power_of_two()
}

/// Serialises a VerifierKey to bytes
pub fn to_bytes(&self) -> Vec<u8> {
use crate::serialisation::{write_commitment, write_u64};
Expand Down

0 comments on commit 196f06c

Please sign in to comment.