From e5623eafde1ef037cf17fe76a212daec0a8a0373 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 17 Dec 2024 14:35:24 +0000 Subject: [PATCH 01/68] first pass at task sep 025 --- .../.env | 4 + .../NestedSignFromJson.s.sol | 121 ++++++++++++++++++ .../OVERVIEW.md | 57 +++++++++ .../README.md | 42 ++++++ .../VALIDATION.md | 19 +++ .../input.json | 105 +++++++++++++++ 6 files changed, 348 insertions(+) create mode 100644 tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/.env create mode 100644 tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol create mode 100644 tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md create mode 100644 tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/README.md create mode 100644 tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md create mode 100644 tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/input.json diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/.env b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/.env new file mode 100644 index 000000000..4a4e63e8a --- /dev/null +++ b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/.env @@ -0,0 +1,4 @@ +ETH_RPC_URL="https://ethereum-sepolia.publicnode.com" +COUNCIL_SAFE=0xf64bc17485f0B4Ea5F06A96514182FC4cB561977 +FOUNDATION_SAFE=0xDEe57160aAfCF04c34C887B5962D0a69676d3C8B +OWNER_SAFE=0x1Eb2fFc903729a0F03966B917003800b145F56E2 diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol new file mode 100644 index 000000000..157915207 --- /dev/null +++ b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.15; + +import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSignFromJson.s.sol"; +import {GnosisSafe} from "safe-contracts/GnosisSafe.sol"; +import {Vm, VmSafe} from "forge-std/Vm.sol"; +import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; +import {console2 as console} from "forge-std/console2.sol"; +import {ProxyAdmin} from "@eth-optimism-bedrock/src/universal/ProxyAdmin.sol"; +import {stdJson} from "forge-std/StdJson.sol"; + +/// @title ISemver +/// @notice ISemver is a simple contract for ensuring that contracts are +/// versioned using semantic versioning. +interface ISemver { + /// @notice Getter for the semantic version of the contract. This is not + /// meant to be used onchain but instead meant to be used by offchain + /// tooling. + /// @return Semver contract version as a string. + function version() external view returns (string memory); +} + +contract NestedSignFromJson is OriginalNestedSignFromJson { + string[1] l2ChainIds = [ + "11155420" // op + // "1740", // metal TODO + // "919", // mode TODO + // "999999999" // zora TODO + ]; + + // The slot used to store the livenessGuard address in GnosisSafe. + // See https://github.com/safe-global/safe-smart-account/blob/186a21a74b327f17fc41217a927dea7064f74604/contracts/base/GuardManager.sol#L30 + bytes32 livenessGuardSlot = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8; + + address newSystemConfigImplAddress = 0x33b83E4C305c908B2Fc181dDa36e230213058d7d; + + // Safe contract for this task. + GnosisSafe securityCouncilSafe = GnosisSafe(payable(vm.envAddress("COUNCIL_SAFE"))); + GnosisSafe fndSafe = GnosisSafe(payable(vm.envAddress("FOUNDATION_SAFE"))); + GnosisSafe proxyAdminOwnerSafe = GnosisSafe(payable(vm.envAddress("OWNER_SAFE"))); + + /// @notice Sets up the contract + function setUp() public {} + + function checkProxyAdminproxyAdminOwnerSafe(string memory l2ChainId) internal view { + ProxyAdmin proxyAdmin = ProxyAdmin(readAddressFromSuperchainRegistry(l2ChainId, "ProxyAdmin")); + + address proxyAdminOwner = proxyAdmin.owner(); + require(proxyAdminOwner == address(proxyAdminOwnerSafe), "checkProxyAdminproxyAdminOwnerSafe-260"); + + address[] memory owners = proxyAdminOwnerSafe.getOwners(); + require(owners.length == 2, "checkProxyAdminproxyAdminOwnerSafe-270"); + require(proxyAdminOwnerSafe.isOwner(address(fndSafe)), "checkProxyAdminproxyAdminOwnerSafe-300"); + require(proxyAdminOwnerSafe.isOwner(address(securityCouncilSafe)), "checkProxyAdminproxyAdminOwnerSafe-400"); + } + + /// @notice Checks the correctness of the deployment + function _postCheck(Vm.AccountAccess[] memory accesses, Simulation.Payload memory /* simPayload */ ) + internal + view + override + { + console.log("Running post-deploy assertions"); + checkStateDiff(accesses); + for (uint256 i = 0; i < l2ChainIds.length; i++) { + console.log("Running checks on chain with iD ", l2ChainIds[i]); + checkProxyAdminproxyAdminOwnerSafe(l2ChainIds[i]); + ISemver systemConfigProxy = ISemver(readAddressFromSuperchainRegistry(l2ChainIds[i], "SystemConfigProxy")); + ProxyAdmin proxyAdmin = ProxyAdmin(readAddressFromSuperchainRegistry(l2ChainIds[i], "ProxyAdmin")); + require( + proxyAdmin.getProxyImplementation(address(systemConfigProxy)) == newSystemConfigImplAddress, + "SystemConfigProxy implementation not updated" + ); + require( + keccak256(abi.encode(systemConfigProxy.version())) == keccak256(abi.encode("2.3.0")), + "Version not updated" + ); + } + + console.log("All assertions passed!"); + } + + function readAddressFromSuperchainRegistry(string memory chainId, string memory contractName) + internal + view + returns (address) + { + string memory addressesJson; + + // Read addresses json + string memory path = "/lib/superchain-registry/superchain/extra/addresses/addresses.json"; + + try vm.readFile(string.concat(vm.projectRoot(), path)) returns (string memory data) { + addressesJson = data; + } catch { + revert(string.concat("Failed to read ", path)); + } + + return stdJson.readAddress(addressesJson, string.concat("$.", chainId, ".", contractName)); + } + + function getAllowedStorageAccess() internal view override returns (address[] memory allowed) { + address livenessGuard = address(uint160(uint256(vm.load(address(securityCouncilSafe), livenessGuardSlot)))); + + allowed = new address[](9); + + for (uint256 i = 0; i < l2ChainIds.length; i++) { + address systemConfigProxy = readAddressFromSuperchainRegistry(l2ChainIds[i], "SystemConfigProxy"); + allowed[i] = systemConfigProxy; + } + allowed[5] = address(proxyAdminOwnerSafe); + allowed[6] = address(securityCouncilSafe); + allowed[7] = address(fndSafe); + allowed[8] = livenessGuard; + } + + function getCodeExceptions() internal pure override returns (address[] memory) { + address[] memory exceptions = new address[](0); + return exceptions; + } +} diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md new file mode 100644 index 000000000..fe7e6b3c6 --- /dev/null +++ b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md @@ -0,0 +1,57 @@ +# Holocene Hardfork - SystemConfig Upgrade +Upgrades the `SystemConfig.sol` contract for Holocene. + +The batch will be executed on chain ID `11155111`, and contains `3` transactions. + +## Tx #1: ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter) +Upgrades the `SystemConfigProxy`to the StorageSetter. + +**Function Signature:** `upgrade(address,address)` + +**To:** `0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc` + +**Value:** `0 WEI` + +**Raw Input Data:** `0x99a88ec4000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb` + +### Inputs +**_proxy:** `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` + +**_implementation:** `0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB` + + +## Tx #2: SystemConfigProxy.setBytes32(0,0) +Zeroes out the initialized state variable to allow reinitialization. + +**Function Signature:** `setBytes32(bytes32,bytes32)` + +**To:** `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` + +**Value:** `0 WEI` + +**Raw Input Data:** `0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000` + +### Inputs +**_value:** `0x0000000000000000000000000000000000000000000000000000000000000000` + +**_slot:** `0x0000000000000000000000000000000000000000000000000000000000000000` + + +## Tx #3: ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize()) +Upgrades the SystemConfig to a new implementation and initializes it. + +**Function Signature:** `upgradeAndCall(address,address,bytes)` + +**To:** `0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc` + +**Value:** `0 WEI` + +**Raw Input Data:** `0x9623609d000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000` + +### Inputs +**_data:** `0xdb9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` + +**_proxy:** `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` + +**_implementation:** `0x33b83E4C305c908B2Fc181dDa36e230213058d7d` + diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/README.md b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/README.md new file mode 100644 index 000000000..c82e7dcf2 --- /dev/null +++ b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/README.md @@ -0,0 +1,42 @@ +# Holocene Hardfork Upgrade - `SystemConfig` + +Status: DRAFT, NOT READY TO SIGN + +## Objective + +Upgrades the `SystemConfig` for the Holocene hardfork. + +The proposal was: + +- [ ] Posted on the governance forum. +- [ ] Approved by Token House voting. +- [ ] Not vetoed by the Citizens' house. +- [ ] Executed on OP Mainnet. + +The governance proposal should be treated as the source of truth and used to verify the correctness of the onchain operations. + +Governance post of the upgrade can be found at . + +This upgrades the `SystemConfig` in the +[v1.8.0-rc.4](https://github.com/ethereum-optimism/optimism/tree/v1.8.0-rc.4) release. + +## Pre-deployments + +- `SystemConfig` - `0x33b83E4C305c908B2Fc181dDa36e230213058d7d` + +## Simulation + +Please see the "Simulating and Verifying the Transaction" instructions in [NESTED.md](../../../NESTED.md). +When simulating, ensure the logs say `Using script /your/path/to/superchain-ops/tasks//NestedSignFromJson.s.sol`. +This ensures all safety checks are run. If the default `NestedSignFromJson.s.sol` script is shown (without the full path), something is wrong and the safety checks will not run. + +## State Validation + +Please see the instructions for [validation](./VALIDATION.md). + +## Execution + +This upgrade +* Changes the implementation of the `SystemConfig` to hold EIP-1559 parameters for the + +See the [overview](./OVERVIEW.md) and `input.json` bundle for more details. diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md new file mode 100644 index 000000000..7457b5293 --- /dev/null +++ b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -0,0 +1,19 @@ +# Validation + +This document can be used to validate the state diff resulting from the execution of the upgrade +transaction. + +For each contract listed in the state diff, please verify that no contracts or state changes shown in the Tenderly diff are missing from this document. Additionally, please verify that for each contract: + +- The following state changes (and none others) are made to that contract. This validates that no unexpected state changes occur. +- All addresses (in section headers and storage values) match the provided name, using the Etherscan and Superchain Registry links provided. This validates the bytecode deployed at the addresses contains the correct logic. +- All key values match the semantic meaning provided, which can be validated using the storage layout links provided. + +## State Changes + +### `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` (`SystemConfigProxy`) + +- **Key**: `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` + **Before**: `0x00000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d` + **After**: `0x00000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d` + **Meaning**: Updates the `SystemConfig` proxy implementation. diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/input.json b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/input.json new file mode 100644 index 000000000..9a6f1f93b --- /dev/null +++ b/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/input.json @@ -0,0 +1,105 @@ +{ + "chainId": 11155111, + "metadata": { + "name": "Holocene Hardfork - SystemConfig Upgrade", + "description": "Upgrades the `SystemConfig.sol` contract for Holocene." + }, + "transactions": [ + { + "metadata": { + "name": "ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter)", + "description": "Upgrades the `SystemConfigProxy`to the StorageSetter." + }, + "to": "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc", + "data": "0x99a88ec4000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + } + ], + "name": "upgrade", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_proxy": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", + "_implementation": "0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB" + } + }, + { + "metadata": { + "name": "SystemConfigProxy.setBytes32(0,0)", + "description": "Zeroes out the initialized state variable to allow reinitialization." + }, + "to": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", + "data": "0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_slot", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "_value", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "name": "setBytes32", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_slot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "_value": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "metadata": { + "name": "ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize())", + "description": "Upgrades the SystemConfig to a new implementation and initializes it." + }, + "to": "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc", + "data": "0x9623609d000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "upgradeAndCall", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_data": "0xdb9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "_proxy": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", + "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" + } + } + ] +} From 14500b863e261123c5bcdca68984240230a1136a Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 17 Dec 2024 14:39:44 +0000 Subject: [PATCH 02/68] bump task index existing task in flight for 025 --- .../.env | 0 .../NestedSignFromJson.s.sol | 0 .../OVERVIEW.md | 0 .../README.md | 0 .../VALIDATION.md | 0 .../input.json | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename tasks/sep/{025-holocene-system-config-upgrade-and-init-multi-chain => 026-holocene-system-config-upgrade-and-init-multi-chain}/.env (100%) rename tasks/sep/{025-holocene-system-config-upgrade-and-init-multi-chain => 026-holocene-system-config-upgrade-and-init-multi-chain}/NestedSignFromJson.s.sol (100%) rename tasks/sep/{025-holocene-system-config-upgrade-and-init-multi-chain => 026-holocene-system-config-upgrade-and-init-multi-chain}/OVERVIEW.md (100%) rename tasks/sep/{025-holocene-system-config-upgrade-and-init-multi-chain => 026-holocene-system-config-upgrade-and-init-multi-chain}/README.md (100%) rename tasks/sep/{025-holocene-system-config-upgrade-and-init-multi-chain => 026-holocene-system-config-upgrade-and-init-multi-chain}/VALIDATION.md (100%) rename tasks/sep/{025-holocene-system-config-upgrade-and-init-multi-chain => 026-holocene-system-config-upgrade-and-init-multi-chain}/input.json (100%) diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/.env b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/.env similarity index 100% rename from tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/.env rename to tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/.env diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol similarity index 100% rename from tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol rename to tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md similarity index 100% rename from tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md rename to tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/README.md b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/README.md similarity index 100% rename from tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/README.md rename to tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/README.md diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md similarity index 100% rename from tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md rename to tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md diff --git a/tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/input.json b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/input.json similarity index 100% rename from tasks/sep/025-holocene-system-config-upgrade-and-init-multi-chain/input.json rename to tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/input.json From 9c83d58adef96bfefae4ae6f75bbb6d2244e3379 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 17 Dec 2024 15:39:38 +0000 Subject: [PATCH 03/68] undo change to submodule --- lib/base-contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base-contracts b/lib/base-contracts index ed36aac52..494586571 160000 --- a/lib/base-contracts +++ b/lib/base-contracts @@ -1 +1 @@ -Subproject commit ed36aac52a19bdad6dee09c59e7241fe3a194160 +Subproject commit 494586571e1a4d845ee6f381b65229d63c630986 From cc782b3f20151b9b8c321329d0320aa883f5d22e Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 17 Dec 2024 21:00:38 +0000 Subject: [PATCH 04/68] add exceptions for EOAs in SystemConfig storage --- .../NestedSignFromJson.s.sol | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 157915207..4dd071b2f 100644 --- a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -7,6 +7,7 @@ import {Vm, VmSafe} from "forge-std/Vm.sol"; import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; import {console2 as console} from "forge-std/console2.sol"; import {ProxyAdmin} from "@eth-optimism-bedrock/src/universal/ProxyAdmin.sol"; +import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol"; import {stdJson} from "forge-std/StdJson.sol"; /// @title ISemver @@ -114,8 +115,19 @@ contract NestedSignFromJson is OriginalNestedSignFromJson { allowed[8] = livenessGuard; } - function getCodeExceptions() internal pure override returns (address[] memory) { - address[] memory exceptions = new address[](0); + function getCodeExceptions() internal view override returns (address[] memory) { + address[] memory exceptions = new address[](4 * l2ChainIds.length); + for (uint256 i = 0; i < l2ChainIds.length; i += 4) { + SystemConfig systemConfigProxy = + SystemConfig(readAddressFromSuperchainRegistry(l2ChainIds[i], "SystemConfigProxy")); + // The following are all EOAs which will be "updated" (to their original values) + // When we reinit the SystemConfig. So we need to except them from the check + // which complains when it finds addresses in storage with no code. + exceptions[i] = systemConfigProxy.owner(); // NOTE this can be removed for mainnet + exceptions[i + 1] = address(uint160(uint256((systemConfigProxy.batcherHash())))); + exceptions[i + 2] = systemConfigProxy.unsafeBlockSigner(); + exceptions[i + 3] = systemConfigProxy.batchInbox(); + } return exceptions; } } From dcd607cd25ee9d31392436549f4f1650801d9fe9 Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 11:15:52 +0000 Subject: [PATCH 05/68] bump task sequence number --- .../.env | 0 .../NestedSignFromJson.s.sol | 0 .../OVERVIEW.md | 0 .../README.md | 0 .../VALIDATION.md | 0 .../input.json | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename tasks/sep/{026-holocene-system-config-upgrade-and-init-multi-chain => 027-holocene-system-config-upgrade-and-init-multi-chain}/.env (100%) rename tasks/sep/{026-holocene-system-config-upgrade-and-init-multi-chain => 027-holocene-system-config-upgrade-and-init-multi-chain}/NestedSignFromJson.s.sol (100%) rename tasks/sep/{026-holocene-system-config-upgrade-and-init-multi-chain => 027-holocene-system-config-upgrade-and-init-multi-chain}/OVERVIEW.md (100%) rename tasks/sep/{026-holocene-system-config-upgrade-and-init-multi-chain => 027-holocene-system-config-upgrade-and-init-multi-chain}/README.md (100%) rename tasks/sep/{026-holocene-system-config-upgrade-and-init-multi-chain => 027-holocene-system-config-upgrade-and-init-multi-chain}/VALIDATION.md (100%) rename tasks/sep/{026-holocene-system-config-upgrade-and-init-multi-chain => 027-holocene-system-config-upgrade-and-init-multi-chain}/input.json (100%) diff --git a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/.env b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/.env similarity index 100% rename from tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/.env rename to tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/.env diff --git a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol similarity index 100% rename from tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol rename to tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol diff --git a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md similarity index 100% rename from tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md rename to tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md diff --git a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/README.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md similarity index 100% rename from tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/README.md rename to tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md diff --git a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md similarity index 100% rename from tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md rename to tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md diff --git a/tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/input.json b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json similarity index 100% rename from tasks/sep/026-holocene-system-config-upgrade-and-init-multi-chain/input.json rename to tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json From c04293ca419ac03ac44c0277592b80a935548be4 Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 15:24:58 +0000 Subject: [PATCH 06/68] change validation script to use Seb's new framework --- lib/superchain-registry | 2 +- script/verification/IResourceMetering.sol | 27 ++++ script/verification/ISystemConfig.sol | 87 ++++++++++++ script/verification/SystemConfigUpgrade.s.sol | 72 ++++++++++ .../NestedSignFromJson.s.sol | 130 +++--------------- 5 files changed, 209 insertions(+), 109 deletions(-) create mode 100644 script/verification/IResourceMetering.sol create mode 100644 script/verification/ISystemConfig.sol create mode 100644 script/verification/SystemConfigUpgrade.s.sol diff --git a/lib/superchain-registry b/lib/superchain-registry index 2a82b7922..b05aa1f9c 160000 --- a/lib/superchain-registry +++ b/lib/superchain-registry @@ -1 +1 @@ -Subproject commit 2a82b7922a7d719e4243846c679e4a9946d04b8c +Subproject commit b05aa1f9c876bc20fef15d15b39d00846a788add diff --git a/script/verification/IResourceMetering.sol b/script/verification/IResourceMetering.sol new file mode 100644 index 000000000..1c5a5174b --- /dev/null +++ b/script/verification/IResourceMetering.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IResourceMetering { + struct ResourceParams { + uint128 prevBaseFee; + uint64 prevBoughtGas; + uint64 prevBlockNum; + } + + struct ResourceConfig { + uint32 maxResourceLimit; + uint8 elasticityMultiplier; + uint8 baseFeeMaxChangeDenominator; + uint32 minimumBaseFee; + uint32 systemTxMaxGas; + uint128 maximumBaseFee; + } + + error OutOfGas(); + + event Initialized(uint8 version); + + function params() external view returns (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum); // nosemgrep + + function __constructor__() external; +} diff --git a/script/verification/ISystemConfig.sol b/script/verification/ISystemConfig.sol new file mode 100644 index 000000000..d1c34e308 --- /dev/null +++ b/script/verification/ISystemConfig.sol @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IResourceMetering} from "./IResourceMetering.sol"; + +/// @notice This interface corresponds to the Custom Gas Token version of the SystemConfig contract. +interface ISystemConfig { + enum UpdateType { + BATCHER, + FEE_SCALARS, + GAS_LIMIT, + UNSAFE_BLOCK_SIGNER, + EIP_1559_PARAMS + } + + struct Addresses { + address l1CrossDomainMessenger; + address l1ERC721Bridge; + address l1StandardBridge; + address disputeGameFactory; + address optimismPortal; + address optimismMintableERC20Factory; + address gasPayingToken; + } + + event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data); + event Initialized(uint8 version); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + function BATCH_INBOX_SLOT() external view returns (bytes32); + function DISPUTE_GAME_FACTORY_SLOT() external view returns (bytes32); + function L1_CROSS_DOMAIN_MESSENGER_SLOT() external view returns (bytes32); + function L1_ERC_721_BRIDGE_SLOT() external view returns (bytes32); + function L1_STANDARD_BRIDGE_SLOT() external view returns (bytes32); + function OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT() external view returns (bytes32); + function OPTIMISM_PORTAL_SLOT() external view returns (bytes32); + function START_BLOCK_SLOT() external view returns (bytes32); + function UNSAFE_BLOCK_SIGNER_SLOT() external view returns (bytes32); + function VERSION() external view returns (uint256); + function basefeeScalar() external view returns (uint32); + function batchInbox() external view returns (address addr_); + function batcherHash() external view returns (bytes32); + function blobbasefeeScalar() external view returns (uint32); + function disputeGameFactory() external view returns (address addr_); + function gasLimit() external view returns (uint64); + function eip1559Denominator() external view returns (uint32); + function eip1559Elasticity() external view returns (uint32); + function gasPayingToken() external view returns (address addr_, uint8 decimals_); + function gasPayingTokenName() external view returns (string memory name_); + function gasPayingTokenSymbol() external view returns (string memory symbol_); + function initialize( + address _owner, + uint32 _basefeeScalar, + uint32 _blobbasefeeScalar, + bytes32 _batcherHash, + uint64 _gasLimit, + address _unsafeBlockSigner, + IResourceMetering.ResourceConfig memory _config, + address _batchInbox, + Addresses memory _addresses + ) external; + function isCustomGasToken() external view returns (bool); + function l1CrossDomainMessenger() external view returns (address addr_); + function l1ERC721Bridge() external view returns (address addr_); + function l1StandardBridge() external view returns (address addr_); + function maximumGasLimit() external pure returns (uint64); + function minimumGasLimit() external view returns (uint64); + function optimismMintableERC20Factory() external view returns (address addr_); + function optimismPortal() external view returns (address addr_); + function overhead() external view returns (uint256); + function owner() external view returns (address); + function renounceOwnership() external; + function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory); + function scalar() external view returns (uint256); + function setBatcherHash(bytes32 _batcherHash) external; + function setGasConfig(uint256 _overhead, uint256 _scalar) external; + function setGasConfigEcotone(uint32 _basefeeScalar, uint32 _blobbasefeeScalar) external; + function setGasLimit(uint64 _gasLimit) external; + function setUnsafeBlockSigner(address _unsafeBlockSigner) external; + function setEIP1559Params(uint32 _denominator, uint32 _elasticity) external; + function startBlock() external view returns (uint256 startBlock_); + function transferOwnership(address newOwner) external; // nosemgrep + function unsafeBlockSigner() external view returns (address addr_); + function version() external pure returns (string memory); + + function __constructor__() external; +} diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol new file mode 100644 index 000000000..2ccd17fc7 --- /dev/null +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.15; + +import {console2 as console} from "forge-std/console2.sol"; +import {Vm} from "forge-std/Vm.sol"; +import {LibString} from "solady/utils/LibString.sol"; +import {VerificationBase, SuperchainRegistry} from "script/verification/Verification.s.sol"; +import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; +import {ISystemConfig} from "./ISystemConfig.sol"; +import {IResourceMetering} from "./IResourceMetering.sol"; +import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; +import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; +import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; + +contract SystemConfigUpgrade is VerificationBase, SuperchainRegistry { + using LibString for string; + + struct SysCfgVars { + address owner; + uint256 scalar; + bytes32 batcherHash; + uint256 gasLimit; + address unsafeBlockSigner; + IResourceMetering.ResourceConfig resourceConfig; + address batchInbox; + address gasPayingToken; + address l1CrossDomainMessenger; + address l1StandardBridge; + address l1ERC721Bridge; + address disputeGameFactory; + address optimismPortal; + address optimismMintableERC20Factory; + } + + SysCfgVars expected; + + constructor(string memory l1ChainName, string memory l2ChainName, string memory release) + SuperchainRegistry(l1ChainName, l2ChainName, release) + { + expected = getSysCfgVars(); + addAllowedStorageAccess(proxies.SystemConfig); + } + + function getSysCfgVars() internal view returns (SysCfgVars memory) { + ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); + + (address gasPayingToken,) = sysCfg.gasPayingToken(); + + return SysCfgVars({ + owner: sysCfg.owner(), + scalar: sysCfg.scalar(), + batcherHash: sysCfg.batcherHash(), + gasLimit: sysCfg.gasLimit(), + unsafeBlockSigner: sysCfg.unsafeBlockSigner(), + resourceConfig: sysCfg.resourceConfig(), + batchInbox: sysCfg.batchInbox(), + gasPayingToken: gasPayingToken, + l1CrossDomainMessenger: sysCfg.l1CrossDomainMessenger(), + l1StandardBridge: sysCfg.l1StandardBridge(), + l1ERC721Bridge: sysCfg.l1ERC721Bridge(), + disputeGameFactory: sysCfg.disputeGameFactory(), + optimismPortal: sysCfg.optimismPortal(), + optimismMintableERC20Factory: sysCfg.optimismMintableERC20Factory() + }); + } + + /// @notice Public function that must be called by the verification script. + function checkSystemConfigUpgrade() public view { + SysCfgVars memory got = getSysCfgVars(); + require(keccak256(abi.encode(got)) == keccak256(abi.encode(expected)), "system-config-100"); + } +} diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 4dd071b2f..5ba0df8ee 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -1,133 +1,47 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.15; -import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSignFromJson.s.sol"; -import {GnosisSafe} from "safe-contracts/GnosisSafe.sol"; -import {Vm, VmSafe} from "forge-std/Vm.sol"; -import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; import {console2 as console} from "forge-std/console2.sol"; -import {ProxyAdmin} from "@eth-optimism-bedrock/src/universal/ProxyAdmin.sol"; -import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol"; -import {stdJson} from "forge-std/StdJson.sol"; - -/// @title ISemver -/// @notice ISemver is a simple contract for ensuring that contracts are -/// versioned using semantic versioning. -interface ISemver { - /// @notice Getter for the semantic version of the contract. This is not - /// meant to be used onchain but instead meant to be used by offchain - /// tooling. - /// @return Semver contract version as a string. - function version() external view returns (string memory); -} - -contract NestedSignFromJson is OriginalNestedSignFromJson { +import {Vm} from "forge-std/Vm.sol"; +import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; +import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSignFromJson.s.sol"; +import {DisputeGameUpgrade} from "script/verification/DisputeGameUpgrade.s.sol"; +import {CouncilFoundationNestedSign} from "script/verification/CouncilFoundationNestedSign.s.sol"; +import {SuperchainRegistry} from "script/verification/Verification.s.sol"; +import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol"; + +contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { + string constant l1ChainName = "sepolia"; + string constant release = "v1.8.0-rc.4"; string[1] l2ChainIds = [ - "11155420" // op + "op" // op // "1740", // metal TODO // "919", // mode TODO // "999999999" // zora TODO ]; - // The slot used to store the livenessGuard address in GnosisSafe. - // See https://github.com/safe-global/safe-smart-account/blob/186a21a74b327f17fc41217a927dea7064f74604/contracts/base/GuardManager.sol#L30 - bytes32 livenessGuardSlot = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8; + SystemConfigUpgrade[1] sysCfgUpgrades; - address newSystemConfigImplAddress = 0x33b83E4C305c908B2Fc181dDa36e230213058d7d; - - // Safe contract for this task. - GnosisSafe securityCouncilSafe = GnosisSafe(payable(vm.envAddress("COUNCIL_SAFE"))); - GnosisSafe fndSafe = GnosisSafe(payable(vm.envAddress("FOUNDATION_SAFE"))); - GnosisSafe proxyAdminOwnerSafe = GnosisSafe(payable(vm.envAddress("OWNER_SAFE"))); - - /// @notice Sets up the contract - function setUp() public {} - - function checkProxyAdminproxyAdminOwnerSafe(string memory l2ChainId) internal view { - ProxyAdmin proxyAdmin = ProxyAdmin(readAddressFromSuperchainRegistry(l2ChainId, "ProxyAdmin")); - - address proxyAdminOwner = proxyAdmin.owner(); - require(proxyAdminOwner == address(proxyAdminOwnerSafe), "checkProxyAdminproxyAdminOwnerSafe-260"); - - address[] memory owners = proxyAdminOwnerSafe.getOwners(); - require(owners.length == 2, "checkProxyAdminproxyAdminOwnerSafe-270"); - require(proxyAdminOwnerSafe.isOwner(address(fndSafe)), "checkProxyAdminproxyAdminOwnerSafe-300"); - require(proxyAdminOwnerSafe.isOwner(address(securityCouncilSafe)), "checkProxyAdminproxyAdminOwnerSafe-400"); + constructor() { + for (uint256 i = 0; i < l2ChainIds.length; i++) { + sysCfgUpgrades[i] = new SystemConfigUpgrade(l1ChainName, l2ChainIds[i], release); + } } - /// @notice Checks the correctness of the deployment - function _postCheck(Vm.AccountAccess[] memory accesses, Simulation.Payload memory /* simPayload */ ) - internal - view - override - { + function _postCheck(Vm.AccountAccess[] memory accesses, Simulation.Payload memory) internal view override { console.log("Running post-deploy assertions"); checkStateDiff(accesses); for (uint256 i = 0; i < l2ChainIds.length; i++) { - console.log("Running checks on chain with iD ", l2ChainIds[i]); - checkProxyAdminproxyAdminOwnerSafe(l2ChainIds[i]); - ISemver systemConfigProxy = ISemver(readAddressFromSuperchainRegistry(l2ChainIds[i], "SystemConfigProxy")); - ProxyAdmin proxyAdmin = ProxyAdmin(readAddressFromSuperchainRegistry(l2ChainIds[i], "ProxyAdmin")); - require( - proxyAdmin.getProxyImplementation(address(systemConfigProxy)) == newSystemConfigImplAddress, - "SystemConfigProxy implementation not updated" - ); - require( - keccak256(abi.encode(systemConfigProxy.version())) == keccak256(abi.encode("2.3.0")), - "Version not updated" - ); + sysCfgUpgrades[i].checkSystemConfigUpgrade(); } - console.log("All assertions passed!"); } - function readAddressFromSuperchainRegistry(string memory chainId, string memory contractName) - internal - view - returns (address) - { - string memory addressesJson; - - // Read addresses json - string memory path = "/lib/superchain-registry/superchain/extra/addresses/addresses.json"; - - try vm.readFile(string.concat(vm.projectRoot(), path)) returns (string memory data) { - addressesJson = data; - } catch { - revert(string.concat("Failed to read ", path)); - } - - return stdJson.readAddress(addressesJson, string.concat("$.", chainId, ".", contractName)); - } - - function getAllowedStorageAccess() internal view override returns (address[] memory allowed) { - address livenessGuard = address(uint160(uint256(vm.load(address(securityCouncilSafe), livenessGuardSlot)))); - - allowed = new address[](9); - - for (uint256 i = 0; i < l2ChainIds.length; i++) { - address systemConfigProxy = readAddressFromSuperchainRegistry(l2ChainIds[i], "SystemConfigProxy"); - allowed[i] = systemConfigProxy; - } - allowed[5] = address(proxyAdminOwnerSafe); - allowed[6] = address(securityCouncilSafe); - allowed[7] = address(fndSafe); - allowed[8] = livenessGuard; + function getAllowedStorageAccess() internal view override returns (address[] memory) { + return allowedStorageAccess; } function getCodeExceptions() internal view override returns (address[] memory) { - address[] memory exceptions = new address[](4 * l2ChainIds.length); - for (uint256 i = 0; i < l2ChainIds.length; i += 4) { - SystemConfig systemConfigProxy = - SystemConfig(readAddressFromSuperchainRegistry(l2ChainIds[i], "SystemConfigProxy")); - // The following are all EOAs which will be "updated" (to their original values) - // When we reinit the SystemConfig. So we need to except them from the check - // which complains when it finds addresses in storage with no code. - exceptions[i] = systemConfigProxy.owner(); // NOTE this can be removed for mainnet - exceptions[i + 1] = address(uint160(uint256((systemConfigProxy.batcherHash())))); - exceptions[i + 2] = systemConfigProxy.unsafeBlockSigner(); - exceptions[i + 3] = systemConfigProxy.batchInbox(); - } - return exceptions; + return codeExceptions; } } From eb21f18f21b6af3ef696491505053a4fd7518a1f Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 16:04:29 +0000 Subject: [PATCH 07/68] addAllowedStorageAccess for each system config --- script/verification/SystemConfigUpgrade.s.sol | 9 +++++---- .../NestedSignFromJson.s.sol | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index 2ccd17fc7..6c02f1b96 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.15; import {console2 as console} from "forge-std/console2.sol"; import {Vm} from "forge-std/Vm.sol"; import {LibString} from "solady/utils/LibString.sol"; -import {VerificationBase, SuperchainRegistry} from "script/verification/Verification.s.sol"; +import {SuperchainRegistry} from "script/verification/Verification.s.sol"; import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; import {ISystemConfig} from "./ISystemConfig.sol"; import {IResourceMetering} from "./IResourceMetering.sol"; @@ -12,7 +12,7 @@ import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; -contract SystemConfigUpgrade is VerificationBase, SuperchainRegistry { +contract SystemConfigUpgrade is SuperchainRegistry { using LibString for string; struct SysCfgVars { @@ -32,13 +32,14 @@ contract SystemConfigUpgrade is VerificationBase, SuperchainRegistry { address optimismMintableERC20Factory; } + address public systemConfigAddress; SysCfgVars expected; constructor(string memory l1ChainName, string memory l2ChainName, string memory release) SuperchainRegistry(l1ChainName, l2ChainName, release) { - expected = getSysCfgVars(); - addAllowedStorageAccess(proxies.SystemConfig); + systemConfigAddress = proxies.SystemConfig; + expected = getSysCfgVars(); // Set this before the tx is executed. } function getSysCfgVars() internal view returns (SysCfgVars memory) { diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 5ba0df8ee..86c55059a 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -7,7 +7,7 @@ import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSignFromJson.s.sol"; import {DisputeGameUpgrade} from "script/verification/DisputeGameUpgrade.s.sol"; import {CouncilFoundationNestedSign} from "script/verification/CouncilFoundationNestedSign.s.sol"; -import {SuperchainRegistry} from "script/verification/Verification.s.sol"; +import {VerificationBase, SuperchainRegistry} from "script/verification/Verification.s.sol"; import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol"; contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { @@ -25,6 +25,7 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest constructor() { for (uint256 i = 0; i < l2ChainIds.length; i++) { sysCfgUpgrades[i] = new SystemConfigUpgrade(l1ChainName, l2ChainIds[i], release); + addAllowedStorageAccess(sysCfgUpgrades[i].systemConfigAddress()); } } From 401443836bcf38561fbfc37ea8a454cc54308e0e Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 16:16:11 +0000 Subject: [PATCH 08/68] SystemConfigUpgrade exposes code exceptions thru getter --- script/verification/SystemConfigUpgrade.s.sol | 9 +++++++++ .../NestedSignFromJson.s.sol | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index 6c02f1b96..e4edb66d6 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -70,4 +70,13 @@ contract SystemConfigUpgrade is SuperchainRegistry { SysCfgVars memory got = getSysCfgVars(); require(keccak256(abi.encode(got)) == keccak256(abi.encode(expected)), "system-config-100"); } + + function getCodeExceptions() public view returns (address[] memory) { + address[] memory exceptions = new address[](4); + exceptions[0] = expected.owner; // NOTE this can be removed for mainnet + exceptions[1] = address(uint160(uint256((expected.batcherHash)))); + exceptions[2] = expected.unsafeBlockSigner; + exceptions[3] = expected.batchInbox; + return exceptions; + } } diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 86c55059a..ffd4e7a56 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -26,6 +26,10 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest for (uint256 i = 0; i < l2ChainIds.length; i++) { sysCfgUpgrades[i] = new SystemConfigUpgrade(l1ChainName, l2ChainIds[i], release); addAllowedStorageAccess(sysCfgUpgrades[i].systemConfigAddress()); + address[] memory exceptions = sysCfgUpgrades[i].getCodeExceptions(); + for (uint256 j = 0; j < exceptions.length; j++) { + addCodeException(exceptions[j]); + } } } From fcda94c24bc8dbcc2d0013be93e6411a982dd8e6 Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 16:31:28 +0000 Subject: [PATCH 09/68] introduce SystemConfigUpgradeEcotoneScalars --- script/verification/SystemConfigUpgrade.s.sol | 16 +++++----- .../SystemConfigUpgradeEcotoneScalars.s.sol | 31 +++++++++++++++++++ .../NestedSignFromJson.s.sol | 3 +- 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 script/verification/SystemConfigUpgradeEcotoneScalars.s.sol diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index e4edb66d6..e4ec72241 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -33,13 +33,13 @@ contract SystemConfigUpgrade is SuperchainRegistry { } address public systemConfigAddress; - SysCfgVars expected; + SysCfgVars previous; constructor(string memory l1ChainName, string memory l2ChainName, string memory release) SuperchainRegistry(l1ChainName, l2ChainName, release) { systemConfigAddress = proxies.SystemConfig; - expected = getSysCfgVars(); // Set this before the tx is executed. + previous = getSysCfgVars(); // Set this before the tx is executed. } function getSysCfgVars() internal view returns (SysCfgVars memory) { @@ -66,17 +66,17 @@ contract SystemConfigUpgrade is SuperchainRegistry { } /// @notice Public function that must be called by the verification script. - function checkSystemConfigUpgrade() public view { + function checkSystemConfigUpgrade() public view virtual { SysCfgVars memory got = getSysCfgVars(); - require(keccak256(abi.encode(got)) == keccak256(abi.encode(expected)), "system-config-100"); + require(keccak256(abi.encode(got)) == keccak256(abi.encode(previous)), "system-config-100"); } function getCodeExceptions() public view returns (address[] memory) { address[] memory exceptions = new address[](4); - exceptions[0] = expected.owner; // NOTE this can be removed for mainnet - exceptions[1] = address(uint160(uint256((expected.batcherHash)))); - exceptions[2] = expected.unsafeBlockSigner; - exceptions[3] = expected.batchInbox; + exceptions[0] = previous.owner; // NOTE this can be removed for mainnet + exceptions[1] = address(uint160(uint256((previous.batcherHash)))); + exceptions[2] = previous.unsafeBlockSigner; + exceptions[3] = previous.batchInbox; return exceptions; } } diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol new file mode 100644 index 000000000..1e634b960 --- /dev/null +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.15; + +import {console2 as console} from "forge-std/console2.sol"; +import {Vm} from "forge-std/Vm.sol"; +import {LibString} from "solady/utils/LibString.sol"; +import {SuperchainRegistry} from "script/verification/Verification.s.sol"; +import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; +import {ISystemConfig} from "./ISystemConfig.sol"; +import {IResourceMetering} from "./IResourceMetering.sol"; +import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; +import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; +import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; +import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol"; + +contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { + using LibString for string; + + constructor(string memory l1ChainName, string memory l2ChainName, string memory release) + SystemConfigUpgrade(l1ChainName, l2ChainName, release) + {} + + /// @notice Public function that must be called by the verification script. + function checkSystemConfigUpgrade() public view override { + super.checkSystemConfigUpgrade(); + ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); + uint256 reencodedScalar = + (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); + require(reencodedScalar == previous.scalar, "scalar-100"); + } +} diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index ffd4e7a56..7592693f3 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -8,7 +8,8 @@ import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSig import {DisputeGameUpgrade} from "script/verification/DisputeGameUpgrade.s.sol"; import {CouncilFoundationNestedSign} from "script/verification/CouncilFoundationNestedSign.s.sol"; import {VerificationBase, SuperchainRegistry} from "script/verification/Verification.s.sol"; -import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol"; +import {SystemConfigUpgradeEcotoneScalars as SystemConfigUpgrade} from + "script/verification/SystemConfigUpgradeEcotoneScalars.s.sol"; contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { string constant l1ChainName = "sepolia"; From d130513bdb8b8606670d18486c848d55626f9a3c Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 16:47:35 +0000 Subject: [PATCH 10/68] add deprecation notice to task 020 --- .../020-holocene-system-config-upgrade-multi-chain/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md b/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md index dc592caae..6f612593e 100644 --- a/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md +++ b/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md @@ -2,6 +2,8 @@ Status: [EXECUTED](https://sepolia.etherscan.io/tx/0x88bd1d85740af3741e2ed96d6fd07f2abb4541afc667625480bf6a28451c4d6d) +> ⚠️ **Warning:** This task is incorrect and is superceded by [Task 027](../027-holocene-system-config-upgrade-and-init-multi-chain/) + ## Objective Upgrades the `SystemConfig` for the Holocene hardfork for Sepolia/{OP,Mode,Metal,Zora,Base}. From ef183997bd3ef13a7265994aaf3e2beda43423e0 Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 17:07:06 +0000 Subject: [PATCH 11/68] remove unecessary forge build commands Closes https://github.com/ethereum-optimism/superchain-ops/issues/423 --- nested.just | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nested.just b/nested.just index d2ac7e97e..2b89e2ce3 100644 --- a/nested.just +++ b/nested.just @@ -48,7 +48,6 @@ simulate whichSafe hdPath='0': fi echo "" - forge build forge script ${script} \ --rpc-url ${rpcUrl} \ --sender ${signer} \ @@ -85,7 +84,6 @@ sign whichSafe hdPath='0': echo "Signing with: ${signer}" echo "" - forge build # Using the eip712sign within the repo folder since eip712sign was installed there in ./justfile. $(git rev-parse --show-toplevel)/bin/eip712sign --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" -- \ forge script ${script} \ @@ -120,7 +118,6 @@ approve whichSafe hdPath='0': fi sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") - forge build forge script ${script} \ --fork-url ${rpcUrl} \ --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" \ @@ -142,7 +139,6 @@ execute hdPath='0': echo "Using script ${script}" sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") - forge build forge script ${script} \ --fork-url ${rpcUrl} \ --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" \ @@ -161,7 +157,6 @@ simulated-run hdPath='0': fi echo "Using script ${script}" - forge build forge script ${script} \ --fork-url ${rpcUrl} \ --sender ${randomPersonEoa} \ From 35b47188497d36c33a0b5d6b3b5a96760117fcaa Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 18 Dec 2024 17:10:28 +0000 Subject: [PATCH 12/68] add some logging --- .../verification/SystemConfigUpgradeEcotoneScalars.s.sol | 6 ++++++ .../NestedSignFromJson.s.sol | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index 1e634b960..b5ef3f4dd 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -26,6 +26,12 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); + console.log( + "confirmed baseFeeScalar and blobbaseFeeScalar reecode to scalar: ", + sysCfg.basefeeScalar(), + sysCfg.blobbasefeeScalar(), + reencodedScalar + ); require(reencodedScalar == previous.scalar, "scalar-100"); } } diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 7592693f3..1cd8e2aa7 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -14,7 +14,7 @@ import {SystemConfigUpgradeEcotoneScalars as SystemConfigUpgrade} from contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { string constant l1ChainName = "sepolia"; string constant release = "v1.8.0-rc.4"; - string[1] l2ChainIds = [ + string[1] l2ChainNames = [ "op" // op // "1740", // metal TODO // "919", // mode TODO @@ -24,8 +24,8 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest SystemConfigUpgrade[1] sysCfgUpgrades; constructor() { - for (uint256 i = 0; i < l2ChainIds.length; i++) { - sysCfgUpgrades[i] = new SystemConfigUpgrade(l1ChainName, l2ChainIds[i], release); + for (uint256 i = 0; i < l2ChainNames.length; i++) { + sysCfgUpgrades[i] = new SystemConfigUpgrade(l1ChainName, l2ChainNames[i], release); addAllowedStorageAccess(sysCfgUpgrades[i].systemConfigAddress()); address[] memory exceptions = sysCfgUpgrades[i].getCodeExceptions(); for (uint256 j = 0; j < exceptions.length; j++) { @@ -37,7 +37,8 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest function _postCheck(Vm.AccountAccess[] memory accesses, Simulation.Payload memory) internal view override { console.log("Running post-deploy assertions"); checkStateDiff(accesses); - for (uint256 i = 0; i < l2ChainIds.length; i++) { + for (uint256 i = 0; i < l2ChainNames.length; i++) { + console.log("Running post-deploy assertions for chain", l2ChainNames[i], "-", l1ChainName); sysCfgUpgrades[i].checkSystemConfigUpgrade(); } console.log("All assertions passed!"); From 1355535e43f6d2b836dbe0282ed3fd62e45931d4 Mon Sep 17 00:00:00 2001 From: geoknee Date: Thu, 19 Dec 2024 10:28:19 +0000 Subject: [PATCH 13/68] reactivate all chains --- .../NestedSignFromJson.s.sol | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 1cd8e2aa7..dc5a063e6 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -14,12 +14,7 @@ import {SystemConfigUpgradeEcotoneScalars as SystemConfigUpgrade} from contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { string constant l1ChainName = "sepolia"; string constant release = "v1.8.0-rc.4"; - string[1] l2ChainNames = [ - "op" // op - // "1740", // metal TODO - // "919", // mode TODO - // "999999999" // zora TODO - ]; + string[4] l2ChainNames = ["op", "metal", "mode", "zora"]; SystemConfigUpgrade[1] sysCfgUpgrades; From bb163d96b0d1e60c60e297811f00202dfc9bca5e Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 20 Dec 2024 13:50:39 +0000 Subject: [PATCH 14/68] update to superbundle --- .../input.json | 212 +++++++++++++++++- 1 file changed, 202 insertions(+), 10 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json index 9a6f1f93b..3f46f2149 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json @@ -1,8 +1,8 @@ { "chainId": 11155111, "metadata": { - "name": "Holocene Hardfork - SystemConfig Upgrade", - "description": "Upgrades the `SystemConfig.sol` contract for Holocene." + "name": "Holocene Hardfork - Multichain SystemConfig Upgrade", + "description": "Upgrades the 'SystemConfig' contract for Holocene for {op,mode,metal,zora}-sepolia" }, "transactions": [ { @@ -10,8 +10,8 @@ "name": "ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter)", "description": "Upgrades the `SystemConfigProxy`to the StorageSetter." }, - "to": "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc", - "data": "0x99a88ec4000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", + "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", + "data": "0x99a88ec40000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", "value": "0", "contractMethod": { "inputs": [ @@ -31,7 +31,7 @@ "outputs": [] }, "contractInputsValues": { - "_proxy": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", + "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", "_implementation": "0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB" } }, @@ -40,7 +40,7 @@ "name": "SystemConfigProxy.setBytes32(0,0)", "description": "Zeroes out the initialized state variable to allow reinitialization." }, - "to": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", + "to": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", "data": "0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "value": "0", "contractMethod": { @@ -70,8 +70,8 @@ "name": "ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize())", "description": "Upgrades the SystemConfig to a new implementation and initializes it." }, - "to": "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc", - "data": "0x9623609d000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", + "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", + "data": "0x9623609d0000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", "value": "0", "contractMethod": { "inputs": [ @@ -96,8 +96,200 @@ "outputs": [] }, "contractInputsValues": { - "_data": "0xdb9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "_proxy": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", + "_data": "0xdb9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" + } + }, + { + "metadata": { + "name": "ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter)", + "description": "Upgrades the `SystemConfigProxy`to the StorageSetter." + }, + "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", + "data": "0x99a88ec40000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + } + ], + "name": "upgrade", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_implementation": "0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB" + } + }, + { + "metadata": { + "name": "SystemConfigProxy.setBytes32(0,0)", + "description": "Zeroes out the initialized state variable to allow reinitialization." + }, + "to": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "data": "0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_slot", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "_value", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "name": "setBytes32", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_slot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "_value": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "metadata": { + "name": "ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize())", + "description": "Upgrades the SystemConfig to a new implementation and initializes it." + }, + "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", + "data": "0x9623609d0000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "upgradeAndCall", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_data": "0xdb9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" + } + }, + { + "metadata": { + "name": "ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter)", + "description": "Upgrades the `SystemConfigProxy`to the StorageSetter." + }, + "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", + "data": "0x99a88ec40000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + } + ], + "name": "upgrade", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_implementation": "0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB" + } + }, + { + "metadata": { + "name": "SystemConfigProxy.setBytes32(0,0)", + "description": "Zeroes out the initialized state variable to allow reinitialization." + }, + "to": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "data": "0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_slot", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "_value", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "name": "setBytes32", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_slot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "_value": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "metadata": { + "name": "ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize())", + "description": "Upgrades the SystemConfig to a new implementation and initializes it." + }, + "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", + "data": "0x9623609d0000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "upgradeAndCall", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_data": "0xdb9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" } } From 0b39283c77b173bcb4b786c22ae257cb494ab524 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 20 Dec 2024 14:14:10 +0000 Subject: [PATCH 15/68] TEMP: do not try to load all contract addresses (some chains do not have them, e.g. metal) --- script/verification/Verification.s.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script/verification/Verification.s.sol b/script/verification/Verification.s.sol index 6a00f1bae..d090a1d63 100644 --- a/script/verification/Verification.s.sol +++ b/script/verification/Verification.s.sol @@ -100,12 +100,14 @@ contract SuperchainRegistry is CommonBase { proxies.L1CrossDomainMessenger = stdToml.readAddress(toml, "$.addresses.L1CrossDomainMessengerProxy"); proxies.L1StandardBridge = stdToml.readAddress(toml, "$.addresses.L1StandardBridgeProxy"); proxies.SystemConfig = stdToml.readAddress(toml, "$.addresses.SystemConfigProxy"); - proxies.AnchorStateRegistry = stdToml.readAddress(toml, "$.addresses.AnchorStateRegistryProxy"); - proxies.DisputeGameFactory = stdToml.readAddress(toml, "$.addresses.DisputeGameFactoryProxy"); + + // TODO handle chains which are missing these values: + // proxies.AnchorStateRegistry = stdToml.readAddress(toml, "$.addresses.AnchorStateRegistryProxy"); + // proxies.DisputeGameFactory = stdToml.readAddress(toml, "$.addresses.DisputeGameFactoryProxy"); + // chainConfig.unsafeBlockSigner = stdToml.readAddress(toml, "$.addresses.UnsafeBlockSigner"); chainConfig.chainId = stdToml.readUint(toml, "$.chain_id"); chainConfig.systemConfigOwner = stdToml.readAddress(toml, "$.addresses.SystemConfigOwner"); - chainConfig.unsafeBlockSigner = stdToml.readAddress(toml, "$.addresses.UnsafeBlockSigner"); chainConfig.batchSubmitter = stdToml.readAddress(toml, "$.addresses.BatchSubmitter"); chainConfig.batchInbox = stdToml.readAddress(toml, "$.batch_inbox_addr"); } From 85aac3a85aa8335b21d918ad9657db78981523cc Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 20 Dec 2024 14:14:20 +0000 Subject: [PATCH 16/68] improve err msg --- script/verification/SystemConfigUpgradeEcotoneScalars.s.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index b5ef3f4dd..dc4cc5fc7 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -27,11 +27,11 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); console.log( - "confirmed baseFeeScalar and blobbaseFeeScalar reecode to scalar: ", + "checking baseFeeScalar and blobbaseFeeScalar reecode to scalar: ", sysCfg.basefeeScalar(), sysCfg.blobbasefeeScalar(), reencodedScalar ); - require(reencodedScalar == previous.scalar, "scalar-100"); + require(reencodedScalar == previous.scalar, "scalar-100 (reencoding produced incorrect result)"); } } From ca3699e066cf7adc16727c171b90996552be349a Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 20 Dec 2024 16:54:49 +0000 Subject: [PATCH 17/68] fix superbundle --- .../input.json | 128 +++++++++++++++--- 1 file changed, 112 insertions(+), 16 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json index 3f46f2149..6b52ff1ca 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/input.json @@ -10,8 +10,8 @@ "name": "ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter)", "description": "Upgrades the `SystemConfigProxy`to the StorageSetter." }, - "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", - "data": "0x99a88ec40000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", + "to": "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc", + "data": "0x99a88ec4000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", "value": "0", "contractMethod": { "inputs": [ @@ -31,7 +31,7 @@ "outputs": [] }, "contractInputsValues": { - "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_proxy": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", "_implementation": "0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB" } }, @@ -40,7 +40,7 @@ "name": "SystemConfigProxy.setBytes32(0,0)", "description": "Zeroes out the initialized state variable to allow reinitialization." }, - "to": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "to": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", "data": "0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "value": "0", "contractMethod": { @@ -70,8 +70,8 @@ "name": "ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize())", "description": "Upgrades the SystemConfig to a new implementation and initializes it." }, - "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", - "data": "0x9623609d0000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", + "to": "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc", + "data": "0x9623609d000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", "value": "0", "contractMethod": { "inputs": [ @@ -96,8 +96,8 @@ "outputs": [] }, "contractInputsValues": { - "_data": "0xdb9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_data": "0xdb9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "_proxy": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" } }, @@ -106,8 +106,8 @@ "name": "ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter)", "description": "Upgrades the `SystemConfigProxy`to the StorageSetter." }, - "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", - "data": "0x99a88ec40000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", + "to": "0xE7413127F29E050Df65ac3FC9335F85bB10091AE", + "data": "0x99a88ec400000000000000000000000015cd4f6e0ce3b4832b33cb9c6f6fe6fc246754c200000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", "value": "0", "contractMethod": { "inputs": [ @@ -127,7 +127,7 @@ "outputs": [] }, "contractInputsValues": { - "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_proxy": "0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2", "_implementation": "0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB" } }, @@ -136,7 +136,7 @@ "name": "SystemConfigProxy.setBytes32(0,0)", "description": "Zeroes out the initialized state variable to allow reinitialization." }, - "to": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "to": "0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2", "data": "0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "value": "0", "contractMethod": { @@ -166,8 +166,8 @@ "name": "ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize())", "description": "Upgrades the SystemConfig to a new implementation and initializes it." }, - "to": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", - "data": "0x9623609d0000000000000000000000005d63a8dc2737ce771aa4a6510d063b6ba2c4f6f200000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", + "to": "0xE7413127F29E050Df65ac3FC9335F85bB10091AE", + "data": "0x9623609d00000000000000000000000015cd4f6e0ce3b4832b33cb9c6f6fe6fc246754c200000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000003d1000000000000000000000000000000000000000000000000000000000008ee870000000000000000000000004e6bd53883107b063c502ddd49f9600dc51b3ddc0000000000000000000000000000000000000000000000000000000001c9c38000000000000000000000000093a14e6894eeb4ff6a373e1ad4f498c3a207afe40000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000cddae6148da1e003c230e4527f9baedc8a204e7e000000000000000000000000c19a60d9e8c27b9a43527c3283b4dd8edc8be15c000000000000000000000000015a8c2e0a5fed579dbb05fd290e413adc6fc24a000000000000000000000000bc5c679879b2965296756cd959c3c739769995e20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000320e1580efff37e008f1c92700d1eba47c1b23fd00000000000000000000000000f7ab8c72d32f55cff15e8901c2f9f2bf29a3c0000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", "value": "0", "contractMethod": { "inputs": [ @@ -192,8 +192,8 @@ "outputs": [] }, "contractInputsValues": { - "_data": "0xdb9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000a6fe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000db80eca386ac72a55510e33cf9cf7533e75916ee0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003c1a357c4c77843d34750dbee68c589acb4f5f9b0000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000024567b64a86a4c966655fba6502a93dfb701e3160000000000000000000000005d335aa7d93102110879e3b54985c5f08146091e0000000000000000000000005d6ce6917dbeeacf010c96bffdabe89e33a3030900000000000000000000000021530aadf4dcfb9c477171400e40d4ef615868be000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d4dfc994878682811b2980653d03e589f093cb00000000000000000000000049ff2c4be882298e8ca7decd195c207c42b45f66000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", + "_data": "0xdb9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000003d1000000000000000000000000000000000000000000000000000000000008ee870000000000000000000000004e6bd53883107b063c502ddd49f9600dc51b3ddc0000000000000000000000000000000000000000000000000000000001c9c38000000000000000000000000093a14e6894eeb4ff6a373e1ad4f498c3a207afe40000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000cddae6148da1e003c230e4527f9baedc8a204e7e000000000000000000000000c19a60d9e8c27b9a43527c3283b4dd8edc8be15c000000000000000000000000015a8c2e0a5fed579dbb05fd290e413adc6fc24a000000000000000000000000bc5c679879b2965296756cd959c3c739769995e20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000320e1580efff37e008f1c92700d1eba47c1b23fd00000000000000000000000000f7ab8c72d32f55cff15e8901c2f9f2bf29a3c0000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "_proxy": "0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2", "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" } }, @@ -292,6 +292,102 @@ "_proxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2", "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" } + }, + { + "metadata": { + "name": "ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter)", + "description": "Upgrades the `SystemConfigProxy`to the StorageSetter." + }, + "to": "0xE17071F4C216Eb189437fbDBCc16Bb79c4efD9c2", + "data": "0x99a88ec4000000000000000000000000b54c7bfc223058773cf9b739cc5bd4095184fb0800000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + } + ], + "name": "upgrade", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_proxy": "0xB54c7BFC223058773CF9b739cC5bd4095184Fb08", + "_implementation": "0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB" + } + }, + { + "metadata": { + "name": "SystemConfigProxy.setBytes32(0,0)", + "description": "Zeroes out the initialized state variable to allow reinitialization." + }, + "to": "0xB54c7BFC223058773CF9b739cC5bd4095184Fb08", + "data": "0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_slot", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "_value", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "name": "setBytes32", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_slot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "_value": "0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "metadata": { + "name": "ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize())", + "description": "Upgrades the SystemConfig to a new implementation and initializes it." + }, + "to": "0xE17071F4C216Eb189437fbDBCc16Bb79c4efD9c2", + "data": "0x9623609d000000000000000000000000b54c7bfc223058773cf9b739cc5bd4095184fb0800000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000003f400000000000000000000000000000000000000000000000000000000000941ad0000000000000000000000003cd868e221a3be64b161d596a7482257a99d857f0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003609513933100689bd1f84782529a992398423440000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000cd734290e4bd0200dac631c7d4b9e8a33234e91f0000000000000000000000001bdbc0ae22bec0c2f08b4dd836944b3e28fe9b7a00000000000000000000000016b0a4f451c4cb567703367e587e15ac108e43110000000000000000000000005376f1d543dcbb5bd416c56c189e4cb7399fcccb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000effe2c6ca9ab797d418f0d91ea60807713f3536f0000000000000000000000005f3bdd57f01e88ce2f88f00685d30d6eb51a187c000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000", + "value": "0", + "contractMethod": { + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "address payable" + }, + { + "name": "_implementation", + "type": "address", + "internalType": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "upgradeAndCall", + "payable": false, + "outputs": [] + }, + "contractInputsValues": { + "_data": "0xdb9040fa00000000000000000000000023ba22dd7923f3a3f2495bb32a6f3c9b9cd1ec6c00000000000000000000000000000000000000000000000000000000000003f400000000000000000000000000000000000000000000000000000000000941ad0000000000000000000000003cd868e221a3be64b161d596a7482257a99d857f0000000000000000000000000000000000000000000000000000000001c9c3800000000000000000000000003609513933100689bd1f84782529a992398423440000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000cd734290e4bd0200dac631c7d4b9e8a33234e91f0000000000000000000000001bdbc0ae22bec0c2f08b4dd836944b3e28fe9b7a00000000000000000000000016b0a4f451c4cb567703367e587e15ac108e43110000000000000000000000005376f1d543dcbb5bd416c56c189e4cb7399fcccb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000effe2c6ca9ab797d418f0d91ea60807713f3536f0000000000000000000000005f3bdd57f01e88ce2f88f00685d30d6eb51a187c000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "_proxy": "0xB54c7BFC223058773CF9b739cC5bd4095184Fb08", + "_implementation": "0x33b83E4C305c908B2Fc181dDa36e230213058d7d" + } } ] } From 7b7f0d19b9d291c859a14c9d9e114a9b98eb1f0e Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 20 Dec 2024 16:55:03 +0000 Subject: [PATCH 18/68] use dynamic storage array --- .../NestedSignFromJson.s.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index dc5a063e6..fc66349e7 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -16,11 +16,12 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest string constant release = "v1.8.0-rc.4"; string[4] l2ChainNames = ["op", "metal", "mode", "zora"]; - SystemConfigUpgrade[1] sysCfgUpgrades; + SystemConfigUpgrade[] sysCfgUpgrades; constructor() { for (uint256 i = 0; i < l2ChainNames.length; i++) { - sysCfgUpgrades[i] = new SystemConfigUpgrade(l1ChainName, l2ChainNames[i], release); + console.log("Setting up verification data for chain", l2ChainNames[i], "-", l1ChainName); + sysCfgUpgrades.push(new SystemConfigUpgrade(l1ChainName, l2ChainNames[i], release)); addAllowedStorageAccess(sysCfgUpgrades[i].systemConfigAddress()); address[] memory exceptions = sysCfgUpgrades[i].getCodeExceptions(); for (uint256 j = 0; j < exceptions.length; j++) { From 80aa1cc018061b29ecd94ec338a954b26d905624 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 20 Dec 2024 16:55:26 +0000 Subject: [PATCH 19/68] validate in a smarter way for chains migrating from pre ecotone scalars --- .../SystemConfigUpgradeEcotoneScalars.s.sol | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index dc4cc5fc7..f34c8a69e 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -22,16 +22,27 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { /// @notice Public function that must be called by the verification script. function checkSystemConfigUpgrade() public view override { - super.checkSystemConfigUpgrade(); ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); console.log( - "checking baseFeeScalar and blobbaseFeeScalar reecode to scalar: ", - sysCfg.basefeeScalar(), - sysCfg.blobbasefeeScalar(), - reencodedScalar + "checking baseFeeScalar and blobbaseFeeScalar ", + LibString.toString(sysCfg.basefeeScalar()), + LibString.toString(sysCfg.blobbasefeeScalar()) ); - require(reencodedScalar == previous.scalar, "scalar-100 (reencoding produced incorrect result)"); + if ( + uint8(previous.scalar >> 248) == 1 // most significant bit + ) { + console.log( + "reencode to previous scalar: ", + LibString.toString(reencodedScalar), + LibString.toString(previous.scalar) + ); + require(reencodedScalar == previous.scalar, "scalar-100 (reencoding produced incorrect result)"); + // We do this check last because it would fail if the scalar is wrong, and we get less debug info from it. + // It checks all of the other fields which should not have changed (via a hash). + super.checkSystemConfigUpgrade(); + } + require(sysCfg.scalar() == reencodedScalar, "scalar-101"); } } From 7e0c7fe5e6ccd0a9723e34ee66f04d48b37f927f Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 3 Jan 2025 18:02:48 +0000 Subject: [PATCH 20/68] SuperchainRegistry: instead of skipping missing addresses globally, skip only if not found in the TOML file --- script/verification/Verification.s.sol | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/script/verification/Verification.s.sol b/script/verification/Verification.s.sol index d090a1d63..143599a7e 100644 --- a/script/verification/Verification.s.sol +++ b/script/verification/Verification.s.sol @@ -3,8 +3,9 @@ pragma solidity ^0.8.15; import {LibString} from "solady/utils/LibString.sol"; import {Types} from "@eth-optimism-bedrock/scripts/Types.sol"; -import {CommonBase} from "forge-std/Base.sol"; +import {ScriptBase} from "forge-std/Base.sol"; import {stdToml} from "forge-std/StdToml.sol"; +import {console2 as console} from "forge-std/console2.sol"; // TODO(#427): Proposing to just merge this contract into JsonTxBuilderBase. contract VerificationBase { @@ -20,7 +21,7 @@ contract VerificationBase { } } -contract SuperchainRegistry is CommonBase { +contract SuperchainRegistry is ScriptBase { using LibString for string; struct StandardVersion { @@ -101,10 +102,11 @@ contract SuperchainRegistry is CommonBase { proxies.L1StandardBridge = stdToml.readAddress(toml, "$.addresses.L1StandardBridgeProxy"); proxies.SystemConfig = stdToml.readAddress(toml, "$.addresses.SystemConfigProxy"); - // TODO handle chains which are missing these values: - // proxies.AnchorStateRegistry = stdToml.readAddress(toml, "$.addresses.AnchorStateRegistryProxy"); - // proxies.DisputeGameFactory = stdToml.readAddress(toml, "$.addresses.DisputeGameFactoryProxy"); - // chainConfig.unsafeBlockSigner = stdToml.readAddress(toml, "$.addresses.UnsafeBlockSigner"); + // Not all chains have the following values specified in the registry, so we will + // set them to the zero address if they are not found. + proxies.AnchorStateRegistry = tryReadAddress(toml, "$.addresses.AnchorStateRegistryProxy"); + proxies.DisputeGameFactory = tryReadAddress(toml, "$.addresses.DisputeGameFactoryProxy"); + chainConfig.unsafeBlockSigner = tryReadAddress(toml, "$.addresses.UnsafeBlockSigner"); chainConfig.chainId = stdToml.readUint(toml, "$.chain_id"); chainConfig.systemConfigOwner = stdToml.readAddress(toml, "$.addresses.SystemConfigOwner"); @@ -112,6 +114,15 @@ contract SuperchainRegistry is CommonBase { chainConfig.batchInbox = stdToml.readAddress(toml, "$.batch_inbox_addr"); } + function tryReadAddress(string memory toml, string memory key) internal pure returns (address) { + try vmSafe.parseTomlAddress(toml, key) returns (address a) { + return a; + } catch { + console.log("failed to read address for ", key); + return address(0); + } + } + function _readStandardVersions() internal { string memory toml; string memory path = From 127d370a690a1686c71917f9727f5ea888d5a2f2 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 3 Jan 2025 18:40:13 +0000 Subject: [PATCH 21/68] update overview and readme --- .../OVERVIEW.md | 56 ++++--------------- .../README.md | 16 +----- 2 files changed, 12 insertions(+), 60 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md index fe7e6b3c6..7a89a1198 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md @@ -1,57 +1,21 @@ # Holocene Hardfork - SystemConfig Upgrade -Upgrades the `SystemConfig.sol` contract for Holocene. +Upgrades the `SystemConfig.sol` contract for Holocene across multiple L2 chains. -The batch will be executed on chain ID `11155111`, and contains `3` transactions. +The batch will be executed on L1 chain ID `11155111`, and contains `3n` transactions, where `n=4` is the number of L2 chains being upgraded. The chains affected are {op,metal,mode,zora}-sepolia. -## Tx #1: ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter) -Upgrades the `SystemConfigProxy`to the StorageSetter. +The below is a summary of the transaction bundle, see `input.json` for full details. -**Function Signature:** `upgrade(address,address)` - -**To:** `0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc` - -**Value:** `0 WEI` - -**Raw Input Data:** `0x99a88ec4000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000054f8076f4027e21a010b4b3900c86211dd2c2deb` - -### Inputs -**_proxy:** `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` - -**_implementation:** `0x54F8076f4027e21A010b4B3900C86211Dd2C2DEB` +## Txs #1,#4,#7,#10: ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter) +Upgrades the `SystemConfigProxy` on each chain to the StorageSetter. +**Function Signature:** `upgrade(address,address)` -## Tx #2: SystemConfigProxy.setBytes32(0,0) -Zeroes out the initialized state variable to allow reinitialization. +## Txs #2,#5,#8,#11: SystemConfigProxy.setBytes32(0,0) +Zeroes out the initialized state variable for each chain's SystemConfigProxy, to allow reinitialization. **Function Signature:** `setBytes32(bytes32,bytes32)` -**To:** `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` - -**Value:** `0 WEI` - -**Raw Input Data:** `0x4e91db0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000` - -### Inputs -**_value:** `0x0000000000000000000000000000000000000000000000000000000000000000` - -**_slot:** `0x0000000000000000000000000000000000000000000000000000000000000000` - - -## Tx #3: ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize()) -Upgrades the SystemConfig to a new implementation and initializes it. +## Tx #3,#6,#9,#12: ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize()) +Upgrades each chain's SystemConfig to a new implementation and initializes it. **Function Signature:** `upgradeAndCall(address,address,bytes)` - -**To:** `0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc` - -**Value:** `0 WEI` - -**Raw Input Data:** `0x9623609d000000000000000000000000034edd2a225f7f429a63e0f1d2084b9e0a93b53800000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000284db9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000` - -### Inputs -**_data:** `0xdb9040fa000000000000000000000000fd1d2e729ae8eee2e146c033bf4400fe752843010000000000000000000000000000000000000000000000000000000000001db000000000000000000000000000000000000000000000000000000000000d27300000000000000000000000008f23bb38f531600e5d8fddaaec41f13fab46e98c000000000000000000000000000000000000000000000000000000000393870000000000000000000000000057cacbb0d30b01eb2462e5dc940c161aff3230d30000000000000000000000000000000000000000000000000000000001312d00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000003b9aca0000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000ffffffffffffffffffffffffffffffff000000000000000000000000ff0000000000000000000000000000001115542000000000000000000000000058cc85b8d04ea49cc6dbd3cbffd00b4b8d6cb3ef000000000000000000000000d83e03d576d23c9aeab8cc44fa98d058d2176d1f000000000000000000000000fbb0621e0b23b5478b630bd55a5f21f67730b0f100000000000000000000000005f9613adb30026ffd634f38e5c4dfd30a197fa100000000000000000000000016fc5058f25648194471939df75cf27a2fdc48bc000000000000000000000000868d59ff9710159c2b330cc0fbdf57144dd7a13b000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` - -**_proxy:** `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` - -**_implementation:** `0x33b83E4C305c908B2Fc181dDa36e230213058d7d` - diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md index c82e7dcf2..7f9085453 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md @@ -4,18 +4,7 @@ Status: DRAFT, NOT READY TO SIGN ## Objective -Upgrades the `SystemConfig` for the Holocene hardfork. - -The proposal was: - -- [ ] Posted on the governance forum. -- [ ] Approved by Token House voting. -- [ ] Not vetoed by the Citizens' house. -- [ ] Executed on OP Mainnet. - -The governance proposal should be treated as the source of truth and used to verify the correctness of the onchain operations. - -Governance post of the upgrade can be found at . +Upgrades the `SystemConfig` contracts for the Holocene hardfork across multiple chains in the sepolia superchain. This upgrades the `SystemConfig` in the [v1.8.0-rc.4](https://github.com/ethereum-optimism/optimism/tree/v1.8.0-rc.4) release. @@ -36,7 +25,6 @@ Please see the instructions for [validation](./VALIDATION.md). ## Execution -This upgrade -* Changes the implementation of the `SystemConfig` to hold EIP-1559 parameters for the +This upgrade upgrades the implementation of the `SystemConfig` implementation on multiple chains and reinitializes each of the in such a way as to preserve the semantics of all existing parameters stored in that contract. See the [overview](./OVERVIEW.md) and `input.json` bundle for more details. From 67863048d4da369c490141a80050a6d0df7a3258 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 3 Jan 2025 23:08:16 +0000 Subject: [PATCH 22/68] add some more logging --- .../NestedSignFromJson.s.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index fc66349e7..642931f79 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -20,8 +20,10 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest constructor() { for (uint256 i = 0; i < l2ChainNames.length; i++) { - console.log("Setting up verification data for chain", l2ChainNames[i], "-", l1ChainName); sysCfgUpgrades.push(new SystemConfigUpgrade(l1ChainName, l2ChainNames[i], release)); + console.log(""); + console.log("Set up verification data for chain", l2ChainNames[i], "-", l1ChainName); + console.log("with SystemConfigProxy @", sysCfgUpgrades[i].systemConfigAddress()); addAllowedStorageAccess(sysCfgUpgrades[i].systemConfigAddress()); address[] memory exceptions = sysCfgUpgrades[i].getCodeExceptions(); for (uint256 j = 0; j < exceptions.length; j++) { From 1ccf1b68157f28b821f82d64aaac1b23d97980f5 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 3 Jan 2025 23:08:27 +0000 Subject: [PATCH 23/68] fill out validation.md --- .../VALIDATION.md | 84 +++++++++++++++++-- 1 file changed, 79 insertions(+), 5 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index 7457b5293..c35fb96a4 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -9,11 +9,85 @@ For each contract listed in the state diff, please verify that no contracts or s - All addresses (in section headers and storage values) match the provided name, using the Etherscan and Superchain Registry links provided. This validates the bytecode deployed at the addresses contains the correct logic. - All key values match the semantic meaning provided, which can be validated using the storage layout links provided. +## Nested Safe State Overrides and Changes + +This task is executed by the nested 2/2 `ProxyAdminOwner` Safe. Refer to the +[generic nested Safe execution validation document](../../../NESTED-VALIDATION.md) +for the expected state overrides and changes. + +The `approvedHashes` mapping **key** of the `ProxyAdminOwner` that should change during the simulation is +- Council simulation: `0xa2178e2b0ce499a24051659b5ab4528cd4e41b7dff3b76fa6861750f7b154391` +- Foundation simulation: `0x6baf11815ec9e3d4dc6cfa30c0e72dd31a00e45c9ca6d8a40e52f5cc78635009` + +calculated as explained in the nested validation doc: +```sh +cast index address 0xf64bc17485f0B4Ea5F06A96514182FC4cB561977 8 # council +# 0x56362ae34e37f50105bd722d564a267a69bbc15ede4cb7136e81afd747b41c4d +cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe9ca0a 0x56362ae34e37f50105bd722d564a267a69bbc15ede4cb7136e81afd747b41c4d +# 0xa2178e2b0ce499a24051659b5ab4528cd4e41b7dff3b76fa6861750f7b154391 +``` + +```sh +cast index address 0xDEe57160aAfCF04c34C887B5962D0a69676d3C8B 8 # foundation +# 0xc18fefc0a6b81265cf06017c3f1f91c040dc3227321d73c608cfbcf1c5253e5c +cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe9ca0a 0xc18fefc0a6b81265cf06017c3f1f91c040dc3227321d73c608cfbcf1c5253e5c +# 0x6baf11815ec9e3d4dc6cfa30c0e72dd31a00e45c9ca6d8a40e52f5cc78635009 +``` + ## State Changes -### `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` (`SystemConfigProxy`) +### `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` (`SystemConfigProxy` for op-sepolia) + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` + **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` + **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` + **Meaning**: Updates the `scalar` storage variable. + +### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` + **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` + **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` + **Meaning**: Updates the `scalar` storage variable. + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000066` + **Before**: `0x00000000000000000000000000000000000000000000000000000000000a6fe0` + **After**: `0x01000000000000000000000000000000000000000000000000000000000a6fe0` + **Meaning**: TODO + +### `0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2` (`SystemConfigProxy` for mode-sepolia) + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` + **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` + **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` + **Meaning**: Updates the `scalar` storage variable. + +### `0xB54c7BFC223058773CF9b739cC5bd4095184Fb08` (`SystemConfigProxy` for zora-sepolia) + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` + **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` + **After**: `0x00000000000000000000000000000000000941ad000003f40000000001c9c380` + **Meaning**: Updates the `scalar` storage variable. + + +### `0x1Eb2fFc903729a0F03966B917003800b145F56E2` (`ProxyAdminOwner` for all chains in this task) + +- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000005` + **Before**: `0x000000000000000000000000000000000000000000000000000000000000000f` + **After**: `0x0000000000000000000000000000000000000000000000000000000000000010` + **Meaning**: Nonce increments by 1 + +- **Key**: See above. + **Before**: `0x0000000000000000000000000000000000000000000000000000000000000000` + **After**: `0x0000000000000000000000000000000000000000000000000000000000000001` + **Meaning**: See above. + +### `0xc26977310bC89DAee5823C2e2a73195E85382cC7` (LivenessGuard) + +- **Key**: `0xee4378be6a15d4c71cb07a5a47d8ddc4aba235142e05cb828bb7141206657e27` +**Before**: `0x0000000000000000000000000000000000000000000000000000000000000000` +**After**: `0x000000000000000000000000000000000000000000000000000000006778296a` +**Meaning**: `lastLive`[0xca11bde05977b3631167028862be2a173976ca11] -> `73592817` -- **Key**: `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` - **Before**: `0x00000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d` - **After**: `0x00000000000000000000000033b83e4c305c908b2fc181dda36e230213058d7d` - **Meaning**: Updates the `SystemConfig` proxy implementation. +### Signer Address (e.g. `0x1084092Ac2f04c866806CF3d4a385Afa4F6A6C97` for simulation) +Nonce increment by 1. From e0364badf2a23e6fed2bdea06b0a4e01adf56bc4 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 3 Jan 2025 23:59:17 +0000 Subject: [PATCH 24/68] don't alias SystemConfigUpgradeEcotoneScalars --- .../verification/SystemConfigUpgradeEcotoneScalars.s.sol | 2 +- .../NestedSignFromJson.s.sol | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index f34c8a69e..b2c3c97f2 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -40,7 +40,7 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { ); require(reencodedScalar == previous.scalar, "scalar-100 (reencoding produced incorrect result)"); // We do this check last because it would fail if the scalar is wrong, and we get less debug info from it. - // It checks all of the other fields which should not have changed (via a hash). + // It checks all of the other fields which should not have changed (via a hash). super.checkSystemConfigUpgrade(); } require(sysCfg.scalar() == reencodedScalar, "scalar-101"); diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 642931f79..d3710e3a0 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -8,19 +8,18 @@ import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSig import {DisputeGameUpgrade} from "script/verification/DisputeGameUpgrade.s.sol"; import {CouncilFoundationNestedSign} from "script/verification/CouncilFoundationNestedSign.s.sol"; import {VerificationBase, SuperchainRegistry} from "script/verification/Verification.s.sol"; -import {SystemConfigUpgradeEcotoneScalars as SystemConfigUpgrade} from - "script/verification/SystemConfigUpgradeEcotoneScalars.s.sol"; +import {SystemConfigUpgradeEcotoneScalars} from "script/verification/SystemConfigUpgradeEcotoneScalars.s.sol"; contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { string constant l1ChainName = "sepolia"; string constant release = "v1.8.0-rc.4"; string[4] l2ChainNames = ["op", "metal", "mode", "zora"]; - SystemConfigUpgrade[] sysCfgUpgrades; + SystemConfigUpgradeEcotoneScalars[] sysCfgUpgrades; constructor() { for (uint256 i = 0; i < l2ChainNames.length; i++) { - sysCfgUpgrades.push(new SystemConfigUpgrade(l1ChainName, l2ChainNames[i], release)); + sysCfgUpgrades.push(new SystemConfigUpgradeEcotoneScalars(l1ChainName, l2ChainNames[i], release)); console.log(""); console.log("Set up verification data for chain", l2ChainNames[i], "-", l1ChainName); console.log("with SystemConfigProxy @", sysCfgUpgrades[i].systemConfigAddress()); @@ -36,6 +35,7 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest console.log("Running post-deploy assertions"); checkStateDiff(accesses); for (uint256 i = 0; i < l2ChainNames.length; i++) { + console.log(""); console.log("Running post-deploy assertions for chain", l2ChainNames[i], "-", l1ChainName); sysCfgUpgrades[i].checkSystemConfigUpgrade(); } From b1ef2914521fa536bb1f14aa33313d1d5b00f5af Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 3 Jan 2025 23:59:43 +0000 Subject: [PATCH 25/68] fix validation document unpack and verify all storage changes --- .../VALIDATION.md | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index c35fb96a4..ad523b6c0 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -39,35 +39,35 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe ### `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` (`SystemConfigProxy` for op-sepolia) - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` - **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` - **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` - **Meaning**: Updates the `scalar` storage variable. + **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` + **After**: `0xx00000000000000000000000000000000000d273000001db00000000003938700` + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `86200` respectively. These share a slot with the `gasLimit` which remans at `60000000` ### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` - **Meaning**: Updates the `scalar` storage variable. + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `68400` and `0` respectively. These share a slot with the `gasLimit` which remans at `30000000` - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000066` **Before**: `0x00000000000000000000000000000000000000000000000000000000000a6fe0` **After**: `0x01000000000000000000000000000000000000000000000000000000000a6fe0` - **Meaning**: TODO + **Meaning**: Updates the `scalar` storage variable to reflect a scalar version of `1`. ### `0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2` (`SystemConfigProxy` for mode-sepolia) - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` - **Meaning**: Updates the `scalar` storage variable. + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remans at `30000000` ### `0xB54c7BFC223058773CF9b739cC5bd4095184Fb08` (`SystemConfigProxy` for zora-sepolia) - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` **After**: `0x00000000000000000000000000000000000941ad000003f40000000001c9c380` - **Meaning**: Updates the `scalar` storage variable. + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `1012` and `606637` respectively. These share a slot with the `gasLimit` which remans at `30000000` ### `0x1Eb2fFc903729a0F03966B917003800b145F56E2` (`ProxyAdminOwner` for all chains in this task) @@ -80,14 +80,6 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe - **Key**: See above. **Before**: `0x0000000000000000000000000000000000000000000000000000000000000000` **After**: `0x0000000000000000000000000000000000000000000000000000000000000001` - **Meaning**: See above. - -### `0xc26977310bC89DAee5823C2e2a73195E85382cC7` (LivenessGuard) + **Meaning**: approvedHashes update. See above. -- **Key**: `0xee4378be6a15d4c71cb07a5a47d8ddc4aba235142e05cb828bb7141206657e27` -**Before**: `0x0000000000000000000000000000000000000000000000000000000000000000` -**After**: `0x000000000000000000000000000000000000000000000000000000006778296a` -**Meaning**: `lastLive`[0xca11bde05977b3631167028862be2a173976ca11] -> `73592817` -### Signer Address (e.g. `0x1084092Ac2f04c866806CF3d4a385Afa4F6A6C97` for simulation) -Nonce increment by 1. From 6c2961fac9078ce699bf44d9e7d418740d325612 Mon Sep 17 00:00:00 2001 From: geoknee Date: Sat, 4 Jan 2025 00:17:55 +0000 Subject: [PATCH 26/68] add sep/027 to CI --- .circleci/config.yml | 8 ++++++++ lib/solady | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c3913d5e..86665740a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -229,6 +229,13 @@ jobs: - simulate_nested: task: "eth/base-003-holocene-fp-upgrade" + simulate_sep_027: + docker: + - image: << pipeline.parameters.ci_builder_image >> + steps: + - simulate_nested: + task: "sep/027-holocene-system-config-upgrade-and-init-multi-chain" + just_simulate_permissionless_fp_upgrade: docker: - image: << pipeline.parameters.ci_builder_image >> @@ -320,3 +327,4 @@ workflows: - simulate_eth_022 - simulate_base_003 - just_simulate_permissionless_fp_upgrade + - simulate_sep_027 diff --git a/lib/solady b/lib/solady index 513f58167..a6a95729f 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit 513f581675374706dbe947284d6b12d19ce35a2a +Subproject commit a6a95729f947bb2a24e05e862ba9522c10453a70 From e568b3a5fa4a35c314cfb775b02418b66e74eeb1 Mon Sep 17 00:00:00 2001 From: geoknee Date: Mon, 6 Jan 2025 18:00:05 +0000 Subject: [PATCH 27/68] undo changes to submodule --- lib/solady | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/solady b/lib/solady index a6a95729f..513f58167 160000 --- a/lib/solady +++ b/lib/solady @@ -1 +1 @@ -Subproject commit a6a95729f947bb2a24e05e862ba9522c10453a70 +Subproject commit 513f581675374706dbe947284d6b12d19ce35a2a From 35c68f8f3082be9f99bfc7e265d4736e1673d893 Mon Sep 17 00:00:00 2001 From: geoknee Date: Mon, 6 Jan 2025 18:14:49 +0000 Subject: [PATCH 28/68] undo change to submodule --- lib/base-contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base-contracts b/lib/base-contracts index 494586571..ed36aac52 160000 --- a/lib/base-contracts +++ b/lib/base-contracts @@ -1 +1 @@ -Subproject commit 494586571e1a4d845ee6f381b65229d63c630986 +Subproject commit ed36aac52a19bdad6dee09c59e7241fe3a194160 From 94a0e19348bf9b43872f9de0c326a75b819e8c06 Mon Sep 17 00:00:00 2001 From: geoknee Date: Mon, 6 Jan 2025 18:24:34 +0000 Subject: [PATCH 29/68] Revert "remove unecessary forge build commands" This reverts commit ef183997bd3ef13a7265994aaf3e2beda43423e0. --- nested.just | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nested.just b/nested.just index 2b89e2ce3..d2ac7e97e 100644 --- a/nested.just +++ b/nested.just @@ -48,6 +48,7 @@ simulate whichSafe hdPath='0': fi echo "" + forge build forge script ${script} \ --rpc-url ${rpcUrl} \ --sender ${signer} \ @@ -84,6 +85,7 @@ sign whichSafe hdPath='0': echo "Signing with: ${signer}" echo "" + forge build # Using the eip712sign within the repo folder since eip712sign was installed there in ./justfile. $(git rev-parse --show-toplevel)/bin/eip712sign --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" -- \ forge script ${script} \ @@ -118,6 +120,7 @@ approve whichSafe hdPath='0': fi sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") + forge build forge script ${script} \ --fork-url ${rpcUrl} \ --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" \ @@ -139,6 +142,7 @@ execute hdPath='0': echo "Using script ${script}" sender=$(cast wallet address --ledger --mnemonic-derivation-path "m/44'/60'/{{hdPath}}'/0/0") + forge build forge script ${script} \ --fork-url ${rpcUrl} \ --ledger --hd-paths "m/44'/60'/{{hdPath}}'/0/0" \ @@ -157,6 +161,7 @@ simulated-run hdPath='0': fi echo "Using script ${script}" + forge build forge script ${script} \ --fork-url ${rpcUrl} \ --sender ${randomPersonEoa} \ From 5098753ad37ac09680f6978ec39371d9a961e403 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 11:23:01 +0000 Subject: [PATCH 30/68] avoid shadowing variables --- script/verification/SystemConfigUpgrade.s.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index e4ec72241..25c250073 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -35,8 +35,8 @@ contract SystemConfigUpgrade is SuperchainRegistry { address public systemConfigAddress; SysCfgVars previous; - constructor(string memory l1ChainName, string memory l2ChainName, string memory release) - SuperchainRegistry(l1ChainName, l2ChainName, release) + constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) + SuperchainRegistry(_l1ChainName, _l2ChainName, _release) { systemConfigAddress = proxies.SystemConfig; previous = getSysCfgVars(); // Set this before the tx is executed. From ab72af4dca4dbdbcdc782b32a41a21bbd7275eb8 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 11:36:52 +0000 Subject: [PATCH 31/68] add explanatory comment and removed unused imports --- script/verification/SystemConfigUpgrade.s.sol | 10 +++++----- .../SystemConfigUpgradeEcotoneScalars.s.sol | 10 +++------- .../NestedSignFromJson.s.sol | 2 ++ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index 25c250073..784a36a76 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.15; -import {console2 as console} from "forge-std/console2.sol"; import {Vm} from "forge-std/Vm.sol"; import {LibString} from "solady/utils/LibString.sol"; import {SuperchainRegistry} from "script/verification/Verification.s.sol"; -import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; import {ISystemConfig} from "./ISystemConfig.sol"; import {IResourceMetering} from "./IResourceMetering.sol"; -import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; -import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; -import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; +// SystemConfigUpgrade is a contract that can be used to verify that an upgrade of the SystemConfig contract +// has not changed any of the storage variables that are not expected to change. +// It stores the prior storage variables (EXCLUDING the Ecotone Scalar variables basedeeScalat and blobbasefeeScalar) +// of the SystemConfig contract at constructor time. +// It exposes a method which allows the verification script to check that the storage variables have not changed. contract SystemConfigUpgrade is SuperchainRegistry { using LibString for string; diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index b2c3c97f2..d2e97360d 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -2,17 +2,13 @@ pragma solidity ^0.8.15; import {console2 as console} from "forge-std/console2.sol"; -import {Vm} from "forge-std/Vm.sol"; import {LibString} from "solady/utils/LibString.sol"; -import {SuperchainRegistry} from "script/verification/Verification.s.sol"; -import "@eth-optimism-bedrock/src/dispute/lib/Types.sol"; import {ISystemConfig} from "./ISystemConfig.sol"; -import {IResourceMetering} from "./IResourceMetering.sol"; -import {MIPS} from "@eth-optimism-bedrock/src/cannon/MIPS.sol"; -import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; -import {NestedMultisigBuilder} from "@base-contracts/script/universal/NestedMultisigBuilder.sol"; import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol"; +// SystemConfigUpgradeEcotoneScalars is a contract that can be used to verify that an upgrade of the SystemConfig contract +// results in the correct values for scalar, basefeeScalar, and blobbasefeeScalar being set, and that the remaining +// storage values have not changed. contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { using LibString for string; diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index d3710e3a0..fa1159b74 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -19,6 +19,8 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest constructor() { for (uint256 i = 0; i < l2ChainNames.length; i++) { + // Deploy a SystemConfigUpgradeEcotoneScalars instance per chain, + // which each contains its own bindings to an individual chain's SuperchainRegistry data. sysCfgUpgrades.push(new SystemConfigUpgradeEcotoneScalars(l1ChainName, l2ChainNames[i], release)); console.log(""); console.log("Set up verification data for chain", l2ChainNames[i], "-", l1ChainName); From ddad3df754d97266685eda3b6f0eac63fcc37ee1 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 11:38:19 +0000 Subject: [PATCH 32/68] avoid shadowing variabls --- script/verification/SystemConfigUpgradeEcotoneScalars.s.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index d2e97360d..b5f031d82 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -12,8 +12,8 @@ import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { using LibString for string; - constructor(string memory l1ChainName, string memory l2ChainName, string memory release) - SystemConfigUpgrade(l1ChainName, l2ChainName, release) + constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) + SystemConfigUpgrade(_l1ChainName, _l2ChainName, _release) {} /// @notice Public function that must be called by the verification script. From 3d0999fb898f7362aa66faaeb3eb97df0d12ca63 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 13:38:39 +0000 Subject: [PATCH 33/68] previous.owner codeException added conditionally --- script/verification/SystemConfigUpgrade.s.sol | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index 784a36a76..e58dbb617 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -71,12 +71,13 @@ contract SystemConfigUpgrade is SuperchainRegistry { require(keccak256(abi.encode(got)) == keccak256(abi.encode(previous)), "system-config-100"); } - function getCodeExceptions() public view returns (address[] memory) { - address[] memory exceptions = new address[](4); - exceptions[0] = previous.owner; // NOTE this can be removed for mainnet - exceptions[1] = address(uint160(uint256((previous.batcherHash)))); - exceptions[2] = previous.unsafeBlockSigner; - exceptions[3] = previous.batchInbox; - return exceptions; + function getCodeExceptions() public view returns (address[] memory exceptions) { + uint256 len = block.chainid == 1 ? 3 : 4; // Mainnet doesn't need owner exception. + exceptions = new address[](len); + uint256 i = 0; + if (block.chainid != 1) exceptions[i++] = previous.owner; + exceptions[i++] = address(uint160(uint256((previous.batcherHash)))); + exceptions[i++] = previous.unsafeBlockSigner; + exceptions[i++] = previous.batchInbox; } } From 0b4dbeec1733d5994422323075396bcc88963995 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 13:47:05 +0000 Subject: [PATCH 34/68] update forge-std to v1.9.5 --- lib/forge-std | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/forge-std b/lib/forge-std index 2d8b7b876..b93cf4bc3 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 2d8b7b876a5b328d6a73e13c4740ed7a0d72d5f4 +Subproject commit b93cf4bc34ff214c099dc970b153f85ade8c9f66 From 8a770be124b6d7de8ee085e31dc7eaac0fa43ba3 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 13:47:27 +0000 Subject: [PATCH 35/68] prefer stdToml.readAddressOr to rolling my own tryReadAddress --- script/verification/Verification.s.sol | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/script/verification/Verification.s.sol b/script/verification/Verification.s.sol index 143599a7e..600aaa18e 100644 --- a/script/verification/Verification.s.sol +++ b/script/verification/Verification.s.sol @@ -104,9 +104,9 @@ contract SuperchainRegistry is ScriptBase { // Not all chains have the following values specified in the registry, so we will // set them to the zero address if they are not found. - proxies.AnchorStateRegistry = tryReadAddress(toml, "$.addresses.AnchorStateRegistryProxy"); - proxies.DisputeGameFactory = tryReadAddress(toml, "$.addresses.DisputeGameFactoryProxy"); - chainConfig.unsafeBlockSigner = tryReadAddress(toml, "$.addresses.UnsafeBlockSigner"); + proxies.AnchorStateRegistry = stdToml.readAddressOr(toml, "$.addresses.AnchorStateRegistryProxy", address(0)); + proxies.DisputeGameFactory = stdToml.readAddressOr(toml, "$.addresses.DisputeGameFactoryProxy", address(0)); + chainConfig.unsafeBlockSigner = stdToml.readAddressOr(toml, "$.addresses.UnsafeBlockSigner", address(0)); chainConfig.chainId = stdToml.readUint(toml, "$.chain_id"); chainConfig.systemConfigOwner = stdToml.readAddress(toml, "$.addresses.SystemConfigOwner"); @@ -114,15 +114,6 @@ contract SuperchainRegistry is ScriptBase { chainConfig.batchInbox = stdToml.readAddress(toml, "$.batch_inbox_addr"); } - function tryReadAddress(string memory toml, string memory key) internal pure returns (address) { - try vmSafe.parseTomlAddress(toml, key) returns (address a) { - return a; - } catch { - console.log("failed to read address for ", key); - return address(0); - } - } - function _readStandardVersions() internal { string memory toml; string memory path = From 1ce96af2fc89d1f0b1e874a427817b5210a0fd7c Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 13:51:20 +0000 Subject: [PATCH 36/68] spellcheck --- .../020-holocene-system-config-upgrade-multi-chain/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md b/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md index 6f612593e..b74951da4 100644 --- a/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md +++ b/tasks/sep/020-holocene-system-config-upgrade-multi-chain/README.md @@ -2,7 +2,7 @@ Status: [EXECUTED](https://sepolia.etherscan.io/tx/0x88bd1d85740af3741e2ed96d6fd07f2abb4541afc667625480bf6a28451c4d6d) -> ⚠️ **Warning:** This task is incorrect and is superceded by [Task 027](../027-holocene-system-config-upgrade-and-init-multi-chain/) +> ⚠️ **Warning:** This task is incorrect and is superseded by [Task 027](../027-holocene-system-config-upgrade-and-init-multi-chain/) ## Objective From 7d05ab9ec0011dd59b23797705e1270f3c8e92f9 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 13:51:35 +0000 Subject: [PATCH 37/68] move overview contents into readme --- .../OVERVIEW.md | 21 ------------------- .../README.md | 19 ++++++++++++++++- 2 files changed, 18 insertions(+), 22 deletions(-) delete mode 100644 tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md deleted file mode 100644 index 7a89a1198..000000000 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/OVERVIEW.md +++ /dev/null @@ -1,21 +0,0 @@ -# Holocene Hardfork - SystemConfig Upgrade -Upgrades the `SystemConfig.sol` contract for Holocene across multiple L2 chains. - -The batch will be executed on L1 chain ID `11155111`, and contains `3n` transactions, where `n=4` is the number of L2 chains being upgraded. The chains affected are {op,metal,mode,zora}-sepolia. - -The below is a summary of the transaction bundle, see `input.json` for full details. - -## Txs #1,#4,#7,#10: ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter) -Upgrades the `SystemConfigProxy` on each chain to the StorageSetter. - -**Function Signature:** `upgrade(address,address)` - -## Txs #2,#5,#8,#11: SystemConfigProxy.setBytes32(0,0) -Zeroes out the initialized state variable for each chain's SystemConfigProxy, to allow reinitialization. - -**Function Signature:** `setBytes32(bytes32,bytes32)` - -## Tx #3,#6,#9,#12: ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize()) -Upgrades each chain's SystemConfig to a new implementation and initializes it. - -**Function Signature:** `upgradeAndCall(address,address,bytes)` diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md index 7f9085453..cabb5b37b 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md @@ -27,4 +27,21 @@ Please see the instructions for [validation](./VALIDATION.md). This upgrade upgrades the implementation of the `SystemConfig` implementation on multiple chains and reinitializes each of the in such a way as to preserve the semantics of all existing parameters stored in that contract. -See the [overview](./OVERVIEW.md) and `input.json` bundle for more details. +The batch will be executed on L1 chain ID `11155111`, and contains `3n` transactions, where `n=4` is the number of L2 chains being upgraded. The chains affected are {op,metal,mode,zora}-sepolia. + +The below is a summary of the transaction bundle, see `input.json` for full details. + +### Txs #1,#4,#7,#10: ProxyAdmin.upgrade(SystemConfigProxy, StorageSetter) +Upgrades the `SystemConfigProxy` on each chain to the StorageSetter. + +**Function Signature:** `upgrade(address,address)` + +## Txs #2,#5,#8,#11: SystemConfigProxy.setBytes32(0,0) +Zeroes out the initialized state variable for each chain's SystemConfigProxy, to allow reinitialization. + +**Function Signature:** `setBytes32(bytes32,bytes32)` + +### Txs #3,#6,#9,#12: ProxyAdmin.upgradeAndCall(SystemConfigProxy, SystemConfigImplementation, Initialize()) +Upgrades each chain's SystemConfig to a new implementation and initializes it. + +**Function Signature:** `upgradeAndCall(address,address,bytes)` From 7f5ac68be92aa9598d77710b7f275e91ecf568d1 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 13:52:22 +0000 Subject: [PATCH 38/68] set status as READY TO SIGN --- .../README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md index cabb5b37b..930bc8017 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md @@ -1,6 +1,6 @@ # Holocene Hardfork Upgrade - `SystemConfig` -Status: DRAFT, NOT READY TO SIGN +Status: READY TO SIGN ## Objective From 2cd5a75fef8eb82f016ceddd36508973aa311e36 Mon Sep 17 00:00:00 2001 From: George Knee Date: Tue, 7 Jan 2025 15:24:38 +0000 Subject: [PATCH 39/68] Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md Co-authored-by: Matt Solomon --- .../README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md index 930bc8017..36008811f 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/README.md @@ -16,7 +16,7 @@ This upgrades the `SystemConfig` in the ## Simulation Please see the "Simulating and Verifying the Transaction" instructions in [NESTED.md](../../../NESTED.md). -When simulating, ensure the logs say `Using script /your/path/to/superchain-ops/tasks//NestedSignFromJson.s.sol`. +When simulating, ensure the logs say `Using script /your/path/to/superchain-ops/tasks/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol`. This ensures all safety checks are run. If the default `NestedSignFromJson.s.sol` script is shown (without the full path), something is wrong and the safety checks will not run. ## State Validation From 58bc135aea37965cb7c3a61baafe836ae4a3b86b Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 15:41:58 +0000 Subject: [PATCH 40/68] pull scalar checks out of base contract into SystemConfigUpgradeEcotoneScalars --- script/verification/SystemConfigUpgrade.s.sol | 7 +++--- .../SystemConfigUpgradeEcotoneScalars.s.sol | 25 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index e58dbb617..2d62b44bc 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -9,7 +9,10 @@ import {IResourceMetering} from "./IResourceMetering.sol"; // SystemConfigUpgrade is a contract that can be used to verify that an upgrade of the SystemConfig contract // has not changed any of the storage variables that are not expected to change. -// It stores the prior storage variables (EXCLUDING the Ecotone Scalar variables basedeeScalat and blobbasefeeScalar) +// It stores the prior storage variables EXCLUDING: +// - scalar +// - basedeeScalar +// - blobbasefeeScalar // of the SystemConfig contract at constructor time. // It exposes a method which allows the verification script to check that the storage variables have not changed. contract SystemConfigUpgrade is SuperchainRegistry { @@ -17,7 +20,6 @@ contract SystemConfigUpgrade is SuperchainRegistry { struct SysCfgVars { address owner; - uint256 scalar; bytes32 batcherHash; uint256 gasLimit; address unsafeBlockSigner; @@ -49,7 +51,6 @@ contract SystemConfigUpgrade is SuperchainRegistry { return SysCfgVars({ owner: sysCfg.owner(), - scalar: sysCfg.scalar(), batcherHash: sysCfg.batcherHash(), gasLimit: sysCfg.gasLimit(), unsafeBlockSigner: sysCfg.unsafeBlockSigner(), diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index b5f031d82..64d62f437 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -12,13 +12,18 @@ import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { using LibString for string; + ISystemConfig sysCfg; + uint256 previousScalar; + constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) SystemConfigUpgrade(_l1ChainName, _l2ChainName, _release) - {} + { + sysCfg = ISystemConfig(proxies.SystemConfig); + previousScalar = sysCfg.scalar(); + } /// @notice Public function that must be called by the verification script. function checkSystemConfigUpgrade() public view override { - ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); console.log( @@ -27,18 +32,14 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { LibString.toString(sysCfg.blobbasefeeScalar()) ); if ( - uint8(previous.scalar >> 248) == 1 // most significant bit + // If the scalar version (i.e. the most significant bit of the scalar) + // is 1, we expect it to be unchanged during the upgrade. + // Otherwise, the upgrade will migrate the scalar from version 0 to version 1 + uint8(previousScalar >> 248) == 1 ) { - console.log( - "reencode to previous scalar: ", - LibString.toString(reencodedScalar), - LibString.toString(previous.scalar) - ); - require(reencodedScalar == previous.scalar, "scalar-100 (reencoding produced incorrect result)"); - // We do this check last because it would fail if the scalar is wrong, and we get less debug info from it. - // It checks all of the other fields which should not have changed (via a hash). - super.checkSystemConfigUpgrade(); + require(reencodedScalar == previousScalar, "scalar-100 scalar mismatch"); } require(sysCfg.scalar() == reencodedScalar, "scalar-101"); + super.checkSystemConfigUpgrade(); // check remaining storage variables didn't change } } From 5253651eb9ce4c764cbc22e6cd32c0c3a26d01eb Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 16:39:40 +0000 Subject: [PATCH 41/68] make validation of migration of scalar from version 0 to 1 very explicit --- .../SystemConfigUpgradeEcotoneScalars.s.sol | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index 64d62f437..372425da4 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -34,12 +34,21 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { if ( // If the scalar version (i.e. the most significant bit of the scalar) // is 1, we expect it to be unchanged during the upgrade. - // Otherwise, the upgrade will migrate the scalar from version 0 to version 1 uint8(previousScalar >> 248) == 1 ) { require(reencodedScalar == previousScalar, "scalar-100 scalar mismatch"); + } else { + // Otherwise, if the scalar version is 0, + // and the blobbasefeeScalar is 0, + // the upgrade will migrate the scalar version to 1 and preserve + // everything else. + require(previousScalar >> 248 == 0, "scalar-101 previous scalar version != 0 or 1"); + require(reencodedScalar >> 248 == 1, "scalar-102 reenconded scalar version != 1"); + require(sysCfg.blobbasefeeScalar() == uint32(0), "scalar-103 blobbasefeeScalar !=0"); + require(reencodedScalar << 8 == previousScalar << 8, "scalar-104 scalar mismatch"); } - require(sysCfg.scalar() == reencodedScalar, "scalar-101"); + // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. + require(sysCfg.scalar() == reencodedScalar, "scalar-105"); super.checkSystemConfigUpgrade(); // check remaining storage variables didn't change } } From 0f0c5391fd5796d2fd5bd1838aa94bb450086548 Mon Sep 17 00:00:00 2001 From: geoknee Date: Tue, 7 Jan 2025 16:53:30 +0000 Subject: [PATCH 42/68] add link to ecotone scalars specs --- script/verification/SystemConfigUpgradeEcotoneScalars.s.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index 372425da4..92f489677 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -42,6 +42,7 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { // and the blobbasefeeScalar is 0, // the upgrade will migrate the scalar version to 1 and preserve // everything else. + // See https://specs.optimism.io/protocol/system-config.html?highlight=ecotone%20scalar#ecotone-scalar-overhead-uint256uint256-change require(previousScalar >> 248 == 0, "scalar-101 previous scalar version != 0 or 1"); require(reencodedScalar >> 248 == 1, "scalar-102 reenconded scalar version != 1"); require(sysCfg.blobbasefeeScalar() == uint32(0), "scalar-103 blobbasefeeScalar !=0"); From ece1fe99c2a2b6cecb4e6b92a20ae69011a12658 Mon Sep 17 00:00:00 2001 From: George Knee Date: Tue, 7 Jan 2025 17:02:03 +0000 Subject: [PATCH 43/68] Update script/verification/SystemConfigUpgrade.s.sol --- script/verification/SystemConfigUpgrade.s.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index 2d62b44bc..207cdd8a4 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -11,7 +11,7 @@ import {IResourceMetering} from "./IResourceMetering.sol"; // has not changed any of the storage variables that are not expected to change. // It stores the prior storage variables EXCLUDING: // - scalar -// - basedeeScalar +// - basefeeScalar // - blobbasefeeScalar // of the SystemConfig contract at constructor time. // It exposes a method which allows the verification script to check that the storage variables have not changed. From dd88bab5d0aaedd8158cef451e590dc686f020b1 Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 8 Jan 2025 10:52:21 +0000 Subject: [PATCH 44/68] add step to validate target semver of SystemConfig --- script/verification/SystemConfigUpgrade.s.sol | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index 207cdd8a4..3cf6cd246 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -6,6 +6,7 @@ import {LibString} from "solady/utils/LibString.sol"; import {SuperchainRegistry} from "script/verification/Verification.s.sol"; import {ISystemConfig} from "./ISystemConfig.sol"; import {IResourceMetering} from "./IResourceMetering.sol"; +import {console2 as console} from "forge-std/console2.sol"; // SystemConfigUpgrade is a contract that can be used to verify that an upgrade of the SystemConfig contract // has not changed any of the storage variables that are not expected to change. @@ -36,14 +37,21 @@ contract SystemConfigUpgrade is SuperchainRegistry { address public systemConfigAddress; SysCfgVars previous; + string targetVersion; constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) SuperchainRegistry(_l1ChainName, _l2ChainName, _release) { systemConfigAddress = proxies.SystemConfig; + targetVersion = standardVersions.SystemConfig.version; previous = getSysCfgVars(); // Set this before the tx is executed. } + function getSysCfgVersion() internal view returns (string memory) { + ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); + return sysCfg.version(); + } + function getSysCfgVars() internal view returns (SysCfgVars memory) { ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); @@ -68,6 +76,11 @@ contract SystemConfigUpgrade is SuperchainRegistry { /// @notice Public function that must be called by the verification script. function checkSystemConfigUpgrade() public view virtual { + require( + keccak256(abi.encode(getSysCfgVersion())) == keccak256(abi.encode(targetVersion)), + "system-config-050: targetVersion" + ); + console.log("confirmed SystemConfig upgraded to version", targetVersion); SysCfgVars memory got = getSysCfgVars(); require(keccak256(abi.encode(got)) == keccak256(abi.encode(previous)), "system-config-100"); } From ce792fc97a4b97640221af084c9b9b80e09fc402 Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 8 Jan 2025 18:56:56 +0000 Subject: [PATCH 45/68] SystemConfigUpgrade.getSysCfgVars() copes with explicit contract versions --- script/verification/SystemConfigUpgrade.s.sol | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index 3cf6cd246..f65d5204a 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -55,7 +55,25 @@ contract SystemConfigUpgrade is SuperchainRegistry { function getSysCfgVars() internal view returns (SysCfgVars memory) { ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); - (address gasPayingToken,) = sysCfg.gasPayingToken(); + // gasPayingToken is not available on superchainconfig 1.12.0 and 2.2.0 + // the only supported versions to upgrade _from_. + // Since all supported chains are therefore non CGT chains + // we hardcode this: + address gasPayingToken; + address disputeGameFactory; + + if (sysCfg.version().eq("2.3.0")) { + disputeGameFactory = sysCfg.disputeGameFactory(); + (gasPayingToken,) = sysCfg.gasPayingToken(); + } else if (sysCfg.version().eq("2.2.0")) { + disputeGameFactory = sysCfg.disputeGameFactory(); + gasPayingToken = address(0); + } else if (sysCfg.version().eq("1.12.0")) { + disputeGameFactory = address(0); + gasPayingToken = address(0); + } else { + revert("unsupported SystemConfig version"); + } return SysCfgVars({ owner: sysCfg.owner(), @@ -64,13 +82,13 @@ contract SystemConfigUpgrade is SuperchainRegistry { unsafeBlockSigner: sysCfg.unsafeBlockSigner(), resourceConfig: sysCfg.resourceConfig(), batchInbox: sysCfg.batchInbox(), - gasPayingToken: gasPayingToken, l1CrossDomainMessenger: sysCfg.l1CrossDomainMessenger(), l1StandardBridge: sysCfg.l1StandardBridge(), l1ERC721Bridge: sysCfg.l1ERC721Bridge(), - disputeGameFactory: sysCfg.disputeGameFactory(), optimismPortal: sysCfg.optimismPortal(), - optimismMintableERC20Factory: sysCfg.optimismMintableERC20Factory() + optimismMintableERC20Factory: sysCfg.optimismMintableERC20Factory(), + gasPayingToken: gasPayingToken, + disputeGameFactory: disputeGameFactory }); } From 9ffc1a6e0e6ba950518a802fb7e06805218b8e04 Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 8 Jan 2025 21:22:31 +0000 Subject: [PATCH 46/68] comments --- script/verification/SystemConfigUpgrade.s.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index f65d5204a..c1bb5535b 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -55,20 +55,20 @@ contract SystemConfigUpgrade is SuperchainRegistry { function getSysCfgVars() internal view returns (SysCfgVars memory) { ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); - // gasPayingToken is not available on superchainconfig 1.12.0 and 2.2.0 - // the only supported versions to upgrade _from_. - // Since all supported chains are therefore non CGT chains - // we hardcode this: + // Depending on the version of the SystemConfig contract, + // certain variables may not be present address gasPayingToken; address disputeGameFactory; - if (sysCfg.version().eq("2.3.0")) { + // Target Version disputeGameFactory = sysCfg.disputeGameFactory(); (gasPayingToken,) = sysCfg.gasPayingToken(); } else if (sysCfg.version().eq("2.2.0")) { + // Supported initial version disputeGameFactory = sysCfg.disputeGameFactory(); gasPayingToken = address(0); } else if (sysCfg.version().eq("1.12.0")) { + // Supported initial version disputeGameFactory = address(0); gasPayingToken = address(0); } else { From d2162ee07e0c5446894e42fd19a994766daffd8c Mon Sep 17 00:00:00 2001 From: geoknee Date: Wed, 8 Jan 2025 22:34:24 +0000 Subject: [PATCH 47/68] SystemConfigUpgrade: pull gasPayingToken and disputeGameFactory checks into child contract --- script/verification/SystemConfigUpgrade.s.sol | 28 ++----------------- .../SystemConfigUpgradeEcotoneScalars.s.sol | 25 ++++++++++++++++- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol index c1bb5535b..2917a1c32 100644 --- a/script/verification/SystemConfigUpgrade.s.sol +++ b/script/verification/SystemConfigUpgrade.s.sol @@ -14,6 +14,8 @@ import {console2 as console} from "forge-std/console2.sol"; // - scalar // - basefeeScalar // - blobbasefeeScalar +// - gasPayingToken +// - disputeGameFactory // of the SystemConfig contract at constructor time. // It exposes a method which allows the verification script to check that the storage variables have not changed. contract SystemConfigUpgrade is SuperchainRegistry { @@ -26,11 +28,9 @@ contract SystemConfigUpgrade is SuperchainRegistry { address unsafeBlockSigner; IResourceMetering.ResourceConfig resourceConfig; address batchInbox; - address gasPayingToken; address l1CrossDomainMessenger; address l1StandardBridge; address l1ERC721Bridge; - address disputeGameFactory; address optimismPortal; address optimismMintableERC20Factory; } @@ -55,26 +55,6 @@ contract SystemConfigUpgrade is SuperchainRegistry { function getSysCfgVars() internal view returns (SysCfgVars memory) { ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); - // Depending on the version of the SystemConfig contract, - // certain variables may not be present - address gasPayingToken; - address disputeGameFactory; - if (sysCfg.version().eq("2.3.0")) { - // Target Version - disputeGameFactory = sysCfg.disputeGameFactory(); - (gasPayingToken,) = sysCfg.gasPayingToken(); - } else if (sysCfg.version().eq("2.2.0")) { - // Supported initial version - disputeGameFactory = sysCfg.disputeGameFactory(); - gasPayingToken = address(0); - } else if (sysCfg.version().eq("1.12.0")) { - // Supported initial version - disputeGameFactory = address(0); - gasPayingToken = address(0); - } else { - revert("unsupported SystemConfig version"); - } - return SysCfgVars({ owner: sysCfg.owner(), batcherHash: sysCfg.batcherHash(), @@ -86,9 +66,7 @@ contract SystemConfigUpgrade is SuperchainRegistry { l1StandardBridge: sysCfg.l1StandardBridge(), l1ERC721Bridge: sysCfg.l1ERC721Bridge(), optimismPortal: sysCfg.optimismPortal(), - optimismMintableERC20Factory: sysCfg.optimismMintableERC20Factory(), - gasPayingToken: gasPayingToken, - disputeGameFactory: disputeGameFactory + optimismMintableERC20Factory: sysCfg.optimismMintableERC20Factory() }); } diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol index 92f489677..c17c2e46c 100644 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol @@ -14,12 +14,26 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { ISystemConfig sysCfg; uint256 previousScalar; + address targetDGF; constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) SystemConfigUpgrade(_l1ChainName, _l2ChainName, _release) { sysCfg = ISystemConfig(proxies.SystemConfig); previousScalar = sysCfg.scalar(); + + if (sysCfg.version().eq("2.3.0")) { + // Target Version + targetDGF = sysCfg.disputeGameFactory(); + } else if (sysCfg.version().eq("2.2.0")) { + // Supported initial version + targetDGF = sysCfg.disputeGameFactory(); + } else if (sysCfg.version().eq("1.12.0")) { + // Supported initial version + targetDGF = address(0); + } else { + revert("unsupported SystemConfig version"); + } } /// @notice Public function that must be called by the verification script. @@ -50,6 +64,15 @@ contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { } // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. require(sysCfg.scalar() == reencodedScalar, "scalar-105"); - super.checkSystemConfigUpgrade(); // check remaining storage variables didn't change + + require(sysCfg.disputeGameFactory() == targetDGF, "scalar-106"); + + // upgrade does not support CGT chains, so we require the gasPayingToken to be ETH + (address t, uint8 d) = sysCfg.gasPayingToken(); + require(t == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, "scalar-107"); + require(d == 18, "scalar-108"); + + // Check remaining storage variables didn't change + super.checkSystemConfigUpgrade(); } } From 4892a5c7f7edd9a257c9a9af2b3899b4cee41373 Mon Sep 17 00:00:00 2001 From: geoknee Date: Thu, 9 Jan 2025 11:50:33 +0000 Subject: [PATCH 48/68] combine SystemConfigUpgrade with SystemConfigUpgradeEcotoneScalars and rename to HoloceneSystemConfigUpgrade --- .../HoloceneSystemConfigUpgrade.s.sol | 144 ++++++++++++++++++ script/verification/SystemConfigUpgrade.s.sol | 93 ----------- .../SystemConfigUpgradeEcotoneScalars.s.sol | 78 ---------- .../NestedSignFromJson.s.sol | 6 +- 4 files changed, 147 insertions(+), 174 deletions(-) create mode 100644 script/verification/HoloceneSystemConfigUpgrade.s.sol delete mode 100644 script/verification/SystemConfigUpgrade.s.sol delete mode 100644 script/verification/SystemConfigUpgradeEcotoneScalars.s.sol diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol new file mode 100644 index 000000000..b09dd0877 --- /dev/null +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -0,0 +1,144 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.15; + +import {console2 as console} from "forge-std/console2.sol"; +import {LibString} from "solady/utils/LibString.sol"; +import {ISystemConfig} from "./ISystemConfig.sol"; +import {IResourceMetering} from "./IResourceMetering.sol"; +import {SuperchainRegistry} from "script/verification/Verification.s.sol"; + +// HoloceneSystemConfigUpgrade is a contract that can be used to verify the Holocene upgrade of the SystemConfig contract. +// The upgrade paths supported are 2.2.0 -> 2.3.0 and 1.12.0 -> 2.3.0. +// The verification checks that the following storage values are properly modified if appropriate: +// - scalar (may be migrated to a different encoding version) +// - basefeeScalar (new storage variable, needs to be set in a way which is consistent with the previous scalar) +// - blobbasefeeScalar (new storage variable, needs to be set in a way which is consistent with the previous scalar) +// - gasPayingToken (new storage variable, needs to be set to a magic value representing ETH) +// - disputeGameFactory (does not exist @ 1.12.0, needs to be set to zero address for changes on this upgrade path) +// It also verified that remaining storage variables are unchanged. +contract HoloceneSystemConfigUpgrade is SuperchainRegistry { + using LibString for string; + + address public systemConfigAddress; + ISystemConfig sysCfg; + + // Values which should not change during the upgrade + struct BaseSysCfgVars { + address owner; + bytes32 batcherHash; + uint256 gasLimit; + address unsafeBlockSigner; + IResourceMetering.ResourceConfig resourceConfig; + address batchInbox; + address l1CrossDomainMessenger; + address l1StandardBridge; + address l1ERC721Bridge; + address optimismPortal; + address optimismMintableERC20Factory; + } + + BaseSysCfgVars previous; + + uint256 previousScalar; + address targetDGF; + string targetVersion; + + constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) + SuperchainRegistry(_l1ChainName, _l2ChainName, _release) + { + systemConfigAddress = proxies.SystemConfig; + targetVersion = standardVersions.SystemConfig.version; + previous = getBaseSysCfgVars(); // Set this before the tx is executed. + sysCfg = ISystemConfig(proxies.SystemConfig); + previousScalar = sysCfg.scalar(); + + if (sysCfg.version().eq("2.3.0")) { + // Target Version + targetDGF = sysCfg.disputeGameFactory(); + } else if (sysCfg.version().eq("2.2.0")) { + // Supported initial version + targetDGF = sysCfg.disputeGameFactory(); + } else if (sysCfg.version().eq("1.12.0")) { + // Supported initial version + targetDGF = address(0); + } else { + revert("unsupported SystemConfig version"); + } + } + + /// @notice Public function that must be called by the verification script. + function checkSystemConfigUpgrade() public view { + require( + keccak256(abi.encode(getSysCfgVersion())) == keccak256(abi.encode(targetVersion)), + "system-config-050: targetVersion" + ); + + uint256 reencodedScalar = + (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); + console.log( + "checking baseFeeScalar and blobbaseFeeScalar ", + LibString.toString(sysCfg.basefeeScalar()), + LibString.toString(sysCfg.blobbasefeeScalar()) + ); + if ( + // If the scalar version (i.e. the most significant bit of the scalar) + // is 1, we expect it to be unchanged during the upgrade. + uint8(previousScalar >> 248) == 1 + ) { + require(reencodedScalar == previousScalar, "scalar-100 scalar mismatch"); + } else { + // Otherwise, if the scalar version is 0, + // and the blobbasefeeScalar is 0, + // the upgrade will migrate the scalar version to 1 and preserve + // everything else. + // See https://specs.optimism.io/protocol/system-config.html?highlight=ecotone%20scalar#ecotone-scalar-overhead-uint256uint256-change + require(previousScalar >> 248 == 0, "scalar-101 previous scalar version != 0 or 1"); + require(reencodedScalar >> 248 == 1, "scalar-102 reenconded scalar version != 1"); + require(sysCfg.blobbasefeeScalar() == uint32(0), "scalar-103 blobbasefeeScalar !=0"); + require(reencodedScalar << 8 == previousScalar << 8, "scalar-104 scalar mismatch"); + } + // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. + require(sysCfg.scalar() == reencodedScalar, "scalar-105"); + + require(sysCfg.disputeGameFactory() == targetDGF, "scalar-106"); + + // upgrade does not support CGT chains, so we require the gasPayingToken to be ETH + (address t, uint8 d) = sysCfg.gasPayingToken(); + require(t == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, "scalar-107"); + require(d == 18, "scalar-108"); + + // Check remaining storage variables didn't change + console.log("confirmed SystemConfig upgraded to version", targetVersion); + require(keccak256(abi.encode(getBaseSysCfgVars())) == keccak256(abi.encode(previous)), "system-config-100"); + } + + function getCodeExceptions() public view returns (address[] memory exceptions) { + uint256 len = block.chainid == 1 ? 3 : 4; // Mainnet doesn't need owner exception. + exceptions = new address[](len); + uint256 i = 0; + if (block.chainid != 1) exceptions[i++] = previous.owner; + exceptions[i++] = address(uint160(uint256((previous.batcherHash)))); + exceptions[i++] = previous.unsafeBlockSigner; + exceptions[i++] = previous.batchInbox; + } + + function getSysCfgVersion() internal view returns (string memory) { + return sysCfg.version(); + } + + function getBaseSysCfgVars() internal view returns (BaseSysCfgVars memory) { + return BaseSysCfgVars({ + owner: sysCfg.owner(), + batcherHash: sysCfg.batcherHash(), + gasLimit: sysCfg.gasLimit(), + unsafeBlockSigner: sysCfg.unsafeBlockSigner(), + resourceConfig: sysCfg.resourceConfig(), + batchInbox: sysCfg.batchInbox(), + l1CrossDomainMessenger: sysCfg.l1CrossDomainMessenger(), + l1StandardBridge: sysCfg.l1StandardBridge(), + l1ERC721Bridge: sysCfg.l1ERC721Bridge(), + optimismPortal: sysCfg.optimismPortal(), + optimismMintableERC20Factory: sysCfg.optimismMintableERC20Factory() + }); + } +} diff --git a/script/verification/SystemConfigUpgrade.s.sol b/script/verification/SystemConfigUpgrade.s.sol deleted file mode 100644 index 2917a1c32..000000000 --- a/script/verification/SystemConfigUpgrade.s.sol +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.15; - -import {Vm} from "forge-std/Vm.sol"; -import {LibString} from "solady/utils/LibString.sol"; -import {SuperchainRegistry} from "script/verification/Verification.s.sol"; -import {ISystemConfig} from "./ISystemConfig.sol"; -import {IResourceMetering} from "./IResourceMetering.sol"; -import {console2 as console} from "forge-std/console2.sol"; - -// SystemConfigUpgrade is a contract that can be used to verify that an upgrade of the SystemConfig contract -// has not changed any of the storage variables that are not expected to change. -// It stores the prior storage variables EXCLUDING: -// - scalar -// - basefeeScalar -// - blobbasefeeScalar -// - gasPayingToken -// - disputeGameFactory -// of the SystemConfig contract at constructor time. -// It exposes a method which allows the verification script to check that the storage variables have not changed. -contract SystemConfigUpgrade is SuperchainRegistry { - using LibString for string; - - struct SysCfgVars { - address owner; - bytes32 batcherHash; - uint256 gasLimit; - address unsafeBlockSigner; - IResourceMetering.ResourceConfig resourceConfig; - address batchInbox; - address l1CrossDomainMessenger; - address l1StandardBridge; - address l1ERC721Bridge; - address optimismPortal; - address optimismMintableERC20Factory; - } - - address public systemConfigAddress; - SysCfgVars previous; - string targetVersion; - - constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) - SuperchainRegistry(_l1ChainName, _l2ChainName, _release) - { - systemConfigAddress = proxies.SystemConfig; - targetVersion = standardVersions.SystemConfig.version; - previous = getSysCfgVars(); // Set this before the tx is executed. - } - - function getSysCfgVersion() internal view returns (string memory) { - ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); - return sysCfg.version(); - } - - function getSysCfgVars() internal view returns (SysCfgVars memory) { - ISystemConfig sysCfg = ISystemConfig(proxies.SystemConfig); - - return SysCfgVars({ - owner: sysCfg.owner(), - batcherHash: sysCfg.batcherHash(), - gasLimit: sysCfg.gasLimit(), - unsafeBlockSigner: sysCfg.unsafeBlockSigner(), - resourceConfig: sysCfg.resourceConfig(), - batchInbox: sysCfg.batchInbox(), - l1CrossDomainMessenger: sysCfg.l1CrossDomainMessenger(), - l1StandardBridge: sysCfg.l1StandardBridge(), - l1ERC721Bridge: sysCfg.l1ERC721Bridge(), - optimismPortal: sysCfg.optimismPortal(), - optimismMintableERC20Factory: sysCfg.optimismMintableERC20Factory() - }); - } - - /// @notice Public function that must be called by the verification script. - function checkSystemConfigUpgrade() public view virtual { - require( - keccak256(abi.encode(getSysCfgVersion())) == keccak256(abi.encode(targetVersion)), - "system-config-050: targetVersion" - ); - console.log("confirmed SystemConfig upgraded to version", targetVersion); - SysCfgVars memory got = getSysCfgVars(); - require(keccak256(abi.encode(got)) == keccak256(abi.encode(previous)), "system-config-100"); - } - - function getCodeExceptions() public view returns (address[] memory exceptions) { - uint256 len = block.chainid == 1 ? 3 : 4; // Mainnet doesn't need owner exception. - exceptions = new address[](len); - uint256 i = 0; - if (block.chainid != 1) exceptions[i++] = previous.owner; - exceptions[i++] = address(uint160(uint256((previous.batcherHash)))); - exceptions[i++] = previous.unsafeBlockSigner; - exceptions[i++] = previous.batchInbox; - } -} diff --git a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol b/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol deleted file mode 100644 index c17c2e46c..000000000 --- a/script/verification/SystemConfigUpgradeEcotoneScalars.s.sol +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.15; - -import {console2 as console} from "forge-std/console2.sol"; -import {LibString} from "solady/utils/LibString.sol"; -import {ISystemConfig} from "./ISystemConfig.sol"; -import {SystemConfigUpgrade} from "script/verification/SystemConfigUpgrade.s.sol"; - -// SystemConfigUpgradeEcotoneScalars is a contract that can be used to verify that an upgrade of the SystemConfig contract -// results in the correct values for scalar, basefeeScalar, and blobbasefeeScalar being set, and that the remaining -// storage values have not changed. -contract SystemConfigUpgradeEcotoneScalars is SystemConfigUpgrade { - using LibString for string; - - ISystemConfig sysCfg; - uint256 previousScalar; - address targetDGF; - - constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) - SystemConfigUpgrade(_l1ChainName, _l2ChainName, _release) - { - sysCfg = ISystemConfig(proxies.SystemConfig); - previousScalar = sysCfg.scalar(); - - if (sysCfg.version().eq("2.3.0")) { - // Target Version - targetDGF = sysCfg.disputeGameFactory(); - } else if (sysCfg.version().eq("2.2.0")) { - // Supported initial version - targetDGF = sysCfg.disputeGameFactory(); - } else if (sysCfg.version().eq("1.12.0")) { - // Supported initial version - targetDGF = address(0); - } else { - revert("unsupported SystemConfig version"); - } - } - - /// @notice Public function that must be called by the verification script. - function checkSystemConfigUpgrade() public view override { - uint256 reencodedScalar = - (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); - console.log( - "checking baseFeeScalar and blobbaseFeeScalar ", - LibString.toString(sysCfg.basefeeScalar()), - LibString.toString(sysCfg.blobbasefeeScalar()) - ); - if ( - // If the scalar version (i.e. the most significant bit of the scalar) - // is 1, we expect it to be unchanged during the upgrade. - uint8(previousScalar >> 248) == 1 - ) { - require(reencodedScalar == previousScalar, "scalar-100 scalar mismatch"); - } else { - // Otherwise, if the scalar version is 0, - // and the blobbasefeeScalar is 0, - // the upgrade will migrate the scalar version to 1 and preserve - // everything else. - // See https://specs.optimism.io/protocol/system-config.html?highlight=ecotone%20scalar#ecotone-scalar-overhead-uint256uint256-change - require(previousScalar >> 248 == 0, "scalar-101 previous scalar version != 0 or 1"); - require(reencodedScalar >> 248 == 1, "scalar-102 reenconded scalar version != 1"); - require(sysCfg.blobbasefeeScalar() == uint32(0), "scalar-103 blobbasefeeScalar !=0"); - require(reencodedScalar << 8 == previousScalar << 8, "scalar-104 scalar mismatch"); - } - // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. - require(sysCfg.scalar() == reencodedScalar, "scalar-105"); - - require(sysCfg.disputeGameFactory() == targetDGF, "scalar-106"); - - // upgrade does not support CGT chains, so we require the gasPayingToken to be ETH - (address t, uint8 d) = sysCfg.gasPayingToken(); - require(t == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, "scalar-107"); - require(d == 18, "scalar-108"); - - // Check remaining storage variables didn't change - super.checkSystemConfigUpgrade(); - } -} diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index fa1159b74..91420ed32 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -8,20 +8,20 @@ import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSig import {DisputeGameUpgrade} from "script/verification/DisputeGameUpgrade.s.sol"; import {CouncilFoundationNestedSign} from "script/verification/CouncilFoundationNestedSign.s.sol"; import {VerificationBase, SuperchainRegistry} from "script/verification/Verification.s.sol"; -import {SystemConfigUpgradeEcotoneScalars} from "script/verification/SystemConfigUpgradeEcotoneScalars.s.sol"; +import {HoloceneSystemConfigUpgrade} from "script/verification/HoloceneSystemConfigUpgrade.s.sol"; contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNestedSign { string constant l1ChainName = "sepolia"; string constant release = "v1.8.0-rc.4"; string[4] l2ChainNames = ["op", "metal", "mode", "zora"]; - SystemConfigUpgradeEcotoneScalars[] sysCfgUpgrades; + HoloceneSystemConfigUpgrade[] sysCfgUpgrades; constructor() { for (uint256 i = 0; i < l2ChainNames.length; i++) { // Deploy a SystemConfigUpgradeEcotoneScalars instance per chain, // which each contains its own bindings to an individual chain's SuperchainRegistry data. - sysCfgUpgrades.push(new SystemConfigUpgradeEcotoneScalars(l1ChainName, l2ChainNames[i], release)); + sysCfgUpgrades.push(new HoloceneSystemConfigUpgrade(l1ChainName, l2ChainNames[i], release)); console.log(""); console.log("Set up verification data for chain", l2ChainNames[i], "-", l1ChainName); console.log("with SystemConfigProxy @", sysCfgUpgrades[i].systemConfigAddress()); From 06f91d1dbc0d0f5391c1ddf9d76a6f4b0d06dfcf Mon Sep 17 00:00:00 2001 From: geoknee Date: Thu, 9 Jan 2025 12:03:23 +0000 Subject: [PATCH 49/68] tidy --- .../HoloceneSystemConfigUpgrade.s.sol | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index b09dd0877..71bc7ec6b 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -47,11 +47,15 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { SuperchainRegistry(_l1ChainName, _l2ChainName, _release) { systemConfigAddress = proxies.SystemConfig; - targetVersion = standardVersions.SystemConfig.version; - previous = getBaseSysCfgVars(); // Set this before the tx is executed. sysCfg = ISystemConfig(proxies.SystemConfig); + + // cache the values of the SystemConfig contract before the upgrade + previous = getBaseSysCfgVars(); previousScalar = sysCfg.scalar(); + // Read target version from SCR @ specified release + targetVersion = standardVersions.SystemConfig.version; + if (sysCfg.version().eq("2.3.0")) { // Target Version targetDGF = sysCfg.disputeGameFactory(); @@ -68,11 +72,32 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { /// @notice Public function that must be called by the verification script. function checkSystemConfigUpgrade() public view { + checkTargetVersion(); + checkScalar(); + checkDGF(); + checkGasPayingToken(); + checkBaseSysCfgVars(); + } + + function getCodeExceptions() public view returns (address[] memory exceptions) { + uint256 len = block.chainid == 1 ? 3 : 4; // Mainnet doesn't need owner exception. + exceptions = new address[](len); + uint256 i = 0; + if (block.chainid != 1) exceptions[i++] = previous.owner; + exceptions[i++] = address(uint160(uint256((previous.batcherHash)))); + exceptions[i++] = previous.unsafeBlockSigner; + exceptions[i++] = previous.batchInbox; + } + + function checkTargetVersion() internal view { require( keccak256(abi.encode(getSysCfgVersion())) == keccak256(abi.encode(targetVersion)), "system-config-050: targetVersion" ); + console.log("confirmed SystemConfig upgraded to version", targetVersion); + } + function checkScalar() internal view { uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); console.log( @@ -99,29 +124,24 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { } // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. require(sysCfg.scalar() == reencodedScalar, "scalar-105"); + } + function checkDGF() internal view { require(sysCfg.disputeGameFactory() == targetDGF, "scalar-106"); + } + function checkGasPayingToken() internal view { // upgrade does not support CGT chains, so we require the gasPayingToken to be ETH (address t, uint8 d) = sysCfg.gasPayingToken(); require(t == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, "scalar-107"); require(d == 18, "scalar-108"); + } + function checkBaseSysCfgVars() internal view { // Check remaining storage variables didn't change - console.log("confirmed SystemConfig upgraded to version", targetVersion); require(keccak256(abi.encode(getBaseSysCfgVars())) == keccak256(abi.encode(previous)), "system-config-100"); } - function getCodeExceptions() public view returns (address[] memory exceptions) { - uint256 len = block.chainid == 1 ? 3 : 4; // Mainnet doesn't need owner exception. - exceptions = new address[](len); - uint256 i = 0; - if (block.chainid != 1) exceptions[i++] = previous.owner; - exceptions[i++] = address(uint160(uint256((previous.batcherHash)))); - exceptions[i++] = previous.unsafeBlockSigner; - exceptions[i++] = previous.batchInbox; - } - function getSysCfgVersion() internal view returns (string memory) { return sysCfg.version(); } From 566477ebb3cda103b5c34b742e607f4feb12db63 Mon Sep 17 00:00:00 2001 From: geoknee Date: Thu, 9 Jan 2025 13:02:28 +0000 Subject: [PATCH 50/68] some more improvements --- .../HoloceneSystemConfigUpgrade.s.sol | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 71bc7ec6b..7b88a3850 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -8,7 +8,10 @@ import {IResourceMetering} from "./IResourceMetering.sol"; import {SuperchainRegistry} from "script/verification/Verification.s.sol"; // HoloceneSystemConfigUpgrade is a contract that can be used to verify the Holocene upgrade of the SystemConfig contract. -// The upgrade paths supported are 2.2.0 -> 2.3.0 and 1.12.0 -> 2.3.0. +// The upgrade paths supported are: +// 1.12.0 -> 2.3.0 +// 2.2.0 -> 2.3.0 +// 2.3.0 -> 2.3.0 (this case covers where the SystemConfig contract is already at the target version but was upgraded incorrectly) // The verification checks that the following storage values are properly modified if appropriate: // - scalar (may be migrated to a different encoding version) // - basefeeScalar (new storage variable, needs to be set in a way which is consistent with the previous scalar) @@ -22,7 +25,9 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { address public systemConfigAddress; ISystemConfig sysCfg; - // Values which should not change during the upgrade + // Storage variables which exist in the existing and target + // SystemConfig contract versions irrespective of upgrade path, + // and which should be preserved: struct BaseSysCfgVars { address owner; bytes32 batcherHash; @@ -39,8 +44,19 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { BaseSysCfgVars previous; + // Values which may change during the upgrade, depending on the chain:: uint256 previousScalar; + + // The target value for the DisputeGameFactory address, + // this getter does not exist in the SystemConfig contract @ 1.12.0: address targetDGF; + + // Target values for gasPayingToken and its decimals. This should represent ETH + // on all upgrade paths: + address constant targetGasPayingToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; + uint8 constant targetDecimals = 18; + + // The target version of the SystemConfig contract, read from the SCR @ specified release: string targetVersion; constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) @@ -57,7 +73,7 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { targetVersion = standardVersions.SystemConfig.version; if (sysCfg.version().eq("2.3.0")) { - // Target Version + // Supported initial version targetDGF = sysCfg.disputeGameFactory(); } else if (sysCfg.version().eq("2.2.0")) { // Supported initial version @@ -131,10 +147,9 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { } function checkGasPayingToken() internal view { - // upgrade does not support CGT chains, so we require the gasPayingToken to be ETH (address t, uint8 d) = sysCfg.gasPayingToken(); - require(t == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, "scalar-107"); - require(d == 18, "scalar-108"); + require(t == targetGasPayingToken, "scalar-107"); + require(d == targetDecimals, "scalar-108"); } function checkBaseSysCfgVars() internal view { From 497007fcc0d6e66089f8790c22c4a7f57fce7f66 Mon Sep 17 00:00:00 2001 From: geoknee Date: Thu, 9 Jan 2025 13:03:04 +0000 Subject: [PATCH 51/68] more code comments --- script/verification/HoloceneSystemConfigUpgrade.s.sol | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 7b88a3850..e0ae86bdb 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -59,6 +59,8 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { // The target version of the SystemConfig contract, read from the SCR @ specified release: string targetVersion; + // The constructor caches some information from the SCR and from the existing SystemConfig contract + // before the upgrade is executed. constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) SuperchainRegistry(_l1ChainName, _l2ChainName, _release) { @@ -105,6 +107,7 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { exceptions[i++] = previous.batchInbox; } + // Checks semver of SystemConfig is correct after the upgrade function checkTargetVersion() internal view { require( keccak256(abi.encode(getSysCfgVersion())) == keccak256(abi.encode(targetVersion)), @@ -113,6 +116,7 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { console.log("confirmed SystemConfig upgraded to version", targetVersion); } + // Checks scalar, basefeeScalar, blobbasefeeScalar are set consistently: function checkScalar() internal view { uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); @@ -142,21 +146,25 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { require(sysCfg.scalar() == reencodedScalar, "scalar-105"); } + // Checks the disputeGameFactory address is set correctly after the upgrade function checkDGF() internal view { require(sysCfg.disputeGameFactory() == targetDGF, "scalar-106"); } + // Checks gasPayingToken and its decimals are set correctly after the upgrade function checkGasPayingToken() internal view { (address t, uint8 d) = sysCfg.gasPayingToken(); require(t == targetGasPayingToken, "scalar-107"); require(d == targetDecimals, "scalar-108"); } + // CHecsk the remaining storage variables are unchanged after the upgrade function checkBaseSysCfgVars() internal view { // Check remaining storage variables didn't change require(keccak256(abi.encode(getBaseSysCfgVars())) == keccak256(abi.encode(previous)), "system-config-100"); } + // Reads function getSysCfgVersion() internal view returns (string memory) { return sysCfg.version(); } From e843ff436aad911a33c2917eeca58f2ba0951354 Mon Sep 17 00:00:00 2001 From: George Knee Date: Fri, 10 Jan 2025 09:47:11 +0000 Subject: [PATCH 52/68] Update script/verification/HoloceneSystemConfigUpgrade.s.sol --- script/verification/HoloceneSystemConfigUpgrade.s.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index e0ae86bdb..79c6c96c1 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -59,7 +59,7 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { // The target version of the SystemConfig contract, read from the SCR @ specified release: string targetVersion; - // The constructor caches some information from the SCR and from the existing SystemConfig contract + // The constructor caches some information from the Superchain Registry and from the existing SystemConfig contract // before the upgrade is executed. constructor(string memory _l1ChainName, string memory _l2ChainName, string memory _release) SuperchainRegistry(_l1ChainName, _l2ChainName, _release) From 7c2a9c85991508333f1055c95b6abd5bb1853102 Mon Sep 17 00:00:00 2001 From: George Knee Date: Fri, 10 Jan 2025 09:47:39 +0000 Subject: [PATCH 53/68] Update script/verification/HoloceneSystemConfigUpgrade.s.sol --- script/verification/HoloceneSystemConfigUpgrade.s.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 79c6c96c1..8661c98ae 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -116,7 +116,9 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { console.log("confirmed SystemConfig upgraded to version", targetVersion); } - // Checks scalar, basefeeScalar, blobbasefeeScalar are set consistently: + // Checks scalar, basefeeScalar, blobbasefeeScalar are set consistently. + // The upgrade will modify (via the initialize() method) the storage slots for scalar (pre-existing), basefeeScalar (new) and blobbasefeeScalar (new). + // checkScalar() reads the variables from the new slot and reencodes them into reecondedScalar (which is a packed version). It then checks that this is equal to the scalar value before the upgrade (previousScalar). In this way, we indirectly prove that the new slots were set correctly (in a way consistent with existing data in the SystemConfig contract). function checkScalar() internal view { uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); From a44a4915e39e06149952e7aec02ba0553e77a6f6 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 09:49:18 +0000 Subject: [PATCH 54/68] typos --- .../NestedSignFromJson.s.sol | 2 +- .../VALIDATION.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol index 91420ed32..c734da510 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/NestedSignFromJson.s.sol @@ -19,7 +19,7 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest constructor() { for (uint256 i = 0; i < l2ChainNames.length; i++) { - // Deploy a SystemConfigUpgradeEcotoneScalars instance per chain, + // Deploy a HoloceneSystemConfigUpgrade instance per chain, // which each contains its own bindings to an individual chain's SuperchainRegistry data. sysCfgUpgrades.push(new HoloceneSystemConfigUpgrade(l1ChainName, l2ChainNames[i], release)); console.log(""); diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index ad523b6c0..82701faaf 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -41,14 +41,14 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` **After**: `0xx00000000000000000000000000000000000d273000001db00000000003938700` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `86200` respectively. These share a slot with the `gasLimit` which remans at `60000000` + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `86200` respectively. These share a slot with the `gasLimit` which remains at `60000000` ### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `68400` and `0` respectively. These share a slot with the `gasLimit` which remans at `30000000` + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `68400` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000` - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000066` **Before**: `0x00000000000000000000000000000000000000000000000000000000000a6fe0` @@ -60,14 +60,14 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remans at `30000000` + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remains at `30000000` ### `0xB54c7BFC223058773CF9b739cC5bd4095184Fb08` (`SystemConfigProxy` for zora-sepolia) - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` **After**: `0x00000000000000000000000000000000000941ad000003f40000000001c9c380` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `1012` and `606637` respectively. These share a slot with the `gasLimit` which remans at `30000000` + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `1012` and `606637` respectively. These share a slot with the `gasLimit` which remains at `30000000` ### `0x1Eb2fFc903729a0F03966B917003800b145F56E2` (`ProxyAdminOwner` for all chains in this task) From 556d1d51bc7b73b13cc9aeda26cb54c042f589ad Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 10:18:30 +0000 Subject: [PATCH 55/68] refactor for readability do not use << 8 to trim encoding version --- .../HoloceneSystemConfigUpgrade.s.sol | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 8661c98ae..030a8dc29 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -117,35 +117,44 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { } // Checks scalar, basefeeScalar, blobbasefeeScalar are set consistently. - // The upgrade will modify (via the initialize() method) the storage slots for scalar (pre-existing), basefeeScalar (new) and blobbasefeeScalar (new). - // checkScalar() reads the variables from the new slot and reencodes them into reecondedScalar (which is a packed version). It then checks that this is equal to the scalar value before the upgrade (previousScalar). In this way, we indirectly prove that the new slots were set correctly (in a way consistent with existing data in the SystemConfig contract). + // The upgrade will modify (via the initialize() method) the storage slots for scalar (pre-existing), basefeeScalar (new) and blobbasefeeScalar (new). + // checkScalar() reads the variables from the new slot and reencodes them into reecondedScalar (which is a packed version). It then checks that this is equal to the scalar value before the upgrade (previousScalar). In this way, we indirectly prove that the new slots were set correctly (in a way consistent with existing data in the SystemConfig contract). function checkScalar() internal view { + // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); console.log( - "checking baseFeeScalar and blobbaseFeeScalar ", + "checking baseFeeScalar and blobbaseFeeScalar reencoded to ", LibString.toString(sysCfg.basefeeScalar()), - LibString.toString(sysCfg.blobbasefeeScalar()) + LibString.toString(sysCfg.blobbasefeeScalar()), + LibString.toString(reencodedScalar) ); + uint256 newScalar = sysCfg.scalar(); + require(newScalar == reencodedScalar, "scalar-105"); + + // Next, we check that the scalar itself was migrated properly + uint8 previousScalarEncodingVersion = uint8(previousScalar >> 248); + uint8 newScalarEncodingVersion = uint8(newScalar >> 248); + if ( // If the scalar version (i.e. the most significant bit of the scalar) // is 1, we expect it to be unchanged during the upgrade. - uint8(previousScalar >> 248) == 1 + previousScalarEncodingVersion == 1 ) { require(reencodedScalar == previousScalar, "scalar-100 scalar mismatch"); } else { // Otherwise, if the scalar version is 0, - // and the blobbasefeeScalar is 0, + // the blobbasefeeScalar is implicitly 0 and // the upgrade will migrate the scalar version to 1 and preserve // everything else. // See https://specs.optimism.io/protocol/system-config.html?highlight=ecotone%20scalar#ecotone-scalar-overhead-uint256uint256-change - require(previousScalar >> 248 == 0, "scalar-101 previous scalar version != 0 or 1"); - require(reencodedScalar >> 248 == 1, "scalar-102 reenconded scalar version != 1"); + require(previousScalarEncodingVersion == 0, "scalar-101 previous scalar version != 0 or 1"); + require(newScalarEncodingVersion == 1, "scalar-102 reenconded scalar version != 1"); require(sysCfg.blobbasefeeScalar() == uint32(0), "scalar-103 blobbasefeeScalar !=0"); - require(reencodedScalar << 8 == previousScalar << 8, "scalar-104 scalar mismatch"); + + // The scalars should match if we add the new scalar version byte to the previous scalar. + require(reencodedScalar == previousScalar + (uint256(0x01) << 248), "scalar-104 scalar mismatch"); } - // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. - require(sysCfg.scalar() == reencodedScalar, "scalar-105"); } // Checks the disputeGameFactory address is set correctly after the upgrade From cd7ec86dcb90083996058af5ca57e1233c4374cf Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 10:54:01 +0000 Subject: [PATCH 56/68] consolidate interfaces into one file --- .../HoloceneSystemConfigUpgrade.s.sol | 81 ++++++++++++++++- script/verification/IResourceMetering.sol | 27 ------ script/verification/ISystemConfig.sol | 87 ------------------- 3 files changed, 79 insertions(+), 116 deletions(-) delete mode 100644 script/verification/IResourceMetering.sol delete mode 100644 script/verification/ISystemConfig.sol diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 030a8dc29..5ae03b804 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -3,8 +3,6 @@ pragma solidity ^0.8.15; import {console2 as console} from "forge-std/console2.sol"; import {LibString} from "solady/utils/LibString.sol"; -import {ISystemConfig} from "./ISystemConfig.sol"; -import {IResourceMetering} from "./IResourceMetering.sol"; import {SuperchainRegistry} from "script/verification/Verification.s.sol"; // HoloceneSystemConfigUpgrade is a contract that can be used to verify the Holocene upgrade of the SystemConfig contract. @@ -196,3 +194,82 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { }); } } + +interface IResourceMetering { + struct ResourceConfig { + uint32 maxResourceLimit; + uint8 elasticityMultiplier; + uint8 baseFeeMaxChangeDenominator; + uint32 minimumBaseFee; + uint32 systemTxMaxGas; + uint128 maximumBaseFee; + } +} + +interface ISystemConfig { + struct Addresses { + address l1CrossDomainMessenger; + address l1ERC721Bridge; + address l1StandardBridge; + address disputeGameFactory; + address optimismPortal; + address optimismMintableERC20Factory; + address gasPayingToken; + } + + function BATCH_INBOX_SLOT() external view returns (bytes32); + function DISPUTE_GAME_FACTORY_SLOT() external view returns (bytes32); + function L1_CROSS_DOMAIN_MESSENGER_SLOT() external view returns (bytes32); + function L1_ERC_721_BRIDGE_SLOT() external view returns (bytes32); + function L1_STANDARD_BRIDGE_SLOT() external view returns (bytes32); + function OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT() external view returns (bytes32); + function OPTIMISM_PORTAL_SLOT() external view returns (bytes32); + function START_BLOCK_SLOT() external view returns (bytes32); + function UNSAFE_BLOCK_SIGNER_SLOT() external view returns (bytes32); + function VERSION() external view returns (uint256); + function basefeeScalar() external view returns (uint32); + function batchInbox() external view returns (address addr_); + function batcherHash() external view returns (bytes32); + function blobbasefeeScalar() external view returns (uint32); + function disputeGameFactory() external view returns (address addr_); + function gasLimit() external view returns (uint64); + function eip1559Denominator() external view returns (uint32); + function eip1559Elasticity() external view returns (uint32); + function gasPayingToken() external view returns (address addr_, uint8 decimals_); + function gasPayingTokenName() external view returns (string memory name_); + function gasPayingTokenSymbol() external view returns (string memory symbol_); + function initialize( + address _owner, + uint32 _basefeeScalar, + uint32 _blobbasefeeScalar, + bytes32 _batcherHash, + uint64 _gasLimit, + address _unsafeBlockSigner, + IResourceMetering.ResourceConfig memory _config, + address _batchInbox, + Addresses memory _addresses + ) external; + function isCustomGasToken() external view returns (bool); + function l1CrossDomainMessenger() external view returns (address addr_); + function l1ERC721Bridge() external view returns (address addr_); + function l1StandardBridge() external view returns (address addr_); + function maximumGasLimit() external pure returns (uint64); + function minimumGasLimit() external view returns (uint64); + function optimismMintableERC20Factory() external view returns (address addr_); + function optimismPortal() external view returns (address addr_); + function overhead() external view returns (uint256); + function owner() external view returns (address); + function renounceOwnership() external; + function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory); + function scalar() external view returns (uint256); + function setBatcherHash(bytes32 _batcherHash) external; + function setGasConfig(uint256 _overhead, uint256 _scalar) external; + function setGasConfigEcotone(uint32 _basefeeScalar, uint32 _blobbasefeeScalar) external; + function setGasLimit(uint64 _gasLimit) external; + function setUnsafeBlockSigner(address _unsafeBlockSigner) external; + function setEIP1559Params(uint32 _denominator, uint32 _elasticity) external; + function startBlock() external view returns (uint256 startBlock_); + function transferOwnership(address newOwner) external; // nosemgrep + function unsafeBlockSigner() external view returns (address addr_); + function version() external pure returns (string memory); +} diff --git a/script/verification/IResourceMetering.sol b/script/verification/IResourceMetering.sol deleted file mode 100644 index 1c5a5174b..000000000 --- a/script/verification/IResourceMetering.sol +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -interface IResourceMetering { - struct ResourceParams { - uint128 prevBaseFee; - uint64 prevBoughtGas; - uint64 prevBlockNum; - } - - struct ResourceConfig { - uint32 maxResourceLimit; - uint8 elasticityMultiplier; - uint8 baseFeeMaxChangeDenominator; - uint32 minimumBaseFee; - uint32 systemTxMaxGas; - uint128 maximumBaseFee; - } - - error OutOfGas(); - - event Initialized(uint8 version); - - function params() external view returns (uint128 prevBaseFee, uint64 prevBoughtGas, uint64 prevBlockNum); // nosemgrep - - function __constructor__() external; -} diff --git a/script/verification/ISystemConfig.sol b/script/verification/ISystemConfig.sol deleted file mode 100644 index d1c34e308..000000000 --- a/script/verification/ISystemConfig.sol +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import {IResourceMetering} from "./IResourceMetering.sol"; - -/// @notice This interface corresponds to the Custom Gas Token version of the SystemConfig contract. -interface ISystemConfig { - enum UpdateType { - BATCHER, - FEE_SCALARS, - GAS_LIMIT, - UNSAFE_BLOCK_SIGNER, - EIP_1559_PARAMS - } - - struct Addresses { - address l1CrossDomainMessenger; - address l1ERC721Bridge; - address l1StandardBridge; - address disputeGameFactory; - address optimismPortal; - address optimismMintableERC20Factory; - address gasPayingToken; - } - - event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data); - event Initialized(uint8 version); - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - - function BATCH_INBOX_SLOT() external view returns (bytes32); - function DISPUTE_GAME_FACTORY_SLOT() external view returns (bytes32); - function L1_CROSS_DOMAIN_MESSENGER_SLOT() external view returns (bytes32); - function L1_ERC_721_BRIDGE_SLOT() external view returns (bytes32); - function L1_STANDARD_BRIDGE_SLOT() external view returns (bytes32); - function OPTIMISM_MINTABLE_ERC20_FACTORY_SLOT() external view returns (bytes32); - function OPTIMISM_PORTAL_SLOT() external view returns (bytes32); - function START_BLOCK_SLOT() external view returns (bytes32); - function UNSAFE_BLOCK_SIGNER_SLOT() external view returns (bytes32); - function VERSION() external view returns (uint256); - function basefeeScalar() external view returns (uint32); - function batchInbox() external view returns (address addr_); - function batcherHash() external view returns (bytes32); - function blobbasefeeScalar() external view returns (uint32); - function disputeGameFactory() external view returns (address addr_); - function gasLimit() external view returns (uint64); - function eip1559Denominator() external view returns (uint32); - function eip1559Elasticity() external view returns (uint32); - function gasPayingToken() external view returns (address addr_, uint8 decimals_); - function gasPayingTokenName() external view returns (string memory name_); - function gasPayingTokenSymbol() external view returns (string memory symbol_); - function initialize( - address _owner, - uint32 _basefeeScalar, - uint32 _blobbasefeeScalar, - bytes32 _batcherHash, - uint64 _gasLimit, - address _unsafeBlockSigner, - IResourceMetering.ResourceConfig memory _config, - address _batchInbox, - Addresses memory _addresses - ) external; - function isCustomGasToken() external view returns (bool); - function l1CrossDomainMessenger() external view returns (address addr_); - function l1ERC721Bridge() external view returns (address addr_); - function l1StandardBridge() external view returns (address addr_); - function maximumGasLimit() external pure returns (uint64); - function minimumGasLimit() external view returns (uint64); - function optimismMintableERC20Factory() external view returns (address addr_); - function optimismPortal() external view returns (address addr_); - function overhead() external view returns (uint256); - function owner() external view returns (address); - function renounceOwnership() external; - function resourceConfig() external view returns (IResourceMetering.ResourceConfig memory); - function scalar() external view returns (uint256); - function setBatcherHash(bytes32 _batcherHash) external; - function setGasConfig(uint256 _overhead, uint256 _scalar) external; - function setGasConfigEcotone(uint32 _basefeeScalar, uint32 _blobbasefeeScalar) external; - function setGasLimit(uint64 _gasLimit) external; - function setUnsafeBlockSigner(address _unsafeBlockSigner) external; - function setEIP1559Params(uint32 _denominator, uint32 _elasticity) external; - function startBlock() external view returns (uint256 startBlock_); - function transferOwnership(address newOwner) external; // nosemgrep - function unsafeBlockSigner() external view returns (address addr_); - function version() external pure returns (string memory); - - function __constructor__() external; -} From a14b6a358a803c5a819357ce18a0138604b463e1 Mon Sep 17 00:00:00 2001 From: George Knee Date: Fri, 10 Jan 2025 10:56:47 +0000 Subject: [PATCH 57/68] Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md Co-authored-by: Ethnical --- .../VALIDATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index 82701faaf..c35951e1a 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -40,7 +40,7 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` - **After**: `0xx00000000000000000000000000000000000d273000001db00000000003938700` + **After**: `0x00000000000000000000000000000000000d273000001db00000000003938700` **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `86200` respectively. These share a slot with the `gasLimit` which remains at `60000000` ### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) From 1389e432068dc6854d51409b3e9402666c44b4ce Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 10:58:40 +0000 Subject: [PATCH 58/68] typos --- .../VALIDATION.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index c35951e1a..7cb5eaa5f 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -41,14 +41,14 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` **After**: `0x00000000000000000000000000000000000d273000001db00000000003938700` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `86200` respectively. These share a slot with the `gasLimit` which remains at `60000000` + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `862000` respectively. These share a slot with the `gasLimit` which remains at `60000000` ### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `68400` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000` + **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `684000` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000` - **Key**: `0x0000000000000000000000000000000000000000000000000000000000000066` **Before**: `0x00000000000000000000000000000000000000000000000000000000000a6fe0` From 1a121219515316d30db776e59a665a4cb205d776 Mon Sep 17 00:00:00 2001 From: George Knee Date: Fri, 10 Jan 2025 11:00:59 +0000 Subject: [PATCH 59/68] Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md Co-authored-by: Ethnical --- .../VALIDATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index 7cb5eaa5f..65d830719 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -77,7 +77,7 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe **After**: `0x0000000000000000000000000000000000000000000000000000000000000010` **Meaning**: Nonce increments by 1 -- **Key**: See above. +- **Key**: In the [`approvedHashes` section line 18](/blob/main/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md#L18) **Before**: `0x0000000000000000000000000000000000000000000000000000000000000000` **After**: `0x0000000000000000000000000000000000000000000000000000000000000001` **Meaning**: approvedHashes update. See above. From ce9614db7320a2617ddb60e5fcbda45ab7327361 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 11:09:24 +0000 Subject: [PATCH 60/68] improve formatting and links --- .../VALIDATION.md | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index 65d830719..e6954bb7c 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -38,48 +38,52 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe ### `0x034edD2A225f7f429A63E0f1D2084B9E0A93b538` (`SystemConfigProxy` for op-sepolia) -- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` - **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` - **After**: `0x00000000000000000000000000000000000d273000001db00000000003938700` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `862000` respectively. These share a slot with the `gasLimit` which remains at `60000000` +* **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` +* **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` +* **After**: `0x00000000000000000000000000000000000d273000001db00000000003938700` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `862000` respectively. These share a slot with the `gasLimit` which remains at `60000000` ### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) -- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` - **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` - **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `684000` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000` +* **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` +* **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` +* **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `684000` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000` -- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000066` - **Before**: `0x00000000000000000000000000000000000000000000000000000000000a6fe0` - **After**: `0x01000000000000000000000000000000000000000000000000000000000a6fe0` - **Meaning**: Updates the `scalar` storage variable to reflect a scalar version of `1`. +and + +* **Key**: `0x0000000000000000000000000000000000000000000000000000000000000066` +* **Before**: `0x00000000000000000000000000000000000000000000000000000000000a6fe0` +* **After**: `0x01000000000000000000000000000000000000000000000000000000000a6fe0` +* **Meaning**: Updates the `scalar` storage variable to reflect a scalar version of `1`. ### `0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2` (`SystemConfigProxy` for mode-sepolia) -- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` - **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` - **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remains at `30000000` +* **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` +* **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` +* **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remains at `30000000` ### `0xB54c7BFC223058773CF9b739cC5bd4095184Fb08` (`SystemConfigProxy` for zora-sepolia) -- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` - **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` - **After**: `0x00000000000000000000000000000000000941ad000003f40000000001c9c380` - **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `1012` and `606637` respectively. These share a slot with the `gasLimit` which remains at `30000000` +* **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` +* **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` +* **After**: `0x00000000000000000000000000000000000941ad000003f40000000001c9c380` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `1012` and `606637` respectively. These share a slot with the `gasLimit` which remains at `30000000` ### `0x1Eb2fFc903729a0F03966B917003800b145F56E2` (`ProxyAdminOwner` for all chains in this task) -- **Key**: `0x0000000000000000000000000000000000000000000000000000000000000005` - **Before**: `0x000000000000000000000000000000000000000000000000000000000000000f` - **After**: `0x0000000000000000000000000000000000000000000000000000000000000010` - **Meaning**: Nonce increments by 1 +* **Key**: `0x0000000000000000000000000000000000000000000000000000000000000005` +* **Before**: `0x000000000000000000000000000000000000000000000000000000000000000f` +* **After**: `0x0000000000000000000000000000000000000000000000000000000000000010` +* **Meaning**: Nonce increments by 1 + +and -- **Key**: In the [`approvedHashes` section line 18](/blob/main/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md#L18) - **Before**: `0x0000000000000000000000000000000000000000000000000000000000000000` - **After**: `0x0000000000000000000000000000000000000000000000000000000000000001` - **Meaning**: approvedHashes update. See above. +* **Key**: In the [`approvedHashes` section](#nested-safe-state-overrides-and-changes) +* **Before**: `0x0000000000000000000000000000000000000000000000000000000000000000` +* **After**: `0x0000000000000000000000000000000000000000000000000000000000000001` +* **Meaning**: approvedHashes update. See above. From ef7ccef8b78c81d91def4345a3e789a2ca7ec3d5 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 11:14:13 +0000 Subject: [PATCH 61/68] tidy --- script/verification/HoloceneSystemConfigUpgrade.s.sol | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 5ae03b804..52db0bc5f 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -116,7 +116,9 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { // Checks scalar, basefeeScalar, blobbasefeeScalar are set consistently. // The upgrade will modify (via the initialize() method) the storage slots for scalar (pre-existing), basefeeScalar (new) and blobbasefeeScalar (new). - // checkScalar() reads the variables from the new slot and reencodes them into reecondedScalar (which is a packed version). It then checks that this is equal to the scalar value before the upgrade (previousScalar). In this way, we indirectly prove that the new slots were set correctly (in a way consistent with existing data in the SystemConfig contract). + // checkScalar() reads the variables from the new slot and reencodes them into reecondedScalar (which is a packed version). + // It then checks that this is equal to the scalar value before the upgrade (previousScalar). + // In this way, we indirectly prove that the new slots were set correctly (in a way consistent with existing data in the SystemConfig contract). function checkScalar() internal view { // Check that basefeeScalar and blobbasefeeScalar are correct by re-encoding them and comparing to the new scalar value. uint256 reencodedScalar = @@ -167,17 +169,19 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { require(d == targetDecimals, "scalar-108"); } - // CHecsk the remaining storage variables are unchanged after the upgrade + // Checks the remaining storage variables are unchanged after the upgrade function checkBaseSysCfgVars() internal view { // Check remaining storage variables didn't change require(keccak256(abi.encode(getBaseSysCfgVars())) == keccak256(abi.encode(previous)), "system-config-100"); } - // Reads + // Reads the semantic version of the SystemConfig contract function getSysCfgVersion() internal view returns (string memory) { return sysCfg.version(); } + // Reads the base storage variables of the SystemConfig contract + // (the ones which are common to all versions and should not change during the upgrade) function getBaseSysCfgVars() internal view returns (BaseSysCfgVars memory) { return BaseSysCfgVars({ owner: sysCfg.owner(), From c5da1ab97ce18216c896856beb929faab1a4c435 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 16:11:05 +0000 Subject: [PATCH 62/68] respond to review comments --- script/verification/HoloceneSystemConfigUpgrade.s.sol | 5 +---- script/verification/Verification.s.sol | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 52db0bc5f..5cd10993c 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -107,10 +107,7 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { // Checks semver of SystemConfig is correct after the upgrade function checkTargetVersion() internal view { - require( - keccak256(abi.encode(getSysCfgVersion())) == keccak256(abi.encode(targetVersion)), - "system-config-050: targetVersion" - ); + require(getSysCfgVersion().eq(targetVersion), "system-config-050: targetVersion"); console.log("confirmed SystemConfig upgraded to version", targetVersion); } diff --git a/script/verification/Verification.s.sol b/script/verification/Verification.s.sol index 35f424bbb..cf853a81c 100644 --- a/script/verification/Verification.s.sol +++ b/script/verification/Verification.s.sol @@ -4,9 +4,8 @@ pragma solidity ^0.8.15; import {console2 as console} from "forge-std/console2.sol"; import {LibString} from "solady/utils/LibString.sol"; import {Types} from "@eth-optimism-bedrock/scripts/Types.sol"; -import {ScriptBase} from "forge-std/Base.sol"; +import {CommonBase} from "forge-std/Base.sol"; import {stdToml} from "forge-std/StdToml.sol"; -import {console2 as console} from "forge-std/console2.sol"; // TODO(#427): Proposing to just merge this contract into JsonTxBuilderBase. contract VerificationBase { @@ -22,7 +21,7 @@ contract VerificationBase { } } -contract SuperchainRegistry is ScriptBase { +contract SuperchainRegistry is CommonBase { using LibString for string; struct StandardVersion { From c904f925609bcfb52c7d453b71eaf54fa9c86c54 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 16:41:07 +0000 Subject: [PATCH 63/68] tidy up logging --- script/verification/HoloceneSystemConfigUpgrade.s.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index 5cd10993c..d353443a8 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -121,10 +121,10 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { uint256 reencodedScalar = (uint256(0x01) << 248) | (uint256(sysCfg.blobbasefeeScalar()) << 32) | sysCfg.basefeeScalar(); console.log( - "checking baseFeeScalar and blobbaseFeeScalar reencoded to ", - LibString.toString(sysCfg.basefeeScalar()), - LibString.toString(sysCfg.blobbasefeeScalar()), - LibString.toString(reencodedScalar) + "checking baseFeeScalar and blobbaseFeeScalar reencoded to scalar (respectively):", + sysCfg.basefeeScalar(), + sysCfg.blobbasefeeScalar(), + reencodedScalar ); uint256 newScalar = sysCfg.scalar(); require(newScalar == reencodedScalar, "scalar-105"); From 1e1fc2b128be4404cd8245e3075ccaa61700cdaf Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 17:04:51 +0000 Subject: [PATCH 64/68] add links to storage layouts --- .../VALIDATION.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index e6954bb7c..9b52caee3 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -41,28 +41,28 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` * **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` * **After**: `0x00000000000000000000000000000000000d273000001db00000000003938700` -* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `862000` respectively. These share a slot with the `gasLimit` which remains at `60000000` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `862000` respectively. These share a slot with the `gasLimit` which remains at `60000000`. See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) ### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` * **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` * **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` -* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `684000` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `684000` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000`. See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) and * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000066` * **Before**: `0x00000000000000000000000000000000000000000000000000000000000a6fe0` * **After**: `0x01000000000000000000000000000000000000000000000000000000000a6fe0` -* **Meaning**: Updates the `scalar` storage variable to reflect a scalar version of `1`. +* **Meaning**: Updates the `scalar` storage variable to reflect a scalar version of `1`. See the storage layout snapshot [here](https://github.com/ethereum-optimism/optimism/blob/op-contracts/v1.8.0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L44-L50). ### `0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2` (`SystemConfigProxy` for mode-sepolia) * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` * **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` * **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` -* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remains at `30000000` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remains at `30000000`. See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) ### `0xB54c7BFC223058773CF9b739cC5bd4095184Fb08` (`SystemConfigProxy` for zora-sepolia) From 3eec9d8bfbdb740f8e7f5f5c3c0fd48e477d0e60 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 17:13:18 +0000 Subject: [PATCH 65/68] put `cast td` hints into validation doc --- .../VALIDATION.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md index 9b52caee3..04041e560 100644 --- a/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md +++ b/tasks/sep/027-holocene-system-config-upgrade-and-init-multi-chain/VALIDATION.md @@ -41,14 +41,14 @@ cast index bytes32 0x28342fccf7308fc0967d8303fd5289550a30acff2de8754cf384b524ebe * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` * **Before**: `0x0000000000000000000000000000000000000000000000000000000003938700` * **After**: `0x00000000000000000000000000000000000d273000001db00000000003938700` -* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` and `862000` respectively. These share a slot with the `gasLimit` which remains at `60000000`. See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `7600` (`cast td 0x00001db0`) and `862000` (`cast td 0x000d2730`) respectively. These share a slot with the `gasLimit` which remains at `60000000` (`cast td 0x0000000003938700`). See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) ### `0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2` (`SystemConfigProxy` for metal-sepolia) * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` * **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` * **After**: `0x0000000000000000000000000000000000000000000a6fe00000000001c9c380` -* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `684000` and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000`. See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `684000` (`cast td 0x000a6fe0`) and `0` respectively. These share a slot with the `gasLimit` which remains at `30000000` (`cast td 0x0000000001c9c380`). See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) and @@ -62,14 +62,14 @@ and * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` * **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` * **After**: `0x000000000000000000000000000000000008ee87000003d10000000001c9c380` -* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` and `585351` respectively. These share a slot with the `gasLimit` which remains at `30000000`. See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `977` (`cast td 0x000003d1`) and `585351` (` cast td 0x0008ee87`) respectively. These share a slot with the `gasLimit` which remains at `30000000` (`cast td 0x0000000001c9c380`). See the storage layout snapshot [here.](https://github.com/ethereum-optimism/optimism/blob/2073f4059bd806af3e8b76b820aa3fa0b42016d0/packages/contracts-bedrock/snapshots/storageLayout/SystemConfig.json#L58-L78) ### `0xB54c7BFC223058773CF9b739cC5bd4095184Fb08` (`SystemConfigProxy` for zora-sepolia) * **Key**: `0x0000000000000000000000000000000000000000000000000000000000000068` * **Before**: `0x0000000000000000000000000000000000000000000000000000000001c9c380` * **After**: `0x00000000000000000000000000000000000941ad000003f40000000001c9c380` -* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `1012` and `606637` respectively. These share a slot with the `gasLimit` which remains at `30000000` +* **Meaning**: Updates the `basefeeScalar` and `blobbasefeeScalar` storage variables to `1012` (`cast td 0x000003f4`) and `606637` (cast td `0x000941ad`) respectively. These share a slot with the `gasLimit` which remains at `30000000` (`cast td 0x0000000001c9c380`). ### `0x1Eb2fFc903729a0F03966B917003800b145F56E2` (`ProxyAdminOwner` for all chains in this task) From 31ab749a1b08412a1bb4cc5b5083d54b4e30f368 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 17:16:42 +0000 Subject: [PATCH 66/68] combine cases in if/else statement --- script/verification/HoloceneSystemConfigUpgrade.s.sol | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index d353443a8..a05c6ac6b 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -72,14 +72,11 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { // Read target version from SCR @ specified release targetVersion = standardVersions.SystemConfig.version; - if (sysCfg.version().eq("2.3.0")) { - // Supported initial version - targetDGF = sysCfg.disputeGameFactory(); - } else if (sysCfg.version().eq("2.2.0")) { - // Supported initial version + if (sysCfg.version().eq("2.3.0") || sysCfg.version().eq("2.2.0")) { + // Supported initial versions with a getter already targetDGF = sysCfg.disputeGameFactory(); } else if (sysCfg.version().eq("1.12.0")) { - // Supported initial version + // Supported initial version with no getter, so we set an empty value targetDGF = address(0); } else { revert("unsupported SystemConfig version"); From acd812e94dcacc0638d05501af8788fa759d657d Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 18:00:15 +0000 Subject: [PATCH 67/68] better codeExceptions handling --- .../HoloceneSystemConfigUpgrade.s.sol | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/script/verification/HoloceneSystemConfigUpgrade.s.sol b/script/verification/HoloceneSystemConfigUpgrade.s.sol index a05c6ac6b..ded085644 100644 --- a/script/verification/HoloceneSystemConfigUpgrade.s.sol +++ b/script/verification/HoloceneSystemConfigUpgrade.s.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.15; import {console2 as console} from "forge-std/console2.sol"; import {LibString} from "solady/utils/LibString.sol"; -import {SuperchainRegistry} from "script/verification/Verification.s.sol"; +import {SuperchainRegistry, VerificationBase} from "script/verification/Verification.s.sol"; // HoloceneSystemConfigUpgrade is a contract that can be used to verify the Holocene upgrade of the SystemConfig contract. // The upgrade paths supported are: @@ -17,7 +17,7 @@ import {SuperchainRegistry} from "script/verification/Verification.s.sol"; // - gasPayingToken (new storage variable, needs to be set to a magic value representing ETH) // - disputeGameFactory (does not exist @ 1.12.0, needs to be set to zero address for changes on this upgrade path) // It also verified that remaining storage variables are unchanged. -contract HoloceneSystemConfigUpgrade is SuperchainRegistry { +contract HoloceneSystemConfigUpgrade is SuperchainRegistry, VerificationBase { using LibString for string; address public systemConfigAddress; @@ -81,6 +81,8 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { } else { revert("unsupported SystemConfig version"); } + + _getCodeExceptions(); } /// @notice Public function that must be called by the verification script. @@ -92,14 +94,15 @@ contract HoloceneSystemConfigUpgrade is SuperchainRegistry { checkBaseSysCfgVars(); } + function _getCodeExceptions() internal { + if (block.chainid != 1) addCodeException(previous.owner); + addCodeException(address(uint160(uint256(previous.batcherHash)))); + addCodeException(previous.unsafeBlockSigner); + addCodeException(previous.batchInbox); + } + function getCodeExceptions() public view returns (address[] memory exceptions) { - uint256 len = block.chainid == 1 ? 3 : 4; // Mainnet doesn't need owner exception. - exceptions = new address[](len); - uint256 i = 0; - if (block.chainid != 1) exceptions[i++] = previous.owner; - exceptions[i++] = address(uint160(uint256((previous.batcherHash)))); - exceptions[i++] = previous.unsafeBlockSigner; - exceptions[i++] = previous.batchInbox; + return codeExceptions; } // Checks semver of SystemConfig is correct after the upgrade From 17bff2d0b9a2931594f6084d6284ebe88aeaa947 Mon Sep 17 00:00:00 2001 From: geoknee Date: Fri, 10 Jan 2025 18:11:41 +0000 Subject: [PATCH 68/68] reorganise chainConfig getters --- script/verification/Verification.s.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/verification/Verification.s.sol b/script/verification/Verification.s.sol index cf853a81c..dafd90d62 100644 --- a/script/verification/Verification.s.sol +++ b/script/verification/Verification.s.sol @@ -107,10 +107,10 @@ contract SuperchainRegistry is CommonBase { // set them to the zero address if they are not found. proxies.AnchorStateRegistry = stdToml.readAddressOr(toml, "$.addresses.AnchorStateRegistryProxy", address(0)); proxies.DisputeGameFactory = stdToml.readAddressOr(toml, "$.addresses.DisputeGameFactoryProxy", address(0)); - chainConfig.unsafeBlockSigner = stdToml.readAddressOr(toml, "$.addresses.UnsafeBlockSigner", address(0)); chainConfig.chainId = stdToml.readUint(toml, "$.chain_id"); chainConfig.systemConfigOwner = stdToml.readAddress(toml, "$.addresses.SystemConfigOwner"); + chainConfig.unsafeBlockSigner = stdToml.readAddressOr(toml, "$.addresses.UnsafeBlockSigner", address(0)); // Not present on all chains, note .readAddressOr chainConfig.batchSubmitter = stdToml.readAddress(toml, "$.addresses.BatchSubmitter"); chainConfig.batchInbox = stdToml.readAddress(toml, "$.batch_inbox_addr"); }