Commit 1a490d99 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #7401 from ethereum-optimism/fix/op-upgrade

op-chain-ops: clean up `op-upgrade`
parents 199ef3b9 7a484b63
...@@ -99,29 +99,31 @@ func entrypoint(ctx *cli.Context) error { ...@@ -99,29 +99,31 @@ func entrypoint(ctx *cli.Context) error {
batch := safe.Batch{} batch := safe.Batch{}
for _, chainConfig := range targets { for _, chainConfig := range targets {
name, err := toDeployConfigName(chainConfig) name, _ := toDeployConfigName(chainConfig)
config, err := genesis.NewDeployConfigWithNetwork(name, deployConfig)
if err != nil { if err != nil {
log.Warn("Skipping unsupported network", "name", chainConfig.Name) log.Warn("Cannot find deploy config for network", "name", chainConfig.Name, "deploy-config-name", name, "path", deployConfig)
continue
} }
config, err := genesis.NewDeployConfigWithNetwork(name, deployConfig) if config != nil {
if err != nil { log.Info("Checking deploy config validity", "name", chainConfig.Name)
return err if err := config.Check(); err != nil {
return fmt.Errorf("error checking deploy config: %w", err)
}
} }
clients, err := clients.NewClients(ctx.String("l1-rpc-url"), chainConfig.PublicRPC) clients, err := clients.NewClients(ctx.String("l1-rpc-url"), chainConfig.PublicRPC)
if err != nil { if err != nil {
return err return fmt.Errorf("cannot create RPC clients: %w", err)
} }
l1ChainID, err := clients.L1Client.ChainID(ctx.Context) l1ChainID, err := clients.L1Client.ChainID(ctx.Context)
if err != nil { if err != nil {
return err return fmt.Errorf("cannot fetch L1 chain ID: %w", err)
} }
l2ChainID, err := clients.L2Client.ChainID(ctx.Context) l2ChainID, err := clients.L2Client.ChainID(ctx.Context)
if err != nil { if err != nil {
return err return fmt.Errorf("cannot fetch L2 chain ID: %w", err)
} }
log.Info(chainConfig.Name, "l1-chain-id", l1ChainID, "l2-chain-id", l2ChainID) log.Info(chainConfig.Name, "l1-chain-id", l1ChainID, "l2-chain-id", l2ChainID)
...@@ -164,15 +166,19 @@ func entrypoint(ctx *cli.Context) error { ...@@ -164,15 +166,19 @@ func entrypoint(ctx *cli.Context) error {
log.Info("OptimismPortal", "version", list.OptimismPortal.Version, "address", list.OptimismPortal.Address) log.Info("OptimismPortal", "version", list.OptimismPortal.Version, "address", list.OptimismPortal.Address)
log.Info("SystemConfig", "version", list.SystemConfig.Version, "address", list.SystemConfig.Address) log.Info("SystemConfig", "version", list.SystemConfig.Version, "address", list.SystemConfig.Address)
// Ensure that the superchain registry information is correct by checking the
// actual versions based on what the registry says is true.
if err := upgrades.CheckL1(ctx.Context, &list, clients.L1Client); err != nil { if err := upgrades.CheckL1(ctx.Context, &list, clients.L1Client); err != nil {
return fmt.Errorf("error checking L1: %w", err) return fmt.Errorf("error checking L1: %w", err)
} }
if err := upgrades.L1(&batch, list, *addresses, config, chainConfig); err != nil { // Build the batch
if err := upgrades.L1(&batch, list, *addresses, config, chainConfig, clients.L1Client); err != nil {
return err return err
} }
} }
// Write the batch to disk or stdout
if outfile := ctx.Path("outfile"); outfile != "" { if outfile := ctx.Path("outfile"); outfile != "" {
if err := writeJSON(outfile, batch); err != nil { if err := writeJSON(outfile, batch); err != nil {
return err return err
...@@ -207,6 +213,9 @@ func toDeployConfigName(cfg *superchain.ChainConfig) (string, error) { ...@@ -207,6 +213,9 @@ func toDeployConfigName(cfg *superchain.ChainConfig) (string, error) {
if cfg.Name == "OP-Mainnet" { if cfg.Name == "OP-Mainnet" {
return "mainnet", nil return "mainnet", nil
} }
if cfg.Name == "Zora Goerli" {
return "zora-goerli", nil
}
return "", fmt.Errorf("unsupported chain name %s", cfg.Name) return "", fmt.Errorf("unsupported chain name %s", cfg.Name)
} }
......
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"l2GenesisRegolithTimeOffset": "0x0", "l2GenesisRegolithTimeOffset": "0x0",
"portalGuardian": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7", "portalGuardian": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7",
"l2OutputOracleSubmissionInterval": 180, "l2OutputOracleSubmissionInterval": 180,
"l2OutputOracleStartingTimestamp": -1, "l2OutputOracleStartingTimestamp": 0,
"l2OutputOracleProposer": "0xa98B585654fC03E2fEa3FAB56E1C851E4f5c2B54", "l2OutputOracleProposer": "0xa98B585654fC03E2fEa3FAB56E1C851E4f5c2B54",
"l2GenesisBlockGasLimit": "0x1c9c380", "l2GenesisBlockGasLimit": "0x1c9c380",
"fundDevAccounts": false, "fundDevAccounts": false,
......
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