Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sep/027: upgrade and re-initialize SystemConfig across sepolia superchain #418

Merged
merged 77 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e5623ea
first pass at task sep 025
geoknee Dec 17, 2024
14500b8
bump task index
geoknee Dec 17, 2024
9c83d58
undo change to submodule
geoknee Dec 17, 2024
cc782b3
add exceptions for EOAs in SystemConfig storage
geoknee Dec 17, 2024
dcd607c
bump task sequence number
geoknee Dec 18, 2024
c04293c
change validation script to use Seb's new framework
geoknee Dec 18, 2024
eb21f18
addAllowedStorageAccess for each system config
geoknee Dec 18, 2024
4014438
SystemConfigUpgrade exposes code exceptions thru getter
geoknee Dec 18, 2024
fcda94c
introduce SystemConfigUpgradeEcotoneScalars
geoknee Dec 18, 2024
d130513
add deprecation notice to task 020
geoknee Dec 18, 2024
ef18399
remove unecessary forge build commands
geoknee Dec 18, 2024
35b4718
add some logging
geoknee Dec 18, 2024
1355535
reactivate all chains
geoknee Dec 19, 2024
bb163d9
update to superbundle
geoknee Dec 20, 2024
0b39283
TEMP: do not try to load all contract addresses (some chains do not …
geoknee Dec 20, 2024
85aac3a
improve err msg
geoknee Dec 20, 2024
ca3699e
fix superbundle
geoknee Dec 20, 2024
7b7f0d1
use dynamic storage array
geoknee Dec 20, 2024
80aa1cc
validate in a smarter way for chains migrating from pre ecotone scalars
geoknee Dec 20, 2024
7e0c7fe
SuperchainRegistry: instead of skipping missing addresses globally, s…
geoknee Jan 3, 2025
127d370
update overview and readme
geoknee Jan 3, 2025
6786304
add some more logging
geoknee Jan 3, 2025
1ccf1b6
fill out validation.md
geoknee Jan 3, 2025
e0364ba
don't alias SystemConfigUpgradeEcotoneScalars
geoknee Jan 3, 2025
b1ef291
fix validation document
geoknee Jan 3, 2025
6c2961f
add sep/027 to CI
geoknee Jan 4, 2025
e568b3a
undo changes to submodule
geoknee Jan 6, 2025
35c68f8
undo change to submodule
geoknee Jan 6, 2025
94a0e19
Revert "remove unecessary forge build commands"
geoknee Jan 6, 2025
5098753
avoid shadowing variables
geoknee Jan 7, 2025
ab72af4
add explanatory comment and removed unused imports
geoknee Jan 7, 2025
ddad3df
avoid shadowing variabls
geoknee Jan 7, 2025
3d0999f
previous.owner codeException added conditionally
geoknee Jan 7, 2025
0b4dbee
update forge-std to v1.9.5
geoknee Jan 7, 2025
8a770be
prefer stdToml.readAddressOr to rolling my own tryReadAddress
geoknee Jan 7, 2025
1ce96af
spellcheck
geoknee Jan 7, 2025
7d05ab9
move overview contents into readme
geoknee Jan 7, 2025
7f5ac68
set status as READY TO SIGN
geoknee Jan 7, 2025
2cd5a75
Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-ch…
geoknee Jan 7, 2025
58bc135
pull scalar checks out of base contract into SystemConfigUpgradeEcoto…
geoknee Jan 7, 2025
5253651
make validation of migration of scalar from version 0 to 1 very explicit
geoknee Jan 7, 2025
0f0c539
add link to ecotone scalars specs
geoknee Jan 7, 2025
ece1fe9
Update script/verification/SystemConfigUpgrade.s.sol
geoknee Jan 7, 2025
dd88bab
add step to validate target semver of SystemConfig
geoknee Jan 8, 2025
deac638
Merge remote-tracking branch 'origin/main' into gk/025-holocene-sys-cfg
geoknee Jan 8, 2025
ce792fc
SystemConfigUpgrade.getSysCfgVars() copes with explicit contract vers…
geoknee Jan 8, 2025
9ffc1a6
comments
geoknee Jan 8, 2025
d2162ee
SystemConfigUpgrade: pull gasPayingToken and disputeGameFactory check…
geoknee Jan 8, 2025
4892a5c
combine SystemConfigUpgrade with SystemConfigUpgradeEcotoneScalars an…
geoknee Jan 9, 2025
06f91d1
tidy
geoknee Jan 9, 2025
566477e
some more improvements
geoknee Jan 9, 2025
497007f
more code comments
geoknee Jan 9, 2025
e843ff4
Update script/verification/HoloceneSystemConfigUpgrade.s.sol
geoknee Jan 10, 2025
7c2a9c8
Update script/verification/HoloceneSystemConfigUpgrade.s.sol
geoknee Jan 10, 2025
a44a491
typos
geoknee Jan 10, 2025
556d1d5
refactor for readability
geoknee Jan 10, 2025
cd7ec86
consolidate interfaces into one file
geoknee Jan 10, 2025
a14b6a3
Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-ch…
geoknee Jan 10, 2025
1389e43
typos
geoknee Jan 10, 2025
1a12121
Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-ch…
geoknee Jan 10, 2025
ce9614d
improve formatting and links
geoknee Jan 10, 2025
89e4726
Merge remote-tracking branch 'origin/main' into gk/025-holocene-sys-cfg
geoknee Jan 10, 2025
ef7ccef
tidy
geoknee Jan 10, 2025
c5da1ab
respond to review comments
geoknee Jan 10, 2025
c904f92
tidy up logging
geoknee Jan 10, 2025
1e1fc2b
add links to storage layouts
geoknee Jan 10, 2025
3eec9d8
put `cast td` hints into validation doc
geoknee Jan 10, 2025
31ab749
combine cases in if/else statement
geoknee Jan 10, 2025
acd812e
better codeExceptions handling
geoknee Jan 10, 2025
17bff2d
reorganise chainConfig getters
geoknee Jan 10, 2025
9371341
Merge remote-tracking branch 'origin/main' into gk/025-holocene-sys-cfg
geoknee Jan 13, 2025
c18d61e
Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-ch…
geoknee Jan 13, 2025
7bb795b
add check for padding for scalar version 0 chains
geoknee Jan 13, 2025
540baec
add addCodeExceptions to VerificationBase
geoknee Jan 13, 2025
6a52c86
Update tasks/sep/027-holocene-system-config-upgrade-and-init-multi-ch…
geoknee Jan 13, 2025
a99ddbf
rename
geoknee Jan 13, 2025
85bca50
update nonce
geoknee Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ jobs:
just prepare-json
just simulate-council # simulate again to make sure the json is still valid
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 >>
Expand Down Expand Up @@ -303,3 +310,5 @@ workflows:
- just_simulate_sc_rehearsal_4
- just_simulate_permissionless_fp_upgrade
- just_simulate_ink_respected_game_type
# sepolia
- simulate_sep_027
2 changes: 1 addition & 1 deletion lib/forge-std
geoknee marked this conversation as resolved.
Show resolved Hide resolved
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
276 changes: 276 additions & 0 deletions script/verification/HoloceneSystemConfigUpgrade.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
// 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 {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:
// 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)
// - 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, VerificationBase {
using LibString for string;

address public systemConfigAddress;
ISystemConfig sysCfg;

// 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;
uint256 gasLimit;
address unsafeBlockSigner;
IResourceMetering.ResourceConfig resourceConfig;
address batchInbox;
address l1CrossDomainMessenger;
address l1StandardBridge;
address l1ERC721Bridge;
address optimismPortal;
address optimismMintableERC20Factory;
}

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;

// 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)
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
{
systemConfigAddress = proxies.SystemConfig;
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") || 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 with no getter, so we set an empty value
targetDGF = address(0);
} else {
revert("unsupported SystemConfig version");
}

_getCodeExceptions();
}

/// @notice Public function that must be called by the verification script.
function checkSystemConfigUpgrade() public view {
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
checkTargetVersion();
checkScalar();
checkDGF();
checkGasPayingToken();
checkBaseSysCfgVars();
}

function _getCodeExceptions() internal {
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
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) {
return codeExceptions;
}

// Checks semver of SystemConfig is correct after the upgrade
function checkTargetVersion() internal view {
require(getSysCfgVersion().eq(targetVersion), "system-config-050: targetVersion");
console.log("confirmed SystemConfig upgraded to version", targetVersion);
}

// 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 {
// 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 reencoded to scalar (respectively):",
sysCfg.basefeeScalar(),
sysCfg.blobbasefeeScalar(),
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.
previousScalarEncodingVersion == 1
) {
require(reencodedScalar == previousScalar, "scalar-100 scalar mismatch");
} else {
// Otherwise, if the scalar version 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(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");

// 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");
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
}
}

// 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");
}

// 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");
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
}

// Reads the semantic version of the SystemConfig contract
function getSysCfgVersion() internal view returns (string memory) {
return sysCfg.version();
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
}

// 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(),
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()
});
}
}

interface IResourceMetering {
struct ResourceConfig {
uint32 maxResourceLimit;
uint8 elasticityMultiplier;
uint8 baseFeeMaxChangeDenominator;
uint32 minimumBaseFee;
uint32 systemTxMaxGas;
uint128 maximumBaseFee;
}
}
sebastianst marked this conversation as resolved.
Show resolved Hide resolved

interface ISystemConfig {
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
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);
}
9 changes: 6 additions & 3 deletions script/verification/Verification.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,15 @@ 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");

// 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 = stdToml.readAddressOr(toml, "$.addresses.AnchorStateRegistryProxy", address(0));
proxies.DisputeGameFactory = stdToml.readAddressOr(toml, "$.addresses.DisputeGameFactoryProxy", address(0));

chainConfig.chainId = stdToml.readUint(toml, "$.chain_id");
chainConfig.systemConfigOwner = stdToml.readAddress(toml, "$.addresses.SystemConfigOwner");
chainConfig.unsafeBlockSigner = stdToml.readAddress(toml, "$.addresses.UnsafeBlockSigner");
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Status: [EXECUTED](https://sepolia.etherscan.io/tx/0x88bd1d85740af3741e2ed96d6fd07f2abb4541afc667625480bf6a28451c4d6d)

> ⚠️ **Warning:** This task is incorrect and is superseded 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}.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ETH_RPC_URL="https://ethereum-sepolia.publicnode.com"
COUNCIL_SAFE=0xf64bc17485f0B4Ea5F06A96514182FC4cB561977
FOUNDATION_SAFE=0xDEe57160aAfCF04c34C887B5962D0a69676d3C8B
OWNER_SAFE=0x1Eb2fFc903729a0F03966B917003800b145F56E2
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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 {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 {VerificationBase, SuperchainRegistry} from "script/verification/Verification.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";
geoknee marked this conversation as resolved.
Show resolved Hide resolved
string[4] l2ChainNames = ["op", "metal", "mode", "zora"];

HoloceneSystemConfigUpgrade[] sysCfgUpgrades;

constructor() {
for (uint256 i = 0; i < l2ChainNames.length; i++) {
// 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("");
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++) {
addCodeException(exceptions[j]);
}
sebastianst marked this conversation as resolved.
Show resolved Hide resolved
}
}

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 < l2ChainNames.length; i++) {
geoknee marked this conversation as resolved.
Show resolved Hide resolved
console.log("");
console.log("Running post-deploy assertions for chain", l2ChainNames[i], "-", l1ChainName);
geoknee marked this conversation as resolved.
Show resolved Hide resolved
sysCfgUpgrades[i].checkSystemConfigUpgrade();
}
console.log("All assertions passed!");
}

function getAllowedStorageAccess() internal view override returns (address[] memory) {
return allowedStorageAccess;
}

function getCodeExceptions() internal view override returns (address[] memory) {
return codeExceptions;
}
}
Loading