foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.1k stars 1.67k forks source link

Add printing of OPCODEs in forge tests #8198

Open rori4 opened 2 months ago

rori4 commented 2 months ago

Component

Forge

Describe the feature you would like

One feature that is missing in the tooling would be to print the opcodes that re hit when testing contracts.

For example https://github.com/zemse/hardhat-tracer has the option for you to set if you want to print SLOADs, MLOADs and other OPCODES when testing and also their gas usage. This would be beneficial of gas analysis & gas optimizations.

I know with the debugger you can see the opcodes but its hard to navigate and you can't filter only specific opcodes there

image

This maybe can be added as a verbosity level 6 or another way where you can specify which opcodes you want printed.

Additional context

No response

zerosnacks commented 1 month ago

I think the current state of this is that the renderer has support for rendering OPCODEs (added in https://github.com/paradigmxyz/revm-inspectors/pull/157) but we still require an implementation of it here that passes to the renderer, correct @klkvr?