-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(protocol): calculate what gasExcess value will push basefee to 1…
…gwei then 10gwei (#16550) Co-authored-by: David <[email protected]>
- Loading branch information
1 parent
6ad16f5
commit 10872d9
Showing
9 changed files
with
74 additions
and
84 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
/// @title LibL2Config | ||
library LibL2Config { | ||
struct Config { | ||
uint32 gasTargetPerL1Block; | ||
uint8 basefeeAdjustmentQuotient; | ||
uint64 gasExcessMinValue; | ||
} | ||
|
||
/// @notice Returns EIP1559 related configurations. | ||
/// @return config_ struct containing configuration parameters. | ||
function get() internal pure returns (Config memory config_) { | ||
// Assuming we sell 3x more blockspace than Ethereum: 15_000_000 * 4 | ||
// Note that Brecht's concern is that this value may be too large. | ||
// We need to monitor L2 state growth and lower this value when necessary. | ||
config_.gasTargetPerL1Block = 60_000_000; | ||
config_.basefeeAdjustmentQuotient = 8; | ||
|
||
// This value is picked to make the min base fee close to but slightly smaller than 0.1gwei | ||
config_.gasExcessMinValue = 18_435_000_000; | ||
} | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import "./TaikoL2.sol"; | ||
import "../../contracts/L2/TaikoL2.sol"; | ||
|
||
/// @title TaikoL2EIP1559Configurable | ||
/// @notice TaikoL2 with a setter to change EIP-1559 configurations and states. | ||
/// @custom:security-contact [email protected] | ||
contract TaikoL2EIP1559Configurable is TaikoL2 { | ||
/// @notice EIP-1559 configuration. | ||
Config public customConfig; | ||
LibL2Config.Config public customConfig; | ||
|
||
uint256[49] private __gap; | ||
|
||
/// @notice Emits when the EIP-1559 configuration and gas excess are changed. | ||
/// @param config The new EIP-1559 config. | ||
/// @param gasExcess The new gas excess. | ||
event ConfigAndExcessChanged(Config config, uint64 gasExcess); | ||
event ConfigAndExcessChanged(LibL2Config.Config config, uint64 gasExcess); | ||
|
||
error L2_INVALID_CONFIG(); | ||
|
||
/// @notice Sets EIP1559 configuration and gas excess. | ||
/// @param _newConfig The new EIP1559 config. | ||
/// @param _newGasExcess The new gas excess | ||
function setConfigAndExcess( | ||
Config memory _newConfig, | ||
LibL2Config.Config memory _newConfig, | ||
uint64 _newGasExcess | ||
) | ||
external | ||
|
@@ -40,7 +40,7 @@ contract TaikoL2EIP1559Configurable is TaikoL2 { | |
} | ||
|
||
/// @inheritdoc TaikoL2 | ||
function getConfig() public view override returns (Config memory) { | ||
function getConfig() public view override returns (LibL2Config.Config memory) { | ||
return customConfig; | ||
} | ||
} |
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
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