Commit 818bc9f4 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6390 from ethereum-optimism/rollup-config-warning

op-node: log error when op-node is configured with conflicting network and rollup-config
parents 417612ac 9f1dcbc7
......@@ -44,7 +44,7 @@ func Main(cliCtx *cli.Context) error {
m := metrics.NewMetrics("default")
ctx := context.Background()
config, err := opnode.NewRollupConfig(cliCtx)
config, err := opnode.NewRollupConfig(logger, cliCtx)
if err != nil {
return err
}
......
......@@ -30,7 +30,7 @@ func NewConfig(ctx *cli.Context, log log.Logger) (*node.Config, error) {
return nil, err
}
rollupConfig, err := NewRollupConfig(ctx)
rollupConfig, err := NewRollupConfig(log, ctx)
if err != nil {
return nil, err
}
......@@ -168,9 +168,16 @@ func NewDriverConfig(ctx *cli.Context) *driver.Config {
}
}
func NewRollupConfig(ctx *cli.Context) (*rollup.Config, error) {
func NewRollupConfig(log log.Logger, ctx *cli.Context) (*rollup.Config, error) {
network := ctx.String(flags.Network.Name)
rollupConfigPath := ctx.String(flags.RollupConfig.Name)
if network != "" {
if rollupConfigPath != "" {
log.Error(`Cannot configure network and rollup-config at the same time.
Startup will proceed to use the network-parameter and ignore the rollup config.
Conflicting configuration is deprecated, and will stop the op-node from starting in the future.
`, "network", network, "rollup_config", rollupConfigPath)
}
config, err := chaincfg.GetRollupConfig(network)
if err != nil {
return nil, err
......@@ -179,7 +186,6 @@ func NewRollupConfig(ctx *cli.Context) (*rollup.Config, error) {
return &config, nil
}
rollupConfigPath := ctx.String(flags.RollupConfig.Name)
file, err := os.Open(rollupConfigPath)
if err != nil {
return nil, fmt.Errorf("failed to read rollup config: %w", err)
......
......@@ -63,7 +63,7 @@ func run(args []string, action ConfigAction) error {
}
logger.Info("Starting fault proof program", "version", VersionWithMeta)
cfg, err := config.NewConfigFromCLI(ctx)
cfg, err := config.NewConfigFromCLI(logger, ctx)
if err != nil {
return err
}
......
......@@ -12,6 +12,7 @@ import (
"github.com/ethereum-optimism/optimism/op-program/host/flags"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/urfave/cli/v2"
)
......@@ -110,11 +111,11 @@ func NewConfig(rollupCfg *rollup.Config, l2Genesis *params.ChainConfig, l1Head c
}
}
func NewConfigFromCLI(ctx *cli.Context) (*Config, error) {
func NewConfigFromCLI(log log.Logger, ctx *cli.Context) (*Config, error) {
if err := flags.CheckRequired(ctx); err != nil {
return nil, err
}
rollupCfg, err := opnode.NewRollupConfig(ctx)
rollupCfg, err := opnode.NewRollupConfig(log, ctx)
if err != nil {
return nil, err
}
......
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