rating

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDisabledRatingReader added in v1.0.102

func NewDisabledRatingReader(startRating uint32) *disabledRatingReader

NewDisabledRatingReader create a new ratingReader that returns fixed values

func NewRatingStepData added in v0.0.5

func NewRatingStepData(
	proposerIncreaseRatingStep int32,
	proposerDecreaseRatingStep int32,
	validatorIncreaseRatingStep int32,
	validatorDecreaseRatingStep int32,
	consecutiveMissedBlocksPenalty float32,
) process.RatingsStepHandler

NewRatingStepData creates a new RatingStep instance

Types

type BlockSigningRater

type BlockSigningRater struct {
	// contains filtered or unexported fields
}

BlockSigningRater defines the behaviour of a struct able to do ratings for validators

func NewBlockSigningRater

func NewBlockSigningRater(ratingsData process.RatingsInfoHandler) (*BlockSigningRater, error)

NewBlockSigningRater creates a new RaterHandler of Type BlockSigningRater

func (*BlockSigningRater) ComputeDecreaseProposer

func (bsr *BlockSigningRater) ComputeDecreaseProposer(shardId uint32, currentRating uint32, consecutiveMisses uint32) uint32

ComputeDecreaseProposer computes the new rating for the decreaseLeader

func (*BlockSigningRater) ComputeDecreaseValidator

func (bsr *BlockSigningRater) ComputeDecreaseValidator(shardId uint32, currentRating uint32) uint32

ComputeDecreaseValidator computes the new rating for the decreaseValidator

func (*BlockSigningRater) ComputeIncreaseProposer

func (bsr *BlockSigningRater) ComputeIncreaseProposer(shardId uint32, currentRating uint32) uint32

ComputeIncreaseProposer computes the new rating for the increaseLeader

func (*BlockSigningRater) ComputeIncreaseValidator

func (bsr *BlockSigningRater) ComputeIncreaseValidator(shardId uint32, currentRating uint32) uint32

ComputeIncreaseValidator computes the new rating for the increaseValidator

func (*BlockSigningRater) GetChance

func (bsr *BlockSigningRater) GetChance(currentRating uint32) uint32

GetChance returns the chances modifier for the current rating

func (*BlockSigningRater) GetSignedBlocksThreshold added in v0.0.5

func (bsr *BlockSigningRater) GetSignedBlocksThreshold() float32

GetSignedBlocksThreshold ets the signedBlocksThreshold

func (*BlockSigningRater) GetStartRating

func (bsr *BlockSigningRater) GetStartRating() uint32

GetStartRating gets the StartingRating

func (*BlockSigningRater) IsInterfaceNil

func (bsr *BlockSigningRater) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*BlockSigningRater) RevertIncreaseValidator added in v0.0.5

func (bsr *BlockSigningRater) RevertIncreaseValidator(shardId uint32, currentRating uint32, nrReverts uint32) uint32

RevertIncreaseValidator computes the new rating based on how many reverts have to be done for the validator

type DisabledListIndexUpdater added in v1.0.102

type DisabledListIndexUpdater struct {
}

DisabledListIndexUpdater is a nil implementation for an list index updater

func (*DisabledListIndexUpdater) IsInterfaceNil added in v1.0.102

func (n *DisabledListIndexUpdater) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*DisabledListIndexUpdater) UpdateListAndIndex added in v1.0.102

func (n *DisabledListIndexUpdater) UpdateListAndIndex(_ string, _ uint32, _ string, _ uint32) error

UpdateListAndIndex will return nil

type RatingStep added in v0.0.5

type RatingStep struct {
	// contains filtered or unexported fields
}

RatingStep will store information about ratingsComputation specific for a shard or metachain

func (*RatingStep) ConsecutiveMissedBlocksPenalty added in v0.0.5

func (rd *RatingStep) ConsecutiveMissedBlocksPenalty() float32

ConsecutiveMissedBlocksPenalty will return the penalty increase for consecutive block misses

func (*RatingStep) ProposerDecreaseRatingStep added in v0.0.5

func (rd *RatingStep) ProposerDecreaseRatingStep() int32

ProposerDecreaseRatingStep will return the rating step decrease for proposer

func (*RatingStep) ProposerIncreaseRatingStep added in v0.0.5

func (rd *RatingStep) ProposerIncreaseRatingStep() int32

ProposerIncreaseRatingStep will return the rating step increase for validator

func (*RatingStep) ValidatorDecreaseRatingStep added in v0.0.5

func (rd *RatingStep) ValidatorDecreaseRatingStep() int32

ValidatorDecreaseRatingStep will return the rating step decrease for validator

func (*RatingStep) ValidatorIncreaseRatingStep added in v0.0.5

func (rd *RatingStep) ValidatorIncreaseRatingStep() int32

ValidatorIncreaseRatingStep will return the rating step increase for validator

type RatingsData added in v0.0.5

type RatingsData struct {
	// contains filtered or unexported fields
}

RatingsData will store information about ratingsComputation

func NewRatingsData added in v0.0.5

func NewRatingsData(args RatingsDataArg) (*RatingsData, error)

NewRatingsData creates a new RatingsData instance

func (*RatingsData) IsInterfaceNil added in v1.0.110

func (rd *RatingsData) IsInterfaceNil() bool

IsInterfaceNil returns true if underlying object is nil

func (*RatingsData) MaxRating added in v0.0.5

func (rd *RatingsData) MaxRating() uint32

MaxRating will return the max rating

func (*RatingsData) MetaChainRatingsStepHandler added in v0.0.5

func (rd *RatingsData) MetaChainRatingsStepHandler() process.RatingsStepHandler

MetaChainRatingsStepHandler returns the RatingsStepHandler used for the Metachain

func (*RatingsData) MinRating added in v0.0.5

func (rd *RatingsData) MinRating() uint32

MinRating will return the min rating

func (*RatingsData) SelectionChances added in v0.0.5

func (rd *RatingsData) SelectionChances() []process.SelectionChance

SelectionChances will return the array of selectionChances and thresholds

func (*RatingsData) ShardChainRatingsStepHandler added in v0.0.5

func (rd *RatingsData) ShardChainRatingsStepHandler() process.RatingsStepHandler

ShardChainRatingsStepHandler returns the RatingsStepHandler used for the ShardChains

func (*RatingsData) SignedBlocksThreshold added in v0.0.5

func (rd *RatingsData) SignedBlocksThreshold() float32

SignedBlocksThreshold will return the signed blocks threshold

func (*RatingsData) StartRating added in v0.0.5

func (rd *RatingsData) StartRating() uint32

StartRating will return the start rating

type RatingsDataArg added in v1.0.104

type RatingsDataArg struct {
	Config                   config.RatingsConfig
	ShardConsensusSize       uint32
	MetaConsensusSize        uint32
	ShardMinNodes            uint32
	MetaMinNodes             uint32
	RoundDurationMiliseconds uint64
}

RatingsDataArg contains information for the creation of the new ratingsData

type SelectionChance added in v0.0.5

type SelectionChance struct {
	MaxThreshold  uint32
	ChancePercent uint32
}

SelectionChance contains the threshold and chancePercent to be selected

func (*SelectionChance) GetChancePercent added in v0.0.5

func (sc *SelectionChance) GetChancePercent() uint32

GetChancePercent returns the chances percentage to be selected

func (*SelectionChance) GetMaxThreshold added in v0.0.5

func (sc *SelectionChance) GetMaxThreshold() uint32

GetMaxThreshold returns the maximum threshold for which a chancePercent is active

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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