-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(cheatcodes
): include slot type and decode values in state diffs
#11276
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
Conversation
cheatcodes
): include slot type and decode values in state diffs
that makes sense, just to make sure, will it be applied only to formatted output, is this correct? |
Yes, it'll only be applied to the formatted output. |
Done aa36022, @grandizzy ptal |
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.
lgtm, would be great to have more reviews - we can have more iterations in case a better format suggested. Left one nit re tests, think we could remove extra output for all the tests?
testdata/foundry.toml
Outdated
@@ -10,7 +10,7 @@ bytecode_hash = "ipfs" | |||
cache = true | |||
cache_path = "cache" | |||
evm_version = "paris" | |||
extra_output = [] | |||
extra_output = ["storageLayout"] |
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 looks redundant with https://github.com/foundry-rs/foundry/pull/11276/files#diff-a6bfc113481a0755f7283d73dd37eb99ea7ed82674d4a22c24387985d5e0eb8eR73 so I think can be reverted?
No to strong opinion(especially as we're primarily working with the json), but I think i liked it better before. |
I would prefer to keep the entire output as in |
@zerosnacks @grandizzy reverted the change f366667 |
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.
👍 needs docs fix
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.
lgtm 👍 !
Motivation
ref #9504
stacked on #11214
Solution
This features enabled when the compiled artifacts include the
storageLayout
. This can be achieved by setting theextra_output = ["storageLayout"]
in foundry.toml or via the cli flag--extra-output storageLayout
SlotInfo
in theSlotStateDiff
Note: This does not handle types that are non-contiguous in the storage such as dynamic arrays or mappings. This shall be addressed in a followup: #11326 and #11327
Consider the following as an example:
The above test will emit the following output:
Plaintext String
JSON Output
Please drop your comments on the output structure, especially the plaintext string output which looks a bit weird.
PR Checklist