-
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
Merged
Merged
Changes from 63 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
926e8d5
feat(`forge`): sample typed storage values
yash-atreya 8ec91b3
arc it
yash-atreya cfd4a15
nit
yash-atreya c56c920
clippy
yash-atreya 90a1dea
nit
yash-atreya e7caa86
strip file prefixes
yash-atreya bccf3ad
fmt
yash-atreya fd6ecd6
don't add adjacent values to sample
yash-atreya a4c4a79
Merge branch 'master' into yash/fuzz-storage-values-by-type
yash-atreya f62bcb8
feat(cheatcodes): add contract identifier to AccountStateDiffs
yash-atreya 1b4520f
forge fmt
yash-atreya cc29481
Merge branch 'master' into yash/state-diff-storage-labels
yash-atreya 729ea8e
doc nits
yash-atreya 2a8da88
fix tests
yash-atreya 3c74ed9
feat(`cheatcodes`): include `SlotInfo` in SlotStateDiff
yash-atreya 85a225b
cleanup + identify slots of static arrays
yash-atreya a4228ef
nits
yash-atreya 1853d8e
nit
yash-atreya 5b8b95b
nits
yash-atreya e619e0d
test + nits
yash-atreya caf21b9
docs
yash-atreya e9630a0
handle 2d arrays
yash-atreya b44b410
use DynSolType
yash-atreya e78b087
feat: decode storage values
yash-atreya ebcef04
doc nit
yash-atreya 65db931
skip decoded serialization if none
yash-atreya 7d3c87b
nit
yash-atreya fe8b59d
Merge branch 'master' into yash/state-diff-storage-labels
yash-atreya e63e817
fmt
yash-atreya f9ffcea
fix
yash-atreya 05d4a38
Merge branch 'yash/state-diff-storage-labels' into yash/decode-label-…
yash-atreya f25c85d
fix
yash-atreya 055797d
fix
yash-atreya 0882694
Merge branch 'yash/state-diff-storage-labels' into yash/decode-label-…
yash-atreya 0026752
resolve conflicts
2d62559
feat(cheatcodes): decode structs in state diff output
0db68f7
fix
yash-atreya 927e756
while decode
yash-atreya e487e82
fix: show only decoded in plaintext / display output + test
yash-atreya a28c41c
Merge branch 'master' into yash/decode-label-state-diffs
yash-atreya 1482e30
Merge branch 'yash/decode-label-state-diffs' into yash/decode-structs…
yash-atreya aa36022
feat: format slots to only significant bits in vm.getStateDiff output
yash-atreya 3cfefdc
encode_prefixed
yash-atreya 850dc6c
nit
yash-atreya 8f9f82f
Merge branch 'yash/decode-label-state-diffs' into yash/decode-structs…
yash-atreya 6e3120b
chore: add @onbjerg to `CODEOWNERS` (#11343)
zerosnacks 0ea49a2
resolve conflicts
yash-atreya a11c347
fix: disable tx gas limit cap (#11347)
mattsse f9964de
chore(deps): bump all dependencies (#11349)
DaniPopes 6ebfaf3
chore: use get_or_calculate_hash better (#11350)
DaniPopes cc09011
resolve more conflicts
yash-atreya 9c78c61
fix(lint): 'unwrapped-modifier-logic' incorrectly marked with `Severi…
srdtrk cbbbdb6
feat: identify and decode nested structs
yash-atreya 156bc80
resolve conflicts
yash-atreya 55249e8
cleanup
yash-atreya 1b1f626
decode structs and members recursively
yash-atreya 499abf6
cleanup
yash-atreya a1de1dc
doc fix
yash-atreya bb255b3
Merge branch 'master' into yash/decode-structs-in-state-diffs
0xrusowsky c9d1cef
feat(cheatcodes): decode mappings in state diffs (#11381)
yash-atreya 7460161
dedup assertContains test util
yash-atreya befdf4b
Merge branch 'master' into yash/decode-structs-in-state-diffs
yash-atreya 5cd7b12
fix
yash-atreya 398c5ab
Update crates/common/src/slot_identifier.rs
grandizzy 8be596d
Review changes: simplify get or insert, use common fmt
grandizzy b850bc7
alloy-dyn-abi.workspace
grandizzy fbcd265
nits
yash-atreya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use alloy_primitives::{B256, map::B256HashMap}; | ||
|
||
/// Recorded mapping slots. | ||
#[derive(Clone, Debug, Default)] | ||
pub struct MappingSlots { | ||
/// Holds mapping parent (slots => slots) | ||
pub parent_slots: B256HashMap<B256>, | ||
|
||
/// Holds mapping key (slots => key) | ||
pub keys: B256HashMap<B256>, | ||
|
||
/// Holds mapping child (slots => slots[]) | ||
pub children: B256HashMap<Vec<B256>>, | ||
|
||
/// Holds the last sha3 result `sha3_result => (data_low, data_high)`, this would only record | ||
/// when sha3 is called with `size == 0x40`, and the lower 256 bits would be stored in | ||
/// `data_low`, higher 256 bits in `data_high`. | ||
/// This is needed for mapping_key detect if the slot is for some mapping and record that. | ||
pub seen_sha3: B256HashMap<(B256, B256)>, | ||
} | ||
|
||
impl MappingSlots { | ||
/// Tries to insert a mapping slot. Returns true if it was inserted. | ||
pub fn insert(&mut self, slot: B256) -> bool { | ||
match self.seen_sha3.get(&slot).copied() { | ||
Some((key, parent)) => { | ||
if self.keys.contains_key(&slot) { | ||
return false; | ||
} | ||
self.keys.insert(slot, key); | ||
self.parent_slots.insert(slot, parent); | ||
self.children.entry(parent).or_default().push(slot); | ||
self.insert(parent); | ||
true | ||
} | ||
None => false, | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.