node_builder

package
v0.25.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2022 License: AGPL-3.0 Imports: 67 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapIdentities

func BootstrapIdentities(addresses []string, keys []string) (flow.IdentityList, error)

BootstrapIdentities converts the bootstrap node addresses and keys to a Flow Identity list where each Flow Identity is initialized with the passed address, the networking key and the Node ID set to ZeroID, role set to Access, 0 stake and no staking key.

Types

type AccessNodeBuilder

type AccessNodeBuilder interface {
	cmd.NodeBuilder

	// IsStaked returns True if this is a staked Access Node, False otherwise
	IsStaked() bool
}

type AccessNodeConfig

type AccessNodeConfig struct {
	NetworkKey crypto.PrivateKey // the networking key passed in by the caller when being used as a library

	ExecutionNodeAddress string // deprecated
	HistoricalAccessRPCs []access.AccessAPIClient

	PublicNetworkConfig PublicNetworkConfig
	// contains filtered or unexported fields
}

AccessNodeConfig defines all the user defined parameters required to bootstrap an access node 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.

func DefaultAccessNodeConfig

func DefaultAccessNodeConfig() *AccessNodeConfig

DefaultAccessNodeConfig defines all the default values for the AccessNodeConfig

type FlowAccessNodeBuilder

type FlowAccessNodeBuilder struct {
	*cmd.FlowNodeBuilder
	*AccessNodeConfig

	// components
	LibP2PNode                 *p2p.Node
	FollowerState              protocol.MutableState
	SyncCore                   *synchronization.Core
	RpcEng                     *rpc.Engine
	FinalizationDistributor    *pubsub.FinalizationDistributor
	FinalizedHeader            *synceng.FinalizedHeaderCache
	CollectionRPC              access.AccessAPIClient
	TransactionTimings         *stdmap.TransactionTimings
	CollectionsToMarkFinalized *stdmap.Times
	CollectionsToMarkExecuted  *stdmap.Times
	BlocksToMarkExecuted       *stdmap.Times
	TransactionMetrics         module.TransactionMetrics
	PingMetrics                module.PingMetrics
	Committee                  hotstuff.Committee
	Finalized                  *flow.Header
	Pending                    []*flow.Header
	FollowerCore               module.HotStuffFollower
	// for the unstaked access node, the sync engine participants provider is the libp2p peer store which is not
	// available until after the network has started. Hence, a factory function that needs to be called just before
	// creating the sync engine
	SyncEngineParticipantsProviderFactory func() id.IdentifierProvider

	// engines
	IngestEng   *ingestion.Engine
	RequestEng  *requester.Engine
	FollowerEng *followereng.Engine
	SyncEng     *synceng.Engine
}

FlowAccessNodeBuilder provides the common functionality needed to bootstrap a Flow staked and unstaked access node It is composed of the FlowNodeBuilder, the AccessNodeConfig and contains all the components and modules needed for the staked and unstaked access nodes

func FlowAccessNode

func FlowAccessNode(opts ...Option) *FlowAccessNodeBuilder

func (*FlowAccessNodeBuilder) BuildConsensusFollower

func (builder *FlowAccessNodeBuilder) BuildConsensusFollower() AccessNodeBuilder

func (*FlowAccessNodeBuilder) IsStaked

func (builder *FlowAccessNodeBuilder) IsStaked() bool

func (*FlowAccessNodeBuilder) ParseFlags

func (builder *FlowAccessNodeBuilder) ParseFlags() error

type Option

type Option func(*AccessNodeConfig)

func SupportsUnstakedNode added in v0.21.1

func SupportsUnstakedNode(enable bool) Option

func WithBaseOptions

func WithBaseOptions(baseOptions []cmd.Option) Option

func WithBootStrapPeers

func WithBootStrapPeers(bootstrapNodes ...*flow.Identity) Option

func WithNetworkKey added in v0.21.1

func WithNetworkKey(key crypto.PrivateKey) Option

type PublicNetworkConfig added in v0.23.9

type PublicNetworkConfig struct {
	// NetworkKey crypto.PublicKey // TODO: do we need a different key for the public network?
	BindAddress string
	Network     network.Network
	Metrics     module.NetworkMetrics
}

type StakedAccessNodeBuilder

type StakedAccessNodeBuilder struct {
	*FlowAccessNodeBuilder
}

StakedAccessNodeBuilder builds a staked access node. The staked access node can optionally participate in the unstaked network publishing data for the unstaked access node downstream.

func NewStakedAccessNodeBuilder

func NewStakedAccessNodeBuilder(builder *FlowAccessNodeBuilder) *StakedAccessNodeBuilder

func (*StakedAccessNodeBuilder) Build

func (builder *StakedAccessNodeBuilder) Build() (cmd.Node, error)

func (*StakedAccessNodeBuilder) InitIDProviders added in v0.21.1

func (builder *StakedAccessNodeBuilder) InitIDProviders()

func (*StakedAccessNodeBuilder) Initialize

func (builder *StakedAccessNodeBuilder) Initialize() error

type UnstakedAccessNodeBuilder

type UnstakedAccessNodeBuilder struct {
	*FlowAccessNodeBuilder
	// contains filtered or unexported fields
}

func NewUnstakedAccessNodeBuilder

func NewUnstakedAccessNodeBuilder(builder *FlowAccessNodeBuilder) *UnstakedAccessNodeBuilder

func (*UnstakedAccessNodeBuilder) Build added in v0.21.1

func (builder *UnstakedAccessNodeBuilder) Build() (cmd.Node, error)

Build enqueues the sync engine and the follower engine for the unstaked access node. Currently, the unstaked AN only runs the follower engine.

func (*UnstakedAccessNodeBuilder) InitIDProviders added in v0.21.1

func (builder *UnstakedAccessNodeBuilder) InitIDProviders()

func (*UnstakedAccessNodeBuilder) Initialize

func (builder *UnstakedAccessNodeBuilder) Initialize() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL