Skip to content

Commit

Permalink
fix: fuzz test failure on create address (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec authored May 10, 2024
1 parent e92ea5e commit 01f61ff
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions zk-tests/src/Cheatcodes.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ interface IMyProxyCaller {
}

contract MyProxyCaller {
function transact(address inner) public {
address inner;
constructor(address _inner) {
inner = _inner;
}

function transact() public {
IMyProxyCaller(inner).transact(10);
}
}
Expand Down Expand Up @@ -157,15 +162,15 @@ contract ZkCheatcodesTest is Test {

function testZkCheatcodesCanMockCallTestContract() public {
address thisAddress = address(this);
MyProxyCaller transactor = new MyProxyCaller(thisAddress);

vm.mockCall(
thisAddress,
abi.encodeWithSelector(IMyProxyCaller.transact.selector),
abi.encode()
);

MyProxyCaller transactor = new MyProxyCaller();
transactor.transact(thisAddress);
transactor.transact();
}

function testZkCheatcodesCanMockCall(address mockMe) public {
Expand All @@ -174,13 +179,14 @@ contract ZkCheatcodesTest is Test {
//zkVM currently doesn't support mocking the transaction sender
vm.assume(mockMe != tx.origin);

MyProxyCaller transactor = new MyProxyCaller(mockMe);

vm.mockCall(
mockMe,
abi.encodeWithSelector(IMyProxyCaller.transact.selector),
abi.encode()
);

MyProxyCaller transactor = new MyProxyCaller();
transactor.transact(mockMe);
transactor.transact();
}
}

0 comments on commit 01f61ff

Please sign in to comment.