Skip to content

Commit

Permalink
chore(tests): EIP-7702: update auth.chainid in set code txs to u256 (#…
Browse files Browse the repository at this point in the history
…1026)

* chore(tests): update chainid in 7702 set code txs to u256

* refactor(tests): rename `MAX_CHAIN_ID` to `MAX_AUTH_CHAIN_ID`

* refactor(tests): rename chain_id to auth_chain_id
  • Loading branch information
danceratopz authored Dec 20, 2024
1 parent 49c766f commit 1bdec80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/prague/eip7702_set_code_tx/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Spec:
DELEGATION_DESIGNATION_READING = Bytes("ef01")
RESET_DELEGATION_ADDRESS = Address(0)

MAX_CHAIN_ID = 2**64 - 1
MAX_AUTH_CHAIN_ID = 2**256 - 1
MAX_NONCE = 2**64 - 1

@staticmethod
Expand Down
11 changes: 5 additions & 6 deletions tests/prague/eip7702_set_code_tx/test_invalid_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ def test_invalid_auth_signature(


@pytest.mark.parametrize(
"chain_id",
"auth_chain_id",
[
pytest.param(Spec.MAX_CHAIN_ID + 1, id="chain_id=2**64"),
pytest.param(2**256, id="chain_id=2**256"),
pytest.param(Spec.MAX_AUTH_CHAIN_ID + 1, id="auth_chain_id=2**256"),
],
)
@pytest.mark.parametrize(
Expand All @@ -115,10 +114,10 @@ def test_invalid_auth_signature(
pytest.param(Address(1), id="non_zero_address"),
],
)
def test_invalid_tx_invalid_chain_id(
def test_invalid_tx_invalid_auth_chain_id(
transaction_test: TransactionTestFiller,
pre: Alloc,
chain_id: int,
auth_chain_id: int,
delegate_address: Address,
):
"""
Expand All @@ -128,7 +127,7 @@ def test_invalid_tx_invalid_chain_id(
authorization = AuthorizationTuple(
address=delegate_address,
nonce=0,
chain_id=chain_id,
chain_id=auth_chain_id,
signer=pre.fund_eoa(auth_account_start_balance),
)

Expand Down
8 changes: 4 additions & 4 deletions tests/prague/eip7702_set_code_tx/test_set_code_txs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2274,16 +2274,16 @@ def test_signature_s_out_of_range(


@pytest.mark.parametrize(
"chain_id",
"auth_chain_id",
[
pytest.param(Spec.MAX_CHAIN_ID, id="chain_id=2**64-1"),
pytest.param(Spec.MAX_AUTH_CHAIN_ID, id="auth_chain_id=2**256-1"),
pytest.param(2, id="chain_id=2"),
],
)
def test_valid_tx_invalid_chain_id(
state_test: StateTestFiller,
pre: Alloc,
chain_id: int,
auth_chain_id: int,
):
"""
Test sending a transaction where the chain id field does not match the current chain's id.
Expand All @@ -2299,7 +2299,7 @@ def test_valid_tx_invalid_chain_id(
authorization = AuthorizationTuple(
address=set_code_to_address,
nonce=0,
chain_id=chain_id,
chain_id=auth_chain_id,
signer=auth_signer,
)

Expand Down

0 comments on commit 1bdec80

Please sign in to comment.