-
Notifications
You must be signed in to change notification settings - Fork 131
fix(l2): shutdown node with ctrl+c #5208
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
Lines of code reportTotal lines added: Detailed view |
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.
Pull Request Overview
This PR refactors the sequencer startup to return handles for the L1 committer and block producer, along with a driver future, enabling proper shutdown coordination. It adds Abort message handling to both the L1Committer and BlockProducer GenServers and updates the initialization logic to send abort messages during shutdown.
- Modifies
start_l2to return handles and a driver future instead of running to completion - Adds
Abortmessage variants toL1CommitterandBlockProducerfor graceful shutdown - Updates shutdown logic to send abort messages to GenServer handles before cancellation
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| crates/l2/sequencer/mod.rs | Changes return type to include GenServer handles and driver future; wraps sequencer logic in pinned async block |
| crates/l2/sequencer/l1_committer.rs | Adds Abort message handling with CastResponse::Stop and refactors handle_cast to use pattern matching |
| crates/l2/sequencer/block_producer.rs | Adds Abort message handling with CastResponse::Stop and refactors handle_cast to use pattern matching |
| cmd/ethrex/l2/initializers.rs | Updates initialization to receive handles and driver, sends abort messages in both shutdown branches |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cmd/ethrex/l2/initializers.rs
Outdated
| if let Some(mut handle) = committer_handle.clone() { | ||
| handle | ||
| .cast(l1_committer::InMessage::Abort) | ||
| .await | ||
| .inspect_err(|err| warn!("Failed to send committer abort: {err:?}")) | ||
| .ok(); | ||
| } | ||
| if let Some(mut handle) = block_producer_handle.clone() { | ||
| handle | ||
| .cast(block_producer::InMessage::Abort) | ||
| .await | ||
| .inspect_err(|err| warn!("Failed to send block producer abort: {err:?}")) | ||
| .ok(); | ||
| } |
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.
Can we abstract this functionality into a shutdown function?
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.
crates/l2/sequencer/l1_committer.rs
Outdated
| self.last_committed_batch = current_last_committed_batch; | ||
| self.last_committed_batch_timestamp = current_time; | ||
| match message { | ||
| InMessage::Commit => { |
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.
Maybe we can move the handling of this message to its own function for clarity.
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.
Done cc0fd39
**Motivation** The L2 node is not stopping after pressing `ctrl+c`. This is because the abort of the `l2_sequencer` does not stop block task such as block producer and l1 committer **Description** - Add new `InMessage` to abort l1 committer and block producer tasks - Change `start_l2` to return handles of the blocking tasks --------- Co-authored-by: Ivan Litteri <[email protected]>
Motivation
The L2 node is not stopping after pressing
ctrl+c. This is because the abort of thel2_sequencerdoes not stop block task such as block producer and l1 committerDescription
InMessageto abort l1 committer and block producer tasksstart_l2to return handles of the blocking tasks