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

-rc is removed when upgrade() is called by the Upgrade Controller #13863

Merged
merged 12 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions op-chain-ops/interopgen/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func DeploySuperchainToL1(l1Host *script.Host, superCfg *SuperchainConfig) (*Sup
L1ContractsRelease: superCfg.Implementations.L1ContractsRelease,
SuperchainConfigProxy: superDeployment.SuperchainConfigProxy,
ProtocolVersionsProxy: superDeployment.ProtocolVersionsProxy,
UpgradeController: superCfg.ProxyAdminOwner,
UseInterop: superCfg.Implementations.UseInterop,
})
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions op-deployer/pkg/deployer/bootstrap/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type ImplementationsConfig struct {
DisputeGameFinalityDelaySeconds uint64 `cli:"dispute-game-finality-delay-seconds"`
SuperchainConfigProxy common.Address `cli:"superchain-config-proxy"`
ProtocolVersionsProxy common.Address `cli:"protocol-versions-proxy"`
UpgradeController common.Address `cli:"upgrade-controller"`
UseInterop bool `cli:"use-interop"`

Logger log.Logger
Expand Down Expand Up @@ -192,6 +193,7 @@ func Implementations(ctx context.Context, cfg ImplementationsConfig) (opcm.Deplo
L1ContractsRelease: cfg.L1ContractsRelease,
SuperchainConfigProxy: cfg.SuperchainConfigProxy,
ProtocolVersionsProxy: cfg.ProtocolVersionsProxy,
UpgradeController: cfg.UpgradeController,
UseInterop: cfg.UseInterop,
},
); err != nil {
Expand Down
3 changes: 3 additions & 0 deletions op-deployer/pkg/deployer/bootstrap/implementations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func testImplementations(t *testing.T, forkRPCURL string) {

loc, _ := testutil.LocalArtifacts(t)

proxyAdminOwner, err := standard.L1ProxyAdminOwner(uint64(chainID.Uint64()))
require.NoError(t, err)
deploy := func() opcm.DeployImplementationsOutput {
out, err := Implementations(ctx, ImplementationsConfig{
L1RPCUrl: runner.RPCUrl(),
Expand All @@ -85,6 +87,7 @@ func testImplementations(t *testing.T, forkRPCURL string) {
MIPSVersion: 1,
SuperchainConfigProxy: common.Address(*superchain.Config.SuperchainConfigAddr),
ProtocolVersionsProxy: common.Address(*superchain.Config.ProtocolVersionsAddr),
UpgradeController: proxyAdminOwner,
UseInterop: false,
})
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions op-deployer/pkg/deployer/opcm/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type DeployImplementationsInput struct {
L1ContractsRelease string
SuperchainConfigProxy common.Address
ProtocolVersionsProxy common.Address
UpgradeController common.Address
UseInterop bool // if true, deploy Interop implementations
}

Expand Down
1 change: 1 addition & 0 deletions op-deployer/pkg/deployer/opcm/opcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type DeployOPCMInput struct {
SuperchainConfig common.Address
ProtocolVersions common.Address
L1ContractsRelease string
UpgradeController common.Address

AddressManagerBlueprint common.Address
ProxyBlueprint common.Address
Expand Down
1 change: 1 addition & 0 deletions op-deployer/pkg/deployer/pipeline/implementations.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func DeployImplementations(env *Env, intent *state.Intent, st *state.State) erro
L1ContractsRelease: contractsRelease,
SuperchainConfigProxy: st.SuperchainDeployment.SuperchainConfigProxyAddress,
ProtocolVersionsProxy: st.SuperchainDeployment.ProtocolVersionsProxyAddress,
UpgradeController: intent.SuperchainRoles.ProxyAdminOwner,
UseInterop: intent.UseInterop,
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ interface IOPContractsManager {
error ReservedBitsSet();
error UnexpectedPreambleData(bytes data);
error UnsupportedERCVersion(uint8 version);
error OnlyUpgradeController();

/// @notice Thrown when an address is the zero address.
error AddressNotFound(address who);
Expand Down Expand Up @@ -208,7 +209,8 @@ interface IOPContractsManager {
IProtocolVersions _protocolVersions,
string memory _l1ContractsRelease,
Blueprints memory _blueprints,
Implementations memory _implementations
Implementations memory _implementations,
address _upgradeController
)
external;

Expand All @@ -234,4 +236,10 @@ interface IOPContractsManager {

/// @notice Returns the implementation contract addresses.
function implementations() external view returns (Implementations memory);

function upgradeController() external view returns (address);

function isRC() external view returns (bool);

function setRC(bool _isRC) external;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ interface IOPContractsManagerInterop is IOPContractsManager {
IProtocolVersions _protocolVersions,
string memory _l1ContractsRelease,
Blueprints memory _blueprints,
Implementations memory _implementations
Implementations memory _implementations,
address _upgradeController
)
external;
}
4 changes: 4 additions & 0 deletions packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ contract Deploy is Deployer {
dii.set(dii.l1ContractsRelease.selector, release);
dii.set(dii.superchainConfigProxy.selector, artifacts.mustGetAddress("SuperchainConfigProxy"));
dii.set(dii.protocolVersionsProxy.selector, artifacts.mustGetAddress("ProtocolVersionsProxy"));
dii.set(
dii.upgradeController.selector,
IProxyAdmin(EIP1967Helper.getAdmin(artifacts.mustGetAddress("SuperchainConfigProxy"))).owner()
);

if (_isInterop) {
di = DeployImplementations(new DeployImplementationsInterop());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ contract DeployImplementationsInput is BaseDeployIO {
// Outputs from DeploySuperchain.s.sol.
ISuperchainConfig internal _superchainConfigProxy;
IProtocolVersions internal _protocolVersionsProxy;
address internal _upgradeController;

function set(bytes4 _sel, uint256 _value) public {
require(_value != 0, "DeployImplementationsInput: cannot set zero value");
Expand Down Expand Up @@ -77,6 +78,7 @@ contract DeployImplementationsInput is BaseDeployIO {
require(_addr != address(0), "DeployImplementationsInput: cannot set zero address");
if (_sel == this.superchainConfigProxy.selector) _superchainConfigProxy = ISuperchainConfig(_addr);
else if (_sel == this.protocolVersionsProxy.selector) _protocolVersionsProxy = IProtocolVersions(_addr);
else if (_sel == this.upgradeController.selector) _upgradeController = _addr;
else revert("DeployImplementationsInput: unknown selector");
}

Expand Down Expand Up @@ -127,6 +129,11 @@ contract DeployImplementationsInput is BaseDeployIO {
require(address(_protocolVersionsProxy) != address(0), "DeployImplementationsInput: not set");
return _protocolVersionsProxy;
}

function upgradeController() public view returns (address) {
require(address(_upgradeController) != address(0), "DeployImplementationsInput: not set");
return _upgradeController;
}
}

contract DeployImplementationsOutput is BaseDeployIO {
Expand Down Expand Up @@ -269,6 +276,7 @@ contract DeployImplementationsOutput is BaseDeployIO {
IOPContractsManager impl = IOPContractsManager(address(opcm()));
require(address(impl.superchainConfig()) == address(_dii.superchainConfigProxy()), "OPCMI-10");
require(address(impl.protocolVersions()) == address(_dii.protocolVersionsProxy()), "OPCMI-20");
require(impl.upgradeController() == _dii.upgradeController(), "OPCMI-30");
}

function assertValidOptimismPortalImpl(DeployImplementationsInput) internal view {
Expand Down Expand Up @@ -444,6 +452,7 @@ contract DeployImplementations is Script {
{
ISuperchainConfig superchainConfigProxy = _dii.superchainConfigProxy();
IProtocolVersions protocolVersionsProxy = _dii.protocolVersionsProxy();
address upgradeController = _dii.upgradeController();

IOPContractsManager.Implementations memory implementations = IOPContractsManager.Implementations({
l1ERC721BridgeImpl: address(_dio.l1ERC721BridgeImpl()),
Expand All @@ -465,7 +474,14 @@ contract DeployImplementations is Script {
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOPContractsManager.__constructor__,
(superchainConfigProxy, protocolVersionsProxy, _l1ContractsRelease, _blueprints, implementations)
(
superchainConfigProxy,
protocolVersionsProxy,
_l1ContractsRelease,
_blueprints,
implementations,
upgradeController
)
)
),
_salt: _salt
Expand Down Expand Up @@ -790,6 +806,7 @@ contract DeployImplementationsInterop is DeployImplementations {
{
ISuperchainConfig superchainConfigProxy = _dii.superchainConfigProxy();
IProtocolVersions protocolVersionsProxy = _dii.protocolVersionsProxy();
address upgradeController = _dii.upgradeController();

IOPContractsManager.Implementations memory implementations = IOPContractsManager.Implementations({
l1ERC721BridgeImpl: address(_dio.l1ERC721BridgeImpl()),
Expand All @@ -811,7 +828,14 @@ contract DeployImplementationsInterop is DeployImplementations {
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOPContractsManagerInterop.__constructor__,
(superchainConfigProxy, protocolVersionsProxy, _l1ContractsRelease, _blueprints, implementations)
(
superchainConfigProxy,
protocolVersionsProxy,
_l1ContractsRelease,
_blueprints,
implementations,
upgradeController
)
)
),
_salt: _salt
Expand Down
30 changes: 26 additions & 4 deletions packages/contracts-bedrock/scripts/deploy/DeployOPCM.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contract DeployOPCMInput is BaseDeployIO {
ISuperchainConfig internal _superchainConfig;
IProtocolVersions internal _protocolVersions;
string internal _l1ContractsRelease;
address internal _upgradeController;

address internal _addressManagerBlueprint;
address internal _proxyBlueprint;
Expand All @@ -42,6 +43,7 @@ contract DeployOPCMInput is BaseDeployIO {

if (_sel == this.superchainConfig.selector) _superchainConfig = ISuperchainConfig(_addr);
else if (_sel == this.protocolVersions.selector) _protocolVersions = IProtocolVersions(_addr);
else if (_sel == this.upgradeController.selector) _upgradeController = _addr;
else if (_sel == this.addressManagerBlueprint.selector) _addressManagerBlueprint = _addr;
else if (_sel == this.proxyBlueprint.selector) _proxyBlueprint = _addr;
else if (_sel == this.proxyAdminBlueprint.selector) _proxyAdminBlueprint = _addr;
Expand Down Expand Up @@ -85,6 +87,11 @@ contract DeployOPCMInput is BaseDeployIO {
return _l1ContractsRelease;
}

function upgradeController() public view returns (address) {
require(_upgradeController != address(0), "DeployOPCMInput: not set");
return _upgradeController;
}

function addressManagerBlueprint() public view returns (address) {
require(_addressManagerBlueprint != address(0), "DeployOPCMInput: not set");
return _addressManagerBlueprint;
Expand Down Expand Up @@ -215,7 +222,12 @@ contract DeployOPCM is Script {
});

IOPContractsManager opcm_ = deployOPCM(
_doi.superchainConfig(), _doi.protocolVersions(), blueprints, implementations, _doi.l1ContractsRelease()
_doi.superchainConfig(),
_doi.protocolVersions(),
blueprints,
implementations,
_doi.l1ContractsRelease(),
_doi.upgradeController()
);
_doo.set(_doo.opcm.selector, address(opcm_));

Expand All @@ -227,7 +239,8 @@ contract DeployOPCM is Script {
IProtocolVersions _protocolVersions,
IOPContractsManager.Blueprints memory _blueprints,
IOPContractsManager.Implementations memory _implementations,
string memory _l1ContractsRelease
string memory _l1ContractsRelease,
address _upgradeController
)
public
returns (IOPContractsManager opcm_)
Expand All @@ -239,7 +252,14 @@ contract DeployOPCM is Script {
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOPContractsManager.__constructor__,
(_superchainConfig, _protocolVersions, _l1ContractsRelease, _blueprints, _implementations)
(
_superchainConfig,
_protocolVersions,
_l1ContractsRelease,
_blueprints,
_implementations,
_upgradeController
)
)
),
_salt: DeployUtils.DEFAULT_SALT
Expand All @@ -252,7 +272,9 @@ contract DeployOPCM is Script {
IOPContractsManager impl = IOPContractsManager(address(_doo.opcm()));
require(address(impl.superchainConfig()) == address(_doi.superchainConfig()), "OPCMI-10");
require(address(impl.protocolVersions()) == address(_doi.protocolVersions()), "OPCMI-20");
require(LibString.eq(impl.l1ContractsRelease(), _doi.l1ContractsRelease()), "OPCMI-30");
require(LibString.eq(impl.l1ContractsRelease(), string.concat(_doi.l1ContractsRelease(), "-rc")), "OPCMI-30");

require(impl.upgradeController() == _doi.upgradeController(), "OPCMI-40");

IOPContractsManager.Blueprints memory blueprints = impl.blueprints();
require(blueprints.addressManager == _doi.addressManagerBlueprint(), "OPCMI-40");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
"internalType": "struct OPContractsManager.Implementations",
"name": "_implementations",
"type": "tuple"
},
{
"internalType": "address",
"name": "_upgradeController",
"type": "address"
}
],
"stateMutability": "nonpayable",
Expand Down Expand Up @@ -561,6 +566,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isRC",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "l1ContractsRelease",
Expand All @@ -587,6 +605,19 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "_isRC",
"type": "bool"
}
],
"name": "setRC",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "superchainConfig",
Expand Down Expand Up @@ -625,6 +656,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "upgradeController",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "version",
Expand Down Expand Up @@ -776,6 +820,11 @@
"name": "OnlyDelegatecall",
"type": "error"
},
{
"inputs": [],
"name": "OnlyUpgradeController",
"type": "error"
},
{
"inputs": [],
"name": "ReservedBitsSet",
Expand Down
Loading