Commit 1f335f15 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-deployer: Add support for Isthmus calls to OPCM (#12753)

parent 7f941b84
...@@ -200,7 +200,7 @@ func DeployL2ToL1(l1Host *script.Host, superCfg *SuperchainConfig, superDeployme ...@@ -200,7 +200,7 @@ func DeployL2ToL1(l1Host *script.Host, superCfg *SuperchainConfig, superDeployme
l1Host.SetTxOrigin(cfg.Deployer) l1Host.SetTxOrigin(cfg.Deployer)
output, err := opcm.DeployOPChain(l1Host, opcm.DeployOPChainInput{ output, err := opcm.DeployOPChainV160(l1Host, opcm.DeployOPChainInputV160{
OpChainProxyAdminOwner: cfg.ProxyAdminOwner, OpChainProxyAdminOwner: cfg.ProxyAdminOwner,
SystemConfigOwner: cfg.SystemConfigOwner, SystemConfigOwner: cfg.SystemConfigOwner,
Batcher: cfg.BatchSenderAddress, Batcher: cfg.BatchSenderAddress,
......
[
{
"type": "function",
"name": "decodeOutput",
"inputs": [],
"outputs": [
{
"name": "output",
"indexed": false,
"type": "tuple",
"components": [
{
"name": "opChainProxyAdmin",
"type": "address"
},
{
"name": "addressManager",
"type": "address"
},
{
"name": "l1ERC721BridgeProxy",
"type": "address"
},
{
"name": "systemConfigProxy",
"type": "address"
},
{
"name": "optimismMintableERC20FactoryProxy",
"type": "address"
},
{
"name": "l1StandardBridgeProxy",
"type": "address"
},
{
"name": "l1CrossDomainMessengerProxy",
"type": "address"
},
{
"name": "optimismPortalProxy",
"type": "address"
},
{
"name": "disputeGameFactoryProxy",
"type": "address"
},
{
"name": "anchorStateRegistryProxy",
"type": "address"
},
{
"name": "anchorStateRegistryImpl",
"type": "address"
},
{
"name": "faultDisputeGame",
"type": "address",
"internalType": "contract FaultDisputeGame"
},
{
"name": "permissionedDisputeGame",
"type": "address"
},
{
"name": "delayedWETHPermissionedGameProxy",
"type": "address"
},
{
"name": "delayedWETHPermissionlessGameProxy",
"type": "address"
}
]
}
]
}
]
\ No newline at end of file
This diff is collapsed.
...@@ -29,21 +29,43 @@ func DeployOPChainLiveStrategy(ctx context.Context, env *Env, bundle ArtifactsBu ...@@ -29,21 +29,43 @@ func DeployOPChainLiveStrategy(ctx context.Context, env *Env, bundle ArtifactsBu
return fmt.Errorf("failed to get chain intent: %w", err) return fmt.Errorf("failed to get chain intent: %w", err)
} }
input, err := makeDCI(intent, thisIntent, chainID, st) var deployFunc func() (opcm.DeployOPChainOutput, error)
if err != nil { switch intent.L1ContractsLocator.Tag {
return fmt.Errorf("error making deploy OP chain input: %w", err) case standard.ContractsV160Tag, standard.ContractsV170Beta1L2Tag:
deployFunc = func() (opcm.DeployOPChainOutput, error) {
input, err := makeDCIV160(intent, thisIntent, chainID, st)
if err != nil {
return opcm.DeployOPChainOutput{}, fmt.Errorf("error making deploy OP chain input: %w", err)
}
return opcm.DeployOPChainRawV160(ctx,
env.L1Client,
env.Broadcaster,
env.Deployer,
bundle.L1,
input,
)
}
default:
deployFunc = func() (opcm.DeployOPChainOutput, error) {
input, err := makeDCIIsthmus(intent, thisIntent, chainID, st)
if err != nil {
return opcm.DeployOPChainOutput{}, fmt.Errorf("error making deploy OP chain input: %w", err)
}
return opcm.DeployOPChainRawIsthmus(ctx,
env.L1Client,
env.Broadcaster,
env.Deployer,
bundle.L1,
input,
)
}
} }
var dco opcm.DeployOPChainOutput var dco opcm.DeployOPChainOutput
lgr.Info("deploying OP chain using existing OPCM", "id", chainID.Hex(), "opcmAddress", st.ImplementationsDeployment.OpcmProxyAddress.Hex()) lgr.Info("deploying OP chain using existing OPCM", "id", chainID.Hex(), "opcmAddress", st.ImplementationsDeployment.OpcmProxyAddress.Hex())
dco, err = opcm.DeployOPChainRaw( dco, err = deployFunc()
ctx,
env.L1Client,
env.Broadcaster,
env.Deployer,
bundle.L1,
input,
)
if err != nil { if err != nil {
return fmt.Errorf("error deploying OP chain: %w", err) return fmt.Errorf("error deploying OP chain: %w", err)
} }
...@@ -158,19 +180,33 @@ func DeployOPChainGenesisStrategy(env *Env, intent *state.Intent, st *state.Stat ...@@ -158,19 +180,33 @@ func DeployOPChainGenesisStrategy(env *Env, intent *state.Intent, st *state.Stat
return fmt.Errorf("failed to get chain intent: %w", err) return fmt.Errorf("failed to get chain intent: %w", err)
} }
input, err := makeDCI(intent, thisIntent, chainID, st) var deployFunc func() (opcm.DeployOPChainOutput, error)
if err != nil { switch intent.L1ContractsLocator.Tag {
return fmt.Errorf("error making deploy OP chain input: %w", err) case standard.ContractsV160Tag, standard.ContractsV170Beta1L2Tag:
deployFunc = func() (opcm.DeployOPChainOutput, error) {
input, err := makeDCIV160(intent, thisIntent, chainID, st)
if err != nil {
return opcm.DeployOPChainOutput{}, fmt.Errorf("error making deploy OP chain input: %w", err)
}
return opcm.DeployOPChainV160(env.L1ScriptHost, input)
}
default:
deployFunc = func() (opcm.DeployOPChainOutput, error) {
input, err := makeDCIIsthmus(intent, thisIntent, chainID, st)
if err != nil {
return opcm.DeployOPChainOutput{}, fmt.Errorf("error making deploy OP chain input: %w", err)
}
return opcm.DeployOPChainIsthmus(env.L1ScriptHost, input)
}
} }
env.L1ScriptHost.ImportState(st.L1StateDump.Data) env.L1ScriptHost.ImportState(st.L1StateDump.Data)
var dco opcm.DeployOPChainOutput var dco opcm.DeployOPChainOutput
lgr.Info("deploying OP chain using local allocs", "id", chainID.Hex()) lgr.Info("deploying OP chain using local allocs", "id", chainID.Hex())
dco, err = opcm.DeployOPChain( dco, err = deployFunc()
env.L1ScriptHost,
input,
)
if err != nil { if err != nil {
return fmt.Errorf("error deploying OP chain: %w", err) return fmt.Errorf("error deploying OP chain: %w", err)
} }
...@@ -190,7 +226,7 @@ type ChainProofParams struct { ...@@ -190,7 +226,7 @@ type ChainProofParams struct {
DangerouslyAllowCustomDisputeParameters bool `json:"dangerouslyAllowCustomDisputeParameters" toml:"dangerouslyAllowCustomDisputeParameters"` DangerouslyAllowCustomDisputeParameters bool `json:"dangerouslyAllowCustomDisputeParameters" toml:"dangerouslyAllowCustomDisputeParameters"`
} }
func makeDCI(intent *state.Intent, thisIntent *state.ChainIntent, chainID common.Hash, st *state.State) (opcm.DeployOPChainInput, error) { func makeDCIV160(intent *state.Intent, thisIntent *state.ChainIntent, chainID common.Hash, st *state.State) (opcm.DeployOPChainInputV160, error) {
proofParams, err := jsonutil.MergeJSON( proofParams, err := jsonutil.MergeJSON(
ChainProofParams{ ChainProofParams{
DisputeGameType: standard.DisputeGameType, DisputeGameType: standard.DisputeGameType,
...@@ -204,10 +240,10 @@ func makeDCI(intent *state.Intent, thisIntent *state.ChainIntent, chainID common ...@@ -204,10 +240,10 @@ func makeDCI(intent *state.Intent, thisIntent *state.ChainIntent, chainID common
thisIntent.DeployOverrides, thisIntent.DeployOverrides,
) )
if err != nil { if err != nil {
return opcm.DeployOPChainInput{}, fmt.Errorf("error merging proof params from overrides: %w", err) return opcm.DeployOPChainInputV160{}, fmt.Errorf("error merging proof params from overrides: %w", err)
} }
return opcm.DeployOPChainInput{ return opcm.DeployOPChainInputV160{
OpChainProxyAdminOwner: thisIntent.Roles.L1ProxyAdminOwner, OpChainProxyAdminOwner: thisIntent.Roles.L1ProxyAdminOwner,
SystemConfigOwner: thisIntent.Roles.SystemConfigOwner, SystemConfigOwner: thisIntent.Roles.SystemConfigOwner,
Batcher: thisIntent.Roles.Batcher, Batcher: thisIntent.Roles.Batcher,
...@@ -230,6 +266,18 @@ func makeDCI(intent *state.Intent, thisIntent *state.ChainIntent, chainID common ...@@ -230,6 +266,18 @@ func makeDCI(intent *state.Intent, thisIntent *state.ChainIntent, chainID common
}, nil }, nil
} }
func makeDCIIsthmus(intent *state.Intent, thisIntent *state.ChainIntent, chainID common.Hash, st *state.State) (opcm.DeployOPChainInputIsthmus, error) {
dci, err := makeDCIV160(intent, thisIntent, chainID, st)
if err != nil {
return opcm.DeployOPChainInputIsthmus{}, fmt.Errorf("error making deploy OP chain input: %w", err)
}
return opcm.DeployOPChainInputIsthmus{
DeployOPChainInputV160: dci,
SystemConfigFeeAdmin: common.Address{'D', 'E', 'A', 'D'},
}, nil
}
func makeChainState(chainID common.Hash, dco opcm.DeployOPChainOutput) *state.ChainState { func makeChainState(chainID common.Hash, dco opcm.DeployOPChainOutput) *state.ChainState {
return &state.ChainState{ return &state.ChainState{
ID: chainID, ID: chainID,
......
...@@ -26,6 +26,9 @@ const ( ...@@ -26,6 +26,9 @@ const (
DisputeSplitDepth uint64 = 30 DisputeSplitDepth uint64 = 30
DisputeClockExtension uint64 = 10800 DisputeClockExtension uint64 = 10800
DisputeMaxClockDuration uint64 = 302400 DisputeMaxClockDuration uint64 = 302400
ContractsV160Tag = "op-contracts/v1.6.0"
ContractsV170Beta1L2Tag = "op-contracts/v1.7.0-beta.1+l2-contracts"
) )
var DisputeAbsolutePrestate = common.HexToHash("0x038512e02c4c3f7bdaec27d00edf55b7155e0905301e1a88083e4e0a6764d54c") var DisputeAbsolutePrestate = common.HexToHash("0x038512e02c4c3f7bdaec27d00edf55b7155e0905301e1a88083e4e0a6764d54c")
...@@ -40,9 +43,9 @@ var L1VersionsSepolia L1Versions ...@@ -40,9 +43,9 @@ var L1VersionsSepolia L1Versions
var L1VersionsMainnet L1Versions var L1VersionsMainnet L1Versions
var DefaultL1ContractsTag = "op-contracts/v1.6.0" var DefaultL1ContractsTag = ContractsV160Tag
var DefaultL2ContractsTag = "op-contracts/v1.7.0-beta.1+l2-contracts" var DefaultL2ContractsTag = ContractsV170Beta1L2Tag
type L1Versions struct { type L1Versions struct {
Releases map[string]L1VersionsReleases `toml:"releases"` Releases map[string]L1VersionsReleases `toml:"releases"`
......
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