2 unstable releases
0.3.0 | Oct 20, 2023 |
---|---|
0.2.0 | Sep 14, 2023 |
#39 in #rollup
26 downloads per month
Used in 3 crates
8KB
Tracer
- The tracer binary makes use of goblin, capstone and rustc-demangle to disassemble the riscV ELF and build a symbol table
- The execution trace for the rollup ELF is generated by running the
demo-prover
with theROLLUP_TRACE
environment variable set to the desired path
cd examples/demo-prover/host
ROLLUP_TRACE=rollup.trace cargo bench --bench prover_bench --features bench
rollup.trace
now contains the program counter values for the run of the demo-prover (how many ever blocks, blobs and transactions we configured it for)- The corresponding ELF used for the trace is found at
$ file target/riscv-guest/riscv32im-risc0-zkvm-elf/release/rollup
target/riscv-guest/riscv32im-risc0-zkvm-elf/release/rollup: ELF 32-bit LSB executable, UCB RISC-V, soft-float ABI, version 1 (SYSV), statically linked, with debug_info, not stripped
- Both the above files are passed as input to the tracer
% cargo run -- --rollup-elf ../../../examples/demo-prover/target/riscv-guest/riscv32im-risc0-zkvm-elf/release/rollup --rollup-trace ../../../examples/demo-prover/rollup.trace
Finished dev [unoptimized + debuginfo] target(s) in 0.11s
Running `target/debug/tracer --rollup-elf ../../../examples/demo-prover/target/riscv-guest/riscv32im-risc0-zkvm-elf/release/rollup --rollup-trace ../../../examples/demo-prover/rollup.trace`
[00:01:04] [########################################] 16154861/16154861 (0s)
Total instructions in trace: 16154861
Instruction counts considering call graph
+--------------------------------------------------------------------------------------------+-------------------+
| Function Name | Instruction Count |
+============================================================================================+===================+
| __start | 16154854 |
+--------------------------------------------------------------------------------------------+-------------------+
| main | 16153565 |
+--------------------------------------------------------------------------------------------+-------------------+
| rollup::main::h089e03181dac539a | 16153559 |
+--------------------------------------------------------------------------------------------+-------------------+
| sov_modules_stf_template::<impl | 15350436 |
| sov_rollup_interface::state_machine::stf::StateTransitionFunction<Vm,B> for | |
| sov_modules_stf_template::app_template::AppTemplate<C,Cond,Vm,RT,B>>::apply_slot::h820293d | |
| c8d744201 | |
+--------------------------------------------------------------------------------------------+-------------------+
| ed25519_dalek::public::PublicKey::verify_strict::hfad17f99efbd2cd0 | 13528566 |
+--------------------------------------------------------------------------------------------+-------------------+
| <&curve25519_dalek::backend::serial::u64::field::FieldElement51 as | 8295218 |
| core::ops::arith::Mul<&curve25519_dalek::backend::serial::u64::field::FieldElement51>>::mu | |
| l::h39351372a97422dd | |
.
.
.
+--------------------------------------------------------------------------------------------+-------------------+
- The tracer also generates a pure count of instructions without considering the stack
- There are other options that can be passed which are self documented in the cli
Usage: tracer [OPTIONS] --rollup-elf <ROLLUP_ELF> --rollup-trace <ROLLUP_TRACE>
Options:
-t, --top <TOP> Include the "top" number of functions [default: 30]
--no-stack-counts Don't print stack aware instruction counts
--no-raw-counts Don't print raw (stack un-aware) instruction counts
--rollup-elf <ROLLUP_ELF> Path to the riscv32 elf
--rollup-trace <ROLLUP_TRACE> Path to the rollup trace. File must be one u64 program counter per line
-s, --strip-hashes Strip the hashes from the function name while printing
-h, --help Print help
-V, --version Print version
Dependencies
~10–25MB
~335K SLoC