Repository navigation
[2.0.x] fix(core): count rollback depth in blocks, and restart instead of ignoring a deep rollback (backport of #1331) - #1341
Conversation
…instead of ignoring a deep rollback onRollback ignored a rollback when the cursor was more than 2160 slots ahead of the rollback point. 2160 is k, the security parameter, which counts blocks, not slots. On mainnet and preprod that refused every rollback deeper than about 36 minutes. After an ignored rollback the session went on and wrote the blocks that follow the rollback point on top of newer data. - The limit is now 3k/f slots (129600 on mainnet and preprod): k blocks always fit in that window, so no valid rollback is refused. - A rollback deeper than that is refused and the sync restarts from the cursor, instead of carrying on with that session. - No cursor yet: nothing to roll back (was a NullPointerException). Part of #1328. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit b9c38ad)
…fallback Review: 3k/f slots refused valid one-block rollbacks across a gap on sparse devnets (k=10, f=1 gives 30 slots), and allowed rollbacks of up to ~3k blocks on mainnet. Look up the rollback point's block number in the cursor table and compare with k. Fall back to 3k/f slots only when the point has no cursor row (range-fetch batches write one row per batch; old rows are cleaned up). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 3d7f3d3)
|
Initial automated review · Aster Hi @satran004, thanks for the PR! 🙏 This is an automatic first check by an AI reviewer. It does not replace maintainer review and may be wrong. Reviewed commit: Suggestions:
Not tested: I reviewed the code and CI without running the build, tests, or a deep rollback. |
Fault-injection result on release/2.0.xThe same scenarios as #1328 ran on plain
Full results: #1339. This PR in the run: all 11 rollback scenarios at the tip (RB01–RB11) recovered on both builds. No scenario rolls back far enough to hit the deep-rollback path, so that part is covered by the unit tests only. |
reviewer1 — review of
|
The slot check is used only when the rollback point has no cursor row. It is not the deepest valid rollback in slots: after a long run of empty slots a rollback of fewer than k blocks can be deeper. Say so in the javadoc, and add a test that such a rollback takes the refuse-and-restart path instead of being applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb (cherry picked from commit 2348452)
|
|
Thanks, reviewer1. Handled as follows:
Commits: 93577e0 here, 2348452 on #1331. The fixes were made in #1331 first and cherry-picked here. Each finding, its verdict and its test are in the reply on #1339. The fault suite is running again on the updated combined build. |
|
Verdict: APPROVED reviewer1 — round 2. Reviewed No blocking findings remain.
Keep the distinction between testing refusal/restart signalling and testing the complete recovery sequence. The former is verified here. Validation: seven module suites on isolated combined commit Exact commandJAVA_HOME=/Users/satya/.sdkman/candidates/java/21.0.3-tem ./gradlew :components:core:test :components:common:test :stores:assets:test :stores:metadata:test :stores:script:test :stores:mir:test :stores:staking:test --no-daemon --console=plainNo implementation changes made by this review. The updated VM fault-suite results are still pending. This verdict covers the reviewed head only. |
|
Fault-injection rerun on 2.0.x with all eight backports at their approved heads ( For this PR:
The unpatched baseline is |



Backport of #1331 to
release/2.0.x. Tracked in #1339.What it fixes: see #1331. The backport changes the same code in the same way.
How it was made: The 2 commits of #1331, no changes. Commits are cherry-picked with
-x, and the changed lines were compared one by one with #1331.Checks: 113
components/coretests pass.Fault-injection run: the same scenarios as #1328 are running on
release/2.0.xwith all the backports. The results will be posted here and in #1339.🤖 Generated with Claude Code