Skip to content
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

Refactor MultisigBuilder and NestedMultisigBuilder #97

Merged
merged 18 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ fs_permissions = [ {access = "read-write", path = "./"} ]
optimizer = true
optimizer_runs = 999999
solc_version = "0.8.15"
viaIR = true

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
23 changes: 10 additions & 13 deletions script/deploy/l1/SetGasLimitBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol";
import {
MultisigBuilder,
IMulticall3,
IGnosisSafe
IGnosisSafe,
Simulation
} from "../../universal/MultisigBuilder.sol";
import { Vm } from "forge-std/Vm.sol";

Expand All @@ -31,7 +32,7 @@ abstract contract SetGasLimitBuilder is MultisigBuilder {
* -----------------------------------------------------------
*/

function _postCheck(Vm.AccountAccess[] memory, SimulationPayload memory) internal override view {
function _postCheck() internal override view {
assert(SystemConfig(L1_SYSTEM_CONFIG).gasLimit() == _toGasLimit());
}

Expand All @@ -55,20 +56,16 @@ abstract contract SetGasLimitBuilder is MultisigBuilder {
nonce = safe.nonce() + _nonceOffset();
}

function _addOverrides(address _safe) internal view override returns (SimulationStateOverride memory) {
IGnosisSafe safe = IGnosisSafe(payable(_safe));
uint256 _nonce = _getNonce(safe);
return overrideSafeThresholdOwnerAndNonce(_safe, DEFAULT_SENDER, _nonce);
}

// 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 _addGenericOverrides() internal view override returns (SimulationStateOverride memory) {
SimulationStorageOverride[] memory _stateOverrides = new SimulationStorageOverride[](1);
_stateOverrides[0] = SimulationStorageOverride({
function _simulationOverrides() internal view override returns (Simulation.StateOverride[] memory) {
Simulation.StateOverride[] memory _stateOverrides = new Simulation.StateOverride[](1);
Simulation.StorageOverride[] memory _storageOverrides = new Simulation.StorageOverride[](1);
_storageOverrides[0] = Simulation.StorageOverride({
key: 0x0000000000000000000000000000000000000000000000000000000000000068, // slot of gas limit
value: bytes32(uint(_fromGasLimit()))
});
return SimulationStateOverride({contractAddress: L1_SYSTEM_CONFIG, overrides: _stateOverrides});
_stateOverrides[0] = Simulation.StateOverride({contractAddress: L1_SYSTEM_CONFIG, overrides: _storageOverrides});
return _stateOverrides;
}
}
}
Loading