From 6a94ceff78c8df06d06d3710568d3a15002f42c3 Mon Sep 17 00:00:00 2001 From: Ryan Quinn Ford Date: Tue, 17 Sep 2024 09:56:42 +0200 Subject: [PATCH] serialization --- crates/common/src/hashchain.rs | 16 ---------------- crates/prism/src/node_types/sequencer.rs | 12 ++++++++++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/crates/common/src/hashchain.rs b/crates/common/src/hashchain.rs index c7f01578..0f1e56d0 100644 --- a/crates/common/src/hashchain.rs +++ b/crates/common/src/hashchain.rs @@ -128,14 +128,6 @@ impl Hashchain { pub fn len(&self) -> usize { self.entries.len() } - - pub fn serialize(&self) -> Result> { - bincode::serialize(self).map_err(anyhow::Error::from) - } - - pub fn deserialize(data: &[u8]) -> Result { - bincode::deserialize(data).map_err(anyhow::Error::from) - } } #[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] @@ -162,12 +154,4 @@ impl HashchainEntry { operation, } } - - pub fn serialize(&self) -> Result> { - bincode::serialize(self).map_err(anyhow::Error::from) - } - - pub fn deserialize(data: &[u8]) -> Result { - bincode::deserialize(data).map_err(anyhow::Error::from) - } } diff --git a/crates/prism/src/node_types/sequencer.rs b/crates/prism/src/node_types/sequencer.rs index 8d1f9a7b..e81fff8f 100644 --- a/crates/prism/src/node_types/sequencer.rs +++ b/crates/prism/src/node_types/sequencer.rs @@ -54,8 +54,6 @@ pub struct Sequencer { prover_client: Arc>, proving_key: SP1ProvingKey, - // fix clippy warning, keep verifying_key for future use - #[allow(dead_code)] verifying_key: SP1VerifyingKey, epoch_buffer_tx: Arc>, @@ -331,8 +329,18 @@ impl Sequencer { stdin.write(&batch); let client = self.prover_client.lock().await; + + info!("generating proof for epoch height {}", epoch); + #[cfg(not(feature = "plonk"))] let proof = client.prove(&self.proving_key, stdin).run()?; + #[cfg(feature = "plonk")] + let proof = client.prove(&self.proving_key, stdin).plonk().run()?; + info!("successfully generated proof for epoch height {}", epoch); + + client.verify(&proof, &self.verifying_key)?; + info!("verified proof for epoch height {}", epoch); + let epoch_json = FinalizedEpoch { height: epoch, prev_commitment,