From 9e836ce317b91dbaeb040ce18905de464229b8b3 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Tue, 8 Oct 2024 16:35:45 +0300 Subject: [PATCH 1/4] Updated scaffold, reuse public libp2p code for observer builder --- cmd/observer/node_builder/observer_builder.go | 103 ++---------------- cmd/scaffold.go | 56 +++++----- integration/localnet/builder/bootstrap.go | 4 +- integration/testnet/network.go | 1 + 4 files changed, 39 insertions(+), 125 deletions(-) diff --git a/cmd/observer/node_builder/observer_builder.go b/cmd/observer/node_builder/observer_builder.go index 21d8211daa6..17d724758cf 100644 --- a/cmd/observer/node_builder/observer_builder.go +++ b/cmd/observer/node_builder/observer_builder.go @@ -19,10 +19,7 @@ import ( "github.com/ipfs/go-cid" "github.com/ipfs/go-datastore" badgerds "github.com/ipfs/go-ds-badger2" - dht "github.com/libp2p/go-libp2p-kad-dht" - "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" - "github.com/libp2p/go-libp2p/core/routing" "github.com/onflow/crypto" "github.com/rs/zerolog" "github.com/spf13/pflag" @@ -92,17 +89,12 @@ import ( "github.com/onflow/flow-go/network/converter" "github.com/onflow/flow-go/network/p2p" "github.com/onflow/flow-go/network/p2p/blob" - p2pbuilder "github.com/onflow/flow-go/network/p2p/builder" - p2pbuilderconfig "github.com/onflow/flow-go/network/p2p/builder/config" "github.com/onflow/flow-go/network/p2p/cache" "github.com/onflow/flow-go/network/p2p/conduit" - p2pdht "github.com/onflow/flow-go/network/p2p/dht" "github.com/onflow/flow-go/network/p2p/keyutils" p2plogging "github.com/onflow/flow-go/network/p2p/logging" - networkingsubscription "github.com/onflow/flow-go/network/p2p/subscription" "github.com/onflow/flow-go/network/p2p/translator" "github.com/onflow/flow-go/network/p2p/unicast/protocols" - "github.com/onflow/flow-go/network/p2p/utils" "github.com/onflow/flow-go/network/slashing" "github.com/onflow/flow-go/network/underlay" "github.com/onflow/flow-go/network/validator" @@ -137,8 +129,6 @@ import ( // For a node running as a standalone process, the config fields will be populated from the command line params, // while for a node running as a library, the config fields are expected to be initialized by the caller. type ObserverServiceConfig struct { - bootstrapNodeAddresses []string - bootstrapNodePublicKeys []string observerNetworkingKeyPath string bootstrapIdentities flow.IdentitySkeletonList // the identity list of bootstrap peers the node uses to discover other nodes apiRatelimits map[string]int @@ -222,8 +212,6 @@ func DefaultObserverServiceConfig() *ObserverServiceConfig { rpcMetricsEnabled: false, apiRatelimits: nil, apiBurstlimits: nil, - bootstrapNodeAddresses: []string{}, - bootstrapNodePublicKeys: []string{}, observerNetworkingKeyPath: cmd.NotSet, apiTimeout: 3 * time.Second, upstreamNodeAddresses: []string{}, @@ -333,7 +321,7 @@ func (builder *ObserverServiceBuilder) deriveBootstrapPeerIdentities() error { return nil } - ids, err := cmd.BootstrapIdentities(builder.bootstrapNodeAddresses, builder.bootstrapNodePublicKeys) + ids, err := builder.DeriveBootstrapPeerIdentities() if err != nil { return fmt.Errorf("failed to derive bootstrap peer identities: %w", err) } @@ -654,14 +642,6 @@ func (builder *ObserverServiceBuilder) extraFlags() { "observer-networking-key-path", defaultConfig.observerNetworkingKeyPath, "path to the networking key for observer") - flags.StringSliceVar(&builder.bootstrapNodeAddresses, - "bootstrap-node-addresses", - defaultConfig.bootstrapNodeAddresses, - "the network addresses of the bootstrap access node if this is an observer e.g. access-001.mainnet.flow.org:9653,access-002.mainnet.flow.org:9653") - flags.StringSliceVar(&builder.bootstrapNodePublicKeys, - "bootstrap-node-public-keys", - defaultConfig.bootstrapNodePublicKeys, - "the networking public key of the bootstrap access node if this is an observer (in the same order as the bootstrap node addresses) e.g. \"d57a5e9c5.....\",\"44ded42d....\"") flags.DurationVar(&builder.apiTimeout, "upstream-api-timeout", defaultConfig.apiTimeout, "tcp timeout for Flow API gRPC sockets to upstrem nodes") flags.StringSliceVar(&builder.upstreamNodeAddresses, "upstream-node-addresses", @@ -1001,10 +981,10 @@ func (builder *ObserverServiceBuilder) validateParams() error { if len(builder.bootstrapIdentities) > 0 { return nil } - if len(builder.bootstrapNodeAddresses) == 0 { + if len(builder.BootstrapNodeAddresses) == 0 { return errors.New("no bootstrap node address provided") } - if len(builder.bootstrapNodeAddresses) != len(builder.bootstrapNodePublicKeys) { + if len(builder.BootstrapNodeAddresses) != len(builder.BootstrapNodePublicKeys) { return errors.New("number of bootstrap node addresses and public keys should match") } if len(builder.upstreamNodePublicKeys) > 0 && len(builder.upstreamNodeAddresses) != len(builder.upstreamNodePublicKeys) { @@ -1013,77 +993,6 @@ func (builder *ObserverServiceBuilder) validateParams() error { return nil } -// initPublicLibp2pNode creates a libp2p node for the observer service in the public (unstaked) network. -// The factory function is later passed into the initMiddleware function to eventually instantiate the p2p.LibP2PNode instance -// The LibP2P host is created with the following options: -// * DHT as client and seeded with the given bootstrap peers -// * The specified bind address as the listen address -// * The passed in private key as the libp2p key -// * No connection gater -// * No connection manager -// * No peer manager -// * Default libp2p pubsub options. -// Args: -// - networkKey: the private key to use for the libp2p node -// Returns: -// - p2p.LibP2PNode: the libp2p node -// - error: if any error occurs. Any error returned is considered irrecoverable. -func (builder *ObserverServiceBuilder) initPublicLibp2pNode(networkKey crypto.PrivateKey) (p2p.LibP2PNode, error) { - var pis []peer.AddrInfo - - for _, b := range builder.bootstrapIdentities { - pi, err := utils.PeerAddressInfo(*b) - if err != nil { - return nil, fmt.Errorf("could not extract peer address info from bootstrap identity %v: %w", b, err) - } - - pis = append(pis, pi) - } - - node, err := p2pbuilder.NewNodeBuilder( - builder.Logger, - &builder.FlowConfig.NetworkConfig.GossipSub, - &p2pbuilderconfig.MetricsConfig{ - HeroCacheFactory: builder.HeroCacheMetricsFactory(), - Metrics: builder.Metrics.Network, - }, - network.PublicNetwork, - builder.BaseConfig.BindAddr, - networkKey, - builder.SporkID, - builder.IdentityProvider, - &builder.FlowConfig.NetworkConfig.ResourceManager, - p2pbuilderconfig.PeerManagerDisableConfig(), // disable peer manager for observer node. - &p2p.DisallowListCacheConfig{ - MaxSize: builder.FlowConfig.NetworkConfig.DisallowListNotificationCacheSize, - Metrics: metrics.DisallowListCacheMetricsFactory(builder.HeroCacheMetricsFactory(), network.PublicNetwork), - }, - &p2pbuilderconfig.UnicastConfig{ - Unicast: builder.FlowConfig.NetworkConfig.Unicast, - }). - SetSubscriptionFilter( - networkingsubscription.NewRoleBasedFilter( - networkingsubscription.UnstakedRole, builder.IdentityProvider, - ), - ). - SetRoutingSystem(func(ctx context.Context, h host.Host) (routing.Routing, error) { - return p2pdht.NewDHT(ctx, h, protocols.FlowPublicDHTProtocolID(builder.SporkID), - builder.Logger, - builder.Metrics.Network, - p2pdht.AsClient(), - dht.BootstrapPeers(pis...), - ) - }). - Build() - if err != nil { - return nil, fmt.Errorf("could not initialize libp2p node for observer: %w", err) - } - - builder.LibP2PNode = node - - return builder.LibP2PNode, nil -} - // initObserverLocal initializes the observer's ID, network key and network address // Currently, it reads a node-info.priv.json like any other node. // TODO: read the node ID from the special bootstrap files @@ -1672,11 +1581,13 @@ func (builder *ObserverServiceBuilder) enqueuePublicNetworkInit() { builder. Component("public libp2p node", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) { var err error - publicLibp2pNode, err = builder.initPublicLibp2pNode(node.NetworkKey) + publicLibp2pNode, err = builder.BuildPublicLibp2pNode(builder.BaseConfig.BindAddr, builder.bootstrapIdentities) if err != nil { - return nil, fmt.Errorf("could not create public libp2p node: %w", err) + return nil, fmt.Errorf("could not build public libp2p node: %w", err) } + builder.LibP2PNode = publicLibp2pNode + return publicLibp2pNode, nil }). Component("public network", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) { diff --git a/cmd/scaffold.go b/cmd/scaffold.go index 5db4e75c395..45ef478aa77 100644 --- a/cmd/scaffold.go +++ b/cmd/scaffold.go @@ -138,8 +138,8 @@ type FlowNodeBuilder struct { adminCommandBootstrapper *admin.CommandRunnerBootstrapper adminCommands map[string]func(config *NodeConfig) commands.AdminCommand componentBuilder component.ComponentManagerBuilder - bootstrapNodeAddresses []string - bootstrapNodePublicKeys []string + BootstrapNodeAddresses []string + BootstrapNodePublicKeys []string } var _ NodeBuilder = (*FlowNodeBuilder)(nil) @@ -254,13 +254,13 @@ func (fnb *FlowNodeBuilder) BaseFlags() { // observer mode allows a unstaked execution node to fetch blocks from a public staked access node, and being able to execute blocks fnb.flags.BoolVar(&fnb.BaseConfig.ObserverMode, "observer-mode", defaultConfig.ObserverMode, "whether the node is running in observer mode") - fnb.flags.StringSliceVar(&fnb.bootstrapNodePublicKeys, - "observer-mode-bootstrap-node-public-keys", - nil, + fnb.flags.StringSliceVar(&fnb.BootstrapNodePublicKeys, + "bootstrap-node-public-keys", + []string{}, "the networking public key of the bootstrap access node if this is an observer (in the same order as the bootstrap node addresses) e.g. \"d57a5e9c5.....\",\"44ded42d....\"") - fnb.flags.StringSliceVar(&fnb.bootstrapNodeAddresses, - "observer-mode-bootstrap-node-addresses", - nil, + fnb.flags.StringSliceVar(&fnb.BootstrapNodeAddresses, + "bootstrap-node-addresses", + []string{}, "the network addresses of the bootstrap access node if this is an observer e.g. access-001.mainnet.flow.org:9653,access-002.mainnet.flow.org:9653") } @@ -413,8 +413,13 @@ func (fnb *FlowNodeBuilder) EnqueueNetworkInit() { } if fnb.ObserverMode { - // observer mode only init pulbic libp2p node - publicLibp2pNode, err := fnb.BuildPublicLibp2pNode(myAddr) + // observer mode only init public libp2p node + ids, err := fnb.DeriveBootstrapPeerIdentities() + if err != nil { + return nil, fmt.Errorf("failed to derive bootstrap peer identities: %w", err) + } + + publicLibp2pNode, err := fnb.BuildPublicLibp2pNode(myAddr, ids) if err != nil { return nil, fmt.Errorf("could not build public libp2p node: %w", err) } @@ -500,7 +505,18 @@ func (fnb *FlowNodeBuilder) HeroCacheMetricsFactory() metrics.HeroCacheMetricsFa return metrics.NewNoopHeroCacheMetricsFactory() } -// initPublicLibp2pNode creates a libp2p node for the observer service in the public (unstaked) network. +// DeriveBootstrapPeerIdentities derives the Flow Identity of the bootstrap peers from the parameters. +// These are the identities of the observers also acting as the DHT bootstrap server +func (fnb *FlowNodeBuilder) DeriveBootstrapPeerIdentities() (flow.IdentitySkeletonList, error) { + ids, err := BootstrapIdentities(fnb.BootstrapNodeAddresses, fnb.BootstrapNodePublicKeys) + if err != nil { + return nil, fmt.Errorf("failed to derive bootstrap peer identities: %w", err) + } + + return ids, nil +} + +// BuildPublicLibp2pNode creates a libp2p node for the observer service in the public (unstaked) network. // The factory function is later passed into the initMiddleware function to eventually instantiate the p2p.LibP2PNode instance // The LibP2P host is created with the following options: // * DHT as client and seeded with the given bootstrap peers @@ -515,24 +531,10 @@ func (fnb *FlowNodeBuilder) HeroCacheMetricsFactory() metrics.HeroCacheMetricsFa // Returns: // - p2p.LibP2PNode: the libp2p node // - error: if any error occurs. Any error returned is considered irrecoverable. -func (fnb *FlowNodeBuilder) BuildPublicLibp2pNode(address string) (p2p.LibP2PNode, error) { +func (fnb *FlowNodeBuilder) BuildPublicLibp2pNode(address string, bootstrapIdentities flow.IdentitySkeletonList) (p2p.LibP2PNode, error) { var pis []peer.AddrInfo - ids, err := BootstrapIdentities(fnb.bootstrapNodeAddresses, fnb.bootstrapNodePublicKeys) - if err != nil { - return nil, fmt.Errorf("could not create bootstrap identities: %w", err) - } - - for _, b := range ids { - pi, err := utils.PeerAddressInfo(*b) - if err != nil { - return nil, fmt.Errorf("could not extract peer address info from bootstrap identity %v: %w", b, err) - } - - pis = append(pis, pi) - } - - for _, b := range ids { + for _, b := range bootstrapIdentities { pi, err := utils.PeerAddressInfo(*b) if err != nil { return nil, fmt.Errorf("could not extract peer address info from bootstrap identity %v: %w", b, err) diff --git a/integration/localnet/builder/bootstrap.go b/integration/localnet/builder/bootstrap.go index 200926bf83a..a40f3e4f71a 100644 --- a/integration/localnet/builder/bootstrap.go +++ b/integration/localnet/builder/bootstrap.go @@ -751,8 +751,8 @@ func prepareTestExecutionService(dockerServices Services, flowNodeContainerConfi observerService := prepareExecutionService(containerConfig, 1, 1) observerService.Command = append(observerService.Command, "--observer-mode=true", - fmt.Sprintf("--observer-mode-bootstrap-node-addresses=%s:%s", testnet.PrimaryAN, testnet.PublicNetworkPort), - fmt.Sprintf("--observer-mode-bootstrap-node-public-keys=%s", agPublicKey), + fmt.Sprintf("--bootstrap-node-addresses=%s:%s", testnet.PrimaryAN, testnet.PublicNetworkPort), + fmt.Sprintf("--bootstrap-node-public-keys=%s", agPublicKey), fmt.Sprintf("--public-access-id=%s", publicAccessID), ) diff --git a/integration/testnet/network.go b/integration/testnet/network.go index bc5fdc2f48b..51c1a7db899 100644 --- a/integration/testnet/network.go +++ b/integration/testnet/network.go @@ -31,6 +31,7 @@ import ( "github.com/onflow/cadence" "github.com/onflow/flow-go-sdk/crypto" + "github.com/onflow/flow-go/cmd/bootstrap/dkg" "github.com/onflow/flow-go/cmd/bootstrap/run" "github.com/onflow/flow-go/cmd/bootstrap/utils" From 55c318aeab21863e1d373399a5f6459abb4fcc87 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Tue, 8 Oct 2024 16:36:34 +0300 Subject: [PATCH 2/4] Reuse public libp2p code for follower builder --- follower/follower_builder.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/follower/follower_builder.go b/follower/follower_builder.go index 2988ee2767e..1a7400e85ab 100644 --- a/follower/follower_builder.go +++ b/follower/follower_builder.go @@ -84,19 +84,14 @@ import ( // For a node running as a standalone process, the config fields will be populated from the command line params, // while for a node running as a library, the config fields are expected to be initialized by the caller. type FollowerServiceConfig struct { - bootstrapNodeAddresses []string - bootstrapNodePublicKeys []string - bootstrapIdentities flow.IdentitySkeletonList // the identity list of bootstrap peers the node uses to discover other nodes - NetworkKey crypto.PrivateKey // the networking key passed in by the caller when being used as a library - baseOptions []cmd.Option + bootstrapIdentities flow.IdentitySkeletonList // the identity list of bootstrap peers the node uses to discover other nodes + NetworkKey crypto.PrivateKey // the networking key passed in by the caller when being used as a library + baseOptions []cmd.Option } // DefaultFollowerServiceConfig defines all the default values for the FollowerServiceConfig func DefaultFollowerServiceConfig() *FollowerServiceConfig { - return &FollowerServiceConfig{ - bootstrapNodeAddresses: []string{}, - bootstrapNodePublicKeys: []string{}, - } + return &FollowerServiceConfig{} } // FollowerServiceBuilder provides the common functionality needed to bootstrap a Flow staked and observer @@ -136,7 +131,7 @@ func (builder *FollowerServiceBuilder) deriveBootstrapPeerIdentities() error { return nil } - ids, err := BootstrapIdentities(builder.bootstrapNodeAddresses, builder.bootstrapNodePublicKeys) + ids, err := builder.DeriveBootstrapPeerIdentities() if err != nil { return fmt.Errorf("failed to derive bootstrap peer identities: %w", err) } @@ -535,10 +530,10 @@ func (builder *FollowerServiceBuilder) validateParams() error { if len(builder.bootstrapIdentities) > 0 { return nil } - if len(builder.bootstrapNodeAddresses) == 0 { + if len(builder.BootstrapNodeAddresses) == 0 { return errors.New("no bootstrap node address provided") } - if len(builder.bootstrapNodeAddresses) != len(builder.bootstrapNodePublicKeys) { + if len(builder.BootstrapNodeAddresses) != len(builder.BootstrapNodePublicKeys) { return errors.New("number of bootstrap node addresses and public keys should match") } return nil From 98662cb2a7174c427ef3013ba67374c429fb418b Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Tue, 8 Oct 2024 17:05:57 +0300 Subject: [PATCH 3/4] Removed unused init for public lib p2p, reused BuildPublicLibp2pNode for follower --- follower/follower_builder.go | 85 ++---------------------------------- 1 file changed, 3 insertions(+), 82 deletions(-) diff --git a/follower/follower_builder.go b/follower/follower_builder.go index 1a7400e85ab..6d7b909125c 100644 --- a/follower/follower_builder.go +++ b/follower/follower_builder.go @@ -1,16 +1,12 @@ package follower import ( - "context" "encoding/json" "errors" "fmt" "strings" - dht "github.com/libp2p/go-libp2p-kad-dht" - "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" - "github.com/libp2p/go-libp2p/core/routing" "github.com/onflow/crypto" "github.com/rs/zerolog" @@ -44,17 +40,12 @@ import ( cborcodec "github.com/onflow/flow-go/network/codec/cbor" "github.com/onflow/flow-go/network/converter" "github.com/onflow/flow-go/network/p2p" - p2pbuilder "github.com/onflow/flow-go/network/p2p/builder" - p2pbuilderconfig "github.com/onflow/flow-go/network/p2p/builder/config" "github.com/onflow/flow-go/network/p2p/cache" "github.com/onflow/flow-go/network/p2p/conduit" - p2pdht "github.com/onflow/flow-go/network/p2p/dht" "github.com/onflow/flow-go/network/p2p/keyutils" p2plogging "github.com/onflow/flow-go/network/p2p/logging" - "github.com/onflow/flow-go/network/p2p/subscription" "github.com/onflow/flow-go/network/p2p/translator" "github.com/onflow/flow-go/network/p2p/unicast/protocols" - "github.com/onflow/flow-go/network/p2p/utils" "github.com/onflow/flow-go/network/slashing" "github.com/onflow/flow-go/network/underlay" "github.com/onflow/flow-go/network/validator" @@ -539,77 +530,6 @@ func (builder *FollowerServiceBuilder) validateParams() error { return nil } -// initPublicLibp2pNode creates a libp2p node for the follower service in public (unstaked) network. -// The LibP2P host is created with the following options: -// - DHT as client and seeded with the given bootstrap peers -// - The specified bind address as the listen address -// - The passed in private key as the libp2p key -// - No connection gater -// - No connection manager -// - No peer manager -// - Default libp2p pubsub options -// -// Args: -// - networkKey: the private key to use for the libp2p node -// -// Returns: -// - p2p.LibP2PNode: the libp2p node -// - error: if any error occurs. Any error returned from this function is irrecoverable. -func (builder *FollowerServiceBuilder) initPublicLibp2pNode(networkKey crypto.PrivateKey) (p2p.LibP2PNode, error) { - var pis []peer.AddrInfo - - for _, b := range builder.bootstrapIdentities { - pi, err := utils.PeerAddressInfo(*b) - if err != nil { - return nil, fmt.Errorf("could not extract peer address info from bootstrap identity %v: %w", b, err) - } - - pis = append(pis, pi) - } - - node, err := p2pbuilder.NewNodeBuilder( - builder.Logger, - &builder.FlowConfig.NetworkConfig.GossipSub, - &p2pbuilderconfig.MetricsConfig{ - HeroCacheFactory: builder.HeroCacheMetricsFactory(), - Metrics: builder.Metrics.Network, - }, - network.PublicNetwork, - builder.BaseConfig.BindAddr, - networkKey, - builder.SporkID, - builder.IdentityProvider, - &builder.FlowConfig.NetworkConfig.ResourceManager, - p2pbuilderconfig.PeerManagerDisableConfig(), // disable peer manager for follower - &p2p.DisallowListCacheConfig{ - MaxSize: builder.FlowConfig.NetworkConfig.DisallowListNotificationCacheSize, - Metrics: metrics.DisallowListCacheMetricsFactory(builder.HeroCacheMetricsFactory(), network.PublicNetwork), - }, - &p2pbuilderconfig.UnicastConfig{ - Unicast: builder.FlowConfig.NetworkConfig.Unicast, - }). - SetSubscriptionFilter( - subscription.NewRoleBasedFilter( - subscription.UnstakedRole, builder.IdentityProvider, - ), - ). - SetRoutingSystem(func(ctx context.Context, h host.Host) (routing.Routing, error) { - return p2pdht.NewDHT(ctx, h, protocols.FlowPublicDHTProtocolID(builder.SporkID), - builder.Logger, - builder.Metrics.Network, - p2pdht.AsClient(), - dht.BootstrapPeers(pis...), - ) - }).Build() - if err != nil { - return nil, fmt.Errorf("could not build public libp2p node: %w", err) - } - - builder.LibP2PNode = node - - return builder.LibP2PNode, nil -} - // initObserverLocal initializes the observer's ID, network key and network address // Currently, it reads a node-info.priv.json like any other node. // TODO: read the node ID from the special bootstrap files @@ -646,11 +566,12 @@ func (builder *FollowerServiceBuilder) enqueuePublicNetworkInit() { builder. Component("public libp2p node", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) { var err error - publicLibp2pNode, err = builder.initPublicLibp2pNode(node.NetworkKey) + publicLibp2pNode, err = builder.BuildPublicLibp2pNode(builder.BaseConfig.BindAddr, builder.bootstrapIdentities) if err != nil { - return nil, fmt.Errorf("could not create public libp2p node: %w", err) + return nil, fmt.Errorf("could not build public libp2p node: %w", err) } + builder.LibP2PNode = publicLibp2pNode return publicLibp2pNode, nil }). Component("public network", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) { From 2b5c4b9593c3786bf3eebaf9bf7ed9a3fee69653 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Thu, 10 Oct 2024 15:54:30 +0300 Subject: [PATCH 4/4] Updated flag name according to comment --- cmd/scaffold.go | 4 ++-- integration/localnet/builder/bootstrap.go | 8 ++++---- integration/testnet/network.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/scaffold.go b/cmd/scaffold.go index 45ef478aa77..a3a95cfff15 100644 --- a/cmd/scaffold.go +++ b/cmd/scaffold.go @@ -255,11 +255,11 @@ func (fnb *FlowNodeBuilder) BaseFlags() { // observer mode allows a unstaked execution node to fetch blocks from a public staked access node, and being able to execute blocks fnb.flags.BoolVar(&fnb.BaseConfig.ObserverMode, "observer-mode", defaultConfig.ObserverMode, "whether the node is running in observer mode") fnb.flags.StringSliceVar(&fnb.BootstrapNodePublicKeys, - "bootstrap-node-public-keys", + "observer-mode-bootstrap-node-public-keys", []string{}, "the networking public key of the bootstrap access node if this is an observer (in the same order as the bootstrap node addresses) e.g. \"d57a5e9c5.....\",\"44ded42d....\"") fnb.flags.StringSliceVar(&fnb.BootstrapNodeAddresses, - "bootstrap-node-addresses", + "observer-mode-bootstrap-node-addresses", []string{}, "the network addresses of the bootstrap access node if this is an observer e.g. access-001.mainnet.flow.org:9653,access-002.mainnet.flow.org:9653") } diff --git a/integration/localnet/builder/bootstrap.go b/integration/localnet/builder/bootstrap.go index a40f3e4f71a..e3ed2c91ea2 100644 --- a/integration/localnet/builder/bootstrap.go +++ b/integration/localnet/builder/bootstrap.go @@ -454,8 +454,8 @@ func prepareObserverService(i int, observerName string, agPublicKey string) Serv service := defaultService(observerName, DefaultObserverRole, dataDir, profilerDir, i) service.Command = append(service.Command, - fmt.Sprintf("--bootstrap-node-addresses=%s:%s", testnet.PrimaryAN, testnet.PublicNetworkPort), - fmt.Sprintf("--bootstrap-node-public-keys=%s", agPublicKey), + fmt.Sprintf("--observer-mode-bootstrap-node-addresses=%s:%s", testnet.PrimaryAN, testnet.PublicNetworkPort), + fmt.Sprintf("--observer-mode-bootstrap-node-public-keys=%s", agPublicKey), fmt.Sprintf("--upstream-node-addresses=%s:%s", testnet.PrimaryAN, testnet.GRPCSecurePort), fmt.Sprintf("--upstream-node-public-keys=%s", agPublicKey), fmt.Sprintf("--observer-networking-key-path=/bootstrap/private-root-information/%s_key", observerName), @@ -751,8 +751,8 @@ func prepareTestExecutionService(dockerServices Services, flowNodeContainerConfi observerService := prepareExecutionService(containerConfig, 1, 1) observerService.Command = append(observerService.Command, "--observer-mode=true", - fmt.Sprintf("--bootstrap-node-addresses=%s:%s", testnet.PrimaryAN, testnet.PublicNetworkPort), - fmt.Sprintf("--bootstrap-node-public-keys=%s", agPublicKey), + fmt.Sprintf("--observer-mode-bootstrap-node-addresses=%s:%s", testnet.PrimaryAN, testnet.PublicNetworkPort), + fmt.Sprintf("--observer-mode-bootstrap-node-public-keys=%s", agPublicKey), fmt.Sprintf("--public-access-id=%s", publicAccessID), ) diff --git a/integration/testnet/network.go b/integration/testnet/network.go index 51c1a7db899..250e7eabe53 100644 --- a/integration/testnet/network.go +++ b/integration/testnet/network.go @@ -757,8 +757,8 @@ func (net *FlowNetwork) AddObserver(t *testing.T, conf ObserverConfig) *Containe fmt.Sprintf("--secretsdir=%s", DefaultFlowSecretsDBDir), fmt.Sprintf("--profiler-dir=%s", DefaultProfilerDir), fmt.Sprintf("--loglevel=%s", conf.LogLevel.String()), - fmt.Sprintf("--bootstrap-node-addresses=%s", accessNode.ContainerAddr(PublicNetworkPort)), - fmt.Sprintf("--bootstrap-node-public-keys=%s", accessPublicKey), + fmt.Sprintf("--observer-mode-bootstrap-node-addresses=%s", accessNode.ContainerAddr(PublicNetworkPort)), + fmt.Sprintf("--observer-mode-bootstrap-node-public-keys=%s", accessPublicKey), fmt.Sprintf("--upstream-node-addresses=%s", accessNode.ContainerAddr(GRPCSecurePort)), fmt.Sprintf("--upstream-node-public-keys=%s", accessPublicKey), fmt.Sprintf("--observer-networking-key-path=%s/private-root-information/%s_key", DefaultBootstrapDir, conf.ContainerName),