Week 12, Running a state transition inside openVM now works
Since week10 there have been many modifications to the project which is almost finished. It processes many operations not just an attestation. It runs consensus-spec-tests and checks such as
- recomputing on host the tree hash root that was computed in guest
- comparing tree hash root of guest against tree hash root found in specs
Additionally, OpenVM is now updated to v1.4.
What remains to be done is:
- Get feedback and corrections from Ream team.
- Implement profiling options provided by OpenVM to get instruction counts for functions in guest:
read_ssz,deserialize_ssz,process,merkleize,commitetc.
Apart from the last two, very important, remaining tasks, the project is ready and starting from next week myself and Utsav will shift our focus zk topics in the context of Lean consensus specs that will be available on the 15th of September.
Running an operation inside OpenVM
This can be done using the command line. Move to the root directory of the project,
cd host
cargo run -- --operation-name <OPERATION-NAME>
where OPERATION-NAME = attestation attester_slashing block_header bls_to_execution_change deposit execution_payload proposer_slashing sync_aggregate voluntary_exit withdrawals.
For example, running an attestation along with consensus-spec-tests
cd host
cargo run -- --operation-name attestation
Profiling in OpenVM
According to the instructions that I received from the OpenVM team getting cycle counts out for various functions in guest code has to be done using their profiling tools with additional features. Enabling these features will provide necessary benchmarks. Benchmarks must be run using the command
OUTPUT_PATH="metrics.json" GUEST_SYMBOLS_PATH="guest.syms" cargo run --release --bin <benchmark_name> --features perf-metrics -- --profiling
Then, if inferno-flamegraph is installed, flamegraphs are generated by
python <repo_root>/ci/scripts/metric_unify/flamegraph.py $OUTPUT_PATH --guest-symbols $GUEST_SYMBOLS_PATH
For further details see https://github.com/openvm-org/openvm/blob/main/docs/crates/benchmarks.md#circuit-flamegraphs
Flamegraphs are generated using the flamegraph.py script of OpenVM: https://github.com/openvm-org/openvm/blob/main/ci/scripts/metric_unify/flamegraph.py
Finally, I am not, yet, sure about its relevance but there is a full CI workflow implementation for reth by OpenVM. It is available here: https://github.com/axiom-crypto/openvm-reth-benchmark/blob/main/.github/workflows/reth-benchmark.yml