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
import (
"context"
"errors"
"math/big"
"os"
"path/filepath"
......@@ -13,6 +12,7 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
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/mattn/go-isatty"
......@@ -55,10 +55,6 @@ func main() {
Name: "evm-messages",
Usage: "Path to evm-messages.json",
},
&cli.StringFlag{
Name: "l2-addresses",
Usage: "Path to l2-addresses.json",
},
&cli.StringFlag{
Name: "db-path",
Usage: "Path to database",
......@@ -108,11 +104,6 @@ func main() {
EvmMessages: evmMessages,
}
l2Addrs, err := genesis.NewL2Addresses(ctx.String("l2-addresses"))
if err != nil {
return err
}
l1RpcURL := ctx.String("l1-rpc-url")
l1Client, err := ethclient.Dial(l1RpcURL)
if err != nil {
......@@ -151,14 +142,15 @@ func main() {
return err
}
// TODO: think about optimal config, there are a lot of deps
// regarding changing this
if config.ProxyAdminOwner != l2Addrs.ProxyAdminOwner {
return errors.New("mismatched ProxyAdminOwner config")
l2Addrs := genesis.L2Addresses{
ProxyAdminOwner: config.ProxyAdminOwner,
// TODO: these values are not in the 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
}
......
package genesis
import (
"encoding/json"
"fmt"
"os"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/state"
"github.com/ethereum/go-ethereum/common"
......@@ -16,25 +12,10 @@ import (
// L2Addresses represents L1 contract addresses
// that are required for the construction of an L2 state
type L2Addresses struct {
ProxyAdminOwner common.Address `json:"proxyAdminOwner"`
L1StandardBridgeProxy common.Address `json:"l1StandardBridgeProxy"`
L1CrossDomainMessengerProxy common.Address `json:"l1CrossDomainMessengerProxy"`
L1ERC721BridgeProxy common.Address `json:"l1ERC721BridgeProxy"`
}
// 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
ProxyAdminOwner common.Address
L1StandardBridgeProxy common.Address
L1CrossDomainMessengerProxy common.Address
L1ERC721BridgeProxy common.Address
}
// 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