Commit ac289888 authored by Mark Tyneway's avatar Mark Tyneway

Revert "op-chain-ops: read l2 addrs from json file"

This reverts commit 899c4a8871d6e74a336e512e4b3614427d25169f.
parent bc1cad20
...@@ -2,7 +2,6 @@ package main ...@@ -2,7 +2,6 @@ package main
import ( import (
"context" "context"
"errors"
"math/big" "math/big"
"os" "os"
"path/filepath" "path/filepath"
...@@ -13,6 +12,7 @@ import ( ...@@ -13,6 +12,7 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
op_state "github.com/ethereum-optimism/optimism/op-chain-ops/state" op_state "github.com/ethereum-optimism/optimism/op-chain-ops/state"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethclient"
"github.com/mattn/go-isatty" "github.com/mattn/go-isatty"
...@@ -55,10 +55,6 @@ func main() { ...@@ -55,10 +55,6 @@ func main() {
Name: "evm-messages", Name: "evm-messages",
Usage: "Path to evm-messages.json", Usage: "Path to evm-messages.json",
}, },
&cli.StringFlag{
Name: "l2-addresses",
Usage: "Path to l2-addresses.json",
},
&cli.StringFlag{ &cli.StringFlag{
Name: "db-path", Name: "db-path",
Usage: "Path to database", Usage: "Path to database",
...@@ -108,11 +104,6 @@ func main() { ...@@ -108,11 +104,6 @@ func main() {
EvmMessages: evmMessages, EvmMessages: evmMessages,
} }
l2Addrs, err := genesis.NewL2Addresses(ctx.String("l2-addresses"))
if err != nil {
return err
}
l1RpcURL := ctx.String("l1-rpc-url") l1RpcURL := ctx.String("l1-rpc-url")
l1Client, err := ethclient.Dial(l1RpcURL) l1Client, err := ethclient.Dial(l1RpcURL)
if err != nil { if err != nil {
...@@ -151,14 +142,15 @@ func main() { ...@@ -151,14 +142,15 @@ func main() {
return err return err
} }
// TODO: think about optimal config, there are a lot of deps l2Addrs := genesis.L2Addresses{
// regarding changing this ProxyAdminOwner: config.ProxyAdminOwner,
if config.ProxyAdminOwner != l2Addrs.ProxyAdminOwner { // TODO: these values are not in the config
return errors.New("mismatched ProxyAdminOwner config") L1StandardBridgeProxy: common.Address{},
L1CrossDomainMessengerProxy: common.Address{},
L1ERC721BridgeProxy: common.Address{},
} }
if err := genesis.MigrateDB(wrappedDB, config, block, l2Addrs, &migrationData); err != nil { if err := genesis.MigrateDB(wrappedDB, config, block, &l2Addrs, &migrationData); err != nil {
return err return err
} }
......
package genesis package genesis
import ( import (
"encoding/json"
"fmt"
"os"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys" "github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/state" "github.com/ethereum-optimism/optimism/op-chain-ops/state"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
...@@ -16,25 +12,10 @@ import ( ...@@ -16,25 +12,10 @@ import (
// L2Addresses represents L1 contract addresses // L2Addresses represents L1 contract addresses
// that are required for the construction of an L2 state // that are required for the construction of an L2 state
type L2Addresses struct { type L2Addresses struct {
ProxyAdminOwner common.Address `json:"proxyAdminOwner"` ProxyAdminOwner common.Address
L1StandardBridgeProxy common.Address `json:"l1StandardBridgeProxy"` L1StandardBridgeProxy common.Address
L1CrossDomainMessengerProxy common.Address `json:"l1CrossDomainMessengerProxy"` L1CrossDomainMessengerProxy common.Address
L1ERC721BridgeProxy common.Address `json:"l1ERC721BridgeProxy"` L1ERC721BridgeProxy common.Address
}
// NewL2Addresses will read the L2Addresses from a json file on disk
func NewL2Addresses(path string) (*L2Addresses, error) {
file, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("cannot find L2Addresses json at %s: %w", path, err)
}
var addrs L2Addresses
if err := json.Unmarshal(file, &addrs); err != nil {
return nil, err
}
return &addrs, nil
} }
// BuildL2DeveloperGenesis will build the developer Optimism Genesis // BuildL2DeveloperGenesis will build the developer Optimism Genesis
......
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