-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for proxy calls to execution tracer + tests
- Loading branch information
Showing
5 changed files
with
70 additions
and
44 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
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
28 changes: 28 additions & 0 deletions
28
fuzzing/testdata/contracts/execution_tracing/proxy_call.sol
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,28 @@ | ||
// This contract ensures the fuzzer's execution tracing can trace proxy calls appropriately. | ||
contract InnerDeploymentContract { | ||
uint x; | ||
uint y; | ||
function setXY(uint _x, uint _y, string memory s) public payable { | ||
x = _x; | ||
y = _y; | ||
} | ||
} | ||
|
||
contract TestContract { | ||
uint x; | ||
uint y; | ||
InnerDeploymentContract i; | ||
|
||
constructor() public { | ||
i = new InnerDeploymentContract(); | ||
} | ||
|
||
function testDelegateCall() public returns (address) { | ||
// Perform a delegate call to set our variables in this contract. | ||
(bool success, bytes memory data) = address(i).delegatecall(abi.encodeWithSignature("setXY(uint256,uint256,string)", 123, 321, "Hello from proxy call args!")); | ||
|
||
// Trigger an assertion failure (ending the test), if data was set successfully. | ||
// If we don't hit this assertion failure, something is wrong. | ||
assert(!(x == 123 && y == 321)); | ||
} | ||
} |