test(tests): inter-dependent tx tests for BAL parallelization#2851
test(tests): inter-dependent tx tests for BAL parallelization#2851fselmo wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
marioevz
left a comment
There was a problem hiding this comment.
Looks good, I suggested some extra variations of the tests included. Let me know if the description of these tests are clear. Thanks!
| @pytest.mark.parametrize( | ||
| "eunice_oog", | ||
| [False, True], | ||
| ids=["success", "oog_minus_1"], |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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".
🗒️ 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 writesslot[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) — tx1CREATE/CREATE2s a contract; tx2CALLs it. Catches clients that hit an empty account because tx1'scode_changesweren't applied.test_bal_cross_tx_balance_dependency— tx1 sends value to a contract; tx2 calls the contract andSSTOREsSELFBALANCE. Catches clients that read the pre-block balance.test_bal_7702_cross_tx_delegation_then_call— tx1 installs an EIP-7702 delegation onalice; tx2 and tx3 callaliceto increment slot0, using different senders. Catches clients that don't apply the delegation or skip the intermediate increment.test_bal_cross_tx_funding_chain— Five-tx chainalice→bob→charlie→dan→eunice→targetwhere each intermediate starts empty and only becomes solvent once the prior tx's BALbalance_changesare applied;oog_minus_1additionally exercises target'sstorage_readswhen eunice'sSSTOREOOGs one gas short.✅ Checklist
just statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture