From 146e66052380c89305223238bf160f622a263129 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 12 Apr 2023 09:26:06 -0700 Subject: [PATCH] don't serialize challenges --- plonky2/examples/fibonacci.rs | 9 --------- plonky2/src/plonk/proof.rs | 19 +++++++++---------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/plonky2/examples/fibonacci.rs b/plonky2/examples/fibonacci.rs index d78455c3..aa20c0ff 100644 --- a/plonky2/examples/fibonacci.rs +++ b/plonky2/examples/fibonacci.rs @@ -55,15 +55,6 @@ fn main() -> Result<()> { let proof_serialized = serde_json::to_string(&proof).unwrap(); fs::write("proof_with_public_inputs.json", proof_serialized).expect("Unable to write file"); - let challenges = proof.get_challenges( - proof.get_public_inputs_hash(), - &data.verifier_only.circuit_digest, - &data.common, - )?; - - let challenges_serialized = serde_json::to_string(&challenges).unwrap(); - fs::write("proof_challenges.json", challenges_serialized).expect("Unable to write file"); - println!( "100th Fibonacci number mod |F| (starting with {}, {}) is: {}", proof.public_inputs[0], proof.public_inputs[1], proof.public_inputs[2] diff --git a/plonky2/src/plonk/proof.rs b/plonky2/src/plonk/proof.rs index 71b2d36b..90a7ea86 100644 --- a/plonky2/src/plonk/proof.rs +++ b/plonky2/src/plonk/proof.rs @@ -102,7 +102,7 @@ impl, C: GenericConfig, const D: usize> }) } - pub fn get_public_inputs_hash( + pub(crate) fn get_public_inputs_hash( &self, ) -> <>::InnerHasher as Hasher>::Hash where @@ -152,7 +152,7 @@ impl, C: GenericConfig, const D: usize> CompressedProof { /// Decompress the proof. - pub fn decompress( + pub(crate) fn decompress( self, challenges: &ProofChallenges, fri_inferred_elements: FriInferredElements, @@ -214,7 +214,7 @@ impl, C: GenericConfig, const D: usize> }) } - pub fn verify( + pub(crate) fn verify( self, verifier_data: &VerifierOnlyCircuitData, common_data: &CommonCircuitData, @@ -246,7 +246,7 @@ impl, C: GenericConfig, const D: usize> ) } - pub fn get_public_inputs_hash( + pub(crate) fn get_public_inputs_hash( &self, ) -> <>::InnerHasher as Hasher>::Hash where @@ -276,8 +276,7 @@ impl, C: GenericConfig, const D: usize> } } -#[derive(Serialize)] -pub struct ProofChallenges, const D: usize> { +pub(crate) struct ProofChallenges, const D: usize> { /// Random values used in Plonk's permutation argument. pub plonk_betas: Vec, @@ -293,7 +292,7 @@ pub struct ProofChallenges, const D: usize> { pub fri_challenges: FriChallenges, } -pub struct ProofChallengesTarget { +pub(crate) struct ProofChallengesTarget { pub plonk_betas: Vec, pub plonk_gammas: Vec, pub plonk_alphas: Vec, @@ -302,7 +301,7 @@ pub struct ProofChallengesTarget { } /// Coset elements that can be inferred in the FRI reduction steps. -pub struct FriInferredElements, const D: usize>( +pub(crate) struct FriInferredElements, const D: usize>( pub Vec, ); @@ -356,7 +355,7 @@ impl, const D: usize> OpeningSet { } } - pub fn to_fri_openings(&self) -> FriOpenings { + pub(crate) fn to_fri_openings(&self) -> FriOpenings { let zeta_batch = FriOpeningBatch { values: [ self.constants.as_slice(), @@ -390,7 +389,7 @@ pub struct OpeningSetTarget { } impl OpeningSetTarget { - pub fn to_fri_openings(&self) -> FriOpeningsTarget { + pub(crate) fn to_fri_openings(&self) -> FriOpeningsTarget { let zeta_batch = FriOpeningBatchTarget { values: [ self.constants.as_slice(),