diff --git a/halo2_proofs/src/plonk.rs b/halo2_proofs/src/plonk.rs index 0fc98c50..64460e37 100644 --- a/halo2_proofs/src/plonk.rs +++ b/halo2_proofs/src/plonk.rs @@ -46,37 +46,6 @@ pub struct VerifyingKey { } impl VerifyingKey { - /// Writes a verifying key to a buffer. - pub fn write(&self, writer: &mut W) -> io::Result<()> { - for commitment in &self.fixed_commitments { - writer.write_all(commitment.to_bytes().as_ref())?; - } - self.permutation.write(writer)?; - - Ok(()) - } - - /// Reads a verification key from a buffer. - pub fn read>( - reader: &mut R, - params: &Params, - ) -> io::Result { - let (domain, cs, _) = keygen::create_domain::(params); - - let fixed_commitments: Vec<_> = (0..cs.num_fixed_columns) - .map(|_| C::read(reader)) - .collect::>()?; - - let permutation = permutation::VerifyingKey::read(reader, &cs.permutation)?; - - Ok(VerifyingKey { - domain, - fixed_commitments, - permutation, - cs, - }) - } - /// Hashes a verification key into a transcript. pub fn hash_into, T: Transcript>( &self, diff --git a/halo2_proofs/src/plonk/permutation.rs b/halo2_proofs/src/plonk/permutation.rs index 96fecf43..2117ebab 100644 --- a/halo2_proofs/src/plonk/permutation.rs +++ b/halo2_proofs/src/plonk/permutation.rs @@ -78,23 +78,6 @@ pub(crate) struct VerifyingKey { commitments: Vec, } -impl VerifyingKey { - pub(crate) fn write(&self, writer: &mut W) -> io::Result<()> { - for commitment in &self.commitments { - writer.write_all(commitment.to_bytes().as_ref())?; - } - - Ok(()) - } - - pub(crate) fn read(reader: &mut R, argument: &Argument) -> io::Result { - let commitments = (0..argument.columns.len()) - .map(|_| C::read(reader)) - .collect::, _>>()?; - Ok(VerifyingKey { commitments }) - } -} - /// The proving key for a single permutation argument. #[derive(Debug)] pub(crate) struct ProvingKey { diff --git a/halo2_proofs/tests/plonk_api.rs b/halo2_proofs/tests/plonk_api.rs index 38cf49ea..1b6a94ae 100644 --- a/halo2_proofs/tests/plonk_api.rs +++ b/halo2_proofs/tests/plonk_api.rs @@ -9,7 +9,6 @@ use halo2_proofs::pasta::{Eq, EqAffine, Fp}; use halo2_proofs::plonk::{ create_proof, keygen_pk, keygen_vk, verify_proof, Advice, BatchVerifier, Circuit, Column, ConstraintSystem, Error, Fixed, SingleVerifier, TableColumn, VerificationStrategy, - VerifyingKey, }; use halo2_proofs::poly::commitment::{Guard, MSM}; use halo2_proofs::poly::{commitment::Params, Rotation}; @@ -565,21 +564,11 @@ fn plonk_api() { ) .unwrap(); - // Write and then read the verification key in between (to check round-trip - // serialization). - // TODO: Figure out whether https://github.com/zcash/halo2/issues/449 should - // be caught by this, or if it is caused by downstream changes to halo2. - let mut vk_buffer = vec![]; - pk.get_vk().write(&mut vk_buffer).unwrap(); - let vk = - VerifyingKey::::read::<_, MyCircuit>(&mut &vk_buffer[..], ¶ms) - .unwrap(); - // "Second" proof (just the first proof again). let mut transcript = Blake2bRead::<_, _, Challenge255<_>>::init(&proof[..]); let strategy = verify_proof( ¶ms, - &vk, + pk.get_vk(), strategy, &[&[&pubinputs[..]], &[&pubinputs[..]]], &mut transcript,