Zk-cycle-macros

[features] bench = ["sov-zk-cycle-macros/bench","sov-zk-cycle-utils", "risc0-zkvm","risc0-zkvm-platform"] * The feature gating is needed because we don't want the cycle tracker scaffolding to be used unless the `bench` feature is enabled * If the `bench` feature is not enabled, the risc0 host will not be built with the necessary syscalls to support tracking cycles * The additional imports are necessary because the macro wraps the user function with the necessary code for tracking the number of cycles before and after the function execution * The rust code that needs to use the `cycle_tracker` macro needs to import it and then annotate the function with it rust,ignore //

[cfg(all(target_os = "zkvm", feature = "bench"))]

use sovzkcyclemacros::cycletracker; // //

[cfgattr(all(targetos = "zkvm", feature = "bench"), cycle_tracker)]

fn beginslot( &mut self, slotdata: &impl SlotData, witness: >::Witness, ) { let statecheckpoint = StateCheckpoint::withwitness(self.current_storage.clone(), witness);

let mut working_set = state_checkpoint.to_revertable();

self.runtime.begin_slot_hook(slot_data, &mut working_set);

self.checkpoint = Some(working_set.checkpoint());

} ```