From b7cdcc74241dda73f3367edfba01da1f7d973424 Mon Sep 17 00:00:00 2001 From: leruaa Date: Tue, 13 May 2025 15:09:56 -0700 Subject: [PATCH 1/2] feat: use profile_report! in the client --- bin/client-op/src/main.rs | 9 +++++---- bin/client/src/main.rs | 9 +++++---- crates/executor/client/src/lib.rs | 2 +- crates/executor/client/src/utils.rs | 6 +++++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/bin/client-op/src/main.rs b/bin/client-op/src/main.rs index 200d1a1..1e2ce4d 100644 --- a/bin/client-op/src/main.rs +++ b/bin/client-op/src/main.rs @@ -4,15 +4,16 @@ sp1_zkvm::entrypoint!(main); use rsp_client_executor::{ executor::{OpClientExecutor, DESERIALZE_INPUTS}, io::{CommittedHeader, OpClientExecutorInput}, + utils::profile_report, }; use std::sync::Arc; pub fn main() { // Read the input. - println!("cycle-tracker-report-start: {}", DESERIALZE_INPUTS); - let input = sp1_zkvm::io::read_vec(); - let input = bincode::deserialize::(&input).unwrap(); - println!("cycle-tracker-report-end: {}", DESERIALZE_INPUTS); + let input = profile_report!(DESERIALZE_INPUTS, { + let input = sp1_zkvm::io::read_vec(); + bincode::deserialize::(&input).unwrap() + }); // Execute the block. let executor = OpClientExecutor::optimism(Arc::new((&input.genesis).try_into().unwrap())); diff --git a/bin/client/src/main.rs b/bin/client/src/main.rs index 8576f9e..31d7105 100644 --- a/bin/client/src/main.rs +++ b/bin/client/src/main.rs @@ -4,15 +4,16 @@ sp1_zkvm::entrypoint!(main); use rsp_client_executor::{ executor::{EthClientExecutor, DESERIALZE_INPUTS}, io::{CommittedHeader, EthClientExecutorInput}, + utils::profile_report, }; use std::sync::Arc; pub fn main() { // Read the input. - println!("cycle-tracker-report-start: {}", DESERIALZE_INPUTS); - let input = sp1_zkvm::io::read_vec(); - let input = bincode::deserialize::(&input).unwrap(); - println!("cycle-tracker-report-end: {}", DESERIALZE_INPUTS); + let input = profile_report!(DESERIALZE_INPUTS, { + let input = sp1_zkvm::io::read_vec(); + bincode::deserialize::(&input).unwrap() + }); // Execute the block. let executor = EthClientExecutor::eth( diff --git a/crates/executor/client/src/lib.rs b/crates/executor/client/src/lib.rs index 81356d8..e666422 100644 --- a/crates/executor/client/src/lib.rs +++ b/crates/executor/client/src/lib.rs @@ -3,7 +3,7 @@ /// Client program input data types. pub mod io; #[macro_use] -mod utils; +pub mod utils; pub mod custom; pub mod error; pub mod executor; diff --git a/crates/executor/client/src/utils.rs b/crates/executor/client/src/utils.rs index 19aeee3..f05f5be 100644 --- a/crates/executor/client/src/utils.rs +++ b/crates/executor/client/src/utils.rs @@ -1,5 +1,5 @@ /// Profile the given code block cycle count. -#[allow(unused_macros)] +#[macro_export] macro_rules! profile { ($name:expr, $block:block) => {{ #[cfg(target_os = "zkvm")] @@ -18,6 +18,7 @@ macro_rules! profile { } /// Profile the given code block and add the cycle count to the execution report. +#[macro_export] macro_rules! profile_report { ($name:expr, $block:block) => {{ #[cfg(target_os = "zkvm")] @@ -34,3 +35,6 @@ macro_rules! profile_report { } }}; } + +pub use profile; +pub use profile_report; From ac7de17a612fa17cc9f4158888eecbe3dc14388b Mon Sep 17 00:00:00 2001 From: leruaa Date: Wed, 14 May 2025 00:12:58 -0700 Subject: [PATCH 2/2] fix: CI --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c818199..b475f2f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] channel = "1.85.0" -components = ["rustfmt"] +components = ["rustfmt", "clippy"]