Skip to content

Commit

Permalink
feat: Simplify SetGasLimit contract, fixing rollback nonce (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianBland authored Feb 12, 2025
1 parent bbbf0a3 commit cdedd0f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 59 deletions.
22 changes: 0 additions & 22 deletions script/deploy/l1/RollbackGasLimit.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol";
import {MultisigBuilder, IMulticall3, IGnosisSafe, Simulation} from "../../universal/MultisigBuilder.sol";
import {Vm} from "forge-std/Vm.sol";

abstract contract SetGasLimitBuilder is MultisigBuilder {
contract SetGasLimit is MultisigBuilder {
address internal SYSTEM_CONFIG_OWNER = vm.envAddress("SYSTEM_CONFIG_OWNER");
address internal L1_SYSTEM_CONFIG = vm.envAddress("L1_SYSTEM_CONFIG_ADDRESS");

/**
* -----------------------------------------------------------
* Virtual Functions
* Implemented Functions
* -----------------------------------------------------------
*/
function _fromGasLimit() internal view virtual returns (uint64);

function _toGasLimit() internal view virtual returns (uint64);
function _fromGasLimit() internal view returns (uint64) {
return uint64(vm.envUint("FROM_GAS_LIMIT"));
}

function _nonceOffset() internal view virtual returns (uint64);
function _toGasLimit() internal view returns (uint64) {
return uint64(vm.envUint("TO_GAS_LIMIT"));
}

/**
* -----------------------------------------------------------
* Implemented Functions
* -----------------------------------------------------------
*/
function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override {
assert(SystemConfig(L1_SYSTEM_CONFIG).gasLimit() == _toGasLimit());
}
Expand All @@ -45,10 +42,6 @@ abstract contract SetGasLimitBuilder is MultisigBuilder {
return SYSTEM_CONFIG_OWNER;
}

function _getNonce(address safe) internal view override returns (uint256 nonce) {
nonce = IGnosisSafe(safe).nonce() + _nonceOffset();
}

// We need to expect that the gas limit will have been updated previously in our simulation
// Use this override to specifically set the gas limit to the expected update value.
function _simulationOverrides() internal view override returns (Simulation.StateOverride[] memory) {
Expand Down
22 changes: 0 additions & 22 deletions script/deploy/l1/UpgradeGasLimit.sol

This file was deleted.

0 comments on commit cdedd0f

Please sign in to comment.