fix AuRaBlockFinalizationManager unclean shutdown#11062
Conversation
|
@claude review |
|
Claude finished @LukaszRozmej's task in 2m 39s —— View job Code Review
SummaryThe PR correctly identifies that IssuesBug:
|
|
@claude re-review |
|
Claude finished @LukaszRozmej's task in 2m 55s —— View job Code Review
SummaryThe previous review's blocking bug (event/memory leak from IssuesMedium:
|
|
@claude re-review |
|
Claude finished @LukaszRozmej's task in 1m 55s —— View job Code Review
SummaryGood progress. Both blocking issues from prior reviews are resolved: IssuesMinor:
|
|
@claude re-review |
|
Claude finished @LukaszRozmej's task in 58s —— View job Code Review
SummaryBoth issues flagged in the previous review have been resolved. The PR is ready to merge. Resolved Issues
_poSSwitcher.TerminalBlockReached -= OnTerminalBlock; // safe no-op if already self-unsubscribedThis correctly handles the early-shutdown path (node disposed before terminal block reached).
Remaining Observations (non-blocking)Double dispose still present —
|
…-rc2 backport) (#11307) fix: skip AuRa finalization startup walk on post-merge chains AuRaBlockFinalizationManager ran a catch-up walk from head in its constructor, allocating a List<BlockHeader> that grew to 10M+ entries on post-merge Gnosis after upgrading to 1.37.0. The walk is meaningless post-merge (finalization is handled by the consensus layer) but previously still executed because the inner manager had no way to know it was wrapped by AuRaMergeFinalizationManager. Move Initialize out of the constructor into SetMainBlockBranchProcessor with an idempotency guard, and add an InitializeBlockchainAuRaMerge override that checks IPoSSwitcher and skips the wiring call after the terminal block has been reached. Pre-merge and pure-AuRa chains are unaffected. Backport of #11306 (master) to release/1.37.0-rc2. The release branch is pre-#11062 so the fix was re-implemented by hand for the older code structure. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Changes
AuRaBlockFinalizationManagerfrom block processing events at merge transition, not just at shutdownAuRaMergeFinalizationManagernow hooksIPoSSwitcher.TerminalBlockReachedand disposes the AuRa finalization manager when the merge happens, preventing post-merge blocks from triggering pre-merge finalization logicGetBlockInforeturns nullable and callers handle null gracefully, preventing NRE ifLoadLevelreturns null during shutdown racesIValidSealerStrategydependency fromAuRaBlockFinalizationManagerRoot cause
AuRaBlockFinalizationManagerhad zero merge awareness — it stayed subscribed toBlockProcessed/BlocksProcessingunconditionally and ran AuRa finalization logic on post-merge blocks. On Gnosis post-merge (block 20544072), this caused aNullReferenceExceptioninGetBlockInfowhenLoadLevelreturned null during shutdown.Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Added
AuRaMergeFinalizationManagerTestswith 3 tests:Disposes_aura_manager_on_merge(parameterized: startup vs runtime transition)Terminal_block_handler_unsubscribes_itself(verifies no event leak)Existing 28 AuRa finalization tests continue to pass.
Documentation
Requires documentation update
Requires explanation in Release Notes