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

feat(forge): Add call tracing support #192

Merged
merged 40 commits into from
Dec 23, 2021
Merged

feat(forge): Add call tracing support #192

merged 40 commits into from
Dec 23, 2021

Conversation

brockelmore
Copy link
Member

@brockelmore brockelmore commented Dec 3, 2021

Adds a CallTrace struct that is built up inside a cheatcode executor. This PR tracks the status

[x] Accumulates all calls
[x] Accumulates all logs
[x] Logs are correctly placed in order relative to calls (may not be possible with sputnik)
[x] Pretty print call tree
[x] Pretty print call inputs
[x] Pretty print logs
[x] Report gas
[x] Parse contract bytecode into contract name

colored prints, better dev ux, verbosity > 2 trace printing
@brockelmore brockelmore marked this pull request as ready for review December 11, 2021 08:45
@brockelmore
Copy link
Member Author

brockelmore commented Dec 12, 2021

I think this is ready for review - some improvements still needed like pretty printing ethers::abi::Token.

Traces will be printed if verbosity > 2.

Screen Shot 2021-12-11 at 9 48 48 PM

@brockelmore brockelmore changed the title [WIP] Add call tracing support feat: Add call tracing support Dec 12, 2021
@brockelmore brockelmore changed the title feat: Add call tracing support feat(forge): Add call tracing support Dec 17, 2021
@brockelmore
Copy link
Member Author

Once this issue is fixed, this should be production ready

@brockelmore
Copy link
Member Author

Here is what it looks like once the above issue is fixed (or with an empty out directory):
Screen Shot 2021-12-23 at 10 27 00 AM

Here is what it looks like without the fix (& for contracts that can't be identified):
Screen Shot 2021-12-23 at 10 27 17 AM

forge/src/runner.rs Outdated Show resolved Hide resolved
Copy link
Member

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LFG

evm-adapters/src/lib.rs Outdated Show resolved Hide resolved
evm-adapters/src/call_tracing.rs Show resolved Hide resolved
evm-adapters/src/call_tracing.rs Show resolved Hide resolved
evm-adapters/src/call_tracing.rs Outdated Show resolved Hide resolved
evm-adapters/src/call_tracing.rs Outdated Show resolved Hide resolved
evm-adapters/src/sputnik/cheatcodes/cheatcode_handler.rs Outdated Show resolved Hide resolved
evm-adapters/src/sputnik/cheatcodes/cheatcode_handler.rs Outdated Show resolved Hide resolved
evm-adapters/src/sputnik/mod.rs Outdated Show resolved Hide resolved
forge/src/runner.rs Show resolved Hide resolved
@brockelmore brockelmore merged commit 8602e1b into master Dec 23, 2021
@brockelmore brockelmore deleted the brock/tracing branch December 23, 2021 20:21
@mds1 mds1 mentioned this pull request Dec 27, 2021
8 tasks
clifton pushed a commit to clifton/foundry that referenced this pull request Dec 27, 2021
* first pass

* fixes

* fmt

* better fmting

* updates

colored prints, better dev ux, verbosity > 2 trace printing

* fmt

* updates

* fmt

* fix after master merge

* fix tests post master merge

* warning fixes

* fmt

* lots of fixes

* fmt

* fix

* cyan color

* fixes

* prettier raw logs + parse setup contracts

* update diff_score threshold

* better printing

* remove integration tests

* improvements

* improvements + fmt + clippy

* fixes

* more cleanup

* cleanup and verbosity > 3 setup print

* refactor printing

* documentation + cleanup

* fix negative number printing

* fix tests to match master and fix tracing_enabled

* fix unnecessary trace_index set

* refactor runner tracing + tracing_enabled

* nits + value printing

* last nits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants