File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,16 @@ interface VmSafe {
2222 RecurrentPrank
2323 }
2424
25+ enum AccountAccessKind {
26+ Call,
27+ DelegateCall,
28+ CallCode,
29+ StaticCall,
30+ Create,
31+ SelfDestruct,
32+ Resume
33+ }
34+
2535 struct Log {
2636 bytes32 [] topics;
2737 bytes data;
@@ -76,6 +86,35 @@ interface VmSafe {
7686 bytes stderr;
7787 }
7888
89+ struct ChainInfo {
90+ uint256 forkId;
91+ uint256 chainId;
92+ }
93+
94+ struct AccountAccess {
95+ ChainInfo chainInfo;
96+ AccountAccessKind kind;
97+ address account;
98+ address accessor;
99+ bool initialized;
100+ uint256 oldBalance;
101+ uint256 newBalance;
102+ bytes deployedCode;
103+ uint256 value;
104+ bytes data;
105+ bool reverted;
106+ StorageAccess[] storageAccesses;
107+ }
108+
109+ struct StorageAccess {
110+ address account;
111+ bytes32 slot;
112+ bool isWrite;
113+ bytes32 previousValue;
114+ bytes32 newValue;
115+ bool reverted;
116+ }
117+
79118 // ======== EVM ========
80119
81120 // Gets the address for a given private key
@@ -98,6 +137,13 @@ interface VmSafe {
98137 // Gets all accessed reads and write slot from a `vm.record` session, for a given address
99138 function accesses (address target ) external returns (bytes32 [] memory readSlots , bytes32 [] memory writeSlots );
100139
140+ // Record all account accesses as part of CREATE, CALL or SELFDESTRUCT opcodes in order,
141+ // along with the context of the calls.
142+ function startStateDiffRecording () external ;
143+
144+ // Returns an ordered array of all account accesses from a `vm.startStateDiffRecording` session.
145+ function stopAndReturnStateDiff () external returns (AccountAccess[] memory accountAccesses );
146+
101147 // -------- Recording Map Writes --------
102148
103149 // Starts recording all map SSTOREs for later retrieval.
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ contract VmTest is Test {
99 // inadvertently moved between Vm and VmSafe. This test must be updated each time a function is
1010 // added to or removed from Vm or VmSafe.
1111 function test_interfaceId () public {
12- assertEq (type (VmSafe).interfaceId, bytes4 (0x1578a242 ), "VmSafe " );
12+ assertEq (type (VmSafe).interfaceId, bytes4 (0x7006b885 ), "VmSafe " );
1313 assertEq (type (Vm).interfaceId, bytes4 (0x316cedc3 ), "Vm " );
1414 }
1515}
You can’t perform that action at this time.
0 commit comments