Skip to content

feat: Add state sync available checkpoint content gap test#11800

Open
semenov-vladyslav wants to merge 1 commit into
developfrom
fix/test-gaps-in-checkpoint-data-sync
Open

feat: Add state sync available checkpoint content gap test#11800
semenov-vladyslav wants to merge 1 commit into
developfrom
fix/test-gaps-in-checkpoint-data-sync

Conversation

@semenov-vladyslav

Copy link
Copy Markdown
Contributor

Description of change

This PR add a reproducer test for a fix in #11485. Before the fix a missing checkpoint would be pushed to the end of retry queue, causing state sync to try and fetch the following checkpoint thus breaking the invariant. The test simulates a gap in the available checkpoint contents and checks that the state sync does not break the invariant. Without the fix (with checkpoint_contents_tasks.push_back) the test fails.

Links to any relevant issues

Fixes #11496

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

@semenov-vladyslav semenov-vladyslav requested a review from a team as a code owner June 8, 2026 05:35
@iota-ci iota-ci added core-protocol node Issues related to the Core Node team labels Jun 8, 2026
// ~40 retry cycles fire for checkpoint 1. If push_back were used
// (pre-fix), checkpoints 2–5 would advance the watermark to 5 within
// this window.
tokio::time::sleep(Duration::from_secs(2)).await;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure a fixed 2s here is good especially for a heavy/slow CI box, and it might be even safer to add an assertion here like

// e.g. before the watermark assert:
assert!(
    store_2.get_full_checkpoint_contents_by_sequence_number(2).is_some(),
    "content loop did not even fetch seq 2 within the window — test is not exercising the gap",
);

so we can prove the loop ran and still refused to advance.
How do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-protocol node Issues related to the Core Node team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node: add a test for gaps in the checkpoint data during sync

3 participants