Skip to content

Commit d07a2ff

Browse files
committed
eof: Update semantic tests - removing address from test expectation
1 parent a165382 commit d07a2ff

File tree

14 files changed

+62
-55
lines changed

14 files changed

+62
-55
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
contract C {
22
uint120[3] x;
3-
function f() public returns (bytes32 hash1, bytes32 hash2, bytes32 hash3) {
3+
function f() public returns (bytes32 hash1, bytes32 hash2, bool hash3NonZero) {
44
uint120[] memory y = new uint120[](3);
55
x[0] = y[0] = uint120(type(uint).max - 1);
66
x[1] = y[1] = uint120(type(uint).max - 2);
77
x[2] = y[2] = uint120(type(uint).max - 3);
88
hash1 = keccak256(abi.encodePacked(x));
99
hash2 = keccak256(abi.encodePacked(y));
10-
hash3 = keccak256(abi.encodePacked(this.f));
10+
hash3NonZero = bytes32(0) != keccak256(abi.encodePacked(this.f));
1111
}
1212
}
1313
// ====
1414
// EVMVersion: >=prague
1515
// bytecodeFormat: >=EOFv1
1616
// ----
17-
// f() -> 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, 0x8a1a644bc732d428df88d4952d1be96a9217ec31fdec3f55bae4059f936e955d
17+
// f() -> 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, true

test/libsolidity/semanticTests/errors/eof/errors_by_parameter_type.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ contract C {
2727
require(false, E3(S(1, true, "string literal")));
2828
}
2929
function e() external view {
30-
require(false, E4(address(this)));
30+
require(false, E4(address(0x6AfCA7D4Df015A0Ba25dA0d02D175603a5fB40E6)));
3131
}
32-
function f() external view {
33-
require(false, E5(this.a));
32+
function f(function() external pure x) external view {
33+
require(false, E5(x));
3434
}
3535
}
3636

@@ -43,4 +43,4 @@ contract C {
4343
// c() -> FAILURE, hex"8f372c34", hex"0000000000000000000000000000000000000000000000000000000000000020", hex"000000000000000000000000000000000000000000000000000000000000000e", hex"737472696e67206c69746572616c000000000000000000000000000000000000"
4444
// d() -> FAILURE, hex"5717173e", hex"0000000000000000000000000000000000000000000000000000000000000020", hex"0000000000000000000000000000000000000000000000000000000000000001", hex"0000000000000000000000000000000000000000000000000000000000000001", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"000000000000000000000000000000000000000000000000000000000000000e", hex"737472696e67206c69746572616c000000000000000000000000000000000000"
4545
// e() -> FAILURE, hex"7efef9ea", hex"0000000000000000000000006afca7d4df015a0ba25da0d02d175603a5fb40e6"
46-
// f() -> FAILURE, hex"0c3f12eb", hex"6afca7d4df015a0ba25da0d02d175603a5fb40e60dbe671f0000000000000000"
46+
// f(function): left(0x6afca7d4df015a0ba25da0d02d175603a5fb40e60dbe671f0000000000000000) -> FAILURE, hex"0c3f12eb", hex"6afca7d4df015a0ba25da0d02d175603a5fb40e60dbe671f0000000000000000"

test/libsolidity/semanticTests/errors/eof/require_error_function_pointer_parameter.sol

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@ error CustomError(function(uint256) external pure returns (uint256));
22

33
contract C
44
{
5-
function e(uint256 x) external pure returns (uint256)
6-
{
7-
return x;
8-
}
9-
10-
function f() external view
5+
function f(function(uint256) external pure returns (uint256) x) external view
116
{
127
// more than one stack slot
13-
require(false, CustomError(this.e));
8+
require(false, CustomError(x));
149
}
1510
}
1611

1712
// ====
1813
// EVMVersion: >=prague
1914
// bytecodeFormat: >=EOFv1
2015
// ----
21-
// f() -> FAILURE, hex"271b1dfa", hex"a4dc3b5fce39438ce512c732ccb22e3212856bb6f37cdc8e0000000000000000"
16+
// f(function): left(0xa4dc3b5fce39438ce512c732ccb22e3212856bb6f37cdc8e0000000000000000) -> FAILURE, hex"271b1dfa", hex"a4dc3b5fce39438ce512c732ccb22e3212856bb6f37cdc8e0000000000000000"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
contract C {
22
event Test(function() external indexed);
3-
function f() public {
4-
emit Test(this.f);
3+
function f(function() external x) public {
4+
emit Test(x);
55
}
66
}
77
// ====
88
// EVMVersion: >=prague
99
// bytecodeFormat: >=EOFv1
1010
// ----
11-
// f() ->
11+
// f(function): left(0x8f8cc95dcbe7358c1cf1409d3a7ad079e89576bb26121ff00000000000000000) ->
1212
// ~ emit Test(function): #0x8f8cc95dcbe7358c1cf1409d3a7ad079e89576bb26121ff00000000000000000
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
contract C {
22
event TestA(function() external indexed);
33
event TestB(function(uint256) external indexed);
4-
function f1() public {
5-
emit TestA(this.f1);
4+
function f1(function() external x) public {
5+
emit TestA(x);
66
}
7-
function f2(uint256 a) public {
8-
emit TestB(this.f2);
7+
function f2(function(uint256) external x) public {
8+
emit TestB(x);
99
}
1010
}
1111
// ====
1212
// EVMVersion: >=prague
1313
// bytecodeFormat: >=EOFv1
1414
// ----
15-
// f1() ->
15+
// f1(function): left(0x347eaa94e3f63220b1f27af5888d33325ddbd4dec27fc3050000000000000000) ->
1616
// ~ emit TestA(function): #0x347eaa94e3f63220b1f27af5888d33325ddbd4dec27fc3050000000000000000
17-
// f2(uint256): 1 ->
17+
// f2(function): left(0x347eaa94e3f63220b1f27af5888d33325ddbd4debf3724af0000000000000000) ->
1818
// ~ emit TestB(function): #0x347eaa94e3f63220b1f27af5888d33325ddbd4debf3724af0000000000000000

test/libsolidity/semanticTests/functionCall/eof/failed_create.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ contract D { constructor() payable {} }
22
contract C {
33
uint public x;
44
constructor() payable {}
5-
function f(uint amount) public returns (D) {
5+
function f(uint amount) public returns (bool) {
66
x++;
7-
return (new D){value: amount, salt: bytes32(x)}();
7+
return address((new D){value: amount, salt: bytes32(x)}()) != address(0);
88
}
9-
function stack(uint depth) public payable returns (address) {
9+
function stack(uint depth) public payable returns (bool) {
1010
if (depth > 0)
1111
return this.stack(depth - 1);
1212
else
13-
return address(f(0));
13+
return f(0);
1414
}
1515
}
1616
// ====
@@ -24,7 +24,7 @@ contract C {
2424
// gas legacy code: 215400
2525
// gas legacyOptimized: 61715
2626
// gas legacyOptimized code: 106800
27-
// f(uint256): 20 -> 0x9d73add92c0d464f534262259cf6914e28caceaa
27+
// f(uint256): 20 -> true
2828
// x() -> 1
2929
// f(uint256): 20 -> FAILURE
3030
// x() -> 1
@@ -33,5 +33,5 @@ contract C {
3333
// gas legacy: 477722
3434
// gas legacyOptimized: 299567
3535
// x() -> 1
36-
// stack(uint256): 10 -> 0xb2c409d23d8105ff2553a318f2f73f47c80c7701
36+
// stack(uint256): 10 -> true
3737
// x() -> 2

test/libsolidity/semanticTests/functionTypes/eof/address_member.sol

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ contract C {
55
[this.f.address][0];
66
a2 = [this.f.address][0];
77
}
8+
9+
function checkAddress() public returns (bool) {
10+
address a1;
11+
address a2;
12+
(a1, a2) = f();
13+
return (a1 != address(0) && a1 == a2);
14+
}
815
}
916
// ====
1017
// EVMVersion: >=prague
1118
// bytecodeFormat: >=EOFv1
1219
// ----
13-
// f() -> 0xc19c03f456eb6e9b1d3e41daa69053e44bdbd949, 0xc19c03f456eb6e9b1d3e41daa69053e44bdbd949
20+
// checkAddress() -> true

test/libsolidity/semanticTests/functionTypes/eof/function_external_delete_storage.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ contract C {
2828
// increment() ->
2929
// y() -> 1
3030
// set() ->
31-
// x() -> 0xfc0c3cc95d8d080a1f9ff0a9474a22423d046267d09de08a0000000000000000
3231
// increment() ->
3332
// y() -> 2
3433
// incrementIndirectly() ->
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
contract C {
22
function testFunction() external {}
3-
4-
function testYul() public returns (address adr) {
3+
address contractAddress = address(this);
4+
function testYul() public returns (bool) {
5+
require(contractAddress != address(0));
56
function() external fp = this.testFunction;
67

8+
address adr;
79
assembly {
810
adr := fp.address
911
}
12+
13+
return adr == contractAddress;
1014
}
11-
function testSol() public returns (address) {
12-
return this.testFunction.address;
15+
function testSol() public returns (bool) {
16+
require(contractAddress != address(0));
17+
return this.testFunction.address == contractAddress;
1318
}
1419
}
1520
// ====
1621
// EVMVersion: >=prague
1722
// bytecodeFormat: >=EOFv1
1823
// ----
19-
// testYul() -> 0x0b4a2e943bbeb51ee55e5785a597202569667e7b
20-
// testSol() -> 0x0b4a2e943bbeb51ee55e5785a597202569667e7b
24+
// testYul() -> true
25+
// testSol() -> true

test/libsolidity/semanticTests/isoltestTesting/eof/balance_other_contract.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ contract ClientReceipt {
1313
function getAddress() public returns (address) {
1414
return other.getAddress();
1515
}
16+
function checkBalance() public returns (bool) {
17+
return getAddress().balance == 500;
18+
}
1619
}
1720
// ====
1821
// bytecodeFormat: >=EOFv1
@@ -29,5 +32,4 @@ contract ClientReceipt {
2932
// gas irOptimized: 191881
3033
// gas legacy: 235167
3134
// gas legacyOptimized: 180756
32-
// getAddress() -> 0x50485c9a7aea973bd309d1bac29c57eeea7e155e
33-
// balance: 0x50485c9a7aea973bd309d1bac29c57eeea7e155e -> 500
35+
// checkBalance() -> true

0 commit comments

Comments
 (0)