Skip to content

test: real-chain fixture for reorg integration testing - #575

Merged
fpelliccioni merged 1 commit into
masterfrom
test/reorg-e2e-harness
Aug 4, 2026
Merged

test: real-chain fixture for reorg integration testing#575
fpelliccioni merged 1 commit into
masterfrom
test/reorg-e2e-harness

Conversation

@fpelliccioni

Copy link
Copy Markdown
Contributor

Start of the end-to-end harness. The reorg path spans the header index, the flat-file block store, the undo files and UTXO-Z, and its bugs live in how those agree with each other — which is why they kept surfacing in review instead of in CI.

What this adds

A fixture that brings up an actual block_chain on a throwaway directory, following the node's own startup sequence: create the store seeded with genesis → start the chain → materialize the active chain through the organizer. Regtest is deliberate: its PoW target is trivial, so competing chains can be built without mining.

It already found something

The first test pinned an ordering dependency I introduced in #572 and had not noticed:

The active chain (height → index) is materialized by header_organizer::sync_tip(), not by block_chain::start(). Until it runs, active_at() answers null_index for every height — so fetch_blocks_raw and disconnect_block, which both now resolve through it, would find nothing.

The node does this at startup so production is fine, but anything else standing up a chain must too. That is now encoded in the fixture rather than being tribal knowledge.

Scope

Fixture only. Building competing chains over it and asserting the disconnect → switch → re-download cycle is the next step, and it is the one that actually validates #571/#572/#573.

I would rather land this small and honest than describe it as more than it is: it does not yet test a reorg.

The reorg path spans the header index, the flat-file block store, the undo files
and UTXO-Z, and its bugs live in how those agree with each other. Every test so
far exercised one piece at a time, which is why the failures kept surfacing in
review instead of in CI.

Adds a fixture that brings up an actual block_chain on a throwaway directory,
following the node's own startup sequence: create the store seeded with genesis,
start the chain, then materialize the active chain through the organizer.
Regtest is used deliberately — its proof-of-work target is trivial, so competing
chains can be built without mining.

The first test already pinned an ordering dependency worth stating: the active
chain (height -> index) is materialized by header_organizer::sync_tip(), NOT by
block_chain::start(). Until it runs, active_at() answers null_index for every
height, so fetch_blocks_raw and disconnect_block — both of which now resolve
through it — would find nothing. The node does this at startup; anything else
standing up a chain must too.

This is the fixture only. Building competing chains over it, and asserting the
disconnect -> switch -> re-download cycle, is the next step.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fpelliccioni, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f65a79a-6baa-4c90-988f-512f062d5d8f

📥 Commits

Reviewing files that changed from the base of the PR and between 67cdf68 and 0847143.

📒 Files selected for processing (3)
  • src/blockchain/CMakeLists.txt
  • src/blockchain/test/reorg_chain_fixture.hpp
  • src/blockchain/test/reorg_e2e.cpp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fpelliccioni fpelliccioni changed the title test: stand up a real chain for reorg end-to-end testing test: real-chain fixture for reorg integration testing Aug 4, 2026
@fpelliccioni
fpelliccioni merged commit e9ee20f into master Aug 4, 2026
25 of 26 checks passed
@fpelliccioni
fpelliccioni deleted the test/reorg-e2e-harness branch August 4, 2026 13:27
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.

1 participant