Skip to content

Commit

Permalink
feat: rename OpChains to OpChainConfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
maurelian committed Jan 25, 2025
1 parent 9cbbfeb commit e92163d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/contracts-bedrock/src/L1/OPContractsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract OPContractsManager is ISemver {

/// @notice The input required to identify a chain for upgrading, along with new prestate hashes
// TODO: rename to OpChainConfig
struct OpChain {
struct OpChainConfig {
ISystemConfig systemConfigProxy;
IProxyAdmin proxyAdmin;
Claim permissionedDisputeGamePrestateHash;
Expand Down Expand Up @@ -441,7 +441,7 @@ contract OPContractsManager is ISemver {
/// @param _superchainProxyAdmin The proxy admin that owns all of the proxies
/// @param _opChains Array of OpChain structs, one per chain to upgrade
/// @dev This function is intended to be called via DELEGATECALL from the Upgrade Controller Safe
function upgrade(IProxyAdmin _superchainProxyAdmin, OpChain[] memory _opChains) external {
function upgrade(IProxyAdmin _superchainProxyAdmin, OpChainConfig[] memory _opChains) external {
if (address(this) == address(thisOPCM)) revert OnlyDelegatecall();

// If this is delegatecalled by the upgrade controller, set isRC to false first, else, continue execution.
Expand Down Expand Up @@ -1060,7 +1060,7 @@ contract OPContractsManager is ISemver {
IDisputeGame _disputeGame,
IAnchorStateRegistry _newAnchorStateRegistryProxy,
GameType _gameType,
OpChain memory _opChain,
OpChainConfig memory _opChain,
Blueprints memory _blueprints,
Implementations memory _implementations,
ISystemConfig.Addresses memory _opChainAddrs
Expand Down
16 changes: 8 additions & 8 deletions packages/contracts-bedrock/test/L1/OPContractsManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ contract OPContractsManager_Upgrade_Harness is CommonTest {
IProxyAdmin proxyAdmin;
IProxyAdmin superchainProxyAdmin;
address upgrader;
IOPContractsManager.OpChain[] opChains;
IOPContractsManager.OpChain[] opChainConfigs;

function setUp() public virtual override {
super.disableUpgradedFork();
Expand All @@ -222,7 +222,7 @@ contract OPContractsManager_Upgrade_Harness is CommonTest {
upgrader = proxyAdmin.owner();
vm.label(upgrader, "ProxyAdmin Owner");

opChains.push(IOPContractsManager.OpChain({ systemConfigProxy: systemConfig, proxyAdmin: proxyAdmin }));
opChainConfigs.push(IOPContractsManager.OpChain({ systemConfigProxy: systemConfig, proxyAdmin: proxyAdmin }));

// Retrieve the l2ChainId, which was read from the superchain-registry, and saved in Artifacts
// encoded as an address.
Expand Down Expand Up @@ -280,11 +280,11 @@ contract OPContractsManager_Upgrade_Harness is CommonTest {
emit ImplementationSet(address(0), GameTypes.CANNON);
}
vm.expectEmit(address(_delegateCaller));
emit Upgraded(l2ChainId, opChains[0].systemConfigProxy, address(_delegateCaller));
emit Upgraded(l2ChainId, opChainConfigs[0].systemConfigProxy, address(_delegateCaller));

superchainProxyAdmin = _superchainUpgrade ? superchainProxyAdmin : IProxyAdmin(address(0));
DelegateCaller(_delegateCaller).dcForward(
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (superchainProxyAdmin, opChains))
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (superchainProxyAdmin, opChainConfigs))
);

// Check the implementations of the core addresses
Expand Down Expand Up @@ -382,7 +382,7 @@ contract OPContractsManager_Upgrade_TestFails is OPContractsManager_Upgrade_Harn
function test_upgrade_notDelegateCalled_reverts() public {
vm.prank(upgrader);
vm.expectRevert(IOPContractsManager.OnlyDelegatecall.selector);
opcm.upgrade(superchainProxyAdmin, opChains);
opcm.upgrade(superchainProxyAdmin, opChainConfigs);
}

function test_upgrade_superchainConfigMismatch_reverts() public {
Expand All @@ -399,7 +399,7 @@ contract OPContractsManager_Upgrade_TestFails is OPContractsManager_Upgrade_Harn
abi.encodeWithSelector(IOPContractsManager.SuperchainConfigMismatch.selector, address(systemConfig))
);
DelegateCaller(upgrader).dcForward(
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (superchainProxyAdmin, opChains))
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (superchainProxyAdmin, opChainConfigs))
);
}

Expand All @@ -412,7 +412,7 @@ contract OPContractsManager_Upgrade_TestFails is OPContractsManager_Upgrade_Harn

vm.expectRevert("Ownable: caller is not the owner");
DelegateCaller(delegateCaller).dcForward(
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (superchainProxyAdmin, opChains))
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (superchainProxyAdmin, opChainConfigs))
);
}

Expand All @@ -425,7 +425,7 @@ contract OPContractsManager_Upgrade_TestFails is OPContractsManager_Upgrade_Harn

vm.expectRevert("Ownable: caller is not the owner");
DelegateCaller(delegateCaller).dcForward(
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (proxyAdmin, opChains))
address(opcm), abi.encodeCall(IOPContractsManager.upgrade, (proxyAdmin, opChainConfigs))
);
}
}
Expand Down

0 comments on commit e92163d

Please sign in to comment.