Skip to content

test(eth): cover accessList formatter on type 1, 2 and 4 transactions#3845

Open
genisis0x wants to merge 1 commit into
ApeWorX:mainfrom
genisis0x:feat/3707-access-list-tx-tests
Open

test(eth): cover accessList formatter on type 1, 2 and 4 transactions#3845
genisis0x wants to merge 1 commit into
ApeWorX:mainfrom
genisis0x:feat/3707-access-list-tx-tests

Conversation

@genisis0x
Copy link
Copy Markdown

What

Closes #3707.

Issue #3707 flags that the transaction-param formatters lack direct tests for several accessList combinations the wire format actually allows. Add three focused cases (with async + sync mirrors) that exercise the eth_sendTransaction and eth_sendRawTransaction paths together.

New test Tx type Path Pins
test_(async_)eth_send_raw_transaction_type_1_access_list EIP-2930 (type 1) eth_sendRawTransaction gasPrice + accessList, no max-fee fields; the round-tripped tx reports type == 1 and preserves the access-list entries
test_(async_)eth_send_transaction_type_2_access_list EIP-1559 (type 2) eth_sendTransaction maxFeePerGas + maxPriorityFeePerGas + accessList go through separate formatter branches; the combination is the regression case
test_(async_)set_code_transaction_with_access_list EIP-7702 (type 4) eth_sendRawTransaction authorizationList + accessList survive together on the raw signing path; the existing set-code test only exercises authorizationList

Why these three

The existing coverage at web3/_utils/module_testing/eth_module.py:

  • test_eth_create_access_list exercises the eth_createAccessList RPC and then feeds the result into eth_sendTransaction (type 2 by default), but doesn't drive eth_sendRawTransaction and doesn't lock the tx type explicitly.
  • test_(async_)sign_authorization_send_raw_and_send_set_code_transactions exercises authorizationList on both raw + send paths, but never with accessList attached — so a regression in the type-4 formatter that drops accessList would not be caught.

The three additions close exactly the gaps the issue points at without changing production code.

No production changes

Pure test additions:

  • web3/_utils/module_testing/eth_module.py — 6 new methods (3 async, 3 sync mirrors).
  • web3/_utils/module_testing/eth_module.py — import AccessList + AccessListEntry from web3.types for typed literals (satisfies TxParams.accessList declared as AccessList, and resolves a Sequence[str] inference issue mypy raised on the dict-literal form).
  • newsfragments/3707.internal.rst.

Tests

$ python -m pytest tests/integration/test_ethereum_tester.py::TestEthereumTesterEthModule \
       -k "access_list or set_code" -v
test_eth_send_transaction_type_2_access_list[<lambda>] PASSED
test_eth_send_transaction_type_2_access_list[identity] PASSED
test_eth_send_raw_transaction_type_1_access_list      PASSED
test_set_code_transaction_with_access_list            PASSED
test_eth_create_access_list[<lambda>]                 PASSED  (existing)
test_eth_create_access_list[identity]                 PASSED  (existing)
test_sign_authorization_send_raw_and_send_set_code_transactions PASSED  (existing)
7 passed

Async mirrors are not exercised against EthereumTesterProvider (no async tester runner exists for the eth module today — the async eth-module suite runs against the geth integration), but the implementations are direct ports of the passing sync cases with await added; the geth CI pipeline will exercise them.

$ pre-commit run --files web3/_utils/module_testing/eth_module.py
all hooks green (black, flake8, isort, pydocstyle, mypy, autoflake, pyupgrade, blocklint)

Open question for the maintainers

Issue #3707 also wonders aloud about blob (type 3) transaction coverage. The current eth-tester backends don't appear to validate type-3 round trips end-to-end the way they do for the other types, so I've left that out of scope here. Happy to add it as a follow-up if a tester path is available, or punt to the geth integration suite.

…ApeWorX#3707)

Issue ApeWorX#3707 flags that the transaction-param formatters lacked direct
tests for several combinations the wire format actually allows. Add three
focused cases that exercise the eth_sendTransaction and
eth_sendRawTransaction paths together:

- test_(async_)eth_send_raw_transaction_type_1_access_list — signs an
  EIP-2930 (gasPrice + accessList, no max-fee fields) payload locally and
  pushes it through eth_sendRawTransaction. Verifies the round-tripped
  transaction reports type 1 and preserves the access-list entries.
- test_(async_)eth_send_transaction_type_2_access_list — sends an
  EIP-1559 payload with a populated accessList via eth_sendTransaction.
  Both fields go through separate formatter branches, so the combination
  is worth pinning.
- test_(async_)set_code_transaction_with_access_list — type 4
  (EIP-7702) accepts both an authorizationList and an accessList. Add a
  raw-signed round-trip that asserts both fields survive together, since
  the existing set-code test only exercises the authorizationList path.

No production code changes. Tests sit alongside the existing
test_eth_create_access_list (which only exercises the
eth_createAccessList RPC, not the send formatters) and the existing
sign_authorization_send_raw_and_send_set_code_transactions test (which
only exercises authorizationList).

Closes ApeWorX#3707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more transaction tests

1 participant