-
Notifications
You must be signed in to change notification settings - Fork 284
feat: Galileo rollup fee #1251
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
feat: Galileo rollup fee #1251
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughBumps the patch version from 7 to 8 and adds Galileo-era L1 data fee logic: new compressed-size calculation via da-codec, a Galileo-specific encoded-fee function, branching in fee calculation, and expanded compression/fee tests. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant CalculateL1DataFee
participant calculateTxCompressedSize
participant calculateEncodedL1DataFeeGalileo
Caller->>CalculateL1DataFee: Request L1 data fee (tx, block, config)
alt Galileo mode
CalculateL1DataFee->>calculateTxCompressedSize: compress tx data (da-codec)
calculateTxCompressedSize-->>CalculateL1DataFee: compressedSize / error
CalculateL1DataFee->>calculateEncodedL1DataFeeGalileo: compute fee using compressedSize & scalars/penalty
calculateEncodedL1DataFeeGalileo-->>CalculateL1DataFee: l1DataFee
else Curie or Feynman
CalculateL1DataFee-->>Caller: existing Curie/Feynman fee path
end
CalculateL1DataFee-->>Caller: return l1DataFee or error
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2025-06-11T15:54:05.820ZApplied to files:
📚 Learning: 2025-10-09T19:18:56.758ZApplied to files:
🧬 Code graph analysis (1)rollup/fees/rollup_fee.go (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
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. 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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
params/version.go(1 hunks)rollup/fees/rollup_fee.go(4 hunks)rollup/fees/rollup_fee_test.go(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-11T15:54:05.820Z
Learnt from: Thegaram
Repo: scroll-tech/go-ethereum PR: 1204
File: miner/scroll_worker.go:836-845
Timestamp: 2025-06-11T15:54:05.820Z
Learning: When `processTxn` rejects a transaction because its calculated L1 data fee is ≥ `fees.MaxL1DataFee()`, this indicates a mis-configured system parameter, not a bad transaction, so the tx must remain in the TxPool rather than being purged.
Applied to files:
rollup/fees/rollup_fee.gorollup/fees/rollup_fee_test.go
🧬 Code graph analysis (2)
rollup/fees/rollup_fee.go (3)
params/config.go (1)
ChainConfig(641-686)common/bytes.go (1)
Bytes2Hex(74-76)rollup/rcfg/config.go (1)
Precision(54-54)
rollup/fees/rollup_fee_test.go (3)
params/config.go (1)
TestChainConfig(505-545)rollup/fees/rollup_fee.go (1)
U256MAX(20-20)common/bytes.go (1)
Hex2Bytes(79-82)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: CodeQL analysis (go)
- GitHub Check: test
- GitHub Check: Analyze (go)
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 introduces the Galileo upgrade for L1 data fee calculation, modifying the rollup fee structure from Feynman's compression ratio-based approach to a compressed size-based approach with a new penalty formula. It also bumps the version patch from 7 to 8.
Key changes:
- Adds
calculateTxCompressedSizefunction to compute compressed transaction size with an upper bound constraint - Implements
calculateEncodedL1DataFeeGalileowith a new fee formula using compressed size and quadratic penalty term - Extends
CalculateL1DataFeeto handle the Galileo fork with appropriate logic branching
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rollup/fees/rollup_fee.go | Adds Galileo fee calculation functions (calculateTxCompressedSize and calculateEncodedL1DataFeeGalileo) and updates CalculateL1DataFee to handle the Galileo fork |
| rollup/fees/rollup_fee_test.go | Adds comprehensive tests for Galileo fee calculation (TestL1DataFeeGalileo) and refactors compression tests to validate both ratio and compressed size |
| params/version.go | Bumps patch version from 7 to 8 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| // Compress data using da-codec | ||
| compressed, err := encoding.CompressScrollBatchBytes(data, blockNumber, blockTime, config) |
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.
Just as a reminder: we need to watch out in case we change the zstd compression level here for batch submission
1. Purpose or design rationale of this PR
Implemented the new, simplified rollup fee formula, activated in the Galileo upgrade.
Spec: https://www.notion.so/scrollzkp/Galileo-Fee-Model-2a07792d22af8051a9e5e987c23c2c6a
Revm: scroll-tech/scroll-revm#65
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
New Features
Tests