-
Notifications
You must be signed in to change notification settings - Fork 1
feat: graceful shutdown #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for refactoring some parts of the code base as well! Left a couple of small inline comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit and 2 questions, otherwise looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Overview
This PR implements a graceful shutdown for the rollup node to ensure that critical in-flight tasks are driven to completion before shutdown.
Test strategy
The test implemented for this feature is to start up a rollup node externally to the EN, such that we can manually poll it. This is required such that we can simulate a crash/shutdown midway through the processing of a batch. We simulate a crash midway through processing and then ensure that the node can start up and reprocess the latest batch that we crashed at. We assert that the EN safe block progresses to the expected chain tip upon restart.
Note: There may be an edge case in which the finalized head is greater than the safe head on restart, as we revert to the safe head. As such, when we issue the forkchoice rule, we ensure that we only issue an update if the safe block hash is greater than the finalized block hash.
Implementation
The following modifications have been made to support this feature:
ConsolidationOutcome
type to clean up the consolidation interfacerun_until_graceful_shutdown
function on the RNM and integrate with the rethTaskExecutor
ScrollRollupConfig
Update
On startup, we purge all data that is above the latest persisted finalized L1 block number (we assume that L1 has reorged). We then start up the L1 watcher such that we replay from the batch associated with the latest L2 safe block post-purge.