Skip to content

Commit

Permalink
Benchmark proof generation
Browse files Browse the repository at this point in the history
  • Loading branch information
pkakelas committed Nov 22, 2023
1 parent 75f6fb4 commit 8a06200
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions feeder/src/prover/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod consensus;
mod execution;

use std::time::Instant;

use crate::{
eth::{consensus::ConsensusRPC, execution::ExecutionRPC, utils::calc_slot_from_timestamp},
prover::{
Expand Down Expand Up @@ -63,28 +65,33 @@ impl Prover {
};

let mut recent_block_state = self.consensus_rpc.get_state(recent_block.slot).await?;

let tx_index = self.get_tx_index(&receipts, &message.message.cc_id)?;

let now = Instant::now();

// Execution Proofs
let receipt_proof = generate_receipt_proof(&target_block, &receipts, tx_index)?;
println!("Got receipts proof: {:?}", receipt_proof.len());
println!(
"Got receipts proof: {:?} {}",
receipt_proof.len(),
now.elapsed().as_secs()
);

let transaction_proof = generate_transaction_proof(&target_block, tx_index)?;
println!("Got transactions proof: {:?}", transaction_proof.len());
println!("Got transactions proof: {}", now.elapsed().as_millis());

// Consensus Proofs
let transactions_branch = generate_transactions_branch(&mut target_beacon_block)?;
println!("Got transactions branch: {:?}", transactions_branch.len());
println!("Got transactions branch: {}", now.elapsed().as_millis());

let receipts_branch = generate_receipts_branch(&mut target_beacon_block)?;
println!("Got receipts branch: {:?}", receipts_branch.len());
println!("Got receipts branch: {}", now.elapsed().as_millis());

let exec_payload_branch = generate_exec_payload_branch(&mut target_beacon_block)?;
println!("Got exec_payload branch: {:?}", exec_payload_branch.len());
println!("Got exec_payload branch: {}", now.elapsed().as_millis());

let ancestry_proof = prove_ancestry(&mut recent_block_state, target_beacon_block.slot)?;
println!("Got ancestry proof");
println!("Got ancestry proof {}", now.elapsed().as_millis());

Ok(EventVerificationData {
message: message.message,
Expand Down

0 comments on commit 8a06200

Please sign in to comment.