Versions in this module Expand all Collapse all v0 v0.0.1 Nov 7, 2024 Changes in this version + var ErrEpochNodesConfigDoesNotExist = errors.New("epoch nodes configuration does not exist") + var ErrIntOverflowNodesCoordinatorRegistryWithAuction = fmt.Errorf("proto: integer overflow") + var ErrInvalidConsensusGroupSize = errors.New("invalid consensus group size") + var ErrInvalidLengthNodesCoordinatorRegistryWithAuction = fmt.Errorf("proto: negative length found during unmarshaling") + var ErrInvalidNumberOfShards = errors.New("the number of shards must be greater than zero") + var ErrInvalidNumberPubKeys = errors.New("invalid number of public keys") + var ErrInvalidSampleSize = errors.New("invalid sample size") + var ErrInvalidShardId = errors.New("shard id must be smaller than the total number of shards") + var ErrInvalidWeight = errors.New("invalid weight") + var ErrKeyNotFoundInWaitingList = errors.New("key not found in waiting list") + var ErrMapSizeZero = errors.New("map size zero") + var ErrNilBlockBody = errors.New("nil block body") + var ErrNilBootStorer = errors.New("nil boot storer provided") + var ErrNilCacher = errors.New("nil cacher") + var ErrNilChanceComputer = errors.New("nil chance computer") + var ErrNilEnableEpochsHandler = errors.New("nil enable epochs handler") + var ErrNilEpochNotifier = errors.New("nil epoch notifier provided") + var ErrNilGenesisNodesSetupHandler = errors.New("nil genesis nodes setup handler") + var ErrNilHasher = errors.New("nil hasher") + var ErrNilInputNodesMap = errors.New("nil input nodes map") + var ErrNilMarshalizer = errors.New("nil marshalizer") + var ErrNilNodeShufflerArguments = errors.New("nil arguments for the creation of a node shuffler") + var ErrNilNodeStopChannel = errors.New("nil node stop channel") + var ErrNilNodeTypeProvider = errors.New("nil node type provider") + var ErrNilNodesCoordinator = errors.New("nil nodesCoordinator") + var ErrNilNodesCoordinatorRegistryFactory = errors.New("nil nodes coordinator registry factory has been given") + var ErrNilOrEmptyDestinationForDistribute = errors.New("nil or empty destination list for distributeNodes") + var ErrNilPreviousEpochConfig = errors.New("nil previous epoch config") + var ErrNilPubKey = errors.New("nil public key") + var ErrNilRandomSelector = errors.New("nil selector") + var ErrNilRandomness = errors.New("nil randomness source") + var ErrNilShuffledOutHandler = errors.New("nil shuffled out handler") + var ErrNilShuffler = errors.New("nil nodes shuffler provided") + var ErrNilValidatorInfoCacher = errors.New("validator info cacher is nil") + var ErrNilWeights = errors.New("nil weights") + var ErrNotImplemented = errors.New("feature not implemented") + var ErrReceivedAuctionValidatorsBeforeStakingV4 = errors.New(...) + var ErrSmallMetachainEligibleListSize = errors.New("small metachain eligible list size") + var ErrSmallShardEligibleListSize = errors.New("small shard eligible list size") + var ErrUnexpectedEndOfGroupNodesCoordinatorRegistryWithAuction = fmt.Errorf("proto: unexpected end of group") + var ErrValidatorCannotBeFullArchive = errors.New("validator cannot be a full archive node") + var ErrValidatorNotFound = errors.New("validator not found") + var ErrWrongTypeAssertion = errors.New("wrong type assertion") + func NewHashValidatorsShuffler(args *NodesShufflerArgs) (*randHashShuffler, error) + func NewIndexHashedNodesCoordinator(arguments ArgNodesCoordinator) (*indexHashedNodesCoordinator, error) + func NewIndexHashedNodesCoordinatorWithRater(indexNodesCoordinator *indexHashedNodesCoordinator, ...) (*indexHashedNodesCoordinatorWithRater, error) + func NewNodesCoordinatorRegistryFactory(marshaller marshal.Marshalizer, stakingV4Step2EnableEpoch uint32) (*nodesCoordinatorRegistryFactory, error) + func NewSelectorExpandedList(weightList []uint32, hasher hashing.Hasher) (*selectorExpandedList, error) + func NewSelectorWRS(weightList []uint32, hasher hashing.Hasher) (*selectorWRS, error) + func NewValidator(pubKey []byte, chances uint32, index uint32) (*validator, error) + func NodesInfoToValidators(nodesInfo map[uint32][]GenesisNodeInfoHandler) (map[uint32][]Validator, error) + func SerializableValidatorsToValidators(nodeRegistryValidators map[string][]*SerializableValidator) (map[uint32][]Validator, error) + type ArgNodesCoordinator struct + BootStorer storage.Storer + ChanStopNode chan endProcess.ArgEndProcess + ConsensusGroupCache Cacher + EligibleNodes map[uint32][]Validator + EnableEpochsHandler common.EnableEpochsHandler + Epoch uint32 + EpochStartNotifier EpochStartEventNotifier + GenesisNodesSetupHandler GenesisNodesSetupHandler + Hasher hashing.Hasher + IsFullArchive bool + Marshalizer marshal.Marshalizer + MetaConsensusGroupSize int + NbShards uint32 + NodeTypeProvider NodeTypeProviderHandler + NodesCoordinatorRegistryFactory NodesCoordinatorRegistryFactory + SelfPublicKey []byte + ShardConsensusGroupSize int + ShardIDAsObserver uint32 + ShuffledOutHandler ShuffledOutHandler + Shuffler NodesShuffler + StartEpoch uint32 + ValidatorInfoCacher epochStart.ValidatorInfoCacher + WaitingNodes map[uint32][]Validator + type ArgsUpdateNodes struct + AdditionalLeaving []Validator + Auction []Validator + Eligible map[uint32][]Validator + Epoch uint32 + NbShards uint32 + NewNodes []Validator + Rand []byte + UnStakeLeaving []Validator + Waiting map[uint32][]Validator + type Cacher interface + Clear func() + Get func(key []byte) (value interface{}, ok bool) + Put func(key []byte, value interface{}, sizeInBytes int) (evicted bool) + type ChanceComputer interface + GetChance func(uint32) uint32 + IsInterfaceNil func() bool + type CrossShardValidatorDistributor struct + func (vd *CrossShardValidatorDistributor) DistributeValidators(destination map[uint32][]Validator, source map[uint32][]Validator, rand []byte, ...) error + func (vd *CrossShardValidatorDistributor) IsInterfaceNil() bool + type EpochNotifier interface + CheckEpoch func(header data.HeaderHandler) + CurrentEpoch func() uint32 + IsInterfaceNil func() bool + RegisterNotifyHandler func(handler vmcommon.EpochSubscriberHandler) + type EpochStartActionHandler interface + EpochStartAction func(hdr data.HeaderHandler) + EpochStartPrepare func(metaHdr data.HeaderHandler, body data.BodyHandler) + NotifyOrder func() uint32 + type EpochStartEventNotifier interface + IsInterfaceNil func() bool + RegisterHandler func(handler epochStart.ActionHandler) + UnregisterHandler func(handler epochStart.ActionHandler) + type EpochValidators struct + EligibleValidators map[string][]*SerializableValidator + LeavingValidators map[string][]*SerializableValidator + WaitingValidators map[string][]*SerializableValidator + func (ev *EpochValidators) GetEligibleValidators() map[string][]*SerializableValidator + func (ev *EpochValidators) GetLeavingValidators() map[string][]*SerializableValidator + func (ev *EpochValidators) GetWaitingValidators() map[string][]*SerializableValidator + type EpochValidatorsHandler interface + GetEligibleValidators func() map[string][]*SerializableValidator + GetLeavingValidators func() map[string][]*SerializableValidator + GetWaitingValidators func() map[string][]*SerializableValidator + type EpochValidatorsHandlerWithAuction interface + GetLowWaitingList func() bool + GetShuffledOutValidators func() map[string][]*SerializableValidator + type EpochValidatorsWithAuction struct + Eligible map[string]Validators + Leaving map[string]Validators + LowWaitingList bool + ShuffledOut map[string]Validators + Waiting map[string]Validators + func (*EpochValidatorsWithAuction) Descriptor() ([]byte, []int) + func (*EpochValidatorsWithAuction) ProtoMessage() + func (m *EpochValidatorsWithAuction) GetEligible() map[string]Validators + func (m *EpochValidatorsWithAuction) GetEligibleValidators() map[string][]*SerializableValidator + func (m *EpochValidatorsWithAuction) GetLeaving() map[string]Validators + func (m *EpochValidatorsWithAuction) GetLeavingValidators() map[string][]*SerializableValidator + func (m *EpochValidatorsWithAuction) GetLowWaitingList() bool + func (m *EpochValidatorsWithAuction) GetShuffledOut() map[string]Validators + func (m *EpochValidatorsWithAuction) GetShuffledOutValidators() map[string][]*SerializableValidator + func (m *EpochValidatorsWithAuction) GetWaiting() map[string]Validators + func (m *EpochValidatorsWithAuction) GetWaitingValidators() map[string][]*SerializableValidator + func (m *EpochValidatorsWithAuction) Marshal() (dAtA []byte, err error) + func (m *EpochValidatorsWithAuction) MarshalTo(dAtA []byte) (int, error) + func (m *EpochValidatorsWithAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *EpochValidatorsWithAuction) Reset() + func (m *EpochValidatorsWithAuction) Size() (n int) + func (m *EpochValidatorsWithAuction) Unmarshal(dAtA []byte) error + func (m *EpochValidatorsWithAuction) XXX_DiscardUnknown() + func (m *EpochValidatorsWithAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *EpochValidatorsWithAuction) XXX_Merge(src proto.Message) + func (m *EpochValidatorsWithAuction) XXX_Size() int + func (m *EpochValidatorsWithAuction) XXX_Unmarshal(b []byte) error + func (this *EpochValidatorsWithAuction) Equal(that interface{}) bool + func (this *EpochValidatorsWithAuction) GoString() string + func (this *EpochValidatorsWithAuction) String() string + type EpochsConfigUpdateHandler interface + IsEpochInConfig func(epoch uint32) bool + SetNodesConfigFromValidatorsInfo func(epoch uint32, randomness []byte, validatorsInfo []*state.ShardValidatorInfo) error + type GenesisNodeInfoHandler interface + AddressBytes func() []byte + AssignedShard func() uint32 + GetInitialRating func() uint32 + IsInterfaceNil func() bool + PubKeyBytes func() []byte + type GenesisNodesSetupHandler interface + IsInterfaceNil func() bool + MinMetaHysteresisNodes func() uint32 + MinShardHysteresisNodes func() uint32 + type IntraShardValidatorDistributor struct + func (vd *IntraShardValidatorDistributor) DistributeValidators(destination map[uint32][]Validator, source map[uint32][]Validator, _ []byte, ...) error + func (vd *IntraShardValidatorDistributor) IsInterfaceNil() bool + type NodeTypeProviderHandler interface + GetType func() core.NodeType + IsInterfaceNil func() bool + SetType func(nodeType core.NodeType) + type NodesCoordinator interface + ComputeConsensusGroup func(randomness []byte, round uint64, shardId uint32, epoch uint32) (validatorsGroup []Validator, err error) + ConsensusGroupSize func(uint32) int + GetConsensusWhitelistedNodes func(epoch uint32) (map[string]struct{}, error) + GetNumTotalEligible func() uint64 + GetSavedStateKey func() []byte + GetValidatorWithPublicKey func(publicKey []byte) (validator Validator, shardId uint32, err error) + GetWaitingEpochsLeftForPublicKey func(publicKey []byte) (uint32, error) + IsInterfaceNil func() bool + LoadState func(key []byte) error + ShardIdForEpoch func(epoch uint32) (uint32, error) + ShuffleOutForEpoch func(_ uint32) + type NodesCoordinatorHelper interface + ComputeAdditionalLeaving func(allValidators []*state.ShardValidatorInfo) (map[uint32][]Validator, error) + GetChance func(uint32) uint32 + ValidatorsWeights func(validators []Validator) ([]uint32, error) + type NodesCoordinatorRegistry struct + CurrentEpoch uint32 + EpochsConfig map[string]*EpochValidators + func (ncr *NodesCoordinatorRegistry) GetCurrentEpoch() uint32 + func (ncr *NodesCoordinatorRegistry) GetEpochsConfig() map[string]EpochValidatorsHandler + func (ncr *NodesCoordinatorRegistry) SetCurrentEpoch(epoch uint32) + type NodesCoordinatorRegistryFactory interface + CreateNodesCoordinatorRegistry func(buff []byte) (NodesCoordinatorRegistryHandler, error) + GetRegistryData func(registry NodesCoordinatorRegistryHandler, epoch uint32) ([]byte, error) + IsInterfaceNil func() bool + type NodesCoordinatorRegistryHandler interface + GetCurrentEpoch func() uint32 + GetEpochsConfig func() map[string]EpochValidatorsHandler + SetCurrentEpoch func(epoch uint32) + type NodesCoordinatorRegistryWithAuction struct + CurrentEpoch uint32 + EpochsConfigWithAuction map[string]*EpochValidatorsWithAuction + func (*NodesCoordinatorRegistryWithAuction) Descriptor() ([]byte, []int) + func (*NodesCoordinatorRegistryWithAuction) ProtoMessage() + func (m *NodesCoordinatorRegistryWithAuction) GetCurrentEpoch() uint32 + func (m *NodesCoordinatorRegistryWithAuction) GetEpochsConfig() map[string]EpochValidatorsHandler + func (m *NodesCoordinatorRegistryWithAuction) GetEpochsConfigWithAuction() map[string]*EpochValidatorsWithAuction + func (m *NodesCoordinatorRegistryWithAuction) Marshal() (dAtA []byte, err error) + func (m *NodesCoordinatorRegistryWithAuction) MarshalTo(dAtA []byte) (int, error) + func (m *NodesCoordinatorRegistryWithAuction) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *NodesCoordinatorRegistryWithAuction) Reset() + func (m *NodesCoordinatorRegistryWithAuction) SetCurrentEpoch(epoch uint32) + func (m *NodesCoordinatorRegistryWithAuction) Size() (n int) + func (m *NodesCoordinatorRegistryWithAuction) Unmarshal(dAtA []byte) error + func (m *NodesCoordinatorRegistryWithAuction) XXX_DiscardUnknown() + func (m *NodesCoordinatorRegistryWithAuction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *NodesCoordinatorRegistryWithAuction) XXX_Merge(src proto.Message) + func (m *NodesCoordinatorRegistryWithAuction) XXX_Size() int + func (m *NodesCoordinatorRegistryWithAuction) XXX_Unmarshal(b []byte) error + func (this *NodesCoordinatorRegistryWithAuction) Equal(that interface{}) bool + func (this *NodesCoordinatorRegistryWithAuction) GoString() string + func (this *NodesCoordinatorRegistryWithAuction) String() string + type NodesShuffler interface + IsInterfaceNil func() bool + UpdateNodeLists func(args ArgsUpdateNodes) (*ResUpdateNodes, error) + UpdateParams func(numNodesShard uint32, numNodesMeta uint32, hysteresis float32, adaptivity bool) + type NodesShufflerArgs struct + Adaptivity bool + EnableEpochs config.EnableEpochs + EnableEpochsHandler common.EnableEpochsHandler + Hysteresis float32 + MaxNodesEnableConfig []config.MaxNodesChangeConfig + NodesMeta uint32 + NodesShard uint32 + ShuffleBetweenShards bool + type PublicKeysSelector interface + GetAllEligibleValidatorsPublicKeys func(epoch uint32) (map[uint32][][]byte, error) + GetAllLeavingValidatorsPublicKeys func(epoch uint32) (map[uint32][][]byte, error) + GetAllShuffledOutValidatorsPublicKeys func(epoch uint32) (map[uint32][][]byte, error) + GetAllWaitingValidatorsPublicKeys func(epoch uint32) (map[uint32][][]byte, error) + GetConsensusValidatorsPublicKeys func(randomness []byte, round uint64, shardId uint32, epoch uint32) ([]string, error) + GetOwnPublicKey func() []byte + GetShuffledOutToAuctionValidatorsPublicKeys func(epoch uint32) (map[uint32][][]byte, error) + GetValidatorsIndexes func(publicKeys []string, epoch uint32) ([]uint64, error) + type RandomSelector interface + IsInterfaceNil func() bool + Select func(randSeed []byte, sampleSize uint32) ([]uint32, error) + type ResUpdateNodes struct + Eligible map[uint32][]Validator + Leaving []Validator + LowWaitingList bool + ShuffledOut map[uint32][]Validator + StillRemaining []Validator + Waiting map[uint32][]Validator + type SelectionBasedProvider struct + func NewSelectionBasedProvider(hasher hashing.Hasher, maxSize uint32) *SelectionBasedProvider + func (sbp *SelectionBasedProvider) Get(randomness []byte, numValidators int64, expandedEligibleList []uint32) ([]uint32, error) + type SerializableValidator struct + Chances uint32 + Index uint32 + PubKey []byte + func ValidatorArrayToSerializableValidatorArray(validators []Validator) []*SerializableValidator + func (*SerializableValidator) Descriptor() ([]byte, []int) + func (*SerializableValidator) ProtoMessage() + func (m *SerializableValidator) GetChances() uint32 + func (m *SerializableValidator) GetIndex() uint32 + func (m *SerializableValidator) GetPubKey() []byte + func (m *SerializableValidator) Marshal() (dAtA []byte, err error) + func (m *SerializableValidator) MarshalTo(dAtA []byte) (int, error) + func (m *SerializableValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *SerializableValidator) Reset() + func (m *SerializableValidator) Size() (n int) + func (m *SerializableValidator) Unmarshal(dAtA []byte) error + func (m *SerializableValidator) XXX_DiscardUnknown() + func (m *SerializableValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *SerializableValidator) XXX_Merge(src proto.Message) + func (m *SerializableValidator) XXX_Size() int + func (m *SerializableValidator) XXX_Unmarshal(b []byte) error + func (this *SerializableValidator) Equal(that interface{}) bool + func (this *SerializableValidator) GoString() string + func (this *SerializableValidator) String() string + type ShuffledOutHandler interface + CurrentShardID func() uint32 + IsInterfaceNil func() bool + Process func(newShardID uint32) error + RegisterHandler func(handler func(newShardID uint32)) + type Validator interface + Chances func() uint32 + Index func() uint32 + PubKey func() []byte + Size func() int + func SerializableShardValidatorListToValidatorList(shardValidators []*SerializableValidator) ([]Validator, error) + type Validators struct + Data []*SerializableValidator + func (*Validators) Descriptor() ([]byte, []int) + func (*Validators) ProtoMessage() + func (m *Validators) GetData() []*SerializableValidator + func (m *Validators) Marshal() (dAtA []byte, err error) + func (m *Validators) MarshalTo(dAtA []byte) (int, error) + func (m *Validators) MarshalToSizedBuffer(dAtA []byte) (int, error) + func (m *Validators) Reset() + func (m *Validators) Size() (n int) + func (m *Validators) Unmarshal(dAtA []byte) error + func (m *Validators) XXX_DiscardUnknown() + func (m *Validators) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) + func (m *Validators) XXX_Merge(src proto.Message) + func (m *Validators) XXX_Size() int + func (m *Validators) XXX_Unmarshal(b []byte) error + func (this *Validators) Equal(that interface{}) bool + func (this *Validators) GoString() string + func (this *Validators) String() string + type ValidatorsDistributor interface + DistributeValidators func(destination map[uint32][]Validator, source map[uint32][]Validator, rand []byte, ...) error + IsInterfaceNil func() bool