factory

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: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccountsAdapterCreation = errors.New("error creating accounts adapter")

ErrAccountsAdapterCreation signals that the accounts adapter cannot be created based on provided data

View Source
var ErrBlockchainCreation = errors.New("can not create blockchain")

ErrBlockchainCreation signals that the blockchain cannot be created

View Source
var ErrDataPoolCreation = errors.New("can not create data pool")

ErrDataPoolCreation signals that the data pool cannot be created

View Source
var ErrDataStoreCreation = errors.New("can not create data store")

ErrDataStoreCreation signals that the data store cannot be created

View Source
var ErrHasherCreation = errors.New("error creating hasher")

ErrHasherCreation signals that the hasher cannot be created based on provided data

View Source
var ErrMarshalizerCreation = errors.New("error creating marshalizer")

ErrMarshalizerCreation signals that the marshalizer cannot be created based on provided data

View Source
var ErrMissingConsensusConfig = errors.New("no consensus type provided in config file")

ErrMissingConsensusConfig signals that consensus type isn't specified in the configuration file

View Source
var ErrMissingMultiHasherConfig = errors.New("no multisig hasher provided in config file")

ErrMissingMultiHasherConfig signals that the multihasher type isn't specified in the configuration file

View Source
var ErrMultiSigCreation = errors.New("could not start creation of multiSigner")

ErrMultiSigCreation signals that the multisigner couldn't be created

View Source
var ErrMultiSigHasherMissmatch = errors.New("wrong multisig hasher provided for bls consensus type")

ErrMultiSigHasherMissmatch signals that an invalid multisig hasher was provided

View Source
var ErrNilCoreComponents = errors.New("nil core components provided")

ErrNilCoreComponents signals that nil core components have been provided

View Source
var ErrNilEconomicsData = errors.New("nil economics data provided")

ErrNilEconomicsData signals that a nil economics data handler has been provided

View Source
var ErrNilEpochStartNotifier = errors.New("nil epoch start notifier provided")

ErrNilEpochStartNotifier signals that a nil epoch start notifier has been provided

View Source
var ErrNilHasher = errors.New("nil hasher provided")

ErrNilHasher signals that a nil hasher has been provided

View Source
var ErrNilKeyGen = errors.New("nil key generator provided")

ErrNilKeyGen signals that a nil key generator has been provided

View Source
var ErrNilMarshalizer = errors.New("nil marshalizer provided")

ErrNilMarshalizer signals that a nil marshalizer has been provided

View Source
var ErrNilNodesConfig = errors.New("nil nodes configuration provided")

ErrNilNodesConfig signals that a nil nodes configuration has been provided

View Source
var ErrNilPathManager = errors.New("nil path manager provided")

ErrNilPathManager signals that a nil path manager has been provided

View Source
var ErrNilPrivateKey = errors.New("nil private key provided")

ErrNilPrivateKey signals that a nil private key has been provided

View Source
var ErrNilPubKeyConverter = errors.New("nil public key converter provided")

ErrNilPubKeyConverter signals that a nil public key converter has been provided

View Source
var ErrNilShardCoordinator = errors.New("nil shard coordinator provided")

ErrNilShardCoordinator signals that nil core components have been provided

View Source
var ErrNilStatusHandler = errors.New("nil status handler provided")

ErrNilStatusHandler signals that a nil status handler has been provided

View Source
var ErrNilSuite = errors.New("nil suite provided")

ErrNilSuite signals that a nil suite has been provided

View Source
var ErrNilTriesComponents = errors.New("nil tries components provided")

ErrNilTriesComponents signals that nil tries components have been provided

View Source
var ErrPubKeyConverterCreation = errors.New("error creating public key converter")

ErrPubKeyConverterCreation signals that the public key converter cannot be created based on provided data

View Source
var ErrPublicKeyMismatch = errors.New("public key mismatch between the computed and the one read from the file")

ErrPublicKeyMismatch signals that the read public key mismatch the one read

View Source
var ErrWrongTypeAssertion = errors.New("wrong type assertion")

ErrWrongTypeAssertion signals that a wrong type assertion occurred

Functions

func NewCryptoComponentsFactory

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

NewCryptoComponentsFactory returns a new crypto components factory

func NewCryptoSigningParamsLoader

func NewCryptoSigningParamsLoader(
	pubkeyConverter core.PubkeyConverter,
	skIndex int,
	skPemFileName string,
	suite crypto.Suite,
) (*cryptoSigningParamsLoader, error)

NewCryptoSigningParamsLoader returns a new instance of cryptoSigningParamsLoader

func NewDataComponentsFactory

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

NewDataComponentsFactory will return a new instance of dataComponentsFactory

func NewNetworkComponentsFactory

func NewNetworkComponentsFactory(
	p2pConfig config.P2PConfig,
	mainConfig config.Config,
	statusHandler core.AppStatusHandler,
	marshalizer marshal.Marshalizer,
	syncer p2p.SyncTimer,
) (*networkComponentsFactory, error)

NewNetworkComponentsFactory returns a new instance of a network components factory

func NewStateComponentsFactory

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

NewStateComponentsFactory will return a new instance of stateComponentsFactory

func NewTriesComponentsFactory

func NewTriesComponentsFactory(args TriesComponentsFactoryArgs) (*triesComponentsFactory, error)

NewTriesComponentsFactory return a new instance of tries components factory

Types

type CoreComponents

type CoreComponents struct {
	Hasher                   hashing.Hasher
	InternalMarshalizer      marshal.Marshalizer
	VmMarshalizer            marshal.Marshalizer
	TxSignMarshalizer        marshal.Marshalizer
	Uint64ByteSliceConverter typeConverters.Uint64ByteSliceConverter
	StatusHandler            core.AppStatusHandler
	ChainID                  []byte
	MinTransactionVersion    uint32
}

CoreComponents is the DTO used for core components

type CoreComponentsFactory

type CoreComponentsFactory struct {
	MinTransactionVersion uint32
	// contains filtered or unexported fields
}

CoreComponentsFactory is responsible for creating the core components

func NewCoreComponentsFactory

func NewCoreComponentsFactory(args CoreComponentsFactoryArgs) *CoreComponentsFactory

NewCoreComponentsFactory initializes the factory which is responsible to creating core components

func (*CoreComponentsFactory) Create

func (ccf *CoreComponentsFactory) Create() (*CoreComponents, error)

Create creates the core components

type CoreComponentsFactoryArgs

type CoreComponentsFactoryArgs struct {
	Config                config.Config
	ShardId               string
	ChainID               []byte
	MinTransactionVersion uint32
}

CoreComponentsFactoryArgs holds the arguments needed for creating a core components factory

type CryptoComponents

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

CryptoComponents struct holds the crypto components

type CryptoComponentsFactoryArgs

type CryptoComponentsFactoryArgs struct {
	Config                               config.Config
	NodesConfig                          NodesSetupHandler
	ShardCoordinator                     sharding.Coordinator
	KeyGen                               crypto.KeyGenerator
	PrivKey                              crypto.PrivateKey
	ActivateBLSPubKeyMessageVerification bool
}

CryptoComponentsFactoryArgs holds the arguments needed for creating crypto components

type CryptoParams

type CryptoParams struct {
	KeyGenerator    crypto.KeyGenerator
	PrivateKey      crypto.PrivateKey
	PublicKey       crypto.PublicKey
	PublicKeyBytes  []byte
	PublicKeyString string
}

CryptoParams is a DTO for holding block signing parameters

type DataComponents

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

DataComponents struct holds the data components

type DataComponentsFactoryArgs

type DataComponentsFactoryArgs struct {
	Config             config.Config
	EconomicsData      *economics.EconomicsData
	ShardCoordinator   sharding.Coordinator
	Core               *CoreComponents
	PathManager        storage.PathManagerHandler
	EpochStartNotifier EpochStartNotifier
	CurrentEpoch       uint32
}

DataComponentsFactoryArgs holds the arguments needed for creating a data components factory

type EpochStartNotifier

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

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

type NetworkComponents

type NetworkComponents struct {
	NetMessenger           p2p.Messenger
	InputAntifloodHandler  P2PAntifloodHandler
	OutputAntifloodHandler P2PAntifloodHandler
	PeerBlackListHandler   process.PeerBlackListCacher
	PkTimeCache            process.TimeCacher
}

NetworkComponents struct holds the network components

type NodesSetupHandler

type NodesSetupHandler interface {
	InitialNodesPubKeys() map[uint32][]string
	InitialEligibleNodesPubKeysForShard(shardId uint32) ([]string, error)
	IsInterfaceNil() bool
}

NodesSetupHandler defines which actions should be done for handling initial nodes setup

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
	IsInterfaceNil() bool
}

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

type StateComponents

type StateComponents struct {
	AddressPubkeyConverter   core.PubkeyConverter
	ValidatorPubkeyConverter core.PubkeyConverter
	PeerAccounts             state.AccountsAdapter
	AccountsAdapter          state.AccountsAdapter
	InBalanceForShard        map[string]*big.Int
}

StateComponents struct holds the state components of the Dharitri protocol

type StateComponentsFactoryArgs

type StateComponentsFactoryArgs struct {
	Config           config.Config
	ShardCoordinator sharding.Coordinator
	Core             *CoreComponents
	Tries            *TriesComponents
	PathManager      storage.PathManagerHandler
}

StateComponentsFactoryArgs holds the arguments needed for creating a state components factory

type TriesComponents

type TriesComponents struct {
	TriesContainer      state.TriesHolder
	TrieStorageManagers map[string]data.StorageManager
}

TriesComponents holds the tries components

type TriesComponentsFactoryArgs

type TriesComponentsFactoryArgs struct {
	Marshalizer      marshal.Marshalizer
	Hasher           hashing.Hasher
	PathManager      storage.PathManagerHandler
	ShardCoordinator sharding.Coordinator
	Config           config.Config
}

TriesComponentsFactoryArgs holds the arguments needed for creating a tries components factory

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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