factory

package
v1.0.100 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: GPL-3.0 Imports: 94 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlsConsensusType specifies the signature scheme used in the consensus
	BlsConsensusType = "bls"

	// MaxTxsToRequest specifies the maximum number of txs to request
	MaxTxsToRequest = 100
)

Variables

This section is empty.

Functions

func CreateSoftwareVersionChecker

func CreateSoftwareVersionChecker(statusHandler core.AppStatusHandler) (*softwareVersion.SoftwareVersionChecker, error)

CreateSoftwareVersionChecker will create a new software version checker and will start check if a new software version is available

func CreateStatusHandlers

func CreateStatusHandlers(arguments *ArgStatusHandlers) (*statusHandlersInfo, error)

CreateStatusHandlers will return a slice of status handlers

func GetPkEncoded

func GetPkEncoded(pubKey crypto.PublicKey) string

GetPkEncoded returns the encoded public key

func GetSigningParams

func GetSigningParams(
	ctx *cli.Context,
	skName string,
	skIndexName string,
	skPemFileName string,
	suite crypto.Suite,
) (keyGen crypto.KeyGenerator, privKey crypto.PrivateKey, pubKey crypto.PublicKey, err error)

GetSigningParams returns a key generator, a private key, and a public key

func NewCoreComponentsFactoryArgs

func NewCoreComponentsFactoryArgs(config *config.Config, pathManager storage.PathManagerHandler, shardId string, chainID []byte) *coreComponentsFactoryArgs

NewCoreComponentsFactoryArgs initializes the arguments necessary for creating the core components

func NewCryptoComponentsFactoryArgs

func NewCryptoComponentsFactoryArgs(
	ctx *cli.Context,
	config *config.Config,
	nodesConfig *sharding.NodesSetup,
	shardCoordinator sharding.Coordinator,
	keyGen crypto.KeyGenerator,
	privKey crypto.PrivateKey,
	log logger.Logger,
) *cryptoComponentsFactoryArgs

NewCryptoComponentsFactoryArgs initializes the arguments necessary for creating the crypto components

func NewDataComponentsFactoryArgs

func NewDataComponentsFactoryArgs(
	config *config.Config,
	economicsData *economics.EconomicsData,
	shardCoordinator sharding.Coordinator,
	core *Core,
	pathManager storage.PathManagerHandler,
	epochStartNotifier EpochStartNotifier,
	currentEpoch uint32,
) *dataComponentsFactoryArgs

NewDataComponentsFactoryArgs initializes the arguments necessary for creating the data components

func NewProcessComponentsFactoryArgs

func NewProcessComponentsFactoryArgs(
	coreComponents *coreComponentsFactoryArgs,
	genesisConfig *sharding.Genesis,
	economicsData *economics.EconomicsData,
	nodesConfig *sharding.NodesSetup,
	gasSchedule map[string]map[string]uint64,
	syncer ntp.SyncTimer,
	shardCoordinator sharding.Coordinator,
	nodesCoordinator sharding.NodesCoordinator,
	data *Data,
	coreData *Core,
	crypto *Crypto,
	state *State,
	network *Network,
	coreServiceContainer serviceContainer.Core,
	requestedItemsHandler dataRetriever.RequestedItemsHandler,
	epochStartNotifier EpochStartNotifier,
	epochStart *config.EpochStartConfig,
	startEpochNum uint32,
	rater sharding.RaterHandler,
	sizeCheckDelta uint32,
	stateCheckpointModulus uint,
	maxComputableRounds uint64,
	numConcurrentResolverJobs int32,
	minSizeInBytes uint32,
	maxSizeInBytes uint32,
	maxRating uint32,
) *processComponentsFactoryArgs

NewProcessComponentsFactoryArgs initializes the arguments necessary for creating the process components

func NewStateComponentsFactoryArgs

func NewStateComponentsFactoryArgs(
	config *config.Config,
	genesisConfig *sharding.Genesis,
	shardCoordinator sharding.Coordinator,
	core *Core,
	pathManager storage.PathManagerHandler,
) *stateComponentsFactoryArgs

NewStateComponentsFactoryArgs initializes the arguments necessary for creating the state components

func PrepareNetworkShardingCollector

func PrepareNetworkShardingCollector(
	network *Network,
	config *config.Config,
	nodesCoordinator sharding.NodesCoordinator,
	coordinator sharding.Coordinator,
	epochSubscriber sharding.EpochStartSubscriber,
	epochShard uint32,
) (*networksharding.PeerShardMapper, error)

PrepareNetworkShardingCollector will create the network sharding collector and apply it to the network messenger

Types

type ArgStatusHandlers

type ArgStatusHandlers struct {
	LogViewName                  string
	ServersConfigurationFileName string
	Ctx                          *cli.Context
	Marshalizer                  marshal.Marshalizer
	Uint64ByteSliceConverter     typeConverters.Uint64ByteSliceConverter
}

ArgStatusHandlers is a struct that stores arguments needed to create status handlers

func NewStatusHandlersFactoryArgs

func NewStatusHandlersFactoryArgs(
	logViewName string,
	ctx *cli.Context,
	marshalizer marshal.Marshalizer,
	uint64ByteSliceConverter typeConverters.Uint64ByteSliceConverter,
) *ArgStatusHandlers

NewStatusHandlersFactoryArgs will return arguments for status handlers

type Core

type Core struct {
	Hasher                   hashing.Hasher
	InternalMarshalizer      marshal.Marshalizer
	VmMarshalizer            marshal.Marshalizer
	TxSignMarshalizer        marshal.Marshalizer
	TriesContainer           state.TriesHolder
	Uint64ByteSliceConverter typeConverters.Uint64ByteSliceConverter
	StatusHandler            core.AppStatusHandler
	ChainID                  []byte
}

Core struct holds the core components of the Elrond protocol

func CoreComponentsFactory

func CoreComponentsFactory(args *coreComponentsFactoryArgs) (*Core, error)

CoreComponentsFactory creates the core components

type Crypto

type Crypto struct {
	TxSingleSigner      crypto.SingleSigner
	SingleSigner        crypto.SingleSigner
	MultiSigner         crypto.MultiSigner
	BlockSignKeyGen     crypto.KeyGenerator
	TxSignKeyGen        crypto.KeyGenerator
	InitialPubKeys      map[uint32][]string
	MessageSignVerifier vm.MessageSignVerifier
}

Crypto struct holds the crypto components of the Elrond protocol

func CryptoComponentsFactory

func CryptoComponentsFactory(args *cryptoComponentsFactoryArgs) (*Crypto, error)

CryptoComponentsFactory creates the crypto components

type Data

type Data struct {
	Blkc     data.ChainHandler
	Store    dataRetriever.StorageService
	Datapool dataRetriever.PoolsHolder
}

Data struct holds the data components of the Elrond protocol

func DataComponentsFactory

func DataComponentsFactory(args *dataComponentsFactoryArgs) (*Data, error)

DataComponentsFactory creates the data components

type EpochStartNotifier

type EpochStartNotifier interface {
	RegisterHandler(handler epochStart.EpochStartHandler)
	UnregisterHandler(handler epochStart.EpochStartHandler)
	NotifyAll(hdr data.HeaderHandler)
	NotifyAllPrepare(metaHdr data.HeaderHandler)
	IsInterfaceNil() bool
}

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

type HeaderSigVerifierHandler

type HeaderSigVerifierHandler interface {
	VerifyRandSeed(header data.HeaderHandler) error
	VerifyRandSeedAndLeaderSignature(header data.HeaderHandler) error
	VerifySignature(header data.HeaderHandler) error
	IsInterfaceNil() bool
}

HeaderSigVerifierHandler is the interface needed to check a header if is correct

type Network

type Network struct {
	NetMessenger           p2p.Messenger
	InputAntifloodHandler  P2PAntifloodHandler
	OutputAntifloodHandler P2PAntifloodHandler
}

Network struct holds the network components of the Elrond protocol

func NetworkComponentsFactory

func NetworkComponentsFactory(
	p2pConfig config.P2PConfig,
	mainConfig config.Config,
	statusHandler core.AppStatusHandler,
) (*Network, error)

NetworkComponentsFactory creates the network components

type P2PAntifloodHandler

type P2PAntifloodHandler interface {
	CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer p2p.PeerID) error
	CanProcessMessageOnTopic(peer p2p.PeerID, topic string) error
	ResetForTopic(topic string)
	SetMaxMessagesForTopic(topic string, maxNum uint32)
	IsInterfaceNil() bool
}

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

type Process

type Process struct {
	InterceptorsContainer    process.InterceptorsContainer
	ResolversFinder          dataRetriever.ResolversFinder
	Rounder                  consensus.Rounder
	EpochStartTrigger        epochStart.TriggerHandler
	ForkDetector             process.ForkDetector
	BlockProcessor           process.BlockProcessor
	BlackListHandler         process.BlackListHandler
	BootStorer               process.BootStorer
	HeaderSigVerifier        HeaderSigVerifierHandler
	ValidatorsStatistics     process.ValidatorStatisticsProcessor
	ValidatorsProvider       process.ValidatorsProvider
	BlockTracker             process.BlockTracker
	PendingMiniBlocksHandler process.PendingMiniBlocksHandler
	RequestHandler           process.RequestHandler
}

Process struct holds the process components of the Elrond protocol

func ProcessComponentsFactory

func ProcessComponentsFactory(args *processComponentsFactoryArgs) (*Process, error)

ProcessComponentsFactory creates the process components

type State

type State struct {
	AddressConverter    state.AddressConverter
	BLSAddressConverter state.AddressConverter
	PeerAccounts        state.AccountsAdapter
	AccountsAdapter     state.AccountsAdapter
	InBalanceForShard   map[string]*big.Int
}

State struct holds the state components of the Elrond protocol

func StateComponentsFactory

func StateComponentsFactory(args *stateComponentsFactoryArgs) (*State, error)

StateComponentsFactory creates the state components

Jump to

Keyboard shortcuts

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