Versions in this module Expand all Collapse all v0 v0.0.1 Nov 7, 2024 Changes in this version + var ErrCouldNotParseAddress = errors.New("could not parse node's address") + var ErrCouldNotParsePubKey = errors.New("could not parse node's public key") + var ErrInvalidMaximumNumberOfShards = errors.New("trying to set an invalid maximum number of shards") + var ErrMinNodesPerShardSmallerThanConsensusSize = errors.New("minimum nodes per shard is smaller than consensus group size") + var ErrNegativeOrZeroConsensusGroupSize = errors.New("negative or zero consensus group size") + var ErrNilEndOfProcessingHandler = errors.New("nil end of processing handler") + var ErrNilOwnPublicKey = errors.New("nil own public key") + var ErrNilPubkeyConverter = errors.New("trying to set nil pubkey converter") + var ErrNoPubKeys = errors.New("no public keys defined") + var ErrNodesSizeSmallerThanMinNoOfNodes = errors.New("length of nodes defined is smaller than min nodes per shard required") + var ErrPublicKeyNotFoundInGenesis = errors.New("public key is not valid, it is missing from genesis file") + var ErrShardIdOutOfRange = errors.New("shard id out of range") + func NewMultiShardCoordinator(numberOfShards, selfId uint32) (*multiShardCoordinator, error) + func NewShuffledOutTrigger(ownPubKey []byte, currentShardID uint32, ...) (*shuffledOutTrigger, error) + type Coordinator interface + CommunicationIdentifier func(destShardID uint32) string + ComputeId func(address []byte) uint32 + IsInterfaceNil func() bool + NumberOfShards func() uint32 + SameShard func(firstAddress, secondAddress []byte) bool + SelfId func() uint32 + type EpochHandler interface + IsInterfaceNil func() bool + MetaEpoch func() uint32 + type GenesisNodesSetupHandler interface + AllInitialNodes func() []nodesCoordinator.GenesisNodeInfoHandler + GetAdaptivity func() bool + GetHysteresis func() float32 + GetMetaConsensusGroupSize func() uint32 + GetRoundDuration func() uint64 + GetShardConsensusGroupSize func() uint32 + GetShardIDForPubKey func(pubkey []byte) (uint32, error) + GetStartTime func() int64 + InitialEligibleNodesPubKeysForShard func(shardId uint32) ([]string, error) + InitialNodesInfo func() (map[uint32][]nodesCoordinator.GenesisNodeInfoHandler, ...) + InitialNodesInfoForShard func(shardId uint32) ([]nodesCoordinator.GenesisNodeInfoHandler, ...) + InitialNodesPubKeys func() map[uint32][]string + IsInterfaceNil func() bool + MinMetaHysteresisNodes func() uint32 + MinNumberOfMetaNodes func() uint32 + MinNumberOfNodes func() uint32 + MinNumberOfNodesWithHysteresis func() uint32 + MinNumberOfShardNodes func() uint32 + MinShardHysteresisNodes func() uint32 + NumberOfShards func() uint32 + type InitialNode struct + Address string + InitialRating uint32 + PubKey string + func (ni *InitialNode) AddressBytes() []byte + func (ni *InitialNode) AssignedShard() uint32 + func (ni *InitialNode) GetInitialRating() uint32 + func (ni *InitialNode) IsInterfaceNil() bool + func (ni *InitialNode) PubKeyBytes() []byte + type NodesSetup struct + Adaptivity bool + ConsensusGroupSize uint32 + Hysteresis float32 + InitialNodes []*InitialNode + MetaChainConsensusGroupSize uint32 + MetaChainMinNodes uint32 + MinNodesPerShard uint32 + RoundDuration uint64 + StartTime int64 + func NewNodesSetup(nodesFilePath string, addressPubkeyConverter core.PubkeyConverter, ...) (*NodesSetup, error) + func (ns *NodesSetup) AllInitialNodes() []nodesCoordinator.GenesisNodeInfoHandler + func (ns *NodesSetup) GetAdaptivity() bool + func (ns *NodesSetup) GetHysteresis() float32 + func (ns *NodesSetup) GetMetaConsensusGroupSize() uint32 + func (ns *NodesSetup) GetRoundDuration() uint64 + func (ns *NodesSetup) GetShardConsensusGroupSize() uint32 + func (ns *NodesSetup) GetShardIDForPubKey(pubKey []byte) (uint32, error) + func (ns *NodesSetup) GetStartTime() int64 + func (ns *NodesSetup) InitialEligibleNodesPubKeysForShard(shardId uint32) ([]string, error) + func (ns *NodesSetup) InitialNodesInfo() (map[uint32][]nodesCoordinator.GenesisNodeInfoHandler, ...) + func (ns *NodesSetup) InitialNodesInfoForShard(shardId uint32) ([]nodesCoordinator.GenesisNodeInfoHandler, ...) + func (ns *NodesSetup) InitialNodesPubKeys() map[uint32][]string + func (ns *NodesSetup) IsInterfaceNil() bool + func (ns *NodesSetup) MinMetaHysteresisNodes() uint32 + func (ns *NodesSetup) MinNumberOfMetaNodes() uint32 + func (ns *NodesSetup) MinNumberOfNodes() uint32 + func (ns *NodesSetup) MinNumberOfNodesWithHysteresis() uint32 + func (ns *NodesSetup) MinNumberOfShardNodes() uint32 + func (ns *NodesSetup) MinShardHysteresisNodes() uint32 + func (ns *NodesSetup) NumberOfShards() uint32 + type OneShardCoordinator struct + func (osc *OneShardCoordinator) CommunicationIdentifier(destShardID uint32) string + func (osc *OneShardCoordinator) ComputeId(_ []byte) uint32 + func (osc *OneShardCoordinator) IsInterfaceNil() bool + func (osc *OneShardCoordinator) NumberOfShards() uint32 + func (osc *OneShardCoordinator) SameShard(_, _ []byte) bool + func (osc *OneShardCoordinator) SelfId() uint32 + type PeerAccountListAndRatingHandler interface + ComputeDecreaseProposer func(shardId uint32, currentRating uint32, consecutiveMisses uint32) uint32 + ComputeDecreaseValidator func(shardId uint32, currentRating uint32) uint32 + ComputeIncreaseProposer func(shardId uint32, currentRating uint32) uint32 + ComputeIncreaseValidator func(shardId uint32, currentRating uint32) uint32 + GetChance func(uint32) uint32 + GetSignedBlocksThreshold func() float32 + GetStartRating func() uint32 + IsInterfaceNil func() bool + RevertIncreaseValidator func(shardId uint32, currentRating uint32, nrReverts uint32) uint32