-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests covering EOFCREATE and RETURNDATA, ported from evmone Signed-off-by: Danno Ferrin <danno@numisight.com>
- Loading branch information
Showing
13 changed files
with
1,147 additions
and
10 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
EOFCREATE, RETURNCONTRACT, and container tests | ||
tests.prague.eip7480_data_section.test_data_opcodes.test_data_section_succeed | ||
evmone tests not ported | ||
create_tx_with_eof_initcode - This calls it invalid, it is now the way to add EOF contacts to state | ||
eofcreate_extcall_returncontract - per the new initcode mode tests you cannot have RETURNCONTRACT | ||
in a deployed contract | ||
eofcreate_dataloadn_referring_to_auxdata - covered by | ||
tests.prague.eip7480_data_section.test_data_opcodes.test_data_section_succeed | ||
eofcreate_initcontainer_return - RETURN is banned in initcode containers | ||
eofcreate_initcontainer_stop - STOP is banned in initcode containers | ||
All TXCREATE tests - TXCREATE has been removed from Prague | ||
""" |
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,67 @@ | ||
""" | ||
A collection of contracts used in 7620 EOF tests | ||
""" | ||
from ethereum_test_tools import Address | ||
from ethereum_test_tools import Opcodes as Op | ||
from ethereum_test_tools import Transaction | ||
from ethereum_test_tools.eof.v1 import Container, Section | ||
from ethereum_test_tools.eof.v1.constants import NON_RETURNING_SECTION | ||
|
||
smallest_runtime_subcontainer = Container( | ||
name="Runtime Subcontainer", | ||
sections=[ | ||
Section.Code( | ||
code=Op.STOP, code_inputs=0, code_outputs=NON_RETURNING_SECTION, max_stack_height=0 | ||
) | ||
], | ||
) | ||
|
||
smallest_initcode_subcontainer = Container( | ||
name="Initcode Subcontainer", | ||
sections=[ | ||
Section.Code( | ||
code=Op.RETURNCONTRACT[0](0, 0), | ||
code_inputs=0, | ||
code_outputs=NON_RETURNING_SECTION, | ||
max_stack_height=2, | ||
), | ||
Section.Container(container=smallest_runtime_subcontainer), | ||
], | ||
) | ||
|
||
|
||
def fixed_address(index: int) -> Address: | ||
""" | ||
Returns an determinstic address for testing | ||
Parameters | ||
---------- | ||
index - how foar off of the initial to create the address | ||
Returns | ||
------- | ||
An address, unique per index and human friendly for testing | ||
""" | ||
return Address(0x7E570000 + index) | ||
|
||
|
||
default_address = fixed_address(0) | ||
|
||
|
||
def simple_transaction( | ||
target: Address = default_address, payload: bytes = b"", gas_limit: int = 10_000_000 | ||
): | ||
""" | ||
Creates a simple transaction | ||
Parameters | ||
---------- | ||
target the target address, defaults to 0x100 | ||
payload the payload, defauls to empty | ||
Returns | ||
------- | ||
a transaction instance that can be passed into state_tests | ||
""" | ||
return Transaction( | ||
nonce=1, to=target, gas_limit=gas_limit, gas_price=10, protected=False, data=payload | ||
) |
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,5 @@ | ||
""" | ||
EOF V1 Constants used throughout all tests | ||
""" | ||
|
||
EOF_FORK_NAME = "Prague" |
Oops, something went wrong.