Skip to content

Commit

Permalink
reviewer comments
Browse files Browse the repository at this point in the history
- 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
shemnon committed May 3, 2024
1 parent c9fd78d commit 3b8caa6
Show file tree
Hide file tree
Showing 6 changed files with 453 additions and 351 deletions.
244 changes: 0 additions & 244 deletions tests/prague/eip6206_jumpf/contracts.py

This file was deleted.

67 changes: 67 additions & 0 deletions tests/prague/eip6206_jumpf/helpers.py
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__
56 changes: 0 additions & 56 deletions tests/prague/eip6206_jumpf/test_code_validation.py

This file was deleted.

Loading

0 comments on commit 3b8caa6

Please sign in to comment.