-
Notifications
You must be signed in to change notification settings - Fork 626
refactor(rollup-relayer): simplify construct commit batch payload #1673
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
WalkthroughThis change refactors the batch data structure in the Layer2 relayer by removing the explicit parent batch reference from Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
rollup/internal/controller/relayer/l2_relayer.go (1)
543-546: Define newdbBatchWithChunksstruct
The newly introduced struct cleanly encapsulates the required fields (BatchandChunks). Consider adding a short doc comment above this type to describe its purpose and relation to commit batch payload construction.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
rollup/internal/controller/relayer/l2_relayer.go(6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
rollup/internal/controller/relayer/l2_relayer.go (2)
rollup/internal/orm/batch.go (2)
Batch(22-72)Batch(80-82)rollup/internal/orm/chunk.go (2)
Chunk(20-64)Chunk(72-74)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: tests
🔇 Additional comments (5)
rollup/internal/controller/relayer/l2_relayer.go (5)
380-380: Update batchesToSubmit type to the simplified struct
The slice declaration now uses the newdbBatchWithChunkstype instead of the removeddbBatchWithChunksAndParent. This aligns with the refactoring objective of dropping the explicit parent batch object.
436-439: Append new struct without parent batch reference
The append call now constructs adbBatchWithChunksinstance (onlyBatchandChunks) rather than the old struct that carried aParentBatch. All downstream logic relies onBatch.ParentBatchHash, so removing the extra object is safe and simplifies the payload construction.
525-533: Adjust contextIDFromBatches to use simplified batch type
The method signature now accepts[]*dbBatchWithChunks, matching the refactored struct. The implementation remains correct, building a context ID from each batch’s hash.
899-899: UpdateconstructCommitBatchPayloadCodecV7signature
The parameter list now takes[]*dbBatchWithChunksinstead of the deprecated struct. This change aligns with the refactoring to remove explicit parent-batch dependencies.
930-930: Use storedParentBatchHashinstead of parent object
Accessingb.Batch.ParentBatchHashdirectly here removes the need for a separateParentBatchfield. Ensure that every batch record in the DB has a validparent_batch_hashset; otherwise, consider adding a guard to surface missing hashes early.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1673 +/- ##
========================================
Coverage 40.21% 40.22%
========================================
Files 232 231 -1
Lines 18391 18362 -29
========================================
- Hits 7396 7386 -10
+ Misses 10275 10258 -17
+ Partials 720 718 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Purpose or design rationale of this PR
Describe your change. Make sure to answer these three questions: What does this PR do? Why does it do it? How does it do it?
Simplify logic when construct commit batch payload v7. no need to load parentBatch for ParentBatchHash.
PR title
Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:
Deployment tag versioning
Has
tagincommon/version.gobeen updated or have you addedbump-versionlabel to this PR?Breaking change label
Does this PR have the
breaking-changelabel?Summary by CodeRabbit