Fix flaky UtxoStateNodesSyncSpec: compare best-chain headers, not every known header - #2452
Open
Ergologica wants to merge 1 commit into
Open
Fix flaky UtxoStateNodesSyncSpec: compare best-chain headers, not every known header#2452Ergologica wants to merge 1 commit into
Ergologica wants to merge 1 commit into
Conversation
This was referenced Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
The
Run it node testsCI job has been red onmastersince 4a7dba0 (2026-07-08), so every pull request currently shows a failing check. The failing assertion is always the same:Four nodes are queried, but six ids come back: two of them know two headers at that height.
Why it happens
/blocks/at/{height}returns every header id known at the given height, not only the one on the best chain. From the scaladoc ofHeadersProcessor.headerIdsAtHeight:The spec mines with three generating nodes and then compares
headers.flatten, i.e. the union of every header each node has seen at that height, orphaned ones included. The checked height isinitHeight + blocksQty - forkDepthandforkDepth == blocksQty, so it is the starting height — exactly where competing blocks are most likely while several miners race from the genesis block.The result is that the test fails whenever a short fork occurred and was correctly resolved, i.e. on a perfectly synchronised network.
The neighbouring integration specs already handle this correctly:
ForkResolutionSpeccomparesheaderIdsByHeight(...).headOptionandDeepRollBackSpecuses.head.The fix
Compare the best-chain header of each node (the first returned id) instead of the flattened union, and assert explicitly that no node is missing a header at that height. This preserves the property the test is meant to verify — all nodes converge to the same chain — without failing on forks that were already resolved.
Test-only change, no production code touched.