near / wasmtime

Standalone JIT-style runtime for WebAssembly, using Cranelift
https://wasmtime.dev/
Apache License 2.0
3 stars 4 forks source link

feat(bench): add `InstructionTracer.js` helper #240

Closed mooori closed 4 months ago

mooori commented 4 months ago

Adds the InstructionTracer.js helper for zkevm-proverjs and integrates it with tooling by:

Can be reviewed commit by commit.

Usage

Generate instrumented zkASM with analyze-zkasm, for example:

cargo run -p analyze-zkasm -- instrument-inst \
    cranelift/zkasm_data/spectest/i32/add_1.wat \
    cranelift/zkasm_data/spectest/i32/generated/add_1.zkasm

Execute the instrumented zkASM and write the trace of executed instructions to a file:

node ./tests/zkasm/run-tests-zkasm.js profile-instructions \
    cranelift/zkasm_data/spectest/i32/generated/add_1.zkasm \
    trace.txt

Testing

One of the next steps is adding a subcommand to analyze-zkasm that allows to go wat file -> instrumented zkasm -> executed instruction trace in one step. Adding tests for execution traces will be much easier once this command exists. Therefore, if possible, I would like to postpone adding tests until then.