Skip to content

Commit

Permalink
Rename to original and dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
grandizzy committed Dec 2, 2024
1 parent d46080c commit 1536119
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions crates/cheatcodes/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ struct AccountStateDiffs {

/// Storage slot diff info.
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct SlotStateDiff {
/// Initial storage value.
previous_value: B256,
original: B256,
/// Current storage value.
new_value: B256,
dirty: B256,
}

impl Cheatcode for addrCall {
Expand Down Expand Up @@ -727,7 +726,7 @@ impl Cheatcode for getStateDiffCall {
for (slot, slot_changes) in state_diffs.changes {
diffs.push_str(&format!(
"@ {slot}: {} → {}\n",
slot_changes.previous_value, slot_changes.new_value
slot_changes.original, slot_changes.dirty
));
}
}
Expand Down Expand Up @@ -1130,8 +1129,8 @@ fn get_recorded_state_diffs(state: &mut Cheatcodes) -> StateDiffs {
changes.insert(
slot.to_string(),
SlotStateDiff {
previous_value: recorded_slot_changes.first().unwrap().0,
new_value: recorded_slot_changes.last().unwrap().1,
original: recorded_slot_changes.first().unwrap().0,
dirty: recorded_slot_changes.last().unwrap().1,
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions testdata/default/cheats/RecordAccountAccesses.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ contract RecordAccountAccessesTest is DSTest {
);
string memory diffsJson = cheats.getStateDiff(true);
assertEq(
"{\"0x5991a2df15a8f6a256d3ec51e99254cd3fb576a9\":{\"changes\":{\"1235\":{\"previousValue\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"newValue\":\"0x000000000000000000000000000000000000000000000000000000000000162e\"}}},\"0xc7183455a4c133ae270771860664b6b7ec320bb1\":{\"changes\":{\"5678\":{\"previousValue\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"newValue\":\"0x00000000000000000000000000000000000000000000000000000000000004d2\"}}}}",
"{\"0x5991a2df15a8f6a256d3ec51e99254cd3fb576a9\":{\"changes\":{\"1235\":{\"original\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"dirty\":\"0x000000000000000000000000000000000000000000000000000000000000162e\"}}},\"0xc7183455a4c133ae270771860664b6b7ec320bb1\":{\"changes\":{\"5678\":{\"original\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"dirty\":\"0x00000000000000000000000000000000000000000000000000000000000004d2\"}}}}",
diffsJson
);
Vm.AccountAccess[] memory called = filterExtcodesizeForLegacyTests(cheats.stopAndReturnStateDiff());
Expand Down Expand Up @@ -787,7 +787,7 @@ contract RecordAccountAccessesTest is DSTest {
cheats.getStateDiff(false)
);
assertEq(
"{\"0x2e234dae75c793f67a35089c9d99245e1c58470b\":{\"label\":\"NestedStorer\",\"changes\":{\"31391530734884398925509096751136955997235046655136458338700630915422204365175\":{\"previousValue\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"newValue\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"},\"86546418208203448386783321347074308435724792809315873744194221534962779865098\":{\"previousValue\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"newValue\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"},\"89735575844917174604881245405098157398514761457822262993733937076486162048205\":{\"previousValue\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"newValue\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"},\"99655811014363889343382125167956395016210879868288374279890486979400290732814\":{\"previousValue\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"newValue\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"}}}}",
"{\"0x2e234dae75c793f67a35089c9d99245e1c58470b\":{\"label\":\"NestedStorer\",\"changes\":{\"31391530734884398925509096751136955997235046655136458338700630915422204365175\":{\"original\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"dirty\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"},\"86546418208203448386783321347074308435724792809315873744194221534962779865098\":{\"original\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"dirty\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"},\"89735575844917174604881245405098157398514761457822262993733937076486162048205\":{\"original\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"dirty\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"},\"99655811014363889343382125167956395016210879868288374279890486979400290732814\":{\"original\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"dirty\":\"0x0000000000000000000000000000000000000000000000000000000000000001\"}}}}",
cheats.getStateDiff(true)
);
Vm.AccountAccess[] memory called = filterExtcodesizeForLegacyTests(cheats.stopAndReturnStateDiff());
Expand Down

0 comments on commit 1536119

Please sign in to comment.