Skip to content

test(e2e): add preconf state consistency test#3082

Open
fridrik01 wants to merge 1 commit intopreconf-devfrom
add-preconf-state-consistency-test
Open

test(e2e): add preconf state consistency test#3082
fridrik01 wants to merge 1 commit intopreconf-devfrom
add-preconf-state-consistency-test

Conversation

@fridrik01
Copy link
Copy Markdown
Contributor

@fridrik01 fridrik01 commented Apr 16, 2026

Our existing TestPreconfTransactions e2e 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

make test-e2e-preconf

@fridrik01 fridrik01 self-assigned this Apr 16, 2026
@fridrik01 fridrik01 marked this pull request as ready for review April 16, 2026 11:53
@fridrik01 fridrik01 requested a review from a team as a code owner April 16, 2026 11:53
Copilot AI review requested due to automatic review settings April 16, 2026 11:53
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.93%. Comparing base (cd11467) to head (5a3022c).

Additional details and impacted files

Impacted file tree graph

@@             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           

see 1 file with indirect coverage changes

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 TestFlashblockStateConsistency with serial and parallel modes.
  • After each transfer, asserts recipient balance and sender nonce at both pending and 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.

Comment thread testing/e2e/preconf/state_consistency_test.go
Comment thread testing/e2e/preconf/state_consistency_test.go
Comment thread testing/e2e/preconf/state_consistency_test.go Outdated
@fridrik01 fridrik01 force-pushed the add-preconf-state-consistency-test branch from fc64800 to 5a3022c Compare April 16, 2026 12:01
Copy link
Copy Markdown
Contributor

@calbera calbera left a comment

Choose a reason for hiding this comment

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

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.

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.

3 participants