-
Notifications
You must be signed in to change notification settings - Fork 284
feat: reject txs with max l1 data fee #1203
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
WalkthroughThe changes introduce a new maximum cap for L1 data fees using a big integer constant and enforce this cap during transaction validation. Transactions with L1 data fees at or above this limit are now rejected. Additionally, the patch version number is incremented to reflect the update. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TxPool
participant Fees
User->>TxPool: Submit Transaction
TxPool->>Fees: CalculateL1DataFee(tx)
Fees-->>TxPool: Return l1DataFee (capped at MaxL1DataFee)
TxPool->>TxPool: Check if l1DataFee >= MaxL1DataFee
alt l1DataFee too high
TxPool-->>User: Reject transaction (invalid L1 data fee)
else l1DataFee valid
TxPool->>TxPool: Check balance, etc.
TxPool-->>User: Accept or reject based on further checks
end
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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 (3)
rollup/fees/rollup_fee.go (2)
23-26: Exporting a mutable*big.Intinvites accidental mutation
MaxL1DataFeeis a pointer value – any downstream package could doMaxL1DataFee.Add(...)and silently corrupt the global cap.
Prefer exposing an accessor (e.g.func MaxL1DataFee() *big.Int) that returns a fresh copy, or expose the value byvalue(e.g.const MaxL1DataFee uint64 = math.MaxUint64and convert locally).
This keeps the sentinel truly immutable.
254-256: Avoid mutating the existing result – return a capped copy instead
l1DataFee.Set(MaxL1DataFee)overwrites the existing instance in-place.
Returning a new copy is clearer and avoids side-effects in callers that might hold additional references to the original pointer.- if l1DataFee.Cmp(MaxL1DataFee) > 0 { - l1DataFee.Set(MaxL1DataFee) + if l1DataFee.Cmp(MaxL1DataFee) > 0 { + l1DataFee = new(big.Int).Set(MaxL1DataFee) // return an immutable copy }core/tx_pool.go (1)
845-849: Introduce a typed sentinel error for invalid L1 data feesAll other validation failures use predefined vars (e.g.
ErrNonceTooLow).
Creatingvar ErrInvalidL1DataFee = errors.New("invalid L1 data fee")keeps error handling consistent and lets callerserrors.Is(...)check.@@ - if l1DataFee.Cmp(fees.MaxL1DataFee) >= 0 { - return errors.New("invalid transaction: invalid L1 data fee") + if l1DataFee.Cmp(fees.MaxL1DataFee) >= 0 { + return ErrInvalidL1DataFee }Define the var next to the other
Err*declarations at the top of the file.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
core/tx_pool.go(1 hunks)params/version.go(1 hunks)rollup/fees/rollup_fee.go(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
core/tx_pool.go (1)
rollup/fees/rollup_fee.go (1)
MaxL1DataFee(25-25)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: test
- GitHub Check: check
- GitHub Check: Analyze (go)
🔇 Additional comments (1)
params/version.go (1)
27-28: Patch bump acknowledgedVersion patch increment reflects the new validation logic – no issues spotted.
colinlyguo
left a comment
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. There might be a state divergence when applying the transaction.
1. Purpose or design rationale of this PR
Reject transactions that run into the L1 data fee cap.
2. 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:
3. Deployment tag versioning
Has the version in
params/version.gobeen updated?4. Breaking change label
Does this PR have the
breaking-changelabel?Summary by CodeRabbit
Bug Fixes
Chores