-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cheatcodes): Include calls to create2 factory in state diff recor…
…ding
- Loading branch information
Showing
3 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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,33 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity 0.8.18; | ||
|
||
import "ds-test/test.sol"; | ||
import "../cheats/Vm.sol"; | ||
|
||
contract Box { | ||
uint256 public number; | ||
|
||
constructor (uint _number) { | ||
number = _number; | ||
} | ||
} | ||
|
||
// https://github.com/foundry-rs/foundry/issues/6634 | ||
contract Issue6634Test is DSTest { | ||
Vm constant vm = Vm(HEVM_ADDRESS); | ||
|
||
function test() public { | ||
address CREATE2_DEPLOYER = 0x4e59b44847b379578588920cA78FbF26c0B4956C; | ||
|
||
vm.startStateDiffRecording(); | ||
Box a = new Box{salt: 0}(1); | ||
|
||
Vm.AccountAccess[] memory called = vm.stopAndReturnStateDiff(); | ||
assertEq(called.length, 2, "incorrect length"); | ||
assertEq(uint(called[0].kind), uint(Vm.AccountAccessKind.Call), "first AccountAccess is incorrect kind"); | ||
assertEq(called[0].account, CREATE2_DEPLOYER, "first AccountAccess accout is incorrect"); | ||
assertEq(uint(called[1].kind), uint(Vm.AccountAccessKind.Create), "second AccountAccess is incorrect kind"); | ||
assertEq(called[1].accessor, CREATE2_DEPLOYER, "second AccountAccess accessor is incorrect"); | ||
assertEq(called[1].account, address(a), "first AccountAccess accout is incorrect"); | ||
} | ||
} |