@@ -3,6 +3,7 @@ pragma solidity ^0.8.18;
3
3
4
4
import "ds-test/test.sol " ;
5
5
import "cheats/Vm.sol " ;
6
+ import "../logs/console.sol " ;
6
7
7
8
/// @notice Helper contract with a construction that makes a call to itself then
8
9
/// optionally reverts if zero-length data is passed
@@ -261,6 +262,11 @@ contract RecordAccountAccessesTest is DSTest {
261
262
two.write (bytes32 (uint256 (5678 )), bytes32 (uint256 (123469 )));
262
263
two.write (bytes32 (uint256 (5678 )), bytes32 (uint256 (1234 )));
263
264
265
+ string memory diffs = cheats.getStateDiff ();
266
+ assertEq (
267
+ "0x5991A2dF15A8F6A256D3Ec51E99254Cd3fb576A9:\n@ 1235: 0x0000000000000000000000000000000000000000000000000000000000000000 -> 0x000000000000000000000000000000000000000000000000000000000000162e\n0xc7183455a4C133Ae270771860664b6B7ec320bB1:\n@ 5678: 0x0000000000000000000000000000000000000000000000000000000000000000 -> 0x00000000000000000000000000000000000000000000000000000000000004d2\n " ,
268
+ diffs
269
+ );
264
270
Vm.AccountAccess[] memory called = filterExtcodesizeForLegacyTests (cheats.stopAndReturnStateDiff ());
265
271
assertEq (called.length , 4 , "incorrect length " );
266
272
@@ -332,6 +338,7 @@ contract RecordAccountAccessesTest is DSTest {
332
338
// contract calls to self in constructor
333
339
SelfCaller caller = new SelfCaller {value: 2 ether }("hello2 world2 " );
334
340
341
+ assertEq ("" , cheats.getStateDiff ());
335
342
Vm.AccountAccess[] memory called = filterExtcodesizeForLegacyTests (cheats.stopAndReturnStateDiff ());
336
343
assertEq (called.length , 6 );
337
344
assertEq (
@@ -451,6 +458,7 @@ contract RecordAccountAccessesTest is DSTest {
451
458
uint256 initBalance = address (this ).balance;
452
459
cheats.startStateDiffRecording ();
453
460
try this .revertingCall {value: 1 ether }(address (1234 ), "" ) {} catch {}
461
+ assertEq ("" , cheats.getStateDiff ());
454
462
Vm.AccountAccess[] memory called = filterExtcodesizeForLegacyTests (cheats.stopAndReturnStateDiff ());
455
463
assertEq (called.length , 2 );
456
464
assertEq (
@@ -768,6 +776,11 @@ contract RecordAccountAccessesTest is DSTest {
768
776
function testNestedStorage () public {
769
777
cheats.startStateDiffRecording ();
770
778
nestedStorer.run ();
779
+ cheats.label (address (nestedStorer), "NestedStorer " );
780
+ assertEq (
781
+ "NestedStorer:\n@ 31391530734884398925509096751136955997235046655136458338700630915422204365175: 0x0000000000000000000000000000000000000000000000000000000000000000 -> 0x0000000000000000000000000000000000000000000000000000000000000001\n@ 86546418208203448386783321347074308435724792809315873744194221534962779865098: 0x0000000000000000000000000000000000000000000000000000000000000000 -> 0x0000000000000000000000000000000000000000000000000000000000000001\n@ 89735575844917174604881245405098157398514761457822262993733937076486162048205: 0x0000000000000000000000000000000000000000000000000000000000000000 -> 0x0000000000000000000000000000000000000000000000000000000000000001\n@ 99655811014363889343382125167956395016210879868288374279890486979400290732814: 0x0000000000000000000000000000000000000000000000000000000000000000 -> 0x0000000000000000000000000000000000000000000000000000000000000001\n " ,
782
+ cheats.getStateDiff ()
783
+ );
771
784
Vm.AccountAccess[] memory called = filterExtcodesizeForLegacyTests (cheats.stopAndReturnStateDiff ());
772
785
assertEq (called.length , 3 , "incorrect account access length " );
773
786
0 commit comments