-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(cheatcodes): decode structs and mappings in state diff output #11331
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
* feat(cheatcodes): decode mappings in state diffs * feat: decode nested mappings * assert vm.getStateDiff output * feat: add `keys` fields to `SlotInfo` in case of mappings * remove wrapper * refactor: moves state diff decoding to common (#11413) * refactor: storage decoder * cleanup * dedup MappingSlots by moving it to common * move decoding logic into SlotInfo * rename to SlotIndentifier * docs * fix: delegate identification according to encoding types * clippy + fmt * docs fix * fix * merge match arms * merge ifs * recurse handle_struct
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.
👍 Overall lgtm! Few small nits
I think users will really enjoy this feature
crates/common/src/slot_identifier.rs
Outdated
} | ||
|
||
/// Formats a [`DynSolValue`] as a raw string without type information and only the value itself. | ||
pub fn format_value(value: &DynSolValue) -> String { |
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 common::fmt
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.
reused in 8be596d
Co-authored-by: zerosnacks <[email protected]>
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! pending @zerosnacks @DaniPopes , thank you
lgtm, nitz, merge when done |
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 👍 , pending Dani's nits
Motivation
Ref #9504
Closes #11326 + Closes #11327
Solution
handle_struct
processes both single-slot and multi-slot structs, recursing through nestedstructures.
the accessed slot
Decode Mappings: feat(cheatcodes): decode mappings in state diffs #11381
Refactor PR to extract slot identification and decoding logic to
crates/common
: refactor: moves state diff decoding to common #11413 which will aid in resolving feat(invariants): improve storage decoding for subsequent fuzz runs #11334 and Cannot find the storage slot for a public string variable #3869Example:
TestStruct Diff
MultiSlotStruct Diff
NestedStruct Diff
PR Checklist