-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
EIP4844 L1 Smart Contract Updates #8715
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,14 @@ contract SystemConfig is OwnableUpgradeable, ISemver { | |
/// @custom:value GAS_CONFIG Represents an update to txn fee config on L2. | ||
/// @custom:value GAS_LIMIT Represents an update to gas limit on L2. | ||
/// @custom:value UNSAFE_BLOCK_SIGNER Represents an update to the signer key for unsafe | ||
/// @custom:value FEE_SCALARS_ECOTONE Represents an update to fee scalars on L2 after ecotone. | ||
/// block distrubution. | ||
enum UpdateType { | ||
BATCHER, | ||
GAS_CONFIG, | ||
GAS_LIMIT, | ||
UNSAFE_BLOCK_SIGNER | ||
UNSAFE_BLOCK_SIGNER, | ||
FEE_SCALARS_ECOTONE | ||
} | ||
|
||
/// @notice Version identifier, used for upgrades. | ||
|
@@ -52,6 +54,12 @@ contract SystemConfig is OwnableUpgradeable, ISemver { | |
/// @notice L2 block gas limit. | ||
uint64 public gasLimit; | ||
|
||
/// @notice The scalar value applied to the L1 base fee portion of the blob-capable L1 cost func | ||
uint32 public basefeeScalar; | ||
|
||
/// @notice The scalar value applied to the L1 blob base fee portion of the blob-capable L1 cost func | ||
uint32 public blobBasefeeScalar; | ||
|
||
/// @notice The configuration for the deposit fee market. | ||
/// Used by the OptimismPortal to meter the cost of buying L2 gas on L1. | ||
/// Set as internal with a getter so that the struct is returned instead of a tuple. | ||
|
@@ -64,8 +72,8 @@ contract SystemConfig is OwnableUpgradeable, ISemver { | |
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data); | ||
|
||
/// @notice Semantic version. | ||
/// @custom:semver 1.11.0 | ||
string public constant version = "1.11.0"; | ||
/// @custom:semver 1.12.0 | ||
string public constant version = "1.12.0"; | ||
|
||
/// @notice Constructs the SystemConfig contract. Cannot set | ||
/// the owner to `address(0)` due to the Ownable contract's | ||
|
@@ -124,6 +132,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver { | |
// These are set in ascending order of their UpdateTypes. | ||
_setBatcherHash(_batcherHash); | ||
_setGasConfig({ _overhead: _overhead, _scalar: _scalar }); | ||
_setFeeScalarsEcotone({ _basefeeScalar: _scalar, _blobBasefeeScalar: 0 }); | ||
_setGasLimit(_gasLimit); | ||
_setUnsafeBlockSigner(_unsafeBlockSigner); | ||
_setResourceConfig(_config); | ||
|
@@ -197,6 +206,24 @@ contract SystemConfig is OwnableUpgradeable, ISemver { | |
emit ConfigUpdate(VERSION, UpdateType.GAS_CONFIG, data); | ||
} | ||
|
||
/// @notice Updates fee scalars. Can only be called by the owner. Introduced in Ecotone. | ||
/// @param _basefeeScalar New basefeeScalar value. | ||
/// @param _blobBasefeeScalar New blobBasefeeScalar value. | ||
function setFeeScalarsEcotone(uint32 _basefeeScalar, uint32 _blobBasefeeScalar) external onlyOwner { | ||
_setFeeScalarsEcotone(_basefeeScalar, _blobBasefeeScalar); | ||
} | ||
|
||
/// @notice Internal function for updating the fee scalars. | ||
/// @param _basefeeScalar New basefeeScalar value. | ||
/// @param _blobBasefeeScalar New blobBasefeeScalar value. | ||
function _setFeeScalarsEcotone(uint32 _basefeeScalar, uint32 _blobBasefeeScalar) internal { | ||
basefeeScalar = _basefeeScalar; | ||
blobBasefeeScalar = _blobBasefeeScalar; | ||
|
||
bytes memory data = abi.encode(_basefeeScalar, _blobBasefeeScalar); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's do encodePacked |
||
emit ConfigUpdate(VERSION, UpdateType.FEE_SCALARS_ECOTONE, data); | ||
} | ||
|
||
/// @notice Updates the L2 gas limit. Can only be called by the owner. | ||
/// @param _gasLimit New gas limit. | ||
function setGasLimit(uint64 _gasLimit) external onlyOwner { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
went back and forth around keeping the old
GAS_CONFIG
naming vs thisFEE_SCALARS
one - if using the Fee Scalar naming instead, we could techincally omit the "ecotone" suffix throughout - open to thoughts