Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add printing of OPCODEs in forge tests #8198

Open
rori4 opened this issue Jun 19, 2024 · 1 comment
Open

Add printing of OPCODEs in forge tests #8198

rori4 opened this issue Jun 19, 2024 · 1 comment
Labels
A-tracing Area: tracing Cmd-forge-test Command: forge test T-feature Type: feature

Comments

@rori4
Copy link

rori4 commented Jun 19, 2024

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

@rori4 rori4 added the T-feature Type: feature label Jun 19, 2024
@zerosnacks zerosnacks added Cmd-forge-test Command: forge test A-tracing Area: tracing labels Jun 27, 2024
mattsse pushed a commit to paradigmxyz/revm-inspectors that referenced this issue Jul 2, 2024
ref foundry-rs/foundry#8222
ref foundry-rs/foundry#8198

Adds structs and extends `TraceWriter` to support formatting of decoded
trace steps. Currently two decoding formats are supported:
- Internal calls. Similar to a decoded call trace, decoded internal
function invocation which spans over multiple steps. Kept as decoded
function name, inputs, outputs and index of the last step.
- Arbitrary strings. This might be useful for formatting decoded opcodes
(e.g. adding `├─ [sload] <slot>` to trace. It might make sense to extend
it to something more configurable once we start implementing this
@zerosnacks
Copy link
Member

zerosnacks commented Jul 16, 2024

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

@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@grandizzy grandizzy removed this from the v1.0.0 milestone Oct 1, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tracing Area: tracing Cmd-forge-test Command: forge test T-feature Type: feature
Projects
Status: Todo
Development

No branches or pull requests

3 participants