factory

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: GPL-3.0 Imports: 160 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateApiResolver added in v1.2.0

func CreateApiResolver(args *ApiResolverArgs) (facade.ApiResolver, error)

CreateApiResolver is able to create an ApiResolver instance that will solve the REST API requests through the node facade TODO: refactor to further decrease node's codebase

func CreateNodesCoordinator added in v1.2.0

func CreateNodesCoordinator(
	nodeShufflerOut ShuffleOutCloser,
	nodesConfig sharding.GenesisNodesSetupHandler,
	prefsConfig config.PreferencesConfig,
	epochStartNotifier epochStart.RegistrationHandler,
	pubKey crypto.PublicKey,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	ratingAndListIndexHandler sharding.ChanceComputer,
	bootStorer storage.Storer,
	nodeShuffler sharding.NodesShuffler,
	currentShardID uint32,
	bootstrapParameters BootstrapParamsHolder,
	startEpoch uint32,
	waitingListFixEnabledEpoch uint32,
	chanNodeStop chan endProcess.ArgEndProcess,
	nodeTypeProvider core.NodeTypeProviderHandler,
) (sharding.NodesCoordinator, error)

CreateNodesCoordinator is the nodes coordinator factory

func CreateShardCoordinator added in v1.2.0

func CreateShardCoordinator(
	nodesConfig sharding.GenesisNodesSetupHandler,
	pubKey crypto.PublicKey,
	prefsConfig config.PreferencesConfig,
	log logger.Logger,
) (sharding.Coordinator, core.NodeType, error)

CreateShardCoordinator is the shard coordinator factory

func NewBootstrapComponentsFactory added in v1.2.0

func NewBootstrapComponentsFactory(args BootstrapComponentsFactoryArgs) (*bootstrapComponentsFactory, error)

NewBootstrapComponentsFactory creates an instance of bootstrapComponentsFactory

func NewConsensusComponentsFactory added in v1.2.0

func NewConsensusComponentsFactory(args ConsensusComponentsFactoryArgs) (*consensusComponentsFactory, error)

NewConsensusComponentsFactory creates an instance of consensusComponentsFactory

func NewCoreComponentsFactory

func NewCoreComponentsFactory(args CoreComponentsFactoryArgs) (*coreComponentsFactory, error)

NewCoreComponentsFactory initializes the factory which is responsible to creating core components

func NewCryptoComponentsFactory

func NewCryptoComponentsFactory(args CryptoComponentsFactoryArgs) (*cryptoComponentsFactory, error)

NewCryptoComponentsFactory returns a new crypto components factory

func NewDataComponentsFactory

func NewDataComponentsFactory(args DataComponentsFactoryArgs) (*dataComponentsFactory, error)

NewDataComponentsFactory will return a new instance of dataComponentsFactory

func NewHeartbeatComponentsFactory added in v1.2.0

func NewHeartbeatComponentsFactory(args HeartbeatComponentsFactoryArgs) (*heartbeatComponentsFactory, error)

NewHeartbeatComponentsFactory creates the heartbeat components factory

func NewManagedBootstrapComponents added in v1.2.0

func NewManagedBootstrapComponents(bootstrapComponentsFactory *bootstrapComponentsFactory) (*managedBootstrapComponents, error)

NewManagedBootstrapComponents creates a managed bootstrap components handler

func NewManagedConsensusComponents added in v1.2.0

func NewManagedConsensusComponents(ccf *consensusComponentsFactory) (*managedConsensusComponents, error)

NewManagedConsensusComponents creates a managed consensus components handler

func NewManagedCoreComponents added in v1.2.0

func NewManagedCoreComponents(ccf *coreComponentsFactory) (*managedCoreComponents, error)

NewManagedCoreComponents creates a new core components handler implementation

func NewManagedCryptoComponents added in v1.2.0

func NewManagedCryptoComponents(ccf *cryptoComponentsFactory) (*managedCryptoComponents, error)

NewManagedCryptoComponents creates a new Crypto components handler

func NewManagedDataComponents added in v1.2.0

func NewManagedDataComponents(dcf *dataComponentsFactory) (*managedDataComponents, error)

NewManagedDataComponents creates a new data components handler

func NewManagedHeartbeatComponents added in v1.2.0

func NewManagedHeartbeatComponents(hcf *heartbeatComponentsFactory) (*managedHeartbeatComponents, error)

NewManagedHeartbeatComponents creates a new heartbeat components handler

func NewManagedNetworkComponents added in v1.2.0

func NewManagedNetworkComponents(ncf *networkComponentsFactory) (*managedNetworkComponents, error)

NewManagedNetworkComponents creates a new data components handler

func NewManagedProcessComponents added in v1.2.0

func NewManagedProcessComponents(pcf *processComponentsFactory) (*managedProcessComponents, error)

NewManagedProcessComponents returns a news instance of managedProcessComponents

func NewManagedStateComponents added in v1.2.0

func NewManagedStateComponents(scf *stateComponentsFactory) (*managedStateComponents, error)

NewManagedStateComponents returns a news instance of managedStateComponents

func NewManagedStatusComponents added in v1.2.0

func NewManagedStatusComponents(scf *statusComponentsFactory) (*managedStatusComponents, error)

NewManagedStatusComponents returns a new instance of managedStatusComponents

func NewNetworkComponentsFactory

func NewNetworkComponentsFactory(
	args NetworkComponentsFactoryArgs,
) (*networkComponentsFactory, error)

NewNetworkComponentsFactory returns a new instance of a network components factory

func NewProcessComponentsFactory added in v1.2.0

func NewProcessComponentsFactory(args ProcessComponentsFactoryArgs) (*processComponentsFactory, error)

NewProcessComponentsFactory will return a new instance of processComponentsFactory

func NewStateComponentsFactory

func NewStateComponentsFactory(args StateComponentsFactoryArgs) (*stateComponentsFactory, error)

NewStateComponentsFactory will return a new instance of stateComponentsFactory

func NewStatusComponentsFactory added in v1.2.0

func NewStatusComponentsFactory(args StatusComponentsFactoryArgs) (*statusComponentsFactory, error)

NewStatusComponentsFactory will return a status components factory

Types

type ApiResolverArgs added in v1.2.0

type ApiResolverArgs struct {
	Configs             *config.Configs
	CoreComponents      CoreComponentsHolder
	DataComponents      DataComponentsHolder
	StateComponents     StateComponentsHolder
	BootstrapComponents BootstrapComponentsHolder
	CryptoComponents    CryptoComponentsHolder
	ProcessComponents   ProcessComponentsHolder
	GasScheduleNotifier core.GasScheduleNotifier
	Bootstrapper        process.Bootstrapper
}

ApiResolverArgs holds the argument needed to create an API resolver

type BootstrapComponentsFactoryArgs added in v1.2.0

type BootstrapComponentsFactoryArgs struct {
	Config            config.Config
	EpochConfig       config.EpochConfig
	RoundConfig       config.RoundConfig
	PrefConfig        config.Preferences
	ImportDbConfig    config.ImportDbConfig
	WorkingDir        string
	CoreComponents    CoreComponentsHolder
	CryptoComponents  CryptoComponentsHolder
	NetworkComponents NetworkComponentsHolder
}

BootstrapComponentsFactoryArgs holds the arguments needed to create a botstrap components factory

type BootstrapComponentsHandler added in v1.2.0

type BootstrapComponentsHandler interface {
	ComponentHandler
	BootstrapComponentsHolder
}

BootstrapComponentsHandler defines the bootstrap components handler actions

type BootstrapComponentsHolder added in v1.2.0

type BootstrapComponentsHolder interface {
	RoundActivationHandler() process.RoundActivationHandler
	EpochStartBootstrapper() EpochStartBootstrapper
	EpochBootstrapParams() BootstrapParamsHolder
	NodeType() core.NodeType
	ShardCoordinator() sharding.Coordinator
	VersionedHeaderFactory() factory.VersionedHeaderFactory
	HeaderVersionHandler() factory.HeaderVersionHandler
	HeaderIntegrityVerifier() factory.HeaderIntegrityVerifierHandler
	IsInterfaceNil() bool
}

BootstrapComponentsHolder holds the bootstrap components

type BootstrapParamsHolder added in v1.2.0

type BootstrapParamsHolder interface {
	Epoch() uint32
	SelfShardID() uint32
	NumOfShards() uint32
	NodesConfig() *sharding.NodesCoordinatorRegistry
	IsInterfaceNil() bool
}

BootstrapParamsHolder gives read access to parameters after bootstrap

type Closer added in v1.2.0

type Closer interface {
	Close() error
}

Closer defines the Close behavior

type ComponentHandler added in v1.2.0

type ComponentHandler interface {
	Create() error
	Close() error
	CheckSubcomponents() error
	String() string
}

ComponentHandler defines the actions common to all component handlers

type ConsensusComponentsFactoryArgs added in v1.2.0

type ConsensusComponentsFactoryArgs struct {
	Config              config.Config
	BootstrapRoundIndex uint64
	HardforkTrigger     HardforkTrigger
	CoreComponents      CoreComponentsHolder
	NetworkComponents   NetworkComponentsHolder
	CryptoComponents    CryptoComponentsHolder
	DataComponents      DataComponentsHolder
	ProcessComponents   ProcessComponentsHolder
	StateComponents     StateComponentsHolder
	StatusComponents    StatusComponentsHolder
	ScheduledProcessor  consensus.ScheduledProcessor
	IsInImportMode      bool
}

ConsensusComponentsFactoryArgs holds the arguments needed to create a consensus components factory

type ConsensusComponentsHandler added in v1.2.0

type ConsensusComponentsHandler interface {
	ComponentHandler
	ConsensusComponentsHolder
}

ConsensusComponentsHandler defines the consensus components handler actions

type ConsensusComponentsHolder added in v1.2.0

type ConsensusComponentsHolder interface {
	Chronology() consensus.ChronologyHandler
	ConsensusWorker() ConsensusWorker
	BroadcastMessenger() consensus.BroadcastMessenger
	ConsensusGroupSize() (int, error)
	HardforkTrigger() HardforkTrigger
	Bootstrapper() process.Bootstrapper
	IsInterfaceNil() bool
}

ConsensusComponentsHolder holds the consensus components

type ConsensusWorker added in v1.2.0

type ConsensusWorker interface {
	Close() error
	StartWorking()
	// AddReceivedMessageCall adds a new handler function for a received message type
	AddReceivedMessageCall(messageType consensus.MessageType, receivedMessageCall func(ctx context.Context, cnsDta *consensus.Message) bool)
	// AddReceivedHeaderHandler adds a new handler function for a received header
	AddReceivedHeaderHandler(handler func(data.HeaderHandler))
	// RemoveAllReceivedMessagesCalls removes all the functions handlers
	RemoveAllReceivedMessagesCalls()
	// ProcessReceivedMessage method redirects the received message to the channel which should handle it
	ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	// Extend does an extension for the subround with subroundId
	Extend(subroundId int)
	// GetConsensusStateChangedChannel gets the channel for the consensusStateChanged
	GetConsensusStateChangedChannel() chan bool
	// ExecuteStoredMessages tries to execute all the messages received which are valid for execution
	ExecuteStoredMessages()
	// DisplayStatistics method displays statistics of worker at the end of the round
	DisplayStatistics()
	// ResetConsensusMessages resets at the start of each round all the previous consensus messages received
	ResetConsensusMessages()
	// ReceivedHeader method is a wired method through which worker will receive headers from network
	ReceivedHeader(headerHandler data.HeaderHandler, headerHash []byte)
	// IsInterfaceNil returns true if there is no value under the interface
	IsInterfaceNil() bool
}

ConsensusWorker is the consensus worker handle for the exported functionality

type CoreComponentsFactoryArgs

type CoreComponentsFactoryArgs struct {
	Config                config.Config
	ConfigPathsHolder     config.ConfigurationPathsHolder
	EpochConfig           config.EpochConfig
	RatingsConfig         config.RatingsConfig
	EconomicsConfig       config.EconomicsConfig
	ImportDbConfig        config.ImportDbConfig
	NodesFilename         string
	WorkingDirectory      string
	ChanStopNodeProcess   chan endProcess.ArgEndProcess
	StatusHandlersFactory factory.StatusHandlerUtilsFactory
}

CoreComponentsFactoryArgs holds the arguments needed for creating a core components factory

type CoreComponentsHandler added in v1.2.0

type CoreComponentsHandler interface {
	ComponentHandler
	CoreComponentsHolder
}

CoreComponentsHandler defines the core components handler actions

type CoreComponentsHolder added in v1.2.0

type CoreComponentsHolder interface {
	InternalMarshalizer() marshal.Marshalizer
	SetInternalMarshalizer(marshalizer marshal.Marshalizer) error
	TxMarshalizer() marshal.Marshalizer
	VmMarshalizer() marshal.Marshalizer
	Hasher() hashing.Hasher
	TxSignHasher() hashing.Hasher
	Uint64ByteSliceConverter() typeConverters.Uint64ByteSliceConverter
	AddressPubKeyConverter() core.PubkeyConverter
	ValidatorPubKeyConverter() core.PubkeyConverter
	StatusHandlerUtils() factory.StatusHandlersUtils
	StatusHandler() core.AppStatusHandler
	PathHandler() storage.PathManagerHandler
	Watchdog() core.WatchdogTimer
	AlarmScheduler() core.TimersScheduler
	SyncTimer() ntp.SyncTimer
	RoundHandler() consensus.RoundHandler
	EconomicsData() process.EconomicsDataHandler
	APIEconomicsData() process.EconomicsDataHandler
	RatingsData() process.RatingsInfoHandler
	Rater() sharding.PeerAccountListAndRatingHandler
	GenesisNodesSetup() sharding.GenesisNodesSetupHandler
	NodesShuffler() sharding.NodesShuffler
	EpochNotifier() process.EpochNotifier
	RoundNotifier() process.RoundNotifier
	EpochStartNotifierWithConfirm() EpochStartNotifierWithConfirm
	ChanStopNodeProcess() chan endProcess.ArgEndProcess
	GenesisTime() time.Time
	ChainID() string
	MinTransactionVersion() uint32
	TxVersionChecker() process.TxVersionCheckerHandler
	EncodedAddressLen() uint32
	NodeTypeProvider() core.NodeTypeProviderHandler
	ArwenChangeLocker() common.Locker
	IsInterfaceNil() bool
}

CoreComponentsHolder holds the core components

type CryptoComponentsFactoryArgs

type CryptoComponentsFactoryArgs struct {
	ValidatorKeyPemFileName              string
	SkIndex                              int
	Config                               config.Config
	CoreComponentsHolder                 CoreComponentsHolder
	ActivateBLSPubKeyMessageVerification bool
	KeyLoader                            KeyLoaderHandler
	IsInImportMode                       bool
	ImportModeNoSigCheck                 bool
}

CryptoComponentsFactoryArgs holds the arguments needed for creating crypto components

type CryptoComponentsHandler added in v1.2.0

type CryptoComponentsHandler interface {
	ComponentHandler
	CryptoComponentsHolder
}

CryptoComponentsHandler defines the crypto components handler actions

type CryptoComponentsHandlerArgs added in v1.2.0

type CryptoComponentsHandlerArgs CryptoComponentsFactoryArgs

CryptoComponentsHandlerArgs holds the arguments required to create a crypto components handler

type CryptoComponentsHolder added in v1.2.0

type CryptoComponentsHolder interface {
	CryptoParamsHolder
	TxSingleSigner() crypto.SingleSigner
	BlockSigner() crypto.SingleSigner
	MultiSigner() crypto.MultiSigner
	PeerSignatureHandler() crypto.PeerSignatureHandler
	SetMultiSigner(ms crypto.MultiSigner) error
	BlockSignKeyGen() crypto.KeyGenerator
	TxSignKeyGen() crypto.KeyGenerator
	MessageSignVerifier() vm.MessageSignVerifier
	Clone() interface{}
	IsInterfaceNil() bool
}

CryptoComponentsHolder holds the crypto components

type CryptoParamsHolder added in v1.2.0

type CryptoParamsHolder interface {
	PublicKey() crypto.PublicKey
	PrivateKey() crypto.PrivateKey
	PublicKeyString() string
	PublicKeyBytes() []byte
	PrivateKeyBytes() []byte
}

CryptoParamsHolder permits access to crypto parameters such as the private and public keys

type DataComponentsFactoryArgs

type DataComponentsFactoryArgs struct {
	Config                        config.Config
	PrefsConfig                   config.PreferencesConfig
	ShardCoordinator              sharding.Coordinator
	Core                          CoreComponentsHolder
	EpochStartNotifier            EpochStartNotifier
	CurrentEpoch                  uint32
	CreateTrieEpochRootHashStorer bool
}

DataComponentsFactoryArgs holds the arguments needed for creating a data components factory

type DataComponentsHandler added in v1.2.0

type DataComponentsHandler interface {
	ComponentHandler
	DataComponentsHolder
}

DataComponentsHandler defines the data components handler actions

type DataComponentsHolder added in v1.2.0

type DataComponentsHolder interface {
	Blockchain() data.ChainHandler
	SetBlockchain(chain data.ChainHandler)
	StorageService() dataRetriever.StorageService
	Datapool() dataRetriever.PoolsHolder
	MiniBlocksProvider() MiniBlockProvider
	Clone() interface{}
	IsInterfaceNil() bool
}

DataComponentsHolder holds the data components

type EconomicsHandler added in v1.1.15

type EconomicsHandler interface {
	LeaderPercentage() float64
	ProtocolSustainabilityPercentage() float64
	ProtocolSustainabilityAddress() string
	MinInflationRate() float64
	MaxInflationRate(year uint32) float64
	DeveloperPercentage() float64
	GenesisTotalSupply() *big.Int
	MaxGasLimitPerBlock(shardID uint32) uint64
	ComputeGasLimit(tx data.TransactionWithFeeHandler) uint64
	ComputeMoveBalanceFee(tx data.TransactionWithFeeHandler) *big.Int
	CheckValidityTxValues(tx data.TransactionWithFeeHandler) error
	MinGasPrice() uint64
	MinGasLimit() uint64
	GasPerDataByte() uint64
	GasPriceModifier() float64
	ComputeFeeForProcessing(tx data.TransactionWithFeeHandler, gasToUse uint64) *big.Int
	IsInterfaceNil() bool
}

EconomicsHandler provides some economics related computation and read access to economics data

type EpochStartBootstrapper added in v1.2.0

type EpochStartBootstrapper interface {
	Bootstrap() (bootstrap.Parameters, error)
	IsInterfaceNil() bool
	Close() error
}

EpochStartBootstrapper defines the epoch start bootstrap functionality

type EpochStartNotifier

type EpochStartNotifier interface {
	RegisterHandler(handler epochStart.ActionHandler)
	UnregisterHandler(handler epochStart.ActionHandler)
	NotifyAll(hdr data.HeaderHandler)
	NotifyAllPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)
	NotifyEpochChangeConfirmed(epoch uint32)
	IsInterfaceNil() bool
}

EpochStartNotifier defines which actions should be done for handling new epoch's events

type EpochStartNotifierWithConfirm added in v1.2.0

type EpochStartNotifierWithConfirm interface {
	EpochStartNotifier
	RegisterForEpochChangeConfirmed(handler func(epoch uint32))
}

EpochStartNotifierWithConfirm defines which actions should be done for handling new epoch's events and confirmation

type HardforkTrigger added in v1.2.0

type HardforkTrigger interface {
	TriggerReceived(payload []byte, data []byte, pkBytes []byte) (bool, error)
	RecordedTriggerMessage() ([]byte, bool)
	Trigger(epoch uint32, withEarlyEndOfEpoch bool) error
	CreateData() []byte
	AddCloser(closer update.Closer) error
	NotifyTriggerReceived() <-chan struct{}
	IsSelfTrigger() bool
	IsInterfaceNil() bool
}

HardforkTrigger defines the hard-fork trigger functionality

type HeartbeatComponentsFactoryArgs added in v1.2.0

type HeartbeatComponentsFactoryArgs struct {
	Config            config.Config
	Prefs             config.Preferences
	AppVersion        string
	GenesisTime       time.Time
	HardforkTrigger   heartbeat.HardforkTrigger
	RedundancyHandler heartbeat.NodeRedundancyHandler
	CoreComponents    CoreComponentsHolder
	DataComponents    DataComponentsHolder
	NetworkComponents NetworkComponentsHolder
	CryptoComponents  CryptoComponentsHolder
	ProcessComponents ProcessComponentsHolder
}

HeartbeatComponentsFactoryArgs holds the arguments needed to create a heartbeat components factory

type HeartbeatComponentsHandler added in v1.2.0

type HeartbeatComponentsHandler interface {
	ComponentHandler
	HeartbeatComponentsHolder
}

HeartbeatComponentsHandler defines the heartbeat components handler actions

type HeartbeatComponentsHolder added in v1.2.0

type HeartbeatComponentsHolder interface {
	MessageHandler() heartbeat.MessageHandler
	Monitor() HeartbeatMonitor
	Sender() HeartbeatSender
	Storer() HeartbeatStorer
	IsInterfaceNil() bool
}

HeartbeatComponentsHolder holds the heartbeat components

type HeartbeatMonitor added in v1.2.0

type HeartbeatMonitor interface {
	ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	GetHeartbeats() []heartbeatData.PubKeyHeartbeat
	IsInterfaceNil() bool
	Cleanup()
	Close() error
}

HeartbeatMonitor monitors the received heartbeat messages

type HeartbeatSender added in v1.2.0

type HeartbeatSender interface {
	SendHeartbeat() error
	IsInterfaceNil() bool
}

HeartbeatSender sends heartbeat messages

type HeartbeatStorer added in v1.2.0

type HeartbeatStorer interface {
	UpdateGenesisTime(genesisTime time.Time) error
	LoadGenesisTime() (time.Time, error)
	SaveKeys(peersSlice [][]byte) error
	LoadKeys() ([][]byte, error)
	IsInterfaceNil() bool
}

HeartbeatStorer provides storage functionality for the heartbeat component

type KeyLoaderHandler added in v1.2.0

type KeyLoaderHandler interface {
	LoadKey(string, int) ([]byte, string, error)
}

KeyLoaderHandler defines the loading of a key from a pem file and index

type MiniBlockProvider added in v1.2.0

type MiniBlockProvider interface {
	GetMiniBlocks(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte)
	GetMiniBlocksFromPool(hashes [][]byte) ([]*block.MiniblockAndHash, [][]byte)
	IsInterfaceNil() bool
}

MiniBlockProvider defines what a miniblock data provider should do

type NetworkComponentsFactoryArgs added in v1.2.0

type NetworkComponentsFactoryArgs struct {
	P2pConfig            config.P2PConfig
	MainConfig           config.Config
	RatingsConfig        config.RatingsConfig
	StatusHandler        core.AppStatusHandler
	Marshalizer          marshal.Marshalizer
	Syncer               p2p.SyncTimer
	PreferredPublicKeys  [][]byte
	BootstrapWaitSeconds uint32
	NodeOperationMode    p2p.NodeOperation
}

NetworkComponentsFactoryArgs holds the arguments to create a network component handler instance

type NetworkComponentsHandler added in v1.2.0

type NetworkComponentsHandler interface {
	ComponentHandler
	NetworkComponentsHolder
}

NetworkComponentsHandler defines the network components handler actions

type NetworkComponentsHolder added in v1.2.0

type NetworkComponentsHolder interface {
	NetworkMessenger() p2p.Messenger
	InputAntiFloodHandler() P2PAntifloodHandler
	OutputAntiFloodHandler() P2PAntifloodHandler
	PubKeyCacher() process.TimeCacher
	PeerBlackListHandler() process.PeerBlackListCacher
	PeerHonestyHandler() PeerHonestyHandler
	PreferredPeersHolderHandler() PreferredPeersHolderHandler
	IsInterfaceNil() bool
}

NetworkComponentsHolder holds the network components

type P2PAntifloodHandler

type P2PAntifloodHandler interface {
	CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error
	ResetForTopic(topic string)
	SetMaxMessagesForTopic(topic string, maxNum uint32)
	SetDebugger(debugger process.AntifloodDebugger) error
	SetPeerValidatorMapper(validatorMapper process.PeerValidatorMapper) error
	SetTopicsForAll(topics ...string)
	ApplyConsensusSize(size int)
	BlacklistPeer(peer core.PeerID, reason string, duration time.Duration)
	IsOriginatorEligibleForTopic(pid core.PeerID, topic string) error
	Close() error
	IsInterfaceNil() bool
}

P2PAntifloodHandler defines the behavior of a component able to signal that the system is too busy (or flooded) processing p2p messages

type PeerHonestyHandler added in v1.2.0

type PeerHonestyHandler interface {
	ChangeScore(pk string, topic string, units int)
	IsInterfaceNil() bool
	Close() error
}

PeerHonestyHandler defines the behaivour of a component able to handle/monitor the peer honesty of nodes which are participating in consensus

type PreferredPeersHolderHandler added in v1.2.3

type PreferredPeersHolderHandler interface {
	Put(publicKey []byte, peerID core.PeerID, shardID uint32)
	Get() map[uint32][]core.PeerID
	Contains(peerID core.PeerID) bool
	Remove(peerID core.PeerID)
	Clear()
	IsInterfaceNil() bool
}

PreferredPeersHolderHandler defines the behavior of a component able to handle preferred peers operations

type ProcessComponentsFactoryArgs added in v1.2.0

type ProcessComponentsFactoryArgs struct {
	Config                 config.Config
	EpochConfig            config.EpochConfig
	PrefConfigs            config.PreferencesConfig
	ImportDBConfig         config.ImportDbConfig
	AccountsParser         genesis.AccountsParser
	SmartContractParser    genesis.InitialSmartContractParser
	GasSchedule            core.GasScheduleNotifier
	NodesCoordinator       sharding.NodesCoordinator
	RequestedItemsHandler  dataRetriever.RequestedItemsHandler
	WhiteListHandler       process.WhiteListHandler
	WhiteListerVerifiedTxs process.WhiteListHandler
	MaxRating              uint32
	SystemSCConfig         *config.SystemSmartContractsConfig
	Version                string
	ImportStartHandler     update.ImportStartHandler
	WorkingDir             string
	HistoryRepo            dblookupext.HistoryRepository

	Data                DataComponentsHolder
	CoreData            CoreComponentsHolder
	Crypto              CryptoComponentsHolder
	State               StateComponentsHolder
	Network             NetworkComponentsHolder
	BootstrapComponents BootstrapComponentsHolder
	StatusComponents    StatusComponentsHolder
}

ProcessComponentsFactoryArgs holds the arguments needed to create a process components factory

type ProcessComponentsHandler added in v1.2.0

type ProcessComponentsHandler interface {
	ComponentHandler
	ProcessComponentsHolder
}

ProcessComponentsHandler defines the process components handler actions

type ProcessComponentsHolder added in v1.2.0

type ProcessComponentsHolder interface {
	NodesCoordinator() sharding.NodesCoordinator
	ShardCoordinator() sharding.Coordinator
	InterceptorsContainer() process.InterceptorsContainer
	ResolversFinder() dataRetriever.ResolversFinder
	RoundHandler() consensus.RoundHandler
	EpochStartTrigger() epochStart.TriggerHandler
	EpochStartNotifier() EpochStartNotifier
	ForkDetector() process.ForkDetector
	BlockProcessor() process.BlockProcessor
	BlackListHandler() process.TimeCacher
	BootStorer() process.BootStorer
	HeaderSigVerifier() process.InterceptedHeaderSigVerifier
	HeaderIntegrityVerifier() process.HeaderIntegrityVerifier
	ValidatorsStatistics() process.ValidatorStatisticsProcessor
	ValidatorsProvider() process.ValidatorsProvider
	BlockTracker() process.BlockTracker
	PendingMiniBlocksHandler() process.PendingMiniBlocksHandler
	RequestHandler() process.RequestHandler
	TxLogsProcessor() process.TransactionLogProcessorDatabase
	HeaderConstructionValidator() process.HeaderConstructionValidator
	PeerShardMapper() process.NetworkShardingCollector
	FallbackHeaderValidator() process.FallbackHeaderValidator
	TransactionSimulatorProcessor() TransactionSimulatorProcessor
	WhiteListHandler() process.WhiteListHandler
	WhiteListerVerifiedTxs() process.WhiteListHandler
	HistoryRepository() dblookupext.HistoryRepository
	ImportStartHandler() update.ImportStartHandler
	RequestedItemsHandler() dataRetriever.RequestedItemsHandler
	NodeRedundancyHandler() consensus.NodeRedundancyHandler
	CurrentEpochProvider() process.CurrentNetworkEpochProviderHandler
	ScheduledTxsExecutionHandler() process.ScheduledTxsExecutionHandler
	IsInterfaceNil() bool
}

ProcessComponentsHolder holds the process components

type ShuffleOutCloser added in v1.2.0

type ShuffleOutCloser interface {
	EndOfProcessingHandler(event endProcess.ArgEndProcess) error
	IsInterfaceNil() bool
	Close() error
}

ShuffleOutCloser defines the action for end of processing

func CreateNodesShuffleOut added in v1.2.0

func CreateNodesShuffleOut(
	nodesConfig sharding.GenesisNodesSetupHandler,
	epochConfig config.EpochStartConfig,
	chanStopNodeProcess chan endProcess.ArgEndProcess,
) (ShuffleOutCloser, error)

CreateNodesShuffleOut is the nodes shuffler closer factory

type StateComponentsFactoryArgs

type StateComponentsFactoryArgs struct {
	Config           config.Config
	EnableEpochs     config.EnableEpochs
	ShardCoordinator sharding.Coordinator
	Core             CoreComponentsHolder
	StorageService   dataRetriever.StorageService
	ProcessingMode   common.NodeProcessingMode
	ChainHandler     chainData.ChainHandler
}

StateComponentsFactoryArgs holds the arguments needed for creating a state components factory

type StateComponentsHandler added in v1.2.0

type StateComponentsHandler interface {
	ComponentHandler
	StateComponentsHolder
}

StateComponentsHandler defines the state components handler actions

type StateComponentsHolder added in v1.2.0

type StateComponentsHolder interface {
	PeerAccounts() state.AccountsAdapter
	AccountsAdapter() state.AccountsAdapter
	AccountsAdapterAPI() state.AccountsAdapter
	TriesContainer() common.TriesHolder
	TrieStorageManagers() map[string]common.StorageManager
	IsInterfaceNil() bool
}

StateComponentsHolder holds the

type StatusComponentsFactoryArgs added in v1.2.0

type StatusComponentsFactoryArgs struct {
	Config             config.Config
	ExternalConfig     config.ExternalConfig
	EconomicsConfig    config.EconomicsConfig
	ShardCoordinator   sharding.Coordinator
	NodesCoordinator   sharding.NodesCoordinator
	EpochStartNotifier EpochStartNotifier
	CoreComponents     CoreComponentsHolder
	DataComponents     DataComponentsHolder
	NetworkComponents  NetworkComponentsHolder
	StateComponents    StateComponentsHolder
	IsInImportMode     bool
}

StatusComponentsFactoryArgs redefines the arguments structure needed for the status components factory

type StatusComponentsHandler added in v1.2.0

type StatusComponentsHandler interface {
	ComponentHandler
	StatusComponentsHolder
	// SetForkDetector should be set before starting Polling for updates
	SetForkDetector(forkDetector process.ForkDetector)
	StartPolling() error
}

StatusComponentsHandler defines the status components handler actions

type StatusComponentsHolder added in v1.2.0

type StatusComponentsHolder interface {
	OutportHandler() outport.OutportHandler
	SoftwareVersionChecker() statistics.SoftwareVersionChecker
	IsInterfaceNil() bool
}

StatusComponentsHolder holds the status components

type TransactionSimulatorProcessor added in v1.2.0

type TransactionSimulatorProcessor interface {
	ProcessTx(tx *transaction.Transaction) (*txSimData.SimulationResults, error)
	IsInterfaceNil() bool
}

TransactionSimulatorProcessor defines the actions which a transaction simulator processor has to implement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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