-
Notifications
You must be signed in to change notification settings - Fork 117
fix(l2): remove used checkpoints #5120
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
This reverts commit 02ac09d.
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 adds automatic cleanup of checkpoint directories after batch proofs are successfully verified on L1. The L1ProofSender now receives the checkpoints_dir path and removes old checkpoint directories once they are no longer needed.
- Passes
checkpoints_dirtoL1ProofSenderfor checkpoint cleanup - Adds logic to delete checkpoint directories after batch proof verification
- Uses
PathBufcloning to allow sharing the path betweenL1CommitterandL1ProofSender
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/l2/sequencer/mod.rs | Clones checkpoints_dir when spawning L1Committer and passes the original to L1ProofSender |
| crates/l2/sequencer/l1_proof_sender.rs | Adds checkpoints_dir field, updates constructor/spawn signatures, and implements checkpoint deletion logic after proof verification |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .checkpoints_dir | ||
| .join(format!("checkpoint_batch_{}", batch_to_send - 1)); | ||
| if checkpoint_path.exists() { | ||
| let _ = remove_dir_all(&checkpoint_path).inspect_err(|e| { |
Copilot
AI
Oct 30, 2025
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.
Using std::fs::remove_dir_all is a blocking file system operation being called in an async context. This can block the async executor thread. Consider using tokio::fs::remove_dir_all instead for non-blocking async file operations.
Lines of code reportTotal lines added: Detailed view |
| let checkpoint_path = self | ||
| .checkpoints_dir | ||
| .join(format!("checkpoint_batch_{}", batch_to_send - 1)); |
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.
Document why batch_to_send - 1.
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.
Motivation
Checkpoints are never deleted
Description
Delete checkpoints once we verify the corresponding batch