-
Notifications
You must be signed in to change notification settings - Fork 155
Set optional dataCostEstimate on rollup initialization #388
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
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 a new optional dataCostEstimate configuration parameter that allows specifying a parent chain base fee estimate during rollup initialization, making the initialization message deterministic by avoiding on-chain base fee queries when this parameter is provided.
Key Changes:
- Added
dataCostEstimatefield to theConfigstruct - Modified
rollupInitializedfunction to accept and use the estimate when non-zero - Updated all test files and configuration examples to include the new parameter
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/rollup/Config.sol | Added dataCostEstimate field to Config struct |
| src/rollup/IRollupEventInbox.sol | Updated interface to include l1BaseFeeEstimate parameter |
| src/rollup/AbsRollupEventInbox.sol | Implemented logic to use estimate when provided, otherwise fetch on-chain |
| src/rollup/RollupAdminLogic.sol | Passed dataCostEstimate to rollup initialization |
| src/rollup/BOLDUpgradeAction.sol | Added dataCostEstimate: 0 to config |
| src/mocks/MockRollupEventInbox.sol | Implemented same estimate logic in mock |
| test/foundry/RollupEventInbox.t.sol | Updated test calls to include new parameter |
| test/foundry/ERC20RollupEventInbox.t.sol | Updated test calls to include new parameter |
| test/foundry/RollupCreator.t.sol | Added dataCostEstimate: 0 to test configs |
| test/Rollup.t.sol | Added dataCostEstimate: 0 to test configs |
| test/stakingPool/AssertionStakingPool.t.sol | Added dataCostEstimate: 0 to test config |
| test/e2e/orbitChain.ts | Added dataCostEstimate to TypeScript config |
| scripts/rollupCreation.ts | Added dataCostEstimate to dev config |
| scripts/config.example.ts | Added dataCostEstimate to example config |
| test/signatures/RollupCreator | Updated function signature hash (formatting change) |
| test/signatures/RollupAdminLogic | Updated function signature hash (formatting change) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (dataCostEstimate != 0) { | ||
| currentDataCost = dataCostEstimate; | ||
| } else { | ||
| currentDataCost = _currentDataCostToReport(); | ||
| } |
Copilot
AI
Nov 5, 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.
The condition dataCostEstimate != 0 treats zero as a signal to fetch on-chain data, but zero is also a valid base fee estimate. Consider using a different mechanism (e.g., Optional/nullable parameter or separate boolean flag) to distinguish between 'use estimate' vs 'fetch on-chain' to avoid ambiguity when the actual estimate is zero.
This PR adds a new configuration parameter
dataCostEstimatethat allows to pass an estimation of the data cost (i.e., the base fee of the parent chain) to be included in the rollup initialization message, as an alternative to fetch the base fee on-chain.This allows the initialization message to be fully deterministic, since one of its components is the current on-chain base fee.