-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
tracing: Improve decoding of functions output #6531
tracing: Improve decoding of functions output #6531
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test with the example contract? I don't believe we have trace-specific tests, so a repro with this PR's number is OK. I think we'll want to separate those tho.
8075269
to
ce65b62
Compare
@klkvr Sorry I meant repro tests in crates/forge/tests/it/repros.rs |
Hey @DaniPopes I am not sure if it makes sense to add this as a repro test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great!
the integration test is appropriate since we want to check the actual formatted trace output
Motivation
Currently, while decoding result of function execution in traces, the following is done:
This works fine for decoding inputs, however, openchain.xyz does not (and can not) tell anything about output types of a function.
Due to this, outputs for any calls to external contract accessed by an interface in forked environment are not decoded at the moment.
An example of this behavior is following test:
Traces for it will look like this:
However, it should be decoded into this:
And this gets much uglier when working with contracts returning tuples/addresses/bytes
Solution
There is already
with_events
function which is used for importing events from known contracts when constructing aCallTraceDecoder
, so I've just added similar logic for functions as wellfoundry/crates/forge/bin/cmd/test/mod.rs
Lines 692 to 695 in fdad9fb