Repository navigation
[2.0.x] fix(staking): replaying a block keeps a pool registration a registration (backport of #1335) - #1347
[2.0.x] fix(staking): replaying a block keeps a pool registration a registration (backport of #1335)#1347satran004 wants to merge 4 commits into
Conversation
When a block is processed again after a restart, the row it wrote the first time is still in the pool table. PoolStatusProcessor looked up the latest REGISTRATION of the pool up to the current epoch, found that row, and saved the registration again as an UPDATE (amount 0, active epoch +3). The pool's next certificate then became the REGISTRATION, so adapot counted the 500 ADA deposit in the wrong epoch. Look only at registrations that come before the current certificate (slot, tx index, cert index), so a replay gets the same answer as the first pass. Found by the fault-injection re-test (#1328). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 4da900f)
|
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: Issues found:
Not tested: I reviewed the code and CI without running the build, tests, or a failed-block replay. |
Fault-injection result on release/2.0.xThe same scenarios as #1328 ran on plain
Full results: #1339. This PR in the run: no replayed block held a pool registration in this run, and the |
reviewer1 — review of
|
…itEvent PoolStatusProcessor caches pool registration events until pre-commit and publishes the number of REGISTRATION rows in StakingDepositEvent. When a batch failed before pre-commit, the cache kept its events. A block processed again then sat in the cache twice. Now that a replayed registration stays a registration, both copies were counted: 2 in the event, 1 row in the database. - A block processed again replaces its earlier cached event (same slot and block hash), so each certificate is counted once. - A rollback clears all four caches. A restart publishes a rollback to the cursor before it processes blocks again, so events of the failed batch, including blocks the node no longer serves, are not counted or saved at the next pre-commit. This also resets the stake key registration counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb (cherry picked from commit 15f7a3d)
…PoolRegistrationBefore PoolStorage can be replaced by a custom bean. A provider compiled against the previous interface does not have the new method and failed with AbstractMethodError at the first pool registration. The method now has a default that throws UnsupportedOperationException, naming the class and the method to implement. It does not fall back to findRecentPoolRegistration, because that query sees the certificate's own row and would turn a replayed registration into an update again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb (cherry picked from commit 132f4fb)
…er block PoolRegistrationProcessor publishes one PoolRegistrationEvent per transaction. Replacing a cached event by block dropped the other transactions of the same block, so their pool status rows were not written and the registration count was too low. Replace only the copy of the same transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJrQUCWhJpLCQR5Asv7nDb (cherry picked from commit 1e85144)
|
|
Thanks, reviewer1. Handled as follows:
Commits: 0fb6071, 72b8c9f, 776f9eb here, 15f7a3d, 132f4fb, 1e85144 on #1335. The fixes were made in #1335 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 Both original findings are resolved.
This is an explicit provider upgrade requirement, not transparent behavioural compatibility. I accept that documented choice. 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 #1335 to
release/2.0.x. Tracked in #1339.What it fixes: see #1335. The backport changes the same code in the same way.
How it was made: The commit of #1335, no changes. Commits are cherry-picked with
-x, and the changed lines were compared one by one with #1335.Checks: 32
stores/stakingtests pass, including the 5 replay tests.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