Commit 8f0a9b2d authored by blaine's avatar blaine Committed by GitHub

opcm-redesign: opcm targets a single release (#12851)

* fix: semver locking.

* fix: semver locking.

* feat: opcm impl contracts now type safe.

* feat: fixing test.

* fix: removing unused imports.

* fix: address didn't need to be payable.

* fix: moving all smart contract changes to first pr.

* fix: pr comments addressed.

* fix: removed InputContracts struct.

* fix: ran pre-pr

* fix: deploy implementations renaming version.

* fix: adding solidity changes to this pr.

* fix: adding v160 initializer back in.

* fix: removed branching logic from opcm.

* fix: removed SystemConfigV160.

* opcm-redesign: op-deployer changes

* fix: linting fix.

* fix: semver lock

---------
Co-authored-by: default avatarMatthew Slipper <me@matthewslipper.com>
parent c267d98b
......@@ -35,7 +35,7 @@ type SuperFaultProofConfig struct {
}
type OPCMImplementationsConfig struct {
Release string
L1ContractsRelease string
FaultProof SuperFaultProofConfig
......
......@@ -170,10 +170,9 @@ func DeploySuperchainToL1(l1Host *script.Host, superCfg *SuperchainConfig) (*Sup
ProofMaturityDelaySeconds: superCfg.Implementations.FaultProof.ProofMaturityDelaySeconds,
DisputeGameFinalityDelaySeconds: superCfg.Implementations.FaultProof.DisputeGameFinalityDelaySeconds,
MipsVersion: superCfg.Implementations.FaultProof.MipsVersion,
Release: superCfg.Implementations.Release,
L1ContractsRelease: superCfg.Implementations.L1ContractsRelease,
SuperchainConfigProxy: superDeployment.SuperchainConfigProxy,
ProtocolVersionsProxy: superDeployment.ProtocolVersionsProxy,
OpcmProxyOwner: superDeployment.SuperchainProxyAdmin,
UseInterop: superCfg.Implementations.UseInterop,
StandardVersionsToml: standard.VersionsMainnetData,
})
......@@ -210,7 +209,7 @@ func DeployL2ToL1(l1Host *script.Host, superCfg *SuperchainConfig, superDeployme
BasefeeScalar: cfg.GasPriceOracleBaseFeeScalar,
BlobBaseFeeScalar: cfg.GasPriceOracleBlobBaseFeeScalar,
L2ChainId: new(big.Int).SetUint64(cfg.L2ChainID),
OpcmProxy: superDeployment.OpcmProxy,
Opcm: superDeployment.Opcm,
SaltMixer: cfg.SaltMixer,
GasLimit: cfg.GasLimit,
DisputeGameType: cfg.DisputeGameType,
......
......@@ -9,8 +9,7 @@ type L1Deployment struct {
}
type Implementations struct {
OpcmProxy common.Address `json:"OPCMProxy"`
OpcmImpl common.Address `json:"OPCMImpl"`
Opcm common.Address `json:"OPCM"`
DelayedWETHImpl common.Address `json:"DelayedWETHImpl"`
OptimismPortalImpl common.Address `json:"OptimismPortalImpl"`
PreimageOracleSingleton common.Address `json:"PreimageOracleSingleton"`
......
......@@ -69,7 +69,7 @@ func (r *InteropDevRecipe) Build(addrs devkeys.Addresses) (*WorldConfig, error)
ProtocolVersionsOwner: superchainProtocolVersionsOwner,
Deployer: superchainDeployer,
Implementations: OPCMImplementationsConfig{
Release: "dev",
L1ContractsRelease: "dev",
FaultProof: SuperFaultProofConfig{
WithdrawalDelaySeconds: big.NewInt(604800),
MinProposalSizeBytes: big.NewInt(10000),
......
......@@ -164,10 +164,6 @@ func OPCM(ctx context.Context, cfg OPCMConfig) error {
if err != nil {
return fmt.Errorf("error getting standard versions TOML: %w", err)
}
opcmProxyOwnerAddr, err := standard.ManagerOwnerAddrFor(chainIDU64)
if err != nil {
return fmt.Errorf("error getting superchain proxy admin: %w", err)
}
signer := opcrypto.SignerFnFromBind(opcrypto.PrivateKeySignerFn(cfg.privateKeyECDSA, chainID))
chainDeployer := crypto.PubkeyToAddress(cfg.privateKeyECDSA.PublicKey)
......@@ -199,14 +195,14 @@ func OPCM(ctx context.Context, cfg OPCMConfig) error {
}
host.SetNonce(chainDeployer, nonce)
var release string
var l1ContractsRelease string
if cfg.ArtifactsLocator.IsTag() {
release = cfg.ArtifactsLocator.Tag
l1ContractsRelease = cfg.ArtifactsLocator.Tag
} else {
release = "dev"
l1ContractsRelease = "dev"
}
lgr.Info("deploying OPCM", "release", release)
lgr.Info("deploying OPCM", "l1ContractsRelease", l1ContractsRelease)
// We need to etch the Superchain addresses so that they have nonzero code
// and the checks in the OPCM constructor pass.
......@@ -238,10 +234,9 @@ func OPCM(ctx context.Context, cfg OPCMConfig) error {
ProofMaturityDelaySeconds: new(big.Int).SetUint64(cfg.ProofMaturityDelaySeconds),
DisputeGameFinalityDelaySeconds: new(big.Int).SetUint64(cfg.DisputeGameFinalityDelaySeconds),
MipsVersion: new(big.Int).SetUint64(cfg.MIPSVersion),
Release: release,
L1ContractsRelease: l1ContractsRelease,
SuperchainConfigProxy: superchainConfigAddr,
ProtocolVersionsProxy: protocolVersionsAddr,
OpcmProxyOwner: opcmProxyOwnerAddr,
StandardVersionsToml: standardVersionsTOML,
UseInterop: false,
},
......
......@@ -45,7 +45,7 @@ type OpChainDeployment struct {
}
type ImplementationsDeployment struct {
OpcmProxyAddress common.Address `json:"opcmProxyAddress"`
OpcmAddress common.Address `json:"opcmAddress"`
DelayedWETHImplAddress common.Address `json:"delayedWETHImplAddress"`
OptimismPortalImplAddress common.Address `json:"optimismPortalImplAddress"`
PreimageOracleSingletonAddress common.Address `json:"preimageOracleSingletonAddress"`
......@@ -113,7 +113,7 @@ func L1(globalState *state.State, chainID common.Hash) (*L1Contracts, error) {
// DelayedWETHPermissionlessGameProxyAddress: chainState.DelayedWETHPermissionlessGameProxyAddress,
},
ImplementationsDeployment: ImplementationsDeployment{
OpcmProxyAddress: globalState.ImplementationsDeployment.OpcmProxyAddress,
OpcmAddress: globalState.ImplementationsDeployment.OpcmAddress,
DelayedWETHImplAddress: globalState.ImplementationsDeployment.DelayedWETHImplAddress,
OptimismPortalImplAddress: globalState.ImplementationsDeployment.OptimismPortalImplAddress,
PreimageOracleSingletonAddress: globalState.ImplementationsDeployment.PreimageOracleSingletonAddress,
......
......@@ -207,6 +207,30 @@ func TestApplyExistingOPCM(t *testing.T) {
))
validateOPChainDeployment(t, ethClientCodeGetter(ctx, l1Client), st, intent)
releases := standard.L1VersionsSepolia.Releases["op-contracts/v1.6.0"]
implTests := []struct {
name string
expAddr common.Address
actAddr common.Address
}{
{"OptimismPortal", releases.OptimismPortal.ImplementationAddress, st.ImplementationsDeployment.OptimismPortalImplAddress},
{"SystemConfig,", releases.SystemConfig.ImplementationAddress, st.ImplementationsDeployment.SystemConfigImplAddress},
{"L1CrossDomainMessenger", releases.L1CrossDomainMessenger.ImplementationAddress, st.ImplementationsDeployment.L1CrossDomainMessengerImplAddress},
{"L1ERC721Bridge", releases.L1ERC721Bridge.ImplementationAddress, st.ImplementationsDeployment.L1ERC721BridgeImplAddress},
{"L1StandardBridge", releases.L1StandardBridge.ImplementationAddress, st.ImplementationsDeployment.L1StandardBridgeImplAddress},
{"OptimismMintableERC20Factory", releases.OptimismMintableERC20Factory.ImplementationAddress, st.ImplementationsDeployment.OptimismMintableERC20FactoryImplAddress},
{"DisputeGameFactory", releases.DisputeGameFactory.ImplementationAddress, st.ImplementationsDeployment.DisputeGameFactoryImplAddress},
{"MIPS", releases.MIPS.Address, st.ImplementationsDeployment.MipsSingletonAddress},
{"PreimageOracle", releases.PreimageOracle.Address, st.ImplementationsDeployment.PreimageOracleSingletonAddress},
{"DelayedWETH", releases.DelayedWETH.ImplementationAddress, st.ImplementationsDeployment.DelayedWETHImplAddress},
}
for _, tt := range implTests {
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, tt.expAddr, tt.actAddr)
})
}
}
func TestL2BlockTimeOverride(t *testing.T) {
......@@ -571,7 +595,7 @@ func validateSuperchainDeployment(t *testing.T, st *state.State, cg codeGetter)
{"SuperchainConfigImpl", st.SuperchainDeployment.SuperchainConfigImplAddress},
{"ProtocolVersionsProxy", st.SuperchainDeployment.ProtocolVersionsProxyAddress},
{"ProtocolVersionsImpl", st.SuperchainDeployment.ProtocolVersionsImplAddress},
{"OpcmProxy", st.ImplementationsDeployment.OpcmProxyAddress},
{"Opcm", st.ImplementationsDeployment.OpcmAddress},
{"PreimageOracleSingleton", st.ImplementationsDeployment.PreimageOracleSingletonAddress},
{"MipsSingleton", st.ImplementationsDeployment.MipsSingletonAddress},
}
......
......@@ -48,57 +48,6 @@ func (c *Contract) GenericAddressGetter(ctx context.Context, functionName string
return c.callContractMethod(ctx, functionName, abi.Arguments{})
}
// GetImplementation retrieves the Implementation struct for a given release and contract name.
func (c *Contract) GetOPCMImplementationAddress(ctx context.Context, release, contractName string) (common.Address, error) {
methodName := "implementations"
method := abi.NewMethod(
methodName,
methodName,
abi.Function,
"view",
true,
false,
abi.Arguments{
{Name: "release", Type: mustType("string")},
{Name: "contractName", Type: mustType("string")},
},
abi.Arguments{
{Name: "logic", Type: mustType("address")},
{Name: "initializer", Type: mustType("bytes4")},
},
)
calldata, err := method.Inputs.Pack(release, contractName)
if err != nil {
return common.Address{}, fmt.Errorf("failed to pack inputs: %w", err)
}
msg := ethereum.CallMsg{
To: &c.addr,
Data: append(bytes.Clone(method.ID), calldata...),
}
result, err := c.client.CallContract(ctx, msg, nil)
if err != nil {
return common.Address{}, fmt.Errorf("failed to call contract: %w", err)
}
out, err := method.Outputs.Unpack(result)
if err != nil {
return common.Address{}, fmt.Errorf("failed to unpack result: %w", err)
}
if len(out) != 2 {
return common.Address{}, fmt.Errorf("unexpected output length: %d", len(out))
}
logic, ok := out[0].(common.Address)
if !ok {
return common.Address{}, fmt.Errorf("unexpected type for logic: %T", out[0])
}
return logic, nil
}
func (c *Contract) callContractMethod(ctx context.Context, methodName string, inputs abi.Arguments, args ...interface{}) (common.Address, error) {
method := abi.NewMethod(
methodName,
......
......@@ -18,12 +18,11 @@ type DeployImplementationsInput struct {
DisputeGameFinalityDelaySeconds *big.Int
MipsVersion *big.Int
// Release version to set OPCM implementations for, of the format `op-contracts/vX.Y.Z`.
Release string
L1ContractsRelease string
SuperchainConfigProxy common.Address
ProtocolVersionsProxy common.Address
UseInterop bool // if true, deploy Interop implementations
OpcmProxyOwner common.Address
StandardVersionsToml string // contents of 'standard-versions-mainnet.toml' or 'standard-versions-sepolia.toml' file
}
......@@ -32,8 +31,7 @@ func (input *DeployImplementationsInput) InputSet() bool {
}
type DeployImplementationsOutput struct {
OpcmProxy common.Address
OpcmImpl common.Address
Opcm common.Address
DelayedWETHImpl common.Address
OptimismPortalImpl common.Address
PreimageOracleSingleton common.Address
......
......@@ -26,7 +26,7 @@ type DeployOPChainInputV160 struct {
BasefeeScalar uint32
BlobBaseFeeScalar uint32
L2ChainId *big.Int
OpcmProxy common.Address
Opcm common.Address
SaltMixer string
GasLimit uint64
......@@ -122,8 +122,8 @@ func deployOPChain[T any](host *script.Host, input T) (DeployOPChainOutput, erro
type ReadImplementationAddressesInput struct {
DeployOPChainOutput
OpcmProxy common.Address
Release string
Opcm common.Address
Release string
}
type ReadImplementationAddressesOutput struct {
......
......@@ -31,7 +31,7 @@ func DeployAltDA(env *Env, intent *state.Intent, st *state.State, chainID common
lgr.Info("deploying alt-da contracts")
dao, err = opcm.DeployAltDA(env.L1ScriptHost, opcm.DeployAltDAInput{
Salt: st.Create2Salt,
ProxyAdmin: st.ImplementationsDeployment.OpcmProxyAddress,
ProxyAdmin: chainState.ProxyAdminAddress,
ChallengeContractOwner: chainIntent.Roles.L1ProxyAdminOwner,
ChallengeWindow: new(big.Int).SetUint64(chainIntent.DangerousAltDAConfig.DAChallengeWindow),
ResolveWindow: new(big.Int).SetUint64(chainIntent.DangerousAltDAConfig.DAResolveWindow),
......
......@@ -68,10 +68,9 @@ func DeployImplementations(env *Env, intent *state.Intent, st *state.State) erro
ProofMaturityDelaySeconds: new(big.Int).SetUint64(proofParams.ProofMaturityDelaySeconds),
DisputeGameFinalityDelaySeconds: new(big.Int).SetUint64(proofParams.DisputeGameFinalityDelaySeconds),
MipsVersion: new(big.Int).SetUint64(proofParams.MIPSVersion),
Release: contractsRelease,
L1ContractsRelease: contractsRelease,
SuperchainConfigProxy: st.SuperchainDeployment.SuperchainConfigProxyAddress,
ProtocolVersionsProxy: st.SuperchainDeployment.ProtocolVersionsProxyAddress,
OpcmProxyOwner: st.SuperchainDeployment.ProxyAdminAddress,
StandardVersionsToml: standardVersionsTOML,
UseInterop: intent.UseInterop,
},
......@@ -81,7 +80,7 @@ func DeployImplementations(env *Env, intent *state.Intent, st *state.State) erro
}
st.ImplementationsDeployment = &state.ImplementationsDeployment{
OpcmProxyAddress: dio.OpcmProxy,
OpcmAddress: dio.Opcm,
DelayedWETHImplAddress: dio.DelayedWETHImpl,
OptimismPortalImplAddress: dio.OptimismPortalImpl,
PreimageOracleSingletonAddress: dio.PreimageOracleSingleton,
......
......@@ -45,12 +45,12 @@ func InitLiveStrategy(ctx context.Context, env *Env, intent *state.Intent, st *s
SuperchainConfigProxyAddress: common.Address(*superCfg.Config.SuperchainConfigAddr),
}
opcmProxy, err := standard.ManagerImplementationAddrFor(intent.L1ChainID)
opcmAddress, err := standard.ManagerImplementationAddrFor(intent.L1ChainID)
if err != nil {
return fmt.Errorf("error getting OPCM proxy address: %w", err)
}
st.ImplementationsDeployment = &state.ImplementationsDeployment{
OpcmProxyAddress: opcmProxy,
OpcmAddress: opcmAddress,
}
}
......
......@@ -34,7 +34,7 @@ func DeployOPChain(env *Env, intent *state.Intent, st *state.State, chainID comm
return opcm.DeployOPChainOutput{}, fmt.Errorf("error making deploy OP chain input: %w", err)
}
opcmAddr = input.OpcmProxy
opcmAddr = input.Opcm
return opcm.DeployOPChainV160(env.L1ScriptHost, input)
}
default:
......@@ -44,7 +44,7 @@ func DeployOPChain(env *Env, intent *state.Intent, st *state.State, chainID comm
return opcm.DeployOPChainOutput{}, fmt.Errorf("error making deploy OP chain input: %w", err)
}
opcmAddr = input.OpcmProxy
opcmAddr = input.Opcm
return opcm.DeployOPChainIsthmus(env.L1ScriptHost, input)
}
}
......@@ -67,7 +67,7 @@ func DeployOPChain(env *Env, intent *state.Intent, st *state.State, chainID comm
readInput := opcm.ReadImplementationAddressesInput{
DeployOPChainOutput: dco,
OpcmProxy: opcmAddr,
Opcm: opcmAddr,
Release: release,
}
impls, err := opcm.ReadImplementationAddresses(env.L1ScriptHost, readInput)
......@@ -126,7 +126,7 @@ func makeDCIV160(intent *state.Intent, thisIntent *state.ChainIntent, chainID co
BasefeeScalar: standard.BasefeeScalar,
BlobBaseFeeScalar: standard.BlobBaseFeeScalar,
L2ChainId: chainID.Big(),
OpcmProxy: st.ImplementationsDeployment.OpcmProxyAddress,
Opcm: st.ImplementationsDeployment.OpcmAddress,
SaltMixer: st.Create2Salt.String(), // passing through salt generated at state initialization
GasLimit: standard.GasLimit,
DisputeGameType: proofParams.DisputeGameType,
......
......@@ -134,10 +134,11 @@ func ManagerImplementationAddrFor(chainID uint64) (common.Address, error) {
switch chainID {
case 1:
// Generated using the bootstrap command on 10/18/2024.
return common.HexToAddress("0x18cec91779995ad14c880e4095456b9147160790"), nil
// TODO: @blmalone this needs re-bootstrapped because it's still proxied
return common.HexToAddress(""), nil
case 11155111:
// Generated using the bootstrap command on 10/18/2024.
return common.HexToAddress("0xf564eea7960ea244bfebcbbb17858748606147bf"), nil
// Generated using the bootstrap command on 11/15/2024.
return common.HexToAddress("0xde9eacb994a6eb12997445f8a63a22772c5c4313"), nil
default:
return common.Address{}, fmt.Errorf("unsupported chain ID: %d", chainID)
}
......@@ -172,7 +173,7 @@ func SystemOwnerAddrFor(chainID uint64) (common.Address, error) {
func ArtifactsURLForTag(tag string) (*url.URL, error) {
switch tag {
case "op-contracts/v1.6.0":
return url.Parse(standardArtifactsURL("3a27c6dc0cb61b36feaac26def98c64b4a48ec8f5c5ba6965e8ae3157606043c"))
return url.Parse(standardArtifactsURL("e1f0c4020618c4a98972e7124c39686cab2e31d5d7846f9ce5e0d5eed0f5ff32"))
case "op-contracts/v1.7.0-beta.1+l2-contracts":
return url.Parse(standardArtifactsURL("b0fb1f6f674519d637cff39a22187a5993d7f81a6d7b7be6507a0b50a5e38597"))
default:
......
......@@ -64,7 +64,7 @@ type SuperchainDeployment struct {
}
type ImplementationsDeployment struct {
OpcmProxyAddress common.Address `json:"opcmProxyAddress"`
OpcmAddress common.Address `json:"opcmAddress"`
DelayedWETHImplAddress common.Address `json:"delayedWETHImplAddress"`
OptimismPortalImplAddress common.Address `json:"optimismPortalImplAddress"`
PreimageOracleSingletonAddress common.Address `json:"preimageOracleSingletonAddress"`
......
......@@ -162,7 +162,7 @@ contract Deploy is Deployer {
L1ERC721Bridge: getAddress("L1ERC721BridgeProxy"),
ProtocolVersions: getAddress("ProtocolVersionsProxy"),
SuperchainConfig: getAddress("SuperchainConfigProxy"),
OPContractsManager: getAddress("OPContractsManagerProxy")
OPContractsManager: getAddress("OPContractsManager")
});
}
......@@ -378,13 +378,12 @@ contract Deploy is Deployer {
dii.set(dii.disputeGameFinalityDelaySeconds.selector, cfg.disputeGameFinalityDelaySeconds());
dii.set(dii.mipsVersion.selector, Config.useMultithreadedCannon() ? 2 : 1);
string memory release = "dev";
dii.set(dii.release.selector, release);
dii.set(dii.l1ContractsRelease.selector, release);
dii.set(
dii.standardVersionsToml.selector, string.concat(vm.projectRoot(), "/test/fixtures/standard-versions.toml")
);
dii.set(dii.superchainConfigProxy.selector, mustGetAddress("SuperchainConfigProxy"));
dii.set(dii.protocolVersionsProxy.selector, mustGetAddress("ProtocolVersionsProxy"));
dii.set(dii.opcmProxyOwner.selector, cfg.finalSystemOwner());
if (_isInterop) {
di = DeployImplementations(new DeployImplementationsInterop());
......@@ -409,8 +408,7 @@ contract Deploy is Deployer {
save("DelayedWETH", address(dio.delayedWETHImpl()));
save("PreimageOracle", address(dio.preimageOracleSingleton()));
save("Mips", address(dio.mipsSingleton()));
save("OPContractsManagerProxy", address(dio.opcmProxy()));
save("OPContractsManager", address(dio.opcmImpl()));
save("OPContractsManager", address(dio.opcm()));
Types.ContractSet memory contracts = _impls();
ChainAssertions.checkL1CrossDomainMessenger({ _contracts: contracts, _vm: vm, _isProxy: false });
......@@ -446,7 +444,7 @@ contract Deploy is Deployer {
// Ensure that the requisite contracts are deployed
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
OPContractsManager opcm = OPContractsManager(mustGetAddress("OPContractsManagerProxy"));
OPContractsManager opcm = OPContractsManager(mustGetAddress("OPContractsManager"));
OPContractsManager.DeployInput memory deployInput = getDeployInput();
OPContractsManager.DeployOutput memory deployOutput = opcm.deploy(deployInput);
......
......@@ -47,7 +47,7 @@ contract DeployOPChainInput is BaseDeployIO {
uint32 internal _basefeeScalar;
uint32 internal _blobBaseFeeScalar;
uint256 internal _l2ChainId;
OPContractsManager internal _opcmProxy;
OPContractsManager internal _opcm;
string internal _saltMixer;
uint64 internal _gasLimit;
......@@ -68,7 +68,7 @@ contract DeployOPChainInput is BaseDeployIO {
else if (_sel == this.unsafeBlockSigner.selector) _unsafeBlockSigner = _addr;
else if (_sel == this.proposer.selector) _proposer = _addr;
else if (_sel == this.challenger.selector) _challenger = _addr;
else if (_sel == this.opcmProxy.selector) _opcmProxy = OPContractsManager(_addr);
else if (_sel == this.opcm.selector) _opcm = OPContractsManager(_addr);
else revert("DeployOPChainInput: unknown selector");
}
......@@ -174,11 +174,10 @@ contract DeployOPChainInput is BaseDeployIO {
return abi.encode(ScriptConstants.DEFAULT_STARTING_ANCHOR_ROOTS());
}
function opcmProxy() public returns (OPContractsManager) {
require(address(_opcmProxy) != address(0), "DeployOPChainInput: not set");
DeployUtils.assertValidContractAddress(address(_opcmProxy));
DeployUtils.assertERC1967ImplementationSet(address(_opcmProxy));
return _opcmProxy;
function opcm() public view returns (OPContractsManager) {
require(address(_opcm) != address(0), "DeployOPChainInput: not set");
DeployUtils.assertValidContractAddress(address(_opcm));
return _opcm;
}
function saltMixer() public view returns (string memory) {
......@@ -347,7 +346,7 @@ contract DeployOPChain is Script {
// -------- Core Deployment Methods --------
function run(DeployOPChainInput _doi, DeployOPChainOutput _doo) public {
OPContractsManager opcmProxy = _doi.opcmProxy();
OPContractsManager opcm = _doi.opcm();
OPContractsManager.Roles memory roles = OPContractsManager.Roles({
opChainProxyAdminOwner: _doi.opChainProxyAdminOwner(),
......@@ -374,7 +373,7 @@ contract DeployOPChain is Script {
});
vm.broadcast(msg.sender);
OPContractsManager.DeployOutput memory deployOutput = opcmProxy.deploy(deployInput);
OPContractsManager.DeployOutput memory deployOutput = opcm.deploy(deployInput);
vm.label(address(deployOutput.opChainProxyAdmin), "opChainProxyAdmin");
vm.label(address(deployOutput.addressManager), "addressManager");
......@@ -480,9 +479,9 @@ contract DeployOPChain is Script {
"DPG-20"
);
OPContractsManager opcm = _doi.opcmProxy();
(address mips,) = opcm.implementations(opcm.latestRelease(), "MIPS");
require(game.vm() == IBigStepper(mips), "DPG-30");
OPContractsManager opcm = _doi.opcm();
address mipsImpl = opcm.implementations().mipsImpl;
require(game.vm() == IBigStepper(mipsImpl), "DPG-30");
require(address(game.weth()) == address(_doo.delayedWETHPermissionedGameProxy()), "DPG-40");
require(address(game.anchorStateRegistry()) == address(_doo.anchorStateRegistryProxy()), "DPG-50");
......@@ -552,9 +551,7 @@ contract DeployOPChain is Script {
require(outputConfig.maximumBaseFee == rConfig.maximumBaseFee, "SYSCON-130");
require(systemConfig.startBlock() == block.number, "SYSCON-140");
require(
systemConfig.batchInbox() == _doi.opcmProxy().chainIdToBatchInboxAddress(_doi.l2ChainId()), "SYSCON-150"
);
require(systemConfig.batchInbox() == _doi.opcm().chainIdToBatchInboxAddress(_doi.l2ChainId()), "SYSCON-150");
require(systemConfig.l1CrossDomainMessenger() == address(_doo.l1CrossDomainMessengerProxy()), "SYSCON-160");
require(systemConfig.l1ERC721Bridge() == address(_doo.l1ERC721BridgeProxy()), "SYSCON-170");
......@@ -579,7 +576,7 @@ contract DeployOPChain is Script {
require(address(messenger.PORTAL()) == address(_doo.optimismPortalProxy()), "L1xDM-30");
require(address(messenger.portal()) == address(_doo.optimismPortalProxy()), "L1xDM-40");
require(address(messenger.superchainConfig()) == address(_doi.opcmProxy().superchainConfig()), "L1xDM-50");
require(address(messenger.superchainConfig()) == address(_doi.opcm().superchainConfig()), "L1xDM-50");
bytes32 xdmSenderSlot = vm.load(address(messenger), bytes32(uint256(204)));
require(address(uint160(uint256(xdmSenderSlot))) == Constants.DEFAULT_L2_SENDER, "L1xDM-60");
......@@ -595,7 +592,7 @@ contract DeployOPChain is Script {
require(address(bridge.messenger()) == address(messenger), "L1SB-20");
require(address(bridge.OTHER_BRIDGE()) == Predeploys.L2_STANDARD_BRIDGE, "L1SB-30");
require(address(bridge.otherBridge()) == Predeploys.L2_STANDARD_BRIDGE, "L1SB-40");
require(address(bridge.superchainConfig()) == address(_doi.opcmProxy().superchainConfig()), "L1SB-50");
require(address(bridge.superchainConfig()) == address(_doi.opcm().superchainConfig()), "L1SB-50");
}
function assertValidOptimismMintableERC20Factory(DeployOPChainInput, DeployOPChainOutput _doo) internal {
......@@ -617,12 +614,12 @@ contract DeployOPChain is Script {
require(address(bridge.MESSENGER()) == address(_doo.l1CrossDomainMessengerProxy()), "L721B-30");
require(address(bridge.messenger()) == address(_doo.l1CrossDomainMessengerProxy()), "L721B-40");
require(address(bridge.superchainConfig()) == address(_doi.opcmProxy().superchainConfig()), "L721B-50");
require(address(bridge.superchainConfig()) == address(_doi.opcm().superchainConfig()), "L721B-50");
}
function assertValidOptimismPortal(DeployOPChainInput _doi, DeployOPChainOutput _doo) internal {
IOptimismPortal2 portal = _doo.optimismPortalProxy();
ISuperchainConfig superchainConfig = ISuperchainConfig(address(_doi.opcmProxy().superchainConfig()));
ISuperchainConfig superchainConfig = ISuperchainConfig(address(_doi.opcm().superchainConfig()));
require(address(portal.disputeGameFactory()) == address(_doo.disputeGameFactoryProxy()), "PORTAL-10");
require(address(portal.systemConfig()) == address(_doo.systemConfigProxy()), "PORTAL-20");
......
......@@ -12,29 +12,18 @@ import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
import { IStaticL1ChugSplashProxy } from "src/legacy/interfaces/IL1ChugSplashProxy.sol";
contract ReadImplementationAddressesInput is DeployOPChainOutput {
OPContractsManager internal _opcmProxy;
string internal _release;
OPContractsManager internal _opcm;
function set(bytes4 _sel, address _addr) public override {
require(_addr != address(0), "ReadImplementationAddressesInput: cannot set zero address");
if (_sel == this.opcmProxy.selector) _opcmProxy = OPContractsManager(_addr);
if (_sel == this.opcm.selector) _opcm = OPContractsManager(_addr);
else if (_sel == this.addressManager.selector) _addressManager = IAddressManager(_addr);
else super.set(_sel, _addr);
}
function set(bytes4 _sel, string memory _val) public {
if (_sel == this.release.selector) _release = _val;
else revert("ReadImplementationAddressesInput: unknown selector");
}
function opcmProxy() public view returns (OPContractsManager) {
DeployUtils.assertValidContractAddress(address(_opcmProxy));
return _opcmProxy;
}
function release() public view returns (string memory) {
require(bytes(_release).length != 0, "ReadImplementationAddressesInput: release not set");
return _release;
function opcm() public view returns (OPContractsManager) {
DeployUtils.assertValidContractAddress(address(_opcm));
return _opcm;
}
}
......@@ -154,9 +143,12 @@ contract ReadImplementationAddresses is Script {
vm.prank(address(0));
_rio.set(_rio.l1StandardBridge.selector, l1SBImpl);
(address mipsLogic,) = _rii.opcmProxy().implementations(_rii.release(), "MIPS");
address mipsLogic = _rii.opcm().implementations().mipsImpl;
_rio.set(_rio.mipsSingleton.selector, mipsLogic);
address delayedWETH = _rii.opcm().implementations().delayedWETHImpl;
_rio.set(_rio.delayedWETH.selector, delayedWETH);
IAddressManager am = _rii.addressManager();
_rio.set(_rio.l1CrossDomainMessenger.selector, am.getAddress("OVM_L1CrossDomainMessenger"));
......
......@@ -10,6 +10,110 @@
"internalType": "contract IProtocolVersions",
"name": "_protocolVersions",
"type": "address"
},
{
"internalType": "string",
"name": "_l1ContractsRelease",
"type": "string"
},
{
"components": [
{
"internalType": "address",
"name": "addressManager",
"type": "address"
},
{
"internalType": "address",
"name": "proxy",
"type": "address"
},
{
"internalType": "address",
"name": "proxyAdmin",
"type": "address"
},
{
"internalType": "address",
"name": "l1ChugSplashProxy",
"type": "address"
},
{
"internalType": "address",
"name": "resolvedDelegateProxy",
"type": "address"
},
{
"internalType": "address",
"name": "anchorStateRegistry",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame1",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame2",
"type": "address"
}
],
"internalType": "struct OPContractsManager.Blueprints",
"name": "_blueprints",
"type": "tuple"
},
{
"components": [
{
"internalType": "address",
"name": "l1ERC721BridgeImpl",
"type": "address"
},
{
"internalType": "address",
"name": "optimismPortalImpl",
"type": "address"
},
{
"internalType": "address",
"name": "systemConfigImpl",
"type": "address"
},
{
"internalType": "address",
"name": "optimismMintableERC20FactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1CrossDomainMessengerImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1StandardBridgeImpl",
"type": "address"
},
{
"internalType": "address",
"name": "disputeGameFactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "delayedWETHImpl",
"type": "address"
},
{
"internalType": "address",
"name": "mipsImpl",
"type": "address"
}
],
"internalType": "struct OPContractsManager.Implementations",
"name": "_implementations",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
......@@ -298,138 +402,68 @@
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "",
"type": "string"
},
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"inputs": [],
"name": "implementations",
"outputs": [
{
"internalType": "address",
"name": "logic",
"type": "address"
},
{
"internalType": "bytes4",
"name": "initializer",
"type": "bytes4"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"components": [
{
"internalType": "address",
"name": "addressManager",
"type": "address"
},
{
"internalType": "address",
"name": "proxy",
"type": "address"
},
{
"internalType": "address",
"name": "proxyAdmin",
"type": "address"
},
{
"internalType": "address",
"name": "l1ChugSplashProxy",
"type": "address"
},
{
"internalType": "address",
"name": "resolvedDelegateProxy",
"type": "address"
},
{
"internalType": "address",
"name": "anchorStateRegistry",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame1",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame2",
"type": "address"
}
],
"internalType": "struct OPContractsManager.Blueprints",
"name": "blueprints",
"type": "tuple"
"internalType": "address",
"name": "l1ERC721BridgeImpl",
"type": "address"
},
{
"components": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"components": [
{
"internalType": "address",
"name": "logic",
"type": "address"
},
{
"internalType": "bytes4",
"name": "initializer",
"type": "bytes4"
}
],
"internalType": "struct OPContractsManager.Implementation",
"name": "info",
"type": "tuple"
}
],
"internalType": "struct OPContractsManager.ImplementationSetter[]",
"name": "setters",
"type": "tuple[]"
"internalType": "address",
"name": "optimismPortalImpl",
"type": "address"
},
{
"internalType": "string",
"name": "release",
"type": "string"
"internalType": "address",
"name": "systemConfigImpl",
"type": "address"
},
{
"internalType": "address",
"name": "optimismMintableERC20FactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1CrossDomainMessengerImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1StandardBridgeImpl",
"type": "address"
},
{
"internalType": "bool",
"name": "isLatest",
"type": "bool"
"internalType": "address",
"name": "disputeGameFactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "delayedWETHImpl",
"type": "address"
},
{
"internalType": "address",
"name": "mipsImpl",
"type": "address"
}
],
"internalType": "struct OPContractsManager.InitializerInputs",
"name": "_initializerInputs",
"internalType": "struct OPContractsManager.Implementations",
"name": "",
"type": "tuple"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRelease",
"name": "l1ContractsRelease",
"outputs": [
{
"internalType": "string",
......@@ -529,19 +563,6 @@
"name": "Deployed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{
"inputs": [
{
......
......@@ -10,6 +10,110 @@
"internalType": "contract IProtocolVersions",
"name": "_protocolVersions",
"type": "address"
},
{
"internalType": "string",
"name": "_l1ContractsRelease",
"type": "string"
},
{
"components": [
{
"internalType": "address",
"name": "addressManager",
"type": "address"
},
{
"internalType": "address",
"name": "proxy",
"type": "address"
},
{
"internalType": "address",
"name": "proxyAdmin",
"type": "address"
},
{
"internalType": "address",
"name": "l1ChugSplashProxy",
"type": "address"
},
{
"internalType": "address",
"name": "resolvedDelegateProxy",
"type": "address"
},
{
"internalType": "address",
"name": "anchorStateRegistry",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame1",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame2",
"type": "address"
}
],
"internalType": "struct OPContractsManager.Blueprints",
"name": "_blueprints",
"type": "tuple"
},
{
"components": [
{
"internalType": "address",
"name": "l1ERC721BridgeImpl",
"type": "address"
},
{
"internalType": "address",
"name": "optimismPortalImpl",
"type": "address"
},
{
"internalType": "address",
"name": "systemConfigImpl",
"type": "address"
},
{
"internalType": "address",
"name": "optimismMintableERC20FactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1CrossDomainMessengerImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1StandardBridgeImpl",
"type": "address"
},
{
"internalType": "address",
"name": "disputeGameFactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "delayedWETHImpl",
"type": "address"
},
{
"internalType": "address",
"name": "mipsImpl",
"type": "address"
}
],
"internalType": "struct OPContractsManager.Implementations",
"name": "_implementations",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
......@@ -298,138 +402,68 @@
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "",
"type": "string"
},
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"inputs": [],
"name": "implementations",
"outputs": [
{
"internalType": "address",
"name": "logic",
"type": "address"
},
{
"internalType": "bytes4",
"name": "initializer",
"type": "bytes4"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"components": [
{
"internalType": "address",
"name": "addressManager",
"type": "address"
},
{
"internalType": "address",
"name": "proxy",
"type": "address"
},
{
"internalType": "address",
"name": "proxyAdmin",
"type": "address"
},
{
"internalType": "address",
"name": "l1ChugSplashProxy",
"type": "address"
},
{
"internalType": "address",
"name": "resolvedDelegateProxy",
"type": "address"
},
{
"internalType": "address",
"name": "anchorStateRegistry",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame1",
"type": "address"
},
{
"internalType": "address",
"name": "permissionedDisputeGame2",
"type": "address"
}
],
"internalType": "struct OPContractsManager.Blueprints",
"name": "blueprints",
"type": "tuple"
"internalType": "address",
"name": "l1ERC721BridgeImpl",
"type": "address"
},
{
"components": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"components": [
{
"internalType": "address",
"name": "logic",
"type": "address"
},
{
"internalType": "bytes4",
"name": "initializer",
"type": "bytes4"
}
],
"internalType": "struct OPContractsManager.Implementation",
"name": "info",
"type": "tuple"
}
],
"internalType": "struct OPContractsManager.ImplementationSetter[]",
"name": "setters",
"type": "tuple[]"
"internalType": "address",
"name": "optimismPortalImpl",
"type": "address"
},
{
"internalType": "string",
"name": "release",
"type": "string"
"internalType": "address",
"name": "systemConfigImpl",
"type": "address"
},
{
"internalType": "address",
"name": "optimismMintableERC20FactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1CrossDomainMessengerImpl",
"type": "address"
},
{
"internalType": "address",
"name": "l1StandardBridgeImpl",
"type": "address"
},
{
"internalType": "bool",
"name": "isLatest",
"type": "bool"
"internalType": "address",
"name": "disputeGameFactoryImpl",
"type": "address"
},
{
"internalType": "address",
"name": "delayedWETHImpl",
"type": "address"
},
{
"internalType": "address",
"name": "mipsImpl",
"type": "address"
}
],
"internalType": "struct OPContractsManager.InitializerInputs",
"name": "_initializerInputs",
"internalType": "struct OPContractsManager.Implementations",
"name": "",
"type": "tuple"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRelease",
"name": "l1ContractsRelease",
"outputs": [
{
"internalType": "string",
......@@ -529,19 +563,6 @@
"name": "Deployed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{
"inputs": [
{
......
......@@ -20,8 +20,8 @@
"sourceCodeHash": "0x4132ff37d267cb12224b75ea806c0aa7d25407b0d66ce526d7fcda8f7d223882"
},
"src/L1/OPContractsManager.sol": {
"initCodeHash": "0xd58cb3978affc5c1457cdd498ff8420c90aef804d4c3b62cf42ab2691986d6d2",
"sourceCodeHash": "0x7bfa6eff76176649fe600303cd60009a0f6e282cbaec55836b5ea1f8875cbeb5"
"initCodeHash": "0xd038cc35325d023499151264232d75fa4ecc81f04a8c8353e6b50c43af224d6e",
"sourceCodeHash": "0xa13f3ab2b8744015290dbabe5f20fdd44774607e6a7ad3e5e016303fc4aa8c12"
},
"src/L1/OptimismPortal.sol": {
"initCodeHash": "0x152167cfa18635ae4918a6eb3371a599cfa084418c0a652799cdb48bfc0ee0cc",
......
[
{
"bytes": "1",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "uint8"
},
{
"bytes": "1",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "bool"
},
{
"bytes": "32",
"label": "latestRelease",
"label": "l1ContractsRelease",
"offset": 0,
"slot": "1",
"slot": "0",
"type": "string"
},
{
"bytes": "32",
"label": "implementations",
"offset": 0,
"slot": "2",
"type": "mapping(string => mapping(string => struct OPContractsManager.Implementation))"
},
{
"bytes": "32",
"label": "systemConfigs",
"offset": 0,
"slot": "3",
"slot": "1",
"type": "mapping(uint256 => contract ISystemConfig)"
},
{
"bytes": "256",
"label": "blueprint",
"offset": 0,
"slot": "4",
"slot": "2",
"type": "struct OPContractsManager.Blueprints"
},
{
"bytes": "1600",
"label": "__gap",
"bytes": "288",
"label": "implementation",
"offset": 0,
"slot": "12",
"type": "uint256[50]"
"slot": "10",
"type": "struct OPContractsManager.Implementations"
}
]
\ No newline at end of file
[
{
"bytes": "1",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "uint8"
},
{
"bytes": "1",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "bool"
},
{
"bytes": "32",
"label": "latestRelease",
"label": "l1ContractsRelease",
"offset": 0,
"slot": "1",
"slot": "0",
"type": "string"
},
{
"bytes": "32",
"label": "implementations",
"offset": 0,
"slot": "2",
"type": "mapping(string => mapping(string => struct OPContractsManager.Implementation))"
},
{
"bytes": "32",
"label": "systemConfigs",
"offset": 0,
"slot": "3",
"slot": "1",
"type": "mapping(uint256 => contract ISystemConfig)"
},
{
"bytes": "256",
"label": "blueprint",
"offset": 0,
"slot": "4",
"slot": "2",
"type": "struct OPContractsManager.Blueprints"
},
{
"bytes": "1600",
"label": "__gap",
"bytes": "288",
"label": "implementation",
"offset": 0,
"slot": "12",
"type": "uint256[50]"
"slot": "10",
"type": "struct OPContractsManager.Implementations"
}
]
\ No newline at end of file
......@@ -6,20 +6,22 @@ import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISystemConfigInterop } from "src/L1/interfaces/ISystemConfigInterop.sol";
/// @custom:proxied true
contract OPContractsManagerInterop is OPContractsManager {
constructor(
ISuperchainConfig _superchainConfig,
IProtocolVersions _protocolVersions
IProtocolVersions _protocolVersions,
string memory _l1ContractsRelease,
Blueprints memory _blueprints,
Implementations memory _implementations
)
OPContractsManager(_superchainConfig, _protocolVersions)
OPContractsManager(_superchainConfig, _protocolVersions, _l1ContractsRelease, _blueprints, _implementations)
{ }
// The `SystemConfigInterop` contract has an extra `address _dependencyManager` argument
// that we must account for.
function encodeSystemConfigInitializer(
bytes4 _selector,
DeployInput memory _input,
DeployOutput memory _output
)
......@@ -29,8 +31,9 @@ contract OPContractsManagerInterop is OPContractsManager {
override
returns (bytes memory)
{
bytes4 selector = ISystemConfigInterop.initialize.selector;
(IResourceMetering.ResourceConfig memory referenceResourceConfig, ISystemConfig.Addresses memory opChainAddrs) =
defaultSystemConfigParams(_selector, _input, _output);
defaultSystemConfigParams(selector, _input, _output);
// TODO For now we assume that the dependency manager is the same as system config owner.
// This is currently undefined since it's not part of the standard config, so we may need
......@@ -40,7 +43,7 @@ contract OPContractsManagerInterop is OPContractsManager {
address dependencyManager = address(_input.roles.systemConfigOwner);
return abi.encodeWithSelector(
_selector,
selector,
_input.roles.systemConfigOwner,
_input.basefeeScalar,
_input.blobBasefeeScalar,
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
/// @notice This interface corresponds to the op-contracts/v1.6.0 release of the SystemConfig
/// contract, which has a semver of 2.2.0 as specified in
/// https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.6.0
interface ISystemConfigV160 {
enum UpdateType {
BATCHER,
FEE_SCALARS,
GAS_LIMIT,
UNSAFE_BLOCK_SIGNER
}
struct Addresses {
address l1CrossDomainMessenger;
address l1ERC721Bridge;
address l1StandardBridge;
address disputeGameFactory;
address optimismPortal;
address optimismMintableERC20Factory;
}
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 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,
uint256 _basefeeScalar,
uint256 _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 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;
}
......@@ -14,9 +14,12 @@ import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol";
contract OPContractsManager_Harness is OPContractsManager {
constructor(
ISuperchainConfig _superchainConfig,
IProtocolVersions _protocolVersions
IProtocolVersions _protocolVersions,
string memory _l1ContractsRelease,
Blueprints memory _blueprints,
Implementations memory _implementations
)
OPContractsManager(_superchainConfig, _protocolVersions)
OPContractsManager(_superchainConfig, _protocolVersions, _l1ContractsRelease, _blueprints, _implementations)
{ }
function chainIdToBatchInboxAddress_exposed(uint256 l2ChainId) public pure returns (address) {
......@@ -49,7 +52,7 @@ contract OPContractsManager_Deploy_Test is DeployOPChain_TestBase {
doi.set(doi.basefeeScalar.selector, basefeeScalar);
doi.set(doi.blobBaseFeeScalar.selector, blobBaseFeeScalar);
doi.set(doi.l2ChainId.selector, l2ChainId);
doi.set(doi.opcmProxy.selector, address(opcm));
doi.set(doi.opcm.selector, address(opcm));
doi.set(doi.gasLimit.selector, gasLimit);
doi.set(doi.disputeGameType.selector, disputeGameType);
......@@ -116,12 +119,17 @@ contract OPContractsManager_InternalMethods_Test is Test {
function setUp() public {
ISuperchainConfig superchainConfigProxy = ISuperchainConfig(makeAddr("superchainConfig"));
IProtocolVersions protocolVersionsProxy = IProtocolVersions(makeAddr("protocolVersions"));
OPContractsManager.Blueprints memory emptyBlueprints;
OPContractsManager.Implementations memory emptyImpls;
vm.etch(address(superchainConfigProxy), hex"01");
vm.etch(address(protocolVersionsProxy), hex"01");
opcmHarness = new OPContractsManager_Harness({
_superchainConfig: superchainConfigProxy,
_protocolVersions: protocolVersionsProxy
_protocolVersions: protocolVersionsProxy,
_l1ContractsRelease: "dev",
_blueprints: emptyBlueprints,
_implementations: emptyImpls
});
}
......
......@@ -39,10 +39,10 @@ contract DeployOPChainInput_Test is Test {
address unsafeBlockSigner = makeAddr("unsafeBlockSigner");
address proposer = makeAddr("proposer");
address challenger = makeAddr("challenger");
address opcm = makeAddr("opcm");
uint32 basefeeScalar = 100;
uint32 blobBaseFeeScalar = 200;
uint256 l2ChainId = 300;
OPContractsManager opcm = OPContractsManager(makeAddr("opcm"));
string saltMixer = "saltMixer";
function setUp() public {
......@@ -60,9 +60,8 @@ contract DeployOPChainInput_Test is Test {
doi.set(doi.blobBaseFeeScalar.selector, blobBaseFeeScalar);
doi.set(doi.l2ChainId.selector, l2ChainId);
doi.set(doi.allowCustomDisputeParameters.selector, true);
(IProxy opcmProxy) = DeployUtils.buildERC1967ProxyWithImpl("opcmProxy");
doi.set(doi.opcmProxy.selector, address(opcmProxy));
doi.set(doi.opcm.selector, opcm);
vm.etch(opcm, hex"01");
// Compare the default inputs to the getter methods.
assertEq(opChainProxyAdminOwner, doi.opChainProxyAdminOwner(), "200");
......@@ -74,7 +73,7 @@ contract DeployOPChainInput_Test is Test {
assertEq(basefeeScalar, doi.basefeeScalar(), "800");
assertEq(blobBaseFeeScalar, doi.blobBaseFeeScalar(), "900");
assertEq(l2ChainId, doi.l2ChainId(), "1000");
assertEq(address(opcmProxy), address(doi.opcmProxy()), "1100");
assertEq(opcm, address(doi.opcm()), "1100");
assertEq(true, doi.allowCustomDisputeParameters(), "1200");
}
......@@ -396,7 +395,7 @@ contract DeployOPChain_TestBase is Test {
dii.set(dii.proofMaturityDelaySeconds.selector, proofMaturityDelaySeconds);
dii.set(dii.disputeGameFinalityDelaySeconds.selector, disputeGameFinalityDelaySeconds);
dii.set(dii.mipsVersion.selector, 1);
dii.set(dii.release.selector, release);
dii.set(dii.l1ContractsRelease.selector, release);
dii.set(dii.superchainConfigProxy.selector, address(superchainConfigProxy));
dii.set(dii.protocolVersionsProxy.selector, address(protocolVersionsProxy));
// End users of the DeployImplementations contract will need to set the `standardVersionsToml`.
......@@ -404,7 +403,7 @@ contract DeployOPChain_TestBase is Test {
string.concat(vm.projectRoot(), "/test/fixtures/standard-versions.toml");
string memory standardVersionsToml = vm.readFile(standardVersionsTomlPath);
dii.set(dii.standardVersionsToml.selector, standardVersionsToml);
dii.set(dii.opcmProxyOwner.selector, address(1));
deployImplementations.run(dii, dio);
// Deploy DeployOpChain, but defer populating the input values to the test suites inheriting this contract.
......@@ -412,7 +411,7 @@ contract DeployOPChain_TestBase is Test {
(doi, doo) = deployOPChain.etchIOContracts();
// Set the OPContractsManager input for DeployOPChain.
opcm = dio.opcmProxy();
opcm = dio.opcm();
}
// See the function of the same name in the `DeployImplementations_Test` contract of
......@@ -466,7 +465,7 @@ contract DeployOPChain_Test is DeployOPChain_TestBase {
doi.set(doi.basefeeScalar.selector, basefeeScalar);
doi.set(doi.blobBaseFeeScalar.selector, blobBaseFeeScalar);
doi.set(doi.l2ChainId.selector, l2ChainId);
doi.set(doi.opcmProxy.selector, address(opcm)); // Not fuzzed since it must be an actual instance.
doi.set(doi.opcm.selector, address(opcm));
doi.set(doi.saltMixer.selector, saltMixer);
doi.set(doi.gasLimit.selector, gasLimit);
doi.set(doi.disputeGameType.selector, disputeGameType);
......@@ -559,7 +558,7 @@ contract DeployOPChain_Test is DeployOPChain_TestBase {
doi.set(doi.basefeeScalar.selector, basefeeScalar);
doi.set(doi.blobBaseFeeScalar.selector, blobBaseFeeScalar);
doi.set(doi.l2ChainId.selector, l2ChainId);
doi.set(doi.opcmProxy.selector, address(opcm));
doi.set(doi.opcm.selector, address(opcm));
doi.set(doi.saltMixer.selector, saltMixer);
doi.set(doi.gasLimit.selector, gasLimit);
doi.set(doi.disputeGameType.selector, disputeGameType);
......
......@@ -16,6 +16,7 @@ import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { IOptimismPortalInterop } from "src/L1/interfaces/IOptimismPortalInterop.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { ISystemConfigInterop } from "src/L1/interfaces/ISystemConfigInterop.sol";
import { IDataAvailabilityChallenge } from "src/L1/interfaces/IDataAvailabilityChallenge.sol";
import { IProtocolVersions } from "src/L1/interfaces/IProtocolVersions.sol";
......@@ -479,36 +480,37 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("gasLimit()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("eip1559Denominator()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("eip1559Elasticity()") });
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.initialize.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.initialize.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.minimumGasLimit.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.minimumGasLimit.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("overhead()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("owner()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("renounceOwnership()"), _auth: Role.SYSTEMCONFIGOWNER });
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.resourceConfig.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.resourceConfig.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("scalar()") });
_addSpec({
_name: "SystemConfigInterop",
_sel: ISystemConfig.setBatcherHash.selector,
_sel: ISystemConfigInterop.setBatcherHash.selector,
_auth: Role.SYSTEMCONFIGOWNER
});
_addSpec({
_name: "SystemConfigInterop",
_sel: ISystemConfig.setGasConfig.selector,
_sel: ISystemConfigInterop.setGasConfig.selector,
_auth: Role.SYSTEMCONFIGOWNER
});
_addSpec({
_name: "SystemConfigInterop",
_sel: ISystemConfig.setGasLimit.selector,
_sel: ISystemConfigInterop.setGasLimit.selector,
_auth: Role.SYSTEMCONFIGOWNER
});
_addSpec({
_name: "SystemConfigInterop",
_sel: ISystemConfig.setEIP1559Params.selector,
_sel: ISystemConfigInterop.setEIP1559Params.selector,
_auth: Role.SYSTEMCONFIGOWNER
});
_addSpec({
_name: "SystemConfigInterop",
_sel: ISystemConfig.setUnsafeBlockSigner.selector,
_sel: ISystemConfigInterop.setUnsafeBlockSigner.selector,
_auth: Role.SYSTEMCONFIGOWNER
});
_addSpec({
......@@ -516,7 +518,7 @@ contract Specification_Test is CommonTest {
_sel: _getSel("transferOwnership(address)"),
_auth: Role.SYSTEMCONFIGOWNER
});
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfig.unsafeBlockSigner.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: ISystemConfigInterop.unsafeBlockSigner.selector });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("version()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1CrossDomainMessenger()") });
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("l1ERC721Bridge()") });
......@@ -552,12 +554,6 @@ contract Specification_Test is CommonTest {
_auth: Role.DEPENDENCYMANAGER
});
_addSpec({ _name: "SystemConfigInterop", _sel: _getSel("dependencyManager()") });
_addSpec({
_name: "SystemConfigInterop",
_sel: _getSel(
"initialize(address,uint32,uint32,bytes32,uint64,address,(uint32,uint8,uint8,uint32,uint32,uint128),address,(address,address,address,address,address,address,address),address)"
)
});
// ProxyAdmin
_addSpec({ _name: "ProxyAdmin", _sel: _getSel("addressManager()") });
......@@ -841,27 +837,25 @@ contract Specification_Test is CommonTest {
_addSpec({ _name: "OPContractsManager", _sel: _getSel("version()") });
_addSpec({ _name: "OPContractsManager", _sel: _getSel("superchainConfig()") });
_addSpec({ _name: "OPContractsManager", _sel: _getSel("protocolVersions()") });
_addSpec({ _name: "OPContractsManager", _sel: _getSel("latestRelease()") });
_addSpec({ _name: "OPContractsManager", _sel: _getSel("implementations(string,string)") });
_addSpec({ _name: "OPContractsManager", _sel: _getSel("l1ContractsRelease()") });
_addSpec({ _name: "OPContractsManager", _sel: _getSel("systemConfigs(uint256)") });
_addSpec({ _name: "OPContractsManager", _sel: _getSel("OUTPUT_VERSION()") });
_addSpec({ _name: "OPContractsManager", _sel: OPContractsManager.initialize.selector });
_addSpec({ _name: "OPContractsManager", _sel: OPContractsManager.deploy.selector });
_addSpec({ _name: "OPContractsManager", _sel: OPContractsManager.blueprints.selector });
_addSpec({ _name: "OPContractsManager", _sel: OPContractsManager.chainIdToBatchInboxAddress.selector });
_addSpec({ _name: "OPContractsManager", _sel: OPContractsManager.implementations.selector });
// OPContractsManagerInterop
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("version()") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("superchainConfig()") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("protocolVersions()") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("latestRelease()") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("implementations(string,string)") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("l1ContractsRelease()") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("systemConfigs(uint256)") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: _getSel("OUTPUT_VERSION()") });
_addSpec({ _name: "OPContractsManagerInterop", _sel: OPContractsManager.initialize.selector });
_addSpec({ _name: "OPContractsManagerInterop", _sel: OPContractsManager.deploy.selector });
_addSpec({ _name: "OPContractsManagerInterop", _sel: OPContractsManager.blueprints.selector });
_addSpec({ _name: "OPContractsManagerInterop", _sel: OPContractsManager.chainIdToBatchInboxAddress.selector });
_addSpec({ _name: "OPContractsManagerInterop", _sel: OPContractsManager.implementations.selector });
// DeputyGuardianModule
_addSpec({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment