test: real-chain fixture for reorg integration testing - #575
Conversation
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.
|
Warning Review limit reached
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
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. Comment |
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_chainon 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 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.