Skip to content

Commit

Permalink
contracts-bedrock: delete dead SystemConfig code
Browse files Browse the repository at this point in the history
The old constant for the min gas limit was left behind
in the PR that made the min gas limit calculation safe.
This commit deletes the constant and updates the tests
to use the new method.
  • Loading branch information
tynes committed Mar 28, 2023
1 parent 84773de commit c07968f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ SequencerFeeVault_Test:test_withdraw_succeeds() (gas: 163228)
SetPrevBaseFee_Test:test_setPrevBaseFee_succeeds() (gas: 11515)
StandardBridge_Stateless_Test:test_isCorrectTokenPair_succeeds() (gas: 49936)
StandardBridge_Stateless_Test:test_isOptimismMintableERC20_succeeds() (gas: 33072)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 148858)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 148848)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 10546)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 10622)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 10615)
Expand All @@ -427,6 +427,6 @@ SystemConfig_Setters_TestFail:test_setResourceConfig_badPrecision_reverts() (gas
SystemConfig_Setters_TestFail:test_setResourceConfig_lowGasLimit_reverts() (gas: 16082)
SystemConfig_Setters_TestFail:test_setResourceConfig_notOwner_reverts() (gas: 11790)
SystemConfig_Setters_TestFail:test_setResourceConfig_zeroDenominator_reverts() (gas: 13039)
SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 10639)
SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 10616)
TransferOnionTest:test_constructor_succeeds() (gas: 564855)
TransferOnionTest:test_unwrap_succeeds() (gas: 724958)
11 changes: 2 additions & 9 deletions packages/contracts-bedrock/contracts/L1/SystemConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ contract SystemConfig is OwnableUpgradeable, Semver {
*/
bytes32 public constant UNSAFE_BLOCK_SIGNER_SLOT = keccak256("systemconfig.unsafeblocksigner");

/**
* @notice Minimum gas limit. This should not be lower than the maximum deposit gas resource
* limit in the ResourceMetering contract used by OptimismPortal, to ensure the L2
* block always has sufficient gas to process deposits.
*/
uint64 public constant MINIMUM_GAS_LIMIT = 8_000_000;

/**
* @notice Fixed L2 gas overhead. Used as part of the L2 fee calculation.
*/
Expand Down Expand Up @@ -87,7 +80,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);

/**
* @custom:semver 1.1.0
* @custom:semver 1.2.0
*
* @param _owner Initial owner of the contract.
* @param _overhead Initial overhead value.
Expand All @@ -105,7 +98,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
uint64 _gasLimit,
address _unsafeBlockSigner,
ResourceMetering.ResourceConfig memory _config
) Semver(1, 1, 0) {
) Semver(1, 2, 0) {
initialize({
_owner: _owner,
_overhead: _overhead,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
}

function testFuzz_setGasLimit_succeeds(uint64 newGasLimit) external {
uint64 minimumGasLimit = sysConf.MINIMUM_GAS_LIMIT();
uint64 minimumGasLimit = sysConf.minimumGasLimit();
newGasLimit = uint64(
bound(uint256(newGasLimit), uint256(minimumGasLimit), uint256(type(uint64).max))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ contract SystemConfig_GasLimitLowerBound_Invariant is Test {
* than the hard-coded lower bound.
*/
function invariant_gasLimitLowerBound() external {
assertTrue(config.gasLimit() >= config.MINIMUM_GAS_LIMIT());
assertTrue(config.gasLimit() >= config.minimumGasLimit());
}
}

0 comments on commit c07968f

Please sign in to comment.