Skip to content

test(tests): inter-dependent tx tests for BAL parallelization#2851

Open
fselmo wants to merge 3 commits into
ethereum:forks/amsterdamfrom
fselmo:feat/more-bal-coverage
Open

test(tests): inter-dependent tx tests for BAL parallelization#2851
fselmo wants to merge 3 commits into
ethereum:forks/amsterdamfrom
fselmo:feat/more-bal-coverage

Conversation

@fselmo
Copy link
Copy Markdown
Contributor

@fselmo fselmo commented May 13, 2026

🗒️ Description

From ETH R&D @matkt:

https://discord.com/channels/595666850260713488/1364000387195076608/1504026078107275274

Add five new cross-tx parallelization-correctness tests:

  • test_bal_cross_tx_storage_chain — 8-tx fibonacci chain on one contract... each tx i ≥ 2 writes slot[i] = SLOAD(i-1) + SLOAD(i-2) -- transactions are dependent on previous 2. Catches clients that fail to apply prior txs BAL storage changes.
  • test_bal_cross_tx_deploy_then_call (@with_all_create_opcodes) — tx1 CREATE/CREATE2s a contract; tx2 CALLs it. Catches clients that hit an empty account because tx1's code_changes weren't applied.
  • test_bal_cross_tx_balance_dependency — tx1 sends value to a contract; tx2 calls the contract and SSTOREs SELFBALANCE. Catches clients that read the pre-block balance.
  • test_bal_7702_cross_tx_delegation_then_call — tx1 installs an EIP-7702 delegation on alice; tx2 and tx3 call alice to increment slot 0, using different senders. Catches clients that don't apply the delegation or skip the intermediate increment.
  • test_bal_cross_tx_funding_chain — Five-tx chain alicebobcharliedaneunicetarget where each intermediate starts empty and only becomes solvent once the prior tx's BAL balance_changes are applied; oog_minus_1 additionally exercises target's storage_reads when eunice's SSTORE OOGs one gas short.

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

Screenshot 2026-05-13 at 11 14 41

@fselmo fselmo requested review from marioevz, raxhvl and spencer-tb May 13, 2026 18:05
@fselmo fselmo added the C-test Category: test label May 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.94%. Comparing base (5c6cec7) to head (98fc341).
⚠️ Report is 5 commits behind head on forks/amsterdam.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #2851      +/-   ##
===================================================
- Coverage            90.01%   86.94%   -3.07%     
===================================================
  Files                  539      586      +47     
  Lines                32618    35767    +3149     
  Branches              3030     3362     +332     
===================================================
+ Hits                 29361    31098    +1737     
- Misses                2699     4010    +1311     
- Partials               558      659     +101     
Flag Coverage Δ
unittests 86.94% <ø> (-3.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fselmo fselmo added the A-tests Area: Consensus tests. label May 13, 2026
@fselmo fselmo changed the title feat(test): inter-dependent tx tests for BAL parallelization test(tests): inter-dependent tx tests for BAL parallelization May 13, 2026
Copy link
Copy Markdown
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I suggested some extra variations of the tests included. Let me know if the description of these tests are clear. Thanks!

Comment thread tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Outdated
Comment thread tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py Outdated
@pytest.mark.parametrize(
"eunice_oog",
[False, True],
ids=["success", "oog_minus_1"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be interesting to expect an insufficient-balance error instead of an OOG (invalid block): eunice provides a given gas-limit, but the balance passed by the previous transaction is off-by-one insufficient to pay gas_limit * gas_price.

Malicious case: (Not sure if possible) The BAL is corrupted to indicate there's enough balance for eunice to pay gas_limit*gas_price, but in reality Dan passed insufficient value (by one wei).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. On the malicious case idea, I wonder... malicious BAL corruption is already covered by test_bal_invalid_balance_value (and some other test_bal_invalid_* tests). The 5-tx chain variant would surface as the same hash mismatch via the same path, no?

Lmk if I am missing something 👀. I think these valid cases help verify that we can't just run transactions in parallel in any order. What's tricky is all the different valid ways in which a client might optimize for checking "is this tx parallelizable or not".

@fselmo fselmo removed the request for review from spencer-tb May 13, 2026 21:44
@fselmo fselmo requested a review from marioevz May 13, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tests Area: Consensus tests. C-test Category: test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants