test(e2e): add preconf state consistency test#3082
test(e2e): add preconf state consistency test#3082fridrik01 wants to merge 1 commit intopreconf-devfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## preconf-dev #3082 +/- ##
============================================
Coverage 58.93% 58.93%
============================================
Files 379 379
Lines 19531 19531
============================================
Hits 11511 11511
Misses 7058 7058
Partials 962 962 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new e2e test to validate that the preconf RPC exposes consistent intermediate (“pending”/flashblock) and inclusion-block state after each ETH transfer, aiming to catch transient state exposure bugs that would be missed by end-of-test-only assertions.
Changes:
- Introduces
TestFlashblockStateConsistencywith serial and parallel modes. - After each transfer, asserts recipient balance and sender nonce at both
pendingand the transaction’s inclusion block. - Adds polling helpers to detect pending visibility and inclusion via block scanning.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fc64800 to
5a3022c
Compare
calbera
left a comment
There was a problem hiding this comment.
lgtm, noting a potential flakiness from claude:
Pending-state atomicity:
waitForTxInPending only confirms the tx appears in some pending snapshot. The
subsequent PendingBalanceAt / PendingNonceAt calls are separate RPC round-trips.
Between them, the sequencer may advance the flashblock or seal it into a canonical block.
- Sealing is safe: once the tx is canonical, pending state = latest canonical state +
pending mempool, so recipient balance/sender nonce still include the tx's effect. - The corner case that could produce false negatives is a reorg or pending-block reset on
the preconf RPC, which should not happen on a healthy testnet.
This isn't a correctness bug in the test logic but is worth noting as a source of
potential flake. A stronger formulation would re-poll pending until the observed state
matches (with a bounded retry) rather than requiring exact match on the first read.
Our existing
TestPreconfTransactionse2e test check account state only at the end of the run, after all TXs are canonically settled. Intermediate state bugs (e.g. a flashblock exposing partial state on the pending tag) could self-heal by end-of-test and pass silently.This PR adds
TestFlashblockStateConsistency. After each ETH transfer it asserts, on the preconf RPC, that the recipient balance and sender nonce are exactly as expected, both at the pending tag (flashblock state) and at the inclusion (finalized) block. A Parallel subtest runs one worker per test account with independent recipients exercising multiple TXs per flashblock.Test Plan