Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mario Vega <[email protected]>
  • Loading branch information
pdobacz and marioevz committed Sep 26, 2024
1 parent dca580c commit d91b5d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
23 changes: 4 additions & 19 deletions tests/prague/eip7692_eof_v1/eip7069_extcall/test_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import pytest

from ethereum_test_base_types.conversions import to_fixed_size_bytes
from ethereum_test_tools import (
EOA,
Account,
Expand Down Expand Up @@ -96,7 +95,6 @@ def test_legacy_calls_eof_sstore(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = Storage(
Expand Down Expand Up @@ -169,7 +167,6 @@ def test_legacy_calls_eof_mstore(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -225,7 +222,6 @@ def test_eof_calls_eof_sstore(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = Storage(
Expand Down Expand Up @@ -299,7 +295,6 @@ def test_eof_calls_eof_mstore(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -365,7 +360,6 @@ def test_eof_calls_precompile(
sender=sender,
to=Address(calling_contract_address),
gas_limit=5000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -421,7 +415,6 @@ def test_eof_calls_legacy_sstore(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -489,7 +482,6 @@ def test_eof_calls_legacy_mstore(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -565,7 +557,6 @@ def test_callee_fails(
sender=sender,
to=Address(calling_contract_address),
gas_limit=4000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -637,20 +628,20 @@ def test_callee_context(
sender=sender,
to=Address(calling_contract_address),
gas_limit=100000,
data="",
value=tx_value,
)

expected_bytes: Address | int
if expected_result == "destination":
expected_bytes: bytes = destination_contract_address
expected_bytes = destination_contract_address
elif expected_result == "caller":
expected_bytes = calling_contract_address
elif expected_result == "sender":
expected_bytes = sender
elif expected_result == "tx_value":
expected_bytes = to_fixed_size_bytes(tx_value, 32)
expected_bytes = tx_value
elif isinstance(expected_result, int):
expected_bytes = to_fixed_size_bytes(expected_result, 32)
expected_bytes = expected_result
else:
raise TypeError("Unexpected expected_result", expected_result)

Expand Down Expand Up @@ -704,7 +695,6 @@ def test_eof_calls_eof_then_fails(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

post = {
Expand Down Expand Up @@ -795,7 +785,6 @@ def test_eof_calls_clear_return_buffer(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -856,7 +845,6 @@ def test_eof_calls_static_flag_with_value(
sender=sender,
to=Address(calling_contract_address),
gas_limit=5_000_000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -954,7 +942,6 @@ def test_eof_calls_min_callee_gas(
sender=sender,
to=Address(calling_contract_address),
gas_limit=no_oog_gas + extra_gas_limit,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -1001,7 +988,6 @@ def test_eof_calls_with_value(
sender=sender,
to=Address(calling_contract_address),
gas_limit=50000000,
data="",
)

calling_storage = {
Expand Down Expand Up @@ -1098,7 +1084,6 @@ def test_eof_calls_msg_depth(
sender=sender,
to=Address(calling_contract_address),
gas_limit=gas_limit,
data="",
)

calling_storage = {
Expand Down
11 changes: 5 additions & 6 deletions tests/prague/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from ethereum_test_base_types.conversions import to_fixed_size_bytes
from ethereum_test_base_types.base_types import Address
from ethereum_test_exceptions import EOFException
from ethereum_test_specs import EOFTestFiller
from ethereum_test_tools import (
Expand Down Expand Up @@ -638,18 +638,17 @@ def test_eofcreate_context(

destination_contract_address = compute_eofcreate_address(calling_contract_address, 0, initcode)

tx = Transaction(
sender=sender, to=calling_contract_address, gas_limit=1000000, data="", value=value
)
tx = Transaction(sender=sender, to=calling_contract_address, gas_limit=1000000, value=value)

expected_bytes: Address | int
if expected_result == "destination":
expected_bytes: bytes = destination_contract_address
expected_bytes = destination_contract_address
elif expected_result == "caller":
expected_bytes = calling_contract_address
elif expected_result == "sender":
expected_bytes = sender
elif expected_result == "eofcreate_value":
expected_bytes = to_fixed_size_bytes(eofcreate_value, 32)
expected_bytes = eofcreate_value
else:
raise TypeError("Unexpected expected_result", expected_result)

Expand Down

0 comments on commit d91b5d3

Please sign in to comment.