Skip to content

Commit

Permalink
eof: Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Jan 27, 2025
1 parent d07a2ff commit 7edff9d
Show file tree
Hide file tree
Showing 43 changed files with 146 additions and 301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ contract C {
}
}
// ====
// EVMVersion: >=prague
// bytecodeFormat: >=EOFv1
// ----
// f() -> 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, 0xba4f20407251e4607cd66b90bfea19ec6971699c03e4a4f3ea737d5818ac27ae, true
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ contract B4 { constructor() {} }
contract C {
function createWithValue(bytes memory c, uint256 value) public payable returns (bool) {
uint256 y = 0;
// TODO: This test is hard to recreate for EOF as for now eofcreate is disallowed in inline assembly.
assembly { y := create(value, add(c, 0x20), mload(c)) }
return y != 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,5 @@ contract C {
}
// ====
// bytecodeFormat: >=EOFv1
// 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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
function longdata(S memory) pure returns (bytes memory) {
return
"xasopca.pngaibngidak.jbtnudak.cAP.BRRSMCPJAGPD KIAJDOMHUKR,SCPID"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
library L {
function longdata() pure internal returns (bytes memory) {
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
==== Source: mod.sol ====
function longdata() pure returns (bytes memory) {
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
abstract contract S {
function longdata() internal pure returns (bytes memory) {
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
contract A {
function longdata() pure external returns (bytes memory) {
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
abstract contract S {
function longdata() internal pure returns (bytes memory) {
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
abstract contract S {
function longdata() internal virtual pure returns (bytes memory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ contract C {
}

// ====
// EVMVersion: >=prague
// bytecodeFormat: >=EOFv1
// ----
// a() -> FAILURE, hex"92bbf6e8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ contract C
}

// ====
// EVMVersion: >=prague
// bytecodeFormat: >=EOFv1
// ----
// f(function): left(0xa4dc3b5fce39438ce512c732ccb22e3212856bb6f37cdc8e0000000000000000) -> FAILURE, hex"271b1dfa", hex"a4dc3b5fce39438ce512c732ccb22e3212856bb6f37cdc8e0000000000000000"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ contract C {
}
}
// ====
// EVMVersion: >=prague
// bytecodeFormat: >=EOFv1
// ----
// f(function): left(0x8f8cc95dcbe7358c1cf1409d3a7ad079e89576bb26121ff00000000000000000) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ contract C {
}
}
// ====
// EVMVersion: >=prague
// bytecodeFormat: >=EOFv1
// ----
// f1(function): left(0x347eaa94e3f63220b1f27af5888d33325ddbd4dec27fc3050000000000000000) ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TODO: Implement this test for EOF. Now it's not possible because deployed contract address depends on contact bytecode.
// This means that the address changes when optimisations are applied.
contract D {
event Deposit(address indexed _from, bytes32 indexed _id, uint _value);
function deposit(bytes32 _id) public payable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ contract DepositContract is IDepositContract, ERC165 {
ret[7] = bytesValue[0];
}
}
// ====
// bytecodeFormat: legacy
// ----
// constructor()
// gas irOptimized: 809570
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,7 @@ contract Test {
/// testMul() -> true
//
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: >=EOFv1
// EVMVersion: >=prague
// ----
// library: Pairing
// f() -> true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
contract C {
function f(uint x) external payable returns (uint) { return 1; }
function f(uint x, uint y) external payable returns (uint) { return 2; }
function call() public payable returns (uint v, uint x, uint y, uint z) {
v = this.f{value: 10}(2);
x = this.f(2, 3);
function call() public payable returns (uint x, uint y) {
x = this.f{value: 10}(2);
y = this.f{value: 10}(2, 3);
z = this.f{value: 10}(2, 3);
}
function bal() external returns (uint) { return address(this).balance; }
receive() external payable {}
Expand All @@ -14,5 +12,5 @@ contract C {
// bytecodeFormat: >=EOFv1
// ----
// (), 1 ether
// call() -> 1, 2, 2, 2
// call() -> 1, 2
// bal() -> 1000000000000000000
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// TODO: This test should fail on calling a function which pointer was never initialized but for EOF it's impossible to check that
// there is non-empty code under an address. This should be fixed in with `ISCONTRACT` opcode or any other solution.
abstract contract D {
function g() public virtual;
}


contract C {
D d = D(address(0x1212));

function f() public returns (uint256) {
d.g();
return 7;
}

function h() public returns (uint256) {
address(d).call(""); // this does not throw (low-level)
return 7;
}
}
// ====
// bytecodeFormat: >=EOFv1
// ----
// f() -> 7
// h() -> 7
Loading

0 comments on commit 7edff9d

Please sign in to comment.