bootstrap

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEpochStartBootstrap

func NewEpochStartBootstrap(args ArgsEpochStartBootstrap) (*epochStartBootstrap, error)

NewEpochStartBootstrap will return a new instance of epochStartBootstrap

func NewEpochStartMetaBlockProcessor

func NewEpochStartMetaBlockProcessor(
	messenger Messenger,
	handler RequestHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	consensusPercentage uint8,
	minNumConnectedPeersConfig int,
	minNumOfPeersToConsiderBlockValidConfig int,
) (*epochStartMetaBlockProcessor, error)

NewEpochStartMetaBlockProcessor will return a interceptor processor for epoch start meta block

func NewEpochStartMetaSyncer

func NewEpochStartMetaSyncer(args ArgsNewEpochStartMetaSyncer) (*epochStartMetaSyncer, error)

NewEpochStartMetaSyncer will return a new instance of epochStartMetaSyncer

func NewMetaStorageHandler

func NewMetaStorageHandler(
	generalConfig config.Config,
	shardCoordinator sharding.Coordinator,
	pathManagerHandler storage.PathManagerHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	currentEpoch uint32,
	uint64Converter typeConverters.Uint64ByteSliceConverter,
) (*metaStorageHandler, error)

NewMetaStorageHandler will return a new instance of metaStorageHandler

func NewShardStorageHandler

func NewShardStorageHandler(
	generalConfig config.Config,
	shardCoordinator sharding.Coordinator,
	pathManagerHandler storage.PathManagerHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	currentEpoch uint32,
	uint64Converter typeConverters.Uint64ByteSliceConverter,
) (*shardStorageHandler, error)

NewShardStorageHandler will return a new instance of shardStorageHandler

func NewSyncValidatorStatus

func NewSyncValidatorStatus(args ArgsNewSyncValidatorStatus) (*syncValidatorStatus, error)

NewSyncValidatorStatus creates a new validator status process component

Types

type ArgsEpochStartBootstrap

type ArgsEpochStartBootstrap struct {
	DestinationShardAsObserver uint32
	WorkingDir                 string
	DefaultDBPath              string
	DefaultEpochString         string
	DefaultShardString         string
	PublicKey                  crypto.PublicKey
	Marshalizer                marshal.Marshalizer
	TxSignMarshalizer          marshal.Marshalizer
	Hasher                     hashing.Hasher
	Messenger                  Messenger
	GeneralConfig              config.Config
	EconomicsData              *economics.EconomicsData
	SingleSigner               crypto.SingleSigner
	BlockSingleSigner          crypto.SingleSigner
	KeyGen                     crypto.KeyGenerator
	BlockKeyGen                crypto.KeyGenerator
	GenesisNodesConfig         sharding.GenesisNodesSetupHandler
	GenesisShardCoordinator    sharding.Coordinator
	PathManager                storage.PathManagerHandler
	StorageUnitOpener          storage.UnitOpenerHandler
	LatestStorageDataProvider  storage.LatestStorageDataProviderHandler
	Rater                      sharding.ChanceComputer
	Uint64Converter            typeConverters.Uint64ByteSliceConverter
	NodeShuffler               sharding.NodesShuffler
	Rounder                    epochStart.Rounder
	AddressPubkeyConverter     core.PubkeyConverter
	ArgumentsParser            process.ArgumentsParser
	StatusHandler              core.AppStatusHandler
}

ArgsEpochStartBootstrap holds the arguments needed for creating an epoch start data provider component

type ArgsNewEpochStartMetaSyncer

type ArgsNewEpochStartMetaSyncer struct {
	RequestHandler     RequestHandler
	Messenger          Messenger
	Marshalizer        marshal.Marshalizer
	TxSignMarshalizer  marshal.Marshalizer
	ShardCoordinator   sharding.Coordinator
	KeyGen             crypto.KeyGenerator
	BlockKeyGen        crypto.KeyGenerator
	Hasher             hashing.Hasher
	Signer             crypto.SingleSigner
	BlockSigner        crypto.SingleSigner
	ChainID            []byte
	EconomicsData      *economics.EconomicsData
	WhitelistHandler   process.WhiteListHandler
	AddressPubkeyConv  core.PubkeyConverter
	NonceConverter     typeConverters.Uint64ByteSliceConverter
	StartInEpochConfig config.EpochStartConfig
	ArgsParser         process.ArgumentsParser
}

ArgsNewEpochStartMetaSyncer -

type ArgsNewSyncValidatorStatus

type ArgsNewSyncValidatorStatus struct {
	DataPool           dataRetriever.PoolsHolder
	Marshalizer        marshal.Marshalizer
	Hasher             hashing.Hasher
	RequestHandler     process.RequestHandler
	ChanceComputer     sharding.ChanceComputer
	GenesisNodesConfig sharding.GenesisNodesSetupHandler
	NodeShuffler       sharding.NodesShuffler
	PubKey             []byte
	ShardIdAsObserver  uint32
}

ArgsNewSyncValidatorStatus holds the arguments needed for creating a new validator status process component

type ComponentsNeededForBootstrap

type ComponentsNeededForBootstrap struct {
	EpochStartMetaBlock *block.MetaBlock
	PreviousEpochStart  *block.MetaBlock
	ShardHeader         *block.Header
	NodesConfig         *sharding.NodesCoordinatorRegistry
	Headers             map[string]data.HeaderHandler
	ShardCoordinator    sharding.Coordinator
	UserAccountTries    map[string]data.Trie
	PeerAccountTries    map[string]data.Trie
	PendingMiniBlocks   map[string]*block.MiniBlock
}

ComponentsNeededForBootstrap holds the components which need to be initialized from network

type EpochStartMetaBlockInterceptorProcessor

type EpochStartMetaBlockInterceptorProcessor interface {
	process.InterceptorProcessor
	GetEpochStartMetaBlock(ctx context.Context) (*block.MetaBlock, error)
}

EpochStartMetaBlockInterceptorProcessor defines the methods to sync an epoch start metablock

type Messenger

type Messenger interface {
	dataRetriever.MessageHandler
	dataRetriever.TopicHandler
	UnregisterMessageProcessor(topic string) error
	UnregisterAllMessageProcessors() error
	UnjoinAllTopics() error
	ConnectedPeers() []core.PeerID
}

Messenger defines which methods a p2p messenger should implement

type Parameters

type Parameters struct {
	Epoch       uint32
	SelfShardId uint32
	NumOfShards uint32
	NodesConfig *sharding.NodesCoordinatorRegistry
}

Parameters defines the DTO for the result produced by the bootstrap component

type RequestHandler

type RequestHandler interface {
	RequestStartOfEpochMetaBlock(epoch uint32)
	SetNumPeersToQuery(topic string, intra int, cross int) error
	GetNumPeersToQuery(topic string) (int, int, error)
	IsInterfaceNil() bool
}

RequestHandler defines which methods a request handler should implement

type StartInEpochNodesCoordinator

type StartInEpochNodesCoordinator interface {
	EpochStartPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)
	NodesCoordinatorToRegistry() *sharding.NodesCoordinatorRegistry
	ShardIdForEpoch(epoch uint32) (uint32, error)
	IsInterfaceNil() bool
}

StartInEpochNodesCoordinator defines the methods to process and save nodesCoordinator information to storage

type StartOfEpochNodesConfigHandler

type StartOfEpochNodesConfigHandler interface {
	NodesConfigFromMetaBlock(currMetaBlock *block.MetaBlock, prevMetaBlock *block.MetaBlock) (*sharding.NodesCoordinatorRegistry, uint32, error)
	IsInterfaceNil() bool
}

StartOfEpochNodesConfigHandler defines the methods to process nodesConfig from epoch start metablocks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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