foundry
foundry copied to clipboard
Support for internal function jump trace
Component
Cast
Describe the feature you would like
At present, foundry only supports external call
trace, which is a black box for internal logic function calls, makes it difficult to debug some intermediate variable values.
Hope to introduce the analysis of JUMP
opcode to support the internal function trace.
Additional context
- Tenderly supports this feature.
- Some alternatives use foundry AFAIK:
-
vm.etch()
+console.log()
-
forge --debug
mode
-
But the alternatives are a little bulky. We need this feature so that we can clearly see all internal and external function calls trace.
This would also be useful for forge test
. Maybe add another -v.
Right now when I am auditing a contract it is hard to follow the trace and understand which internal functions are called. This especially applies if there are a lot of if cases or otherwise complex control flow.
This is non trivial since some internal functions get inlined.
Yeah, it's hard to match all function. I wrote a simple demo based on structlog
and ast
analysis that ignores a large number of unmatched functions.
Related WIP PR: https://github.com/foundry-rs/foundry/pull/8222