test(consensus): pin the timestamp check before the parent lookup - #2553
Open
gzliudan wants to merge 1 commit into
Open
test(consensus): pin the timestamp check before the parent lookup#2553gzliudan wants to merge 1 commit into
gzliudan wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
gzliudan
requested review from
AnilChinchawale,
anunay-xin,
benjamin202410,
liam-lai and
wanwiset25
September 6, 2026 23:46
wanwiset25
approved these changes
Sep 7, 2026
anunay-xin
approved these changes
Sep 7, 2026
Add regression tests asserting that header verification checks the timestamp first and answers ErrFutureBlock for blocks too far ahead, without requiring their parent to be resolvable. XDPoS v1/v2 (under full verification) order the checks this way; these tests pin the behavior the future-batch tail queueing (queueFutureTail) relies on: children of a future block surface as ErrFutureBlock, not ErrUnknownAncestor. No production code is changed.
gzliudan
force-pushed
the
test-timestamp-check-precedes-parent
branch
from
September 8, 2026 05:39
87930b8 to
3a06cb3
Compare
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.
Summary
Pin the timestamp-check ordering in header verification with regression tests, extracted from the verified work on
fix-insertchain-known-blocks.XDPoS v1/v2 (under full verification) check the block timestamp before resolving the parent: a block whose timestamp is too far ahead answers
ErrFutureBlockeven when its parent is not yet resolvable. These tests pin that behavior — the future-batch tail queueing (queueFutureTail) relies on children of a future block surfacing asErrFutureBlock, notErrUnknownAncestor.Changes
consensus/XDPoS/engines/engine_v1/verify_header_test.go(new, 117 lines):TestFutureTimestampCheckPrecedesParentLookupconsensus/tests/engine_v2_tests/verify_header_test.go(+78): same pin for the v2 engineNo production code is changed.
Verification
gofmt/goimports/go vetcleanTestFutureTimestampCheckPrecedesParentLookuppasses on both enginesgo test ./consensus/XDPoS/engines/engine_v1/... ./consensus/tests/engine_v2_tests/...— 0 failures