-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Update semantic tests for EOF
- Loading branch information
Showing
98 changed files
with
12,041 additions
and
29 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
5,191 changes: 5,191 additions & 0 deletions
5,191
test/libsolidity/semanticTests/UniswapV3Flattened.sol
Large diffs are not rendered by default.
Oops, something went wrong.
5,191 changes: 5,191 additions & 0 deletions
5,191
test/libsolidity/semanticTests/UniswapV3Flattened_eof.sol
Large diffs are not rendered by default.
Oops, something went wrong.
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
17 changes: 17 additions & 0 deletions
17
test/libsolidity/semanticTests/builtinFunctions/keccak256_packed_complex_types_eof.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,17 @@ | ||
contract C { | ||
uint120[3] x; | ||
function f() public returns (bytes32 hash1, bytes32 hash2, bytes32 hash3) { | ||
uint120[] memory y = new uint120[](3); | ||
x[0] = y[0] = uint120(type(uint).max - 1); | ||
x[1] = y[1] = uint120(type(uint).max - 2); | ||
x[2] = y[2] = uint120(type(uint).max - 3); | ||
hash1 = keccak256(abi.encodePacked(x)); | ||
hash2 = keccak256(abi.encodePacked(y)); | ||
hash3 = keccak256(abi.encodePacked(this.f)); | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: true | ||
// EVMVersion: >=prague | ||
// ---- | ||
// f() -> 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, 0xb8fcf925e706038045e8e57a2620706dfa046b8977add2f3c9b2641f2ea6c8b7 |
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
test/libsolidity/semanticTests/constructor/no_callvalue_check_eof.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 @@ | ||
contract A1 {} | ||
contract B1 is A1 { constructor() payable {} } | ||
|
||
contract A2 { constructor() {} } | ||
contract B2 is A2 { constructor() payable {} } | ||
|
||
contract B3 { constructor() payable {} } | ||
|
||
contract C { | ||
function f() public payable returns (bool) { | ||
// Make sure none of these revert. | ||
new B1{value: 10, salt: hex"00"}(); | ||
new B2{value: 10, salt: hex"01"}(); | ||
new B3{value: 10, salt: hex"02"}(); | ||
return true; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: true | ||
// EVMVersion: >=prague | ||
// ---- | ||
// f(), 2000 ether -> true | ||
// gas irOptimized: 117623 | ||
// gas irOptimized code: 1800 | ||
// gas legacy: 117821 | ||
// gas legacy code: 4800 | ||
// gas legacyOptimized: 117690 | ||
// gas legacyOptimized code: 4800 |
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 |
---|---|---|
|
@@ -36,5 +36,7 @@ contract C { | |
return x < data.length; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: false | ||
// ---- | ||
// test() -> true |
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 |
---|---|---|
|
@@ -30,5 +30,7 @@ contract C { | |
return x < data.length; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: false | ||
// ---- | ||
// test() -> true |
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 |
---|---|---|
|
@@ -32,5 +32,7 @@ contract C { | |
return x < data.length; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: false | ||
// ---- | ||
// test() -> true |
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 |
---|---|---|
|
@@ -31,5 +31,7 @@ contract C is S { | |
return x < data.length; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: false | ||
// ---- | ||
// test() -> true |
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 |
---|---|---|
|
@@ -37,5 +37,7 @@ contract C { | |
x < 2 * type(A).creationCode.length; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: false | ||
// ---- | ||
// test() -> true |
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 |
---|---|---|
|
@@ -31,5 +31,7 @@ contract C is S { | |
return x < data.length; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: false | ||
// ---- | ||
// test() -> true |
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 |
---|---|---|
|
@@ -35,5 +35,7 @@ contract C is X { | |
return x < data.length; | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: false | ||
// ---- | ||
// test() -> true |
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
46 changes: 46 additions & 0 deletions
46
test/libsolidity/semanticTests/errors/errors_by_parameter_type_eof.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,46 @@ | ||
pragma abicoder v2; | ||
|
||
struct S { | ||
uint256 a; | ||
bool b; | ||
string s; | ||
} | ||
|
||
error E(); | ||
error E1(uint256); | ||
error E2(string); | ||
error E3(S); | ||
error E4(address); | ||
error E5(function() external pure); | ||
|
||
contract C { | ||
function a() external pure { | ||
require(false, E()); | ||
} | ||
function b() external pure { | ||
require(false, E1(1)); | ||
} | ||
function c() external pure { | ||
require(false, E2("string literal")); | ||
} | ||
function d() external pure { | ||
require(false, E3(S(1, true, "string literal"))); | ||
} | ||
function e() external view { | ||
require(false, E4(address(this))); | ||
} | ||
function f() external view { | ||
require(false, E5(this.a)); | ||
} | ||
} | ||
|
||
// ==== | ||
// compileToEOF: true | ||
// EVMVersion: >=prague | ||
// ---- | ||
// a() -> FAILURE, hex"92bbf6e8" | ||
// b() -> FAILURE, hex"47e26897", hex"0000000000000000000000000000000000000000000000000000000000000001" | ||
// c() -> FAILURE, hex"8f372c34", hex"0000000000000000000000000000000000000000000000000000000000000020", hex"000000000000000000000000000000000000000000000000000000000000000e", hex"737472696e67206c69746572616c000000000000000000000000000000000000" | ||
// d() -> FAILURE, hex"5717173e", hex"0000000000000000000000000000000000000000000000000000000000000020", hex"0000000000000000000000000000000000000000000000000000000000000001", hex"0000000000000000000000000000000000000000000000000000000000000001", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"000000000000000000000000000000000000000000000000000000000000000e", hex"737472696e67206c69746572616c000000000000000000000000000000000000" | ||
// e() -> FAILURE, hex"7efef9ea", hex"0000000000000000000000008e3f661b8facaa0fa7aa0113847501029db6517e" | ||
// f() -> FAILURE, hex"0c3f12eb", hex"8e3f661b8facaa0fa7aa0113847501029db6517e0dbe671f0000000000000000" |
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
21 changes: 21 additions & 0 deletions
21
test/libsolidity/semanticTests/errors/require_error_function_pointer_parameter_eof.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,21 @@ | ||
error CustomError(function(uint256) external pure returns (uint256)); | ||
|
||
contract C | ||
{ | ||
function e(uint256 x) external pure returns (uint256) | ||
{ | ||
return x; | ||
} | ||
|
||
function f() external view | ||
{ | ||
// more than one stack slot | ||
require(false, CustomError(this.e)); | ||
} | ||
} | ||
|
||
// ==== | ||
// compileToEOF: true | ||
// EVMVersion: >=prague | ||
// ---- | ||
// f() -> FAILURE, hex"271b1dfa", hex"dfc163ea0fefc2097b7425134f69fcafa3742b0af37cdc8e0000000000000000" |
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
test/libsolidity/semanticTests/events/event_emit_from_other_contract_eof.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 @@ | ||
contract D { | ||
event Deposit(address indexed _from, bytes32 indexed _id, uint _value); | ||
function deposit(bytes32 _id) public payable { | ||
emit Deposit(msg.sender, _id, msg.value); | ||
} | ||
} | ||
contract C { | ||
D d; | ||
constructor() { | ||
d = new D(); | ||
} | ||
function deposit(bytes32 _id) public payable { | ||
d.deposit(_id); | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: true | ||
// EVMVersion: >=prague | ||
// ---- | ||
// constructor() -> | ||
// gas irOptimized: 113970 | ||
// gas irOptimized code: 51400 | ||
// gas legacy: 119776 | ||
// gas legacy code: 125000 | ||
// gas legacyOptimized: 114187 | ||
// gas legacyOptimized code: 57400 | ||
// deposit(bytes32), 18 wei: 0x1234 -> | ||
// ~ emit Deposit(address,bytes32,uint256) from 0x32b73100436177e8f2d2aa1214bb4c1230143ec2: #0x3cb69f8aa1103d7ce41821a1b2e1c85c2b63dfa4, #0x1234, 0x00 |
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
18 changes: 18 additions & 0 deletions
18
test/libsolidity/semanticTests/events/event_indexed_function2_eof.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,18 @@ | ||
contract C { | ||
event TestA(function() external indexed); | ||
event TestB(function(uint256) external indexed); | ||
function f1() public { | ||
emit TestA(this.f1); | ||
} | ||
function f2(uint256 a) public { | ||
emit TestB(this.f2); | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: true | ||
// EVMVersion: >=prague | ||
// ---- | ||
// f1() -> | ||
// ~ emit TestA(function): #0xa80a5d214a51e09e24fa3e854004da1ac3f5beffc27fc3050000000000000000 | ||
// f2(uint256): 1 -> | ||
// ~ emit TestB(function): #0xa80a5d214a51e09e24fa3e854004da1ac3f5beffbf3724af0000000000000000 |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/semanticTests/events/event_indexed_function_eof.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,12 @@ | ||
contract C { | ||
event Test(function() external indexed); | ||
function f() public { | ||
emit Test(this.f); | ||
} | ||
} | ||
// ==== | ||
// compileToEOF: true | ||
// EVMVersion: >=prague | ||
// ---- | ||
// f() -> | ||
// ~ emit Test(function): #0x1141c91a4a817b60b5339bc09ac809cedc7649ab26121ff00000000000000000 |
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
Oops, something went wrong.