Skip to content

Commit

Permalink
[ALSP] Implements disallowlisting logic (#4441)
Browse files Browse the repository at this point in the history
* fixes a godoc

* adds heartbeat

* wires in alsp parameters in code

* wires in alsp parameters for testing

* adds test for a single heartbeat

* decouples misbehavior fixture functions

* reduces sleep time of the test

* adds decay to zero test

* lint fix

* test fix

* lint fix

* dissolves start method of middleware

* chore: renames topology method and middleware option

* chore: renames middleware option

* chores middleware

* adds disallow list cache interface

* changes signature of a single method

* adds cache entity

* revises the interface of cache

* changes cause type to map

* adds adjust function

* adds disallow for

* refactors interface and adds missing methods

* adds TestNewDisallowListCache

* adds TestDisallowFor_SinglePeer

* adds TestDisallowFor_MultiplePeers

* refactors interface of the cache

* refactors implementation of the cache

* implements test AllowFor Single peer

* updates godocs

* adds test for multiple peers concurrently

* adds a comment

* removes unused methods

* adds disallow list cache config

* replaces middleware parameters with config

* adds networking disallow list cache metrics factory

* adds default middleware size

* adds default middleware size to cache

* refactors middleware for access node builder

* adds validate to nuddkeware config

* refactors middleware initialization for observer

* refactors middleware initialization in scaffold

* refactors middleware initialization in follower

* adds interface for disallow list oracle

* moves all disallow listing components to network root package

* replaces disallow listing distributor with middleware

* revises middleware interface

* adds string method to disallow list wrapper

* removes disallow list consumer and distributor interfaces

* adds disallow listing event handlers to middleware

* refactors node blocklist wrappers

* lint fix

* lint fix

* generates mocks

* lint fix

* fixes tests

* fixes tests

* fix lint

* libp2p implements disallow list consumer

* removes disallow list oracle

* moves disallow list logic to libp2p node

* moves disallow list cache to libp2p node

* fixes import cycle

* moves disallowlist cache to p2p package

* lint fix

* wires disallow lists to peer manager

* adds disallow list oracle

* adds disallow list oracle to connection gater interface and implementation

* wires disallow listing oracle to connection gater

* wires disallow list consumer to alsp manager

* implements disallow listing below threshold

* generates mocks

* lint fix

* lint fix

* lint fix

* fix lint

* adds test for disallow list notification

* renames a test fixture and add more

* decreases min backoff

* adds a new method to connector host

* adds disallow listing logic to libp2p node

* adds disallow listing test

* decreases time interval of peer manager

* skips connecting to already connected peers

* adds is connected method

* reduces backup

* fixes closure of authorized peers

* adds disallow listing test

* adds godoc

* separate the connection gater for each node in test util

* extends a documentation

* adds misbehavior and disallowlisting test

* updates mocks

* fixes build issues

* lint fix

* renames block list to disallow list

* renames block list to disallow list

* fuxes herocache metrics issue

* fixes nil dependecy issue

* lint fix

* fixes nil pointer exception

* adds a comment

* Update network/disallow.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* Update network/p2p/p2pnode/internal/cache.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/alsp/manager/manager.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* Update network/p2p/p2pnode/internal/cache.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/p2p/p2pnode/internal/cache.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/p2p/p2pnode/internal/cache.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update module/metrics/labels.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/alsp/manager/manager_test.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* Update network/alsp/manager/manager_test.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* Update network/alsp/manager/manager_test.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* Update network/p2p/p2pnode/internal/cache.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/p2p/p2pnode/internal/cache.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/p2p/p2pnode/internal/cache.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/disallow.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* adds documentation for integration testing

* Update network/alsp/manager/manager_test.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* resolves shadow variables

* Update network/alsp/manager/manager.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/alsp/manager/manager.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* Update network/p2p/connection/peerManager.go

Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>

* renames and refactors a cache and libp2p method

* lint fix

* adds readme

* Update network/alsp/manager/manager_test.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* Update network/alsp/manager/README.md

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>

* Update network/alsp/manager/README.md

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>

* Update network/alsp/manager/README.md

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>

* Update network/p2p/p2pnode/libp2pNode.go

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>

* Update network/alsp/manager/README.md

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>

* Update network/alsp/manager/README.md

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>

* Update network/alsp/manager/README.md

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* Update network/alsp/manager/manager_test.go

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>

* adds disallow-listed status to cache

* switches a log level

* fixes duplicate metrics panic

---------

Co-authored-by: Misha <misha.rybalov@dapperlabs.com>
Co-authored-by: Khalil Claybon <khalil.claybon@dapperlabs.com>
Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>
  • Loading branch information
4 people authored Jun 19, 2023
1 parent c94a5a4 commit 3ff4476
Show file tree
Hide file tree
Showing 65 changed files with 2,460 additions and 921 deletions.
44 changes: 21 additions & 23 deletions cmd/access/node_builder/access_node_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,21 +812,21 @@ func (builder *FlowAccessNodeBuilder) InitIDProviders() {
}
builder.IDTranslator = translator.NewHierarchicalIDTranslator(idCache, translator.NewPublicNetworkIDTranslator())

builder.NodeDisallowListDistributor = cmd.BuildDisallowListNotificationDisseminator(builder.DisallowListNotificationCacheSize, builder.MetricsRegisterer, builder.Logger, builder.MetricsEnabled)

// The following wrapper allows to disallow-list byzantine nodes via an admin command:
// the wrapper overrides the 'Ejected' flag of disallow-listed nodes to true
disallowListWrapper, err := cache.NewNodeBlocklistWrapper(idCache, node.DB, builder.NodeDisallowListDistributor)
disallowListWrapper, err := cache.NewNodeDisallowListWrapper(idCache, node.DB, func() network.DisallowListNotificationConsumer {
return builder.Middleware
})
if err != nil {
return fmt.Errorf("could not initialize NodeBlockListWrapper: %w", err)
}
builder.IdentityProvider = disallowListWrapper

// register the wrapper for dynamic configuration via admin command
err = node.ConfigManager.RegisterIdentifierListConfig("network-id-provider-blocklist",
disallowListWrapper.GetBlocklist, disallowListWrapper.Update)
disallowListWrapper.GetDisallowList, disallowListWrapper.Update)
if err != nil {
return fmt.Errorf("failed to register blocklist with config manager: %w", err)
return fmt.Errorf("failed to register disallow-list wrapper with config manager: %w", err)
}

builder.SyncEngineParticipantsProviderFactory = func() module.IdentifierProvider {
Expand All @@ -841,11 +841,6 @@ func (builder *FlowAccessNodeBuilder) InitIDProviders() {
}
return nil
})

builder.Component("disallow list notification distributor", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) {
// distributor is returned as a component to be started and stopped.
return builder.NodeDisallowListDistributor, nil
})
}

func (builder *FlowAccessNodeBuilder) Initialize() error {
Expand Down Expand Up @@ -1221,7 +1216,11 @@ func (builder *FlowAccessNodeBuilder) initPublicLibp2pNode(networkKey crypto.Pri
bindAddress,
networkKey,
builder.SporkID,
builder.LibP2PResourceManagerConfig).
builder.LibP2PResourceManagerConfig,
&p2p.DisallowListCacheConfig{
MaxSize: builder.BaseConfig.NetworkConfig.DisallowListCacheSize,
Metrics: metrics.DisallowListCacheMetricsFactory(builder.HeroCacheMetricsFactory(), network.PublicNetwork),
}).
SetBasicResolver(builder.Resolver).
SetSubscriptionFilter(
subscription.NewRoleBasedFilter(
Expand Down Expand Up @@ -1262,20 +1261,19 @@ func (builder *FlowAccessNodeBuilder) initMiddleware(nodeID flow.Identifier,
validators ...network.MessageValidator,
) network.Middleware {
logger := builder.Logger.With().Bool("staked", false).Logger()
slashingViolationsConsumer := slashing.NewSlashingViolationsConsumer(logger, networkMetrics)
mw := middleware.NewMiddleware(
logger,
libp2pNode,
nodeID,
builder.Metrics.Bitswap,
builder.SporkID,
middleware.DefaultUnicastTimeout,
builder.IDTranslator,
builder.CodecFactory(),
slashingViolationsConsumer,
mw := middleware.NewMiddleware(&middleware.Config{
Logger: logger,
Libp2pNode: libp2pNode,
FlowId: nodeID,
BitSwapMetrics: builder.Metrics.Bitswap,
RootBlockID: builder.SporkID,
UnicastMessageTimeout: middleware.DefaultUnicastTimeout,
IdTranslator: builder.IDTranslator,
Codec: builder.CodecFactory(),
SlashingViolationsConsumer: slashing.NewSlashingViolationsConsumer(logger, networkMetrics),
},
middleware.WithMessageValidators(validators...), // use default identifier provider
)
builder.NodeDisallowListDistributor.AddConsumer(mw)
builder.Middleware = mw
return builder.Middleware
}
22 changes: 11 additions & 11 deletions cmd/node_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/onflow/flow-go/network/codec/cbor"
"github.com/onflow/flow-go/network/p2p"
"github.com/onflow/flow-go/network/p2p/connection"
"github.com/onflow/flow-go/network/p2p/distributor"
"github.com/onflow/flow-go/network/p2p/dns"
"github.com/onflow/flow-go/network/p2p/middleware"
"github.com/onflow/flow-go/network/p2p/p2pbuilder"
Expand Down Expand Up @@ -197,8 +196,11 @@ type NetworkConfig struct {
ConnectionManagerConfig *connection.ManagerConfig
// UnicastCreateStreamRetryDelay initial delay used in the exponential backoff for create stream retries
UnicastCreateStreamRetryDelay time.Duration
// size of the queue for notifications about new peers in the disallow list.
DisallowListNotificationCacheSize uint32
// size of the cache keeping the status of disallow-listed peers. Recommended to be 100 * number of authorized nodes.
// Note: this cache is meant to only keep the authorized (i.e., staked) but disallow-listed peers. There is no sybil
// vulnerability for this cache. However, the cache must be large enough to ensure it never runs out of space even if
// the node has not been re-configured for a long time.
DisallowListCacheSize uint32
// UnicastRateLimitersConfig configuration for all unicast rate limiters.
UnicastRateLimitersConfig *UnicastRateLimitersConfig
AlspConfig *AlspConfig
Expand Down Expand Up @@ -291,8 +293,6 @@ type NodeConfig struct {

// UnicastRateLimiterDistributor notifies consumers when a peer's unicast message is rate limited.
UnicastRateLimiterDistributor p2p.UnicastRateLimiterDistributor
// NodeDisallowListDistributor notifies consumers of updates to disallow listing of nodes.
NodeDisallowListDistributor p2p.DisallowListNotificationDistributor
}

// StateExcerptAtBoot stores information about the root snapshot and latest finalized block for use in bootstrapping.
Expand Down Expand Up @@ -333,12 +333,12 @@ func DefaultBaseConfig() *BaseConfig {
BandwidthRateLimit: 0,
BandwidthBurstLimit: middleware.LargeMsgMaxUnicastMsgSize,
},
GossipSubConfig: p2pbuilder.DefaultGossipSubConfig(),
DNSCacheTTL: dns.DefaultTimeToLive,
LibP2PResourceManagerConfig: p2pbuilder.DefaultResourceManagerConfig(),
ConnectionManagerConfig: connection.DefaultConnManagerConfig(),
NetworkConnectionPruning: connection.PruningEnabled,
DisallowListNotificationCacheSize: distributor.DefaultDisallowListNotificationQueueCacheSize,
GossipSubConfig: p2pbuilder.DefaultGossipSubConfig(),
DNSCacheTTL: dns.DefaultTimeToLive,
LibP2PResourceManagerConfig: p2pbuilder.DefaultResourceManagerConfig(),
ConnectionManagerConfig: connection.DefaultConnManagerConfig(),
NetworkConnectionPruning: connection.PruningEnabled,
DisallowListCacheSize: middleware.DisallowListCacheSize,
AlspConfig: &AlspConfig{
SpamRecordCacheSize: alsp.DefaultSpamRecordCacheSize,
SpamReportQueueSize: alsp.DefaultSpamReportQueueSize,
Expand Down
38 changes: 19 additions & 19 deletions cmd/observer/node_builder/observer_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,11 @@ func (builder *ObserverServiceBuilder) InitIDProviders() {
}
builder.IDTranslator = translator.NewHierarchicalIDTranslator(idCache, translator.NewPublicNetworkIDTranslator())

builder.NodeDisallowListDistributor = cmd.BuildDisallowListNotificationDisseminator(builder.DisallowListNotificationCacheSize, builder.MetricsRegisterer, builder.Logger, builder.MetricsEnabled)

// The following wrapper allows to black-list byzantine nodes via an admin command:
// the wrapper overrides the 'Ejected' flag of disallow-listed nodes to true
builder.IdentityProvider, err = cache.NewNodeBlocklistWrapper(idCache, node.DB, builder.NodeDisallowListDistributor)
builder.IdentityProvider, err = cache.NewNodeDisallowListWrapper(idCache, node.DB, func() network.DisallowListNotificationConsumer {
return builder.Middleware
})
if err != nil {
return fmt.Errorf("could not initialize NodeBlockListWrapper: %w", err)
}
Expand Down Expand Up @@ -616,11 +616,6 @@ func (builder *ObserverServiceBuilder) InitIDProviders() {

return nil
})

builder.Component("disallow list notification distributor", func(node *cmd.NodeConfig) (module.ReadyDoneAware, error) {
// distributor is returned as a component to be started and stopped.
return builder.NodeDisallowListDistributor, nil
})
}

func (builder *ObserverServiceBuilder) Initialize() error {
Expand Down Expand Up @@ -731,7 +726,11 @@ func (builder *ObserverServiceBuilder) initPublicLibp2pNode(networkKey crypto.Pr
builder.BaseConfig.BindAddr,
networkKey,
builder.SporkID,
builder.LibP2PResourceManagerConfig).
builder.LibP2PResourceManagerConfig,
&p2p.DisallowListCacheConfig{
MaxSize: builder.BaseConfig.NetworkConfig.DisallowListCacheSize,
Metrics: metrics.DisallowListCacheMetricsFactory(builder.HeroCacheMetricsFactory(), network.PublicNetwork),
}).
SetSubscriptionFilter(
subscription.NewRoleBasedFilter(
subscription.UnstakedRole, builder.IdentityProvider,
Expand Down Expand Up @@ -912,18 +911,19 @@ func (builder *ObserverServiceBuilder) initMiddleware(nodeID flow.Identifier,
validators ...network.MessageValidator,
) network.Middleware {
slashingViolationsConsumer := slashing.NewSlashingViolationsConsumer(builder.Logger, builder.Metrics.Network)
mw := middleware.NewMiddleware(
builder.Logger,
libp2pNode, nodeID,
builder.Metrics.Bitswap,
builder.SporkID,
middleware.DefaultUnicastTimeout,
builder.IDTranslator,
builder.CodecFactory(),
slashingViolationsConsumer,
mw := middleware.NewMiddleware(&middleware.Config{
Logger: builder.Logger,
Libp2pNode: libp2pNode,
FlowId: nodeID,
BitSwapMetrics: builder.Metrics.Bitswap,
RootBlockID: builder.SporkID,
UnicastMessageTimeout: middleware.DefaultUnicastTimeout,
IdTranslator: builder.IDTranslator,
Codec: builder.CodecFactory(),
SlashingViolationsConsumer: slashingViolationsConsumer,
},
middleware.WithMessageValidators(validators...), // use default identifier provider
)
builder.NodeDisallowListDistributor.AddConsumer(mw)
builder.Middleware = mw
return builder.Middleware
}
Expand Down
59 changes: 30 additions & 29 deletions cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ func (fnb *FlowNodeBuilder) BaseFlags() {

// networking event notifications
fnb.flags.Uint32Var(&fnb.BaseConfig.GossipSubConfig.RpcInspector.GossipSubRPCInspectorNotificationCacheSize, "gossipsub-rpc-inspector-notification-cache-size", defaultConfig.GossipSubConfig.RpcInspector.GossipSubRPCInspectorNotificationCacheSize, "cache size for notification events from gossipsub rpc inspector")
fnb.flags.Uint32Var(&fnb.BaseConfig.DisallowListNotificationCacheSize, "disallow-list-notification-cache-size", defaultConfig.DisallowListNotificationCacheSize, "cache size for notification events from disallow list")

// unicast manager options
fnb.flags.DurationVar(&fnb.BaseConfig.UnicastCreateStreamRetryDelay, "unicast-manager-create-stream-retry-delay", defaultConfig.NetworkConfig.UnicastCreateStreamRetryDelay, "Initial delay between failing to establish a connection with another node and retrying. This delay increases exponentially (exponential backoff) with the number of subsequent failures to establish a connection.")
Expand Down Expand Up @@ -413,7 +412,12 @@ func (fnb *FlowNodeBuilder) EnqueueNetworkInit() {
fnb.GossipSubConfig,
fnb.GossipSubRpcInspectorSuite,
fnb.LibP2PResourceManagerConfig,
uniCfg)
uniCfg,
&p2p.DisallowListCacheConfig{
MaxSize: fnb.BaseConfig.NetworkConfig.DisallowListCacheSize,
Metrics: metrics.DisallowListCacheMetricsFactory(fnb.HeroCacheMetricsFactory(), network.PrivateNetwork),
},
)

if err != nil {
return nil, fmt.Errorf("could not create libp2p node builder: %w", err)
Expand Down Expand Up @@ -458,8 +462,13 @@ func (fnb *FlowNodeBuilder) HeroCacheMetricsFactory() metrics.HeroCacheMetricsFa
return metrics.NewNoopHeroCacheMetricsFactory()
}

func (fnb *FlowNodeBuilder) InitFlowNetworkWithConduitFactory(node *NodeConfig, cf network.ConduitFactory, unicastRateLimiters *ratelimit.RateLimiters, peerManagerFilters []p2p.PeerFilter) (network.Network, error) {
var mwOpts []middleware.MiddlewareOption
func (fnb *FlowNodeBuilder) InitFlowNetworkWithConduitFactory(
node *NodeConfig,
cf network.ConduitFactory,
unicastRateLimiters *ratelimit.RateLimiters,
peerManagerFilters []p2p.PeerFilter) (network.Network, error) {

var mwOpts []middleware.OptionFn
if len(fnb.MsgValidators) > 0 {
mwOpts = append(mwOpts, middleware.WithMessageValidators(fnb.MsgValidators...))
}
Expand All @@ -476,20 +485,19 @@ func (fnb *FlowNodeBuilder) InitFlowNetworkWithConduitFactory(node *NodeConfig,
if len(peerManagerFilters) > 0 {
mwOpts = append(mwOpts, middleware.WithPeerManagerFilters(peerManagerFilters))
}

slashingViolationsConsumer := slashing.NewSlashingViolationsConsumer(fnb.Logger, fnb.Metrics.Network)
mw := middleware.NewMiddleware(
fnb.Logger,
fnb.LibP2PNode,
fnb.Me.NodeID(),
fnb.Metrics.Bitswap,
fnb.SporkID,
fnb.BaseConfig.UnicastMessageTimeout,
fnb.IDTranslator,
fnb.CodecFactory(),
slashingViolationsConsumer,
mw := middleware.NewMiddleware(&middleware.Config{
Logger: fnb.Logger,
Libp2pNode: fnb.LibP2PNode,
FlowId: fnb.Me.NodeID(),
BitSwapMetrics: fnb.Metrics.Bitswap,
RootBlockID: fnb.SporkID,
UnicastMessageTimeout: fnb.BaseConfig.UnicastMessageTimeout,
IdTranslator: fnb.IDTranslator,
Codec: fnb.CodecFactory(),
SlashingViolationsConsumer: slashing.NewSlashingViolationsConsumer(fnb.Logger, fnb.Metrics.Network),
},
mwOpts...)
fnb.NodeDisallowListDistributor.AddConsumer(mw)

fnb.Middleware = mw

subscriptionManager := subscription.NewChannelSubscriptionManager(fnb.Middleware)
Expand Down Expand Up @@ -1037,35 +1045,28 @@ func (fnb *FlowNodeBuilder) initStorage() error {
}

func (fnb *FlowNodeBuilder) InitIDProviders() {
fnb.Component("disallow list notification distributor", func(node *NodeConfig) (module.ReadyDoneAware, error) {
// distributor is returned as a component to be started and stopped.
if fnb.NodeDisallowListDistributor == nil {
return nil, fmt.Errorf("disallow list notification distributor has not been set")
}
return fnb.NodeDisallowListDistributor, nil
})
fnb.Module("id providers", func(node *NodeConfig) error {
idCache, err := cache.NewProtocolStateIDCache(node.Logger, node.State, node.ProtocolEvents)
if err != nil {
return fmt.Errorf("could not initialize ProtocolStateIDCache: %w", err)
}
node.IDTranslator = idCache

fnb.NodeDisallowListDistributor = BuildDisallowListNotificationDisseminator(fnb.DisallowListNotificationCacheSize, fnb.MetricsRegisterer, fnb.Logger, fnb.MetricsEnabled)

// The following wrapper allows to disallow-list byzantine nodes via an admin command:
// the wrapper overrides the 'Ejected' flag of disallow-listed nodes to true
disallowListWrapper, err := cache.NewNodeBlocklistWrapper(idCache, node.DB, fnb.NodeDisallowListDistributor)
disallowListWrapper, err := cache.NewNodeDisallowListWrapper(idCache, node.DB, func() network.DisallowListNotificationConsumer {
return fnb.Middleware
})
if err != nil {
return fmt.Errorf("could not initialize NodeBlockListWrapper: %w", err)
}
node.IdentityProvider = disallowListWrapper

// register the disallow list wrapper for dynamic configuration via admin command
err = node.ConfigManager.RegisterIdentifierListConfig("network-id-provider-blocklist",
disallowListWrapper.GetBlocklist, disallowListWrapper.Update)
disallowListWrapper.GetDisallowList, disallowListWrapper.Update)
if err != nil {
return fmt.Errorf("failed to register blocklist with config manager: %w", err)
return fmt.Errorf("failed to register disallow-list wrapper with config manager: %w", err)
}

node.SyncEngineIdentifierProvider = id.NewIdentityFilterIdentifierProvider(
Expand Down
15 changes: 0 additions & 15 deletions cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@ import (
"path/filepath"

"github.com/libp2p/go-libp2p/core/peer"
"github.com/prometheus/client_golang/prometheus"
"github.com/rs/zerolog"

"github.com/onflow/flow-go/model/bootstrap"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/mempool/queue"
"github.com/onflow/flow-go/module/metrics"
"github.com/onflow/flow-go/network/p2p"
"github.com/onflow/flow-go/network/p2p/distributor"
"github.com/onflow/flow-go/state/protocol/inmem"
"github.com/onflow/flow-go/utils/io"
)
Expand Down Expand Up @@ -68,13 +63,3 @@ func rateLimiterPeerFilter(rateLimiter p2p.RateLimiter) p2p.PeerFilter {
return nil
}
}

// BuildDisallowListNotificationDisseminator builds the disallow list notification distributor.
func BuildDisallowListNotificationDisseminator(size uint32, metricsRegistry prometheus.Registerer, logger zerolog.Logger, metricsEnabled bool) p2p.DisallowListNotificationDistributor {
heroStoreOpts := []queue.HeroStoreConfigOption{queue.WithHeroStoreSizeLimit(size)}
if metricsEnabled {
collector := metrics.DisallowListNotificationQueueMetricFactory(metricsRegistry)
heroStoreOpts = append(heroStoreOpts, queue.WithHeroStoreCollector(collector))
}
return distributor.DefaultDisallowListNotificationDistributor(logger, heroStoreOpts...)
}
Loading

0 comments on commit 3ff4476

Please sign in to comment.