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

Support for internal function jump trace #4351

Closed
KuTuGu opened this issue Feb 14, 2023 · 4 comments · Fixed by #8222
Closed

Support for internal function jump trace #4351

KuTuGu opened this issue Feb 14, 2023 · 4 comments · Fixed by #8222
Labels
A-tracing Area: tracing C-forge Command: forge Cmd-forge-test Command: forge test D-hard Difficulty: hard T-feature Type: feature

Comments

@KuTuGu
Copy link

KuTuGu commented Feb 14, 2023

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.

@KuTuGu KuTuGu added the T-feature Type: feature label Feb 14, 2023
@tonisives
Copy link

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.

@onbjerg
Copy link
Member

onbjerg commented Feb 25, 2023

This is non trivial since some internal functions get inlined.

@onbjerg onbjerg added Cmd-forge-test Command: forge test C-forge Command: forge A-tracing Area: tracing D-hard Difficulty: hard labels Feb 25, 2023
@KuTuGu
Copy link
Author

KuTuGu commented Apr 6, 2023

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.

@zerosnacks zerosnacks self-assigned this Apr 21, 2024
@zerosnacks zerosnacks removed their assignment Jun 25, 2024
@zerosnacks
Copy link
Member

Related WIP PR: #8222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tracing Area: tracing C-forge Command: forge Cmd-forge-test Command: forge test D-hard Difficulty: hard T-feature Type: feature
Projects
No open projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants