From eeabd89fa82c9274dbcc272b7859a519221896c9 Mon Sep 17 00:00:00 2001 From: Joshua Colvin Date: Thu, 25 Aug 2022 11:27:04 -0700 Subject: [PATCH] Fix chain id option to use classic option style instead of nitro --- packages/arb-node-core/cmd/arb-relay/arb-relay.go | 12 ++++++------ packages/arb-rpc-node/rpc/launch.go | 2 +- packages/arb-util/configuration/configuration.go | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/arb-node-core/cmd/arb-relay/arb-relay.go b/packages/arb-node-core/cmd/arb-relay/arb-relay.go index 8a798a86d0..90a84c3865 100644 --- a/packages/arb-node-core/cmd/arb-relay/arb-relay.go +++ b/packages/arb-node-core/cmd/arb-relay/arb-relay.go @@ -80,10 +80,10 @@ func startup() error { defer cancelFunc() config, err := configuration.ParseRelay() - if err != nil || len(config.Feed.Input.URLs) == 0 || config.L2.ChainID == 0 { + if err != nil || len(config.Feed.Input.URLs) == 0 || config.Node.ChainID == 0 { fmt.Printf("\n") fmt.Printf("Sample usage: arb-relay --conf= \n") - fmt.Printf(" or: arb-relay --feed.input.url= --l2.chain-id=\n\n") + fmt.Printf(" or: arb-relay --feed.input.url= --node.chain-id=\n\n") if err != nil && !strings.Contains(err.Error(), "help requested") { fmt.Printf("%s\n", err.Error()) } @@ -127,17 +127,17 @@ func NewArbRelay(config *configuration.Config) (*ArbRelay, chan error) { confirmedAccumulatorChan := make(chan common.Hash, 10) broadcastClientErrChan := make(chan error, 1) for _, address := range config.Feed.Input.URLs { - client := broadcastclient.NewBroadcastClient(address, config.L2.ChainID, nil, config.Feed.Input.Timeout, broadcastClientErrChan) + client := broadcastclient.NewBroadcastClient(address, config.Node.ChainID, nil, config.Feed.Input.Timeout, broadcastClientErrChan) client.ConfirmedAccumulatorListener = confirmedAccumulatorChan broadcastClients = append(broadcastClients, client) } arbRelay := &ArbRelay{ - broadcaster: broadcaster.NewBroadcaster(&config.Feed.Output, 0), + broadcaster: broadcaster.NewBroadcaster(&config.Feed.Output, config.Node.ChainID), broadcastClients: broadcastClients, confirmedAccumulatorChan: confirmedAccumulatorChan, } - arbRelay.chainIdBig = new(big.Int).SetUint64(config.L2.ChainID) - arbRelay.chainIdHex = hexutil.Uint64(config.L2.ChainID) + arbRelay.chainIdBig = new(big.Int).SetUint64(config.Node.ChainID) + arbRelay.chainIdHex = hexutil.Uint64(config.Node.ChainID) return arbRelay, broadcastClientErrChan } diff --git a/packages/arb-rpc-node/rpc/launch.go b/packages/arb-rpc-node/rpc/launch.go index 3e453729b2..143d935dfc 100644 --- a/packages/arb-rpc-node/rpc/launch.go +++ b/packages/arb-rpc-node/rpc/launch.go @@ -152,7 +152,7 @@ func SetupBatcher( if err != nil { return nil, nil, err } - feedBroadcaster := broadcaster.NewBroadcaster(&config.Feed.Output, config.L2.ChainID) + feedBroadcaster := broadcaster.NewBroadcaster(&config.Feed.Output, config.Node.ChainID) seqBatcher, err := batcher.NewSequencerBatcher( ctx, batcherMode.Core, diff --git a/packages/arb-util/configuration/configuration.go b/packages/arb-util/configuration/configuration.go index 070275c6f7..01a9df7172 100644 --- a/packages/arb-util/configuration/configuration.go +++ b/packages/arb-util/configuration/configuration.go @@ -449,8 +449,7 @@ type Config struct { URL string `koanf:"url"` } `koanf:"l1"` L2 struct { - ChainID uint64 `koanf:"chain-id"` - DisableUpstream bool `koanf:"disable-upstream"` + DisableUpstream bool `koanf:"disable-upstream"` } `koanf:"l2"` Log Log `koanf:"log"` Node Node `koanf:"node"` @@ -882,6 +881,7 @@ func resolveDirectoryNames(out *Config, wallet *Wallet) error { func ParseRelay() (*Config, error) { f := flag.NewFlagSet(os.Args[0], flag.ContinueOnError) + f.Uint64("node.chain-id", 0, "chain id of the arbitrum chain") AddFeedOutputOptions(f) k, err := beginCommonParse(f) @@ -998,7 +998,6 @@ func beginCommonParse(f *flag.FlagSet) (*koanf.Koanf, error) { f.String("log.rpc", "info", "log level for rpc") f.String("log.core", "info", "log level for general arb node logging") - f.Uint64("l2.chain-id", 0, "if set other than 0, will be used to validate L2 feed connection") f.Bool("l2.disable-upstream", false, "disable feed and transaction forwarding") f.Bool("pprof-enable", false, "enable profiling server")