forked from ethereum/execution-spec-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- move to parameterized calls - combine eof and state tests in one go - change file groupings Signed-off-by: Danno Ferrin <danno@numisight.com>
- Loading branch information
Showing
6 changed files
with
453 additions
and
351 deletions.
There are no files selected for viewing
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
""" | ||
EOF V1 Code Validation tests | ||
""" | ||
|
||
from ethereum_test_tools import ( | ||
Account, | ||
Address, | ||
Environment, | ||
EOFTestFiller, | ||
StateTestFiller, | ||
TestAddress, | ||
Transaction, | ||
) | ||
from ethereum_test_tools.eof.v1 import Container | ||
|
||
|
||
def execute_tests(state_test: StateTestFiller, eof_test: EOFTestFiller, container: Container): | ||
""" | ||
Executes EOF validaiton on the container, and if valid executes the container, checking for | ||
a canary of {0, 1} for successful execution. | ||
""" | ||
eof_test( | ||
data=container, | ||
expect_exception=container.validity_error, | ||
) | ||
|
||
if container.validity_error is None: | ||
env = Environment() | ||
|
||
pre = { | ||
TestAddress: Account( | ||
balance=1000000000000000000000, | ||
nonce=1, | ||
), | ||
Address(0x100): Account( | ||
code=container, | ||
nonce=1, | ||
), | ||
} | ||
|
||
tx = Transaction( | ||
nonce=1, | ||
to=Address(0x100), | ||
gas_limit=44_000, | ||
gas_price=10, | ||
protected=False, | ||
data="1", | ||
) | ||
|
||
post = {Address(0x100): Account(storage={0: 1})} | ||
|
||
state_test( | ||
env=env, | ||
pre=pre, | ||
post=post, | ||
tx=tx, | ||
) | ||
|
||
|
||
def container_name(c: Container): | ||
""" | ||
Return the name of the container for use in pytest ids. | ||
""" | ||
if hasattr(c, "name"): | ||
return c.name | ||
else: | ||
return c.__class__.__name__ |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.