From 714bbf2de860b1b121f91c8dc314acaa5cd07db3 Mon Sep 17 00:00:00 2001 From: pinkiebell <40266861+pinkiebell@users.noreply.github.com> Date: Tue, 5 Jul 2022 19:01:12 +0000 Subject: [PATCH] prover/compute_proof: track duration of proving time --- prover/src/compute_proof.rs | 5 +++++ prover/src/structs.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/prover/src/compute_proof.rs b/prover/src/compute_proof.rs index f2b3124e1a..b66c03dbbc 100644 --- a/prover/src/compute_proof.rs +++ b/prover/src/compute_proof.rs @@ -9,7 +9,10 @@ use halo2_proofs::{ }; use rand::SeedableRng; use rand_xorshift::XorShiftRng; + use std::str::FromStr; +use std::time::Instant; + use strum::IntoEnumIterator; use zkevm_circuits::evm_circuit::{ table::FixedTableTag, test::TestCircuit, witness::block_convert, @@ -27,6 +30,7 @@ pub async fn compute_proof( rpc_url: &str, ) -> Result> { // request & build the inputs for the circuits + let time_started = Instant::now(); let url = Http::from_str(rpc_url)?; let geth_client = GethClient::new(url); let builder = BuilderClient::new(geth_client).await?; @@ -83,6 +87,7 @@ pub async fn compute_proof( let ret = Proofs { evm_proof: evm_proof.into(), state_proof: state_proof.into(), + duration: Instant::now().duration_since(time_started).as_millis() as u64, }; Ok(ret) diff --git a/prover/src/structs.rs b/prover/src/structs.rs index 91b964067c..5040a734a0 100644 --- a/prover/src/structs.rs +++ b/prover/src/structs.rs @@ -2,6 +2,7 @@ pub struct Proofs { pub state_proof: eth_types::Bytes, pub evm_proof: eth_types::Bytes, + pub duration: u64, } #[derive(Debug, serde::Serialize)]