Skip to content

Commit d8940e1

Browse files
authored
Merge branch 'master' into jordan/existence-check-snapshot
2 parents 7b47d89 + c539928 commit d8940e1

File tree

33 files changed

+889
-609
lines changed

33 files changed

+889
-609
lines changed

cmd/access/node_builder/access_node_builder.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import (
6868
"github.com/onflow/flow-go/network/p2p/dht"
6969
"github.com/onflow/flow-go/network/p2p/middleware"
7070
"github.com/onflow/flow-go/network/p2p/p2pbuilder"
71+
"github.com/onflow/flow-go/network/p2p/p2pbuilder/inspector"
7172
"github.com/onflow/flow-go/network/p2p/subscription"
7273
"github.com/onflow/flow-go/network/p2p/tracer"
7374
"github.com/onflow/flow-go/network/p2p/translator"
@@ -1020,7 +1021,7 @@ func (builder *FlowAccessNodeBuilder) enqueuePublicNetworkInit() {
10201021
}).
10211022
Component("public libp2p node", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) {
10221023

1023-
libP2PFactory := builder.initLibP2PFactory(builder.NodeConfig.NetworkKey, builder.PublicNetworkConfig.BindAddress, builder.PublicNetworkConfig.Metrics)
1024+
libP2PFactory := builder.initPublicLibP2PFactory(builder.NodeConfig.NetworkKey, builder.PublicNetworkConfig.BindAddress, builder.PublicNetworkConfig.Metrics)
10241025

10251026
var err error
10261027
libp2pNode, err = libP2PFactory()
@@ -1066,15 +1067,15 @@ func (builder *FlowAccessNodeBuilder) enqueuePublicNetworkInit() {
10661067
})
10671068
}
10681069

1069-
// initLibP2PFactory creates the LibP2P factory function for the given node ID and network key.
1070+
// initPublicLibP2PFactory creates the LibP2P factory function for the given node ID and network key.
10701071
// The factory function is later passed into the initMiddleware function to eventually instantiate the p2p.LibP2PNode instance
10711072
// The LibP2P host is created with the following options:
10721073
// - DHT as server
10731074
// - The address from the node config or the specified bind address as the listen address
10741075
// - The passed in private key as the libp2p key
10751076
// - No connection gater
10761077
// - Default Flow libp2p pubsub options
1077-
func (builder *FlowAccessNodeBuilder) initLibP2PFactory(networkKey crypto.PrivateKey, bindAddress string, networkMetrics module.LibP2PMetrics) p2p.LibP2PFactoryFunc {
1078+
func (builder *FlowAccessNodeBuilder) initPublicLibP2PFactory(networkKey crypto.PrivateKey, bindAddress string, networkMetrics module.LibP2PMetrics) p2p.LibP2PFactoryFunc {
10781079
return func() (p2p.LibP2PNode, error) {
10791080
connManager, err := connection.NewConnManager(builder.Logger, networkMetrics, builder.ConnectionManagerConfig)
10801081
if err != nil {
@@ -1087,6 +1088,16 @@ func (builder *FlowAccessNodeBuilder) initLibP2PFactory(networkKey crypto.Privat
10871088
builder.IdentityProvider,
10881089
builder.GossipSubConfig.LocalMeshLogInterval)
10891090

1091+
// setup RPC inspectors
1092+
rpcInspectorBuilder := inspector.NewGossipSubInspectorBuilder(builder.Logger, builder.SporkID, builder.GossipSubRPCInspectorsConfig, builder.GossipSubInspectorNotifDistributor)
1093+
rpcInspectors, err := rpcInspectorBuilder.
1094+
SetPublicNetwork(p2p.PublicNetworkEnabled).
1095+
SetMetrics(builder.Metrics.Network, builder.MetricsRegisterer).
1096+
SetMetricsEnabled(builder.MetricsEnabled).Build()
1097+
if err != nil {
1098+
return nil, fmt.Errorf("failed to create gossipsub rpc inspectors: %w", err)
1099+
}
1100+
10901101
libp2pNode, err := p2pbuilder.NewNodeBuilder(
10911102
builder.Logger,
10921103
networkMetrics,
@@ -1116,6 +1127,7 @@ func (builder *FlowAccessNodeBuilder) initLibP2PFactory(networkKey crypto.Privat
11161127
SetStreamCreationRetryInterval(builder.UnicastCreateStreamRetryDelay).
11171128
SetGossipSubTracer(meshTracer).
11181129
SetGossipSubScoreTracerInterval(builder.GossipSubConfig.ScoreTracerInterval).
1130+
SetGossipSubRPCInspectors(rpcInspectors...).
11191131
Build()
11201132

11211133
if err != nil {

cmd/node_builder.go

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import (
66
"path/filepath"
77
"time"
88

9-
"github.com/onflow/flow-go/network/p2p/distributor"
10-
"github.com/onflow/flow-go/network/p2p/p2pbuilder"
11-
129
"github.com/dgraph-io/badger/v2"
1310
madns "github.com/multiformats/go-multiaddr-dns"
1411
"github.com/prometheus/client_golang/prometheus"
@@ -29,9 +26,11 @@ import (
2926
"github.com/onflow/flow-go/network/codec/cbor"
3027
"github.com/onflow/flow-go/network/p2p"
3128
"github.com/onflow/flow-go/network/p2p/connection"
29+
"github.com/onflow/flow-go/network/p2p/distributor"
3230
"github.com/onflow/flow-go/network/p2p/dns"
33-
"github.com/onflow/flow-go/network/p2p/inspector/validation"
3431
"github.com/onflow/flow-go/network/p2p/middleware"
32+
"github.com/onflow/flow-go/network/p2p/p2pbuilder"
33+
inspectorbuilder "github.com/onflow/flow-go/network/p2p/p2pbuilder/inspector"
3534
"github.com/onflow/flow-go/network/p2p/unicast"
3635
"github.com/onflow/flow-go/state/protocol"
3736
"github.com/onflow/flow-go/state/protocol/events"
@@ -185,7 +184,10 @@ type NetworkConfig struct {
185184
// that are not part of protocol state should be trimmed
186185
// TODO: solely a fallback mechanism, can be removed upon reliable behavior in production.
187186
NetworkConnectionPruning bool
188-
GossipSubConfig *p2pbuilder.GossipSubConfig
187+
// GossipSubConfig core gossipsub configuration.
188+
GossipSubConfig *p2pbuilder.GossipSubConfig
189+
// GossipSubRPCInspectorsConfig configuration for all gossipsub RPC control message inspectors.
190+
GossipSubRPCInspectorsConfig *inspectorbuilder.GossipSubRPCInspectorsConfig
189191
// PreferredUnicastProtocols list of unicast protocols in preferred order
190192
PreferredUnicastProtocols []string
191193
NetworkReceivedMessageCacheSize uint32
@@ -199,11 +201,8 @@ type NetworkConfig struct {
199201
UnicastCreateStreamRetryDelay time.Duration
200202
// size of the queue for notifications about new peers in the disallow list.
201203
DisallowListNotificationCacheSize uint32
202-
// size of the queue for notifications about gossipsub RPC inspections.
203-
GossipSubRPCInspectorNotificationCacheSize uint32
204-
GossipSubRPCInspectorCacheSize uint32
205-
UnicastRateLimitersConfig *UnicastRateLimitersConfig
206-
GossipSubRPCValidationConfigs *p2pbuilder.GossipSubRPCValidationConfigs
204+
// UnicastRateLimitersConfig configuration for all unicast rate limiters.
205+
UnicastRateLimitersConfig *UnicastRateLimitersConfig
207206
}
208207

209208
// UnicastRateLimitersConfig unicast rate limiter configuration for the message and bandwidth rate limiters.
@@ -301,27 +300,13 @@ func DefaultBaseConfig() *BaseConfig {
301300
BandwidthRateLimit: 0,
302301
BandwidthBurstLimit: middleware.LargeMsgMaxUnicastMsgSize,
303302
},
304-
GossipSubRPCValidationConfigs: &p2pbuilder.GossipSubRPCValidationConfigs{
305-
NumberOfWorkers: validation.DefaultNumberOfWorkers,
306-
GraftLimits: map[string]int{
307-
validation.DiscardThresholdMapKey: validation.DefaultGraftDiscardThreshold,
308-
validation.SafetyThresholdMapKey: validation.DefaultGraftSafetyThreshold,
309-
validation.RateLimitMapKey: validation.DefaultGraftRateLimit,
310-
},
311-
PruneLimits: map[string]int{
312-
validation.DiscardThresholdMapKey: validation.DefaultPruneDiscardThreshold,
313-
validation.SafetyThresholdMapKey: validation.DefaultPruneSafetyThreshold,
314-
validation.RateLimitMapKey: validation.DefaultPruneRateLimit,
315-
},
316-
},
317-
DNSCacheTTL: dns.DefaultTimeToLive,
318-
LibP2PResourceManagerConfig: p2pbuilder.DefaultResourceManagerConfig(),
319-
ConnectionManagerConfig: connection.DefaultConnManagerConfig(),
320-
NetworkConnectionPruning: connection.ConnectionPruningEnabled,
321-
GossipSubConfig: p2pbuilder.DefaultGossipSubConfig(),
322-
GossipSubRPCInspectorNotificationCacheSize: distributor.DefaultGossipSubInspectorNotificationQueueCacheSize,
323-
GossipSubRPCInspectorCacheSize: validation.DefaultControlMsgValidationInspectorQueueCacheSize,
324-
DisallowListNotificationCacheSize: distributor.DefaultDisallowListNotificationQueueCacheSize,
303+
GossipSubConfig: p2pbuilder.DefaultGossipSubConfig(),
304+
GossipSubRPCInspectorsConfig: inspectorbuilder.DefaultGossipSubRPCInspectorsConfig(),
305+
DNSCacheTTL: dns.DefaultTimeToLive,
306+
LibP2PResourceManagerConfig: p2pbuilder.DefaultResourceManagerConfig(),
307+
ConnectionManagerConfig: connection.DefaultConnManagerConfig(),
308+
NetworkConnectionPruning: connection.ConnectionPruningEnabled,
309+
DisallowListNotificationCacheSize: distributor.DefaultDisallowListNotificationQueueCacheSize,
325310
},
326311
nodeIDHex: NotSet,
327312
AdminAddr: NotSet,

cmd/observer/node_builder/observer_builder.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import (
6464
"github.com/onflow/flow-go/network/p2p/keyutils"
6565
"github.com/onflow/flow-go/network/p2p/middleware"
6666
"github.com/onflow/flow-go/network/p2p/p2pbuilder"
67+
"github.com/onflow/flow-go/network/p2p/p2pbuilder/inspector"
6768
"github.com/onflow/flow-go/network/p2p/subscription"
6869
"github.com/onflow/flow-go/network/p2p/tracer"
6970
"github.com/onflow/flow-go/network/p2p/translator"
@@ -836,7 +837,7 @@ func (builder *ObserverServiceBuilder) validateParams() error {
836837
return nil
837838
}
838839

839-
// initLibP2PFactory creates the LibP2P factory function for the given node ID and network key for the observer.
840+
// initPublicLibP2PFactory creates the LibP2P factory function for the given node ID and network key for the observer.
840841
// The factory function is later passed into the initMiddleware function to eventually instantiate the p2p.LibP2PNode instance
841842
// The LibP2P host is created with the following options:
842843
// * DHT as client and seeded with the given bootstrap peers
@@ -846,7 +847,7 @@ func (builder *ObserverServiceBuilder) validateParams() error {
846847
// * No connection manager
847848
// * No peer manager
848849
// * Default libp2p pubsub options
849-
func (builder *ObserverServiceBuilder) initLibP2PFactory(networkKey crypto.PrivateKey) p2p.LibP2PFactoryFunc {
850+
func (builder *ObserverServiceBuilder) initPublicLibP2PFactory(networkKey crypto.PrivateKey) p2p.LibP2PFactoryFunc {
850851
return func() (p2p.LibP2PNode, error) {
851852
var pis []peer.AddrInfo
852853

@@ -866,11 +867,13 @@ func (builder *ObserverServiceBuilder) initLibP2PFactory(networkKey crypto.Priva
866867
builder.IdentityProvider,
867868
builder.GossipSubConfig.LocalMeshLogInterval)
868869

869-
builder.GossipSubInspectorNotifDistributor = cmd.BuildGossipsubRPCValidationInspectorNotificationDisseminator(builder.GossipSubRPCInspectorNotificationCacheSize, builder.MetricsRegisterer, builder.Logger, builder.MetricsEnabled)
870-
heroStoreOpts := cmd.BuildGossipsubRPCValidationInspectorHeroStoreOpts(builder.GossipSubRPCInspectorCacheSize, builder.MetricsRegisterer, builder.MetricsEnabled)
871-
rpcValidationInspector, err := p2pbuilder.BuildGossipSubRPCValidationInspector(builder.Logger, builder.SporkID, builder.GossipSubRPCValidationConfigs, builder.GossipSubInspectorNotifDistributor, heroStoreOpts...)
870+
rpcInspectorBuilder := inspector.NewGossipSubInspectorBuilder(builder.Logger, builder.SporkID, builder.GossipSubRPCInspectorsConfig, builder.GossipSubInspectorNotifDistributor)
871+
rpcInspectors, err := rpcInspectorBuilder.
872+
SetPublicNetwork(p2p.PublicNetworkEnabled).
873+
SetMetrics(builder.Metrics.Network, builder.MetricsRegisterer).
874+
SetMetricsEnabled(builder.MetricsEnabled).Build()
872875
if err != nil {
873-
return nil, fmt.Errorf("failed to create gossipsub rpc validation inspector: %w", err)
876+
return nil, fmt.Errorf("failed to create gossipsub rpc inspectors: %w", err)
874877
}
875878

876879
node, err := p2pbuilder.NewNodeBuilder(
@@ -896,7 +899,7 @@ func (builder *ObserverServiceBuilder) initLibP2PFactory(networkKey crypto.Priva
896899
SetStreamCreationRetryInterval(builder.UnicastCreateStreamRetryDelay).
897900
SetGossipSubTracer(meshTracer).
898901
SetGossipSubScoreTracerInterval(builder.GossipSubConfig.ScoreTracerInterval).
899-
SetGossipSubValidationInspector(rpcValidationInspector).
902+
SetGossipSubRPCInspectors(rpcInspectors...).
900903
Build()
901904

902905
if err != nil {
@@ -947,7 +950,7 @@ func (builder *ObserverServiceBuilder) enqueuePublicNetworkInit() {
947950
var libp2pNode p2p.LibP2PNode
948951
builder.
949952
Component("public libp2p node", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) {
950-
libP2PFactory := builder.initLibP2PFactory(node.NetworkKey)
953+
libP2PFactory := builder.initPublicLibP2PFactory(node.NetworkKey)
951954

952955
var err error
953956
libp2pNode, err = libP2PFactory()

cmd/scaffold.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import (
5252
"github.com/onflow/flow-go/network/p2p/inspector/validation"
5353
"github.com/onflow/flow-go/network/p2p/middleware"
5454
"github.com/onflow/flow-go/network/p2p/p2pbuilder"
55+
"github.com/onflow/flow-go/network/p2p/p2pbuilder/inspector"
5556
"github.com/onflow/flow-go/network/p2p/ping"
5657
"github.com/onflow/flow-go/network/p2p/subscription"
5758
"github.com/onflow/flow-go/network/p2p/unicast/protocols"
@@ -211,13 +212,16 @@ func (fnb *FlowNodeBuilder) BaseFlags() {
211212
fnb.flags.BoolVar(&fnb.BaseConfig.UnicastRateLimitersConfig.DryRun, "unicast-rate-limit-dry-run", defaultConfig.UnicastRateLimitersConfig.DryRun, "disable peer disconnects and connections gating when rate limiting peers")
212213

213214
// gossipsub RPC control message validation limits used for validation configuration and rate limiting
214-
fnb.flags.IntVar(&fnb.BaseConfig.GossipSubRPCValidationConfigs.NumberOfWorkers, "gossipsub-rpc-inspection-workers", defaultConfig.NetworkConfig.GossipSubRPCValidationConfigs.NumberOfWorkers, "number of gossupsub RPC control message inspector component workers")
215-
fnb.flags.StringToIntVar(&fnb.BaseConfig.GossipSubRPCValidationConfigs.GraftLimits, "gossipsub-rpc-graft-limits", defaultConfig.NetworkConfig.GossipSubRPCValidationConfigs.GraftLimits, fmt.Sprintf("discard threshold, safety and rate limits for gossipsub RPC GRAFT message validation e.g: %s=1000,%s=100,%s=1000", validation.DiscardThresholdMapKey, validation.SafetyThresholdMapKey, validation.RateLimitMapKey))
216-
fnb.flags.StringToIntVar(&fnb.BaseConfig.GossipSubRPCValidationConfigs.PruneLimits, "gossipsub-rpc-prune-limits", defaultConfig.NetworkConfig.GossipSubRPCValidationConfigs.PruneLimits, fmt.Sprintf("discard threshold, safety and rate limits for gossipsub RPC PRUNE message validation e.g: %s=1000,%s=20,%s=1000", validation.DiscardThresholdMapKey, validation.SafetyThresholdMapKey, validation.RateLimitMapKey))
215+
fnb.flags.IntVar(&fnb.BaseConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.NumberOfWorkers, "gossipsub-rpc-validation-inspector-workers", defaultConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.NumberOfWorkers, "number of gossupsub RPC control message validation inspector component workers")
216+
fnb.flags.Uint32Var(&fnb.BaseConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.CacheSize, "gossipsub-rpc-validation-inspector-cache-size", defaultConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.CacheSize, "cache size for gossipsub RPC validation inspector events worker pool queue.")
217+
fnb.flags.StringToIntVar(&fnb.BaseConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.GraftLimits, "gossipsub-rpc-graft-limits", defaultConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.GraftLimits, fmt.Sprintf("discard threshold, safety and rate limits for gossipsub RPC GRAFT message validation e.g: %s=1000,%s=100,%s=1000", validation.DiscardThresholdMapKey, validation.SafetyThresholdMapKey, validation.RateLimitMapKey))
218+
fnb.flags.StringToIntVar(&fnb.BaseConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.PruneLimits, "gossipsub-rpc-prune-limits", defaultConfig.GossipSubRPCInspectorsConfig.ValidationInspectorConfigs.PruneLimits, fmt.Sprintf("discard threshold, safety and rate limits for gossipsub RPC PRUNE message validation e.g: %s=1000,%s=20,%s=1000", validation.DiscardThresholdMapKey, validation.SafetyThresholdMapKey, validation.RateLimitMapKey))
219+
// gossipsub RPC control message metrics observer inspector configuration
220+
fnb.flags.IntVar(&fnb.BaseConfig.GossipSubRPCInspectorsConfig.MetricsInspectorConfigs.NumberOfWorkers, "gossipsub-rpc-metrics-inspector-workers", defaultConfig.GossipSubRPCInspectorsConfig.MetricsInspectorConfigs.NumberOfWorkers, "cache size for gossipsub RPC metrics inspector events worker pool queue.")
221+
fnb.flags.Uint32Var(&fnb.BaseConfig.GossipSubRPCInspectorsConfig.MetricsInspectorConfigs.CacheSize, "gossipsub-rpc-metrics-inspector-cache-size", defaultConfig.GossipSubRPCInspectorsConfig.MetricsInspectorConfigs.CacheSize, "cache size for gossipsub RPC metrics inspector events worker pool.")
217222

218223
// networking event notifications
219-
fnb.flags.Uint32Var(&fnb.BaseConfig.GossipSubRPCInspectorNotificationCacheSize, "gossipsub-rpc-inspector-notification-cache-size", defaultConfig.GossipSubRPCInspectorNotificationCacheSize, "cache size for notification events from gossipsub rpc inspector")
220-
fnb.flags.Uint32Var(&fnb.BaseConfig.GossipSubRPCInspectorCacheSize, "gossipsub-rpc-inspector-cache-size", defaultConfig.GossipSubRPCInspectorNotificationCacheSize, "cache size for gossipsub RPC validation inspector events worker pool.")
224+
fnb.flags.Uint32Var(&fnb.BaseConfig.GossipSubRPCInspectorsConfig.GossipSubRPCInspectorNotificationCacheSize, "gossipsub-rpc-inspector-notification-cache-size", defaultConfig.GossipSubRPCInspectorsConfig.GossipSubRPCInspectorNotificationCacheSize, "cache size for notification events from gossipsub rpc inspector")
221225
fnb.flags.Uint32Var(&fnb.BaseConfig.DisallowListNotificationCacheSize, "disallow-list-notification-cache-size", defaultConfig.DisallowListNotificationCacheSize, "cache size for notification events from disallow list")
222226

223227
// unicast manager options
@@ -371,13 +375,20 @@ func (fnb *FlowNodeBuilder) EnqueueNetworkInit() {
371375
myAddr = fnb.BaseConfig.BindAddr
372376
}
373377

374-
fnb.GossipSubInspectorNotifDistributor = BuildGossipsubRPCValidationInspectorNotificationDisseminator(fnb.GossipSubRPCInspectorNotificationCacheSize, fnb.MetricsRegisterer, fnb.Logger, fnb.MetricsEnabled)
375-
heroStoreOpts := BuildGossipsubRPCValidationInspectorHeroStoreOpts(fnb.GossipSubRPCInspectorCacheSize, fnb.MetricsRegisterer, fnb.MetricsEnabled)
376-
rpcValidationInspector, err := p2pbuilder.BuildGossipSubRPCValidationInspector(fnb.Logger, fnb.SporkID, fnb.GossipSubRPCValidationConfigs, fnb.GossipSubInspectorNotifDistributor, heroStoreOpts...)
378+
fnb.GossipSubInspectorNotifDistributor = BuildGossipsubRPCValidationInspectorNotificationDisseminator(fnb.GossipSubRPCInspectorsConfig.GossipSubRPCInspectorNotificationCacheSize, fnb.MetricsRegisterer, fnb.Logger, fnb.MetricsEnabled)
379+
380+
rpcInspectorBuilder := inspector.NewGossipSubInspectorBuilder(fnb.Logger, fnb.SporkID, fnb.GossipSubRPCInspectorsConfig, fnb.GossipSubInspectorNotifDistributor)
381+
rpcInspectors, err := rpcInspectorBuilder.
382+
SetPublicNetwork(p2p.PublicNetworkDisabled).
383+
SetMetrics(fnb.Metrics.Network, fnb.MetricsRegisterer).
384+
SetMetricsEnabled(fnb.MetricsEnabled).Build()
377385
if err != nil {
378-
return nil, fmt.Errorf("failed to create gossipsub rpc validation inspector: %w", err)
386+
return nil, fmt.Errorf("failed to create gossipsub rpc inspectors: %w", err)
379387
}
380388

389+
// set rpc inspectors on gossipsub config
390+
fnb.GossipSubConfig.RPCInspectors = rpcInspectors
391+
381392
libP2PNodeFactory := p2pbuilder.DefaultLibP2PNodeFactory(
382393
fnb.Logger,
383394
myAddr,
@@ -393,7 +404,6 @@ func (fnb *FlowNodeBuilder) EnqueueNetworkInit() {
393404
fnb.GossipSubConfig,
394405
fnb.LibP2PResourceManagerConfig,
395406
uniCfg,
396-
rpcValidationInspector,
397407
)
398408

399409
libp2pNode, err := libP2PNodeFactory()

cmd/utils.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,3 @@ func BuildGossipsubRPCValidationInspectorNotificationDisseminator(size uint32, m
8888
}
8989
return distributor.DefaultGossipSubInspectorNotificationDistributor(logger, heroStoreOpts...)
9090
}
91-
92-
// BuildGossipsubRPCValidationInspectorHeroStoreOpts builds the gossipsub rpc validation inspector hero store opts.
93-
// These options are used in the underlying worker pool hero store.
94-
func BuildGossipsubRPCValidationInspectorHeroStoreOpts(size uint32, metricsRegistry prometheus.Registerer, metricsEnabled bool) []queue.HeroStoreConfigOption {
95-
heroStoreOpts := []queue.HeroStoreConfigOption{queue.WithHeroStoreSizeLimit(size)}
96-
if metricsEnabled {
97-
collector := metrics.GossipSubRPCInspectorQueueMetricFactory(metricsRegistry)
98-
heroStoreOpts = append(heroStoreOpts, queue.WithHeroStoreCollector(collector))
99-
}
100-
return heroStoreOpts
101-
}

0 commit comments

Comments
 (0)