Skip to content

Commit

Permalink
serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
distractedm1nd committed Sep 17, 2024
1 parent e037373 commit 6a94cef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
16 changes: 0 additions & 16 deletions crates/common/src/hashchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@ impl Hashchain {
pub fn len(&self) -> usize {
self.entries.len()
}

pub fn serialize(&self) -> Result<Vec<u8>> {
bincode::serialize(self).map_err(anyhow::Error::from)
}

pub fn deserialize(data: &[u8]) -> Result<Self> {
bincode::deserialize(data).map_err(anyhow::Error::from)
}
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
Expand All @@ -162,12 +154,4 @@ impl HashchainEntry {
operation,
}
}

pub fn serialize(&self) -> Result<Vec<u8>> {
bincode::serialize(self).map_err(anyhow::Error::from)
}

pub fn deserialize(data: &[u8]) -> Result<Self> {
bincode::deserialize(data).map_err(anyhow::Error::from)
}
}
12 changes: 10 additions & 2 deletions crates/prism/src/node_types/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ pub struct Sequencer {
prover_client: Arc<Mutex<ProverClient>>,

proving_key: SP1ProvingKey,
// fix clippy warning, keep verifying_key for future use
#[allow(dead_code)]
verifying_key: SP1VerifyingKey,

epoch_buffer_tx: Arc<Sender<FinalizedEpoch>>,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6a94cef

Please sign in to comment.