-
Notifications
You must be signed in to change notification settings - Fork 622
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThis change refactors the batch data structure in the Layer2 relayer by removing the explicit parent batch reference from Changes
Suggested reviewers
Poem
✨ 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 newdbBatchWithChunks
struct
The newly introduced struct cleanly encapsulates the required fields (Batch
andChunks
). 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 newdbBatchWithChunks
type 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 adbBatchWithChunks
instance (onlyBatch
andChunks
) 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
: UpdateconstructCommitBatchPayloadCodecV7
signature
The parameter list now takes[]*dbBatchWithChunks
instead of the deprecated struct. This change aligns with the refactoring to remove explicit parent-batch dependencies.
930-930
: Use storedParentBatchHash
instead of parent object
Accessingb.Batch.ParentBatchHash
directly here removes the need for a separateParentBatch
field. Ensure that every batch record in the DB has a validparent_batch_hash
set; 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.87% 40.86% -0.01%
===========================================
Files 225 225
Lines 18071 18070 -1
===========================================
- Hits 7386 7385 -1
Misses 9968 9968
Partials 717 717
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
tag
incommon/version.go
been updated or have you addedbump-version
label to this PR?Breaking change label
Does this PR have the
breaking-change
label?Summary by CodeRabbit