rating

package
v1.4.10 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDisabledRatingReader

func NewDisabledRatingReader(startRating uint32) *disabledRatingReader

NewDisabledRatingReader create a new ratingReader that returns fixed values

func NewRatingStepData

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

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

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

type DisabledListIndexUpdater struct {
}

DisabledListIndexUpdater is a nil implementation for an list index updater

func (*DisabledListIndexUpdater) IsInterfaceNil

func (n *DisabledListIndexUpdater) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*DisabledListIndexUpdater) UpdateListAndIndex

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

UpdateListAndIndex will return nil

type RatingStep

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

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

func (*RatingStep) ConsecutiveMissedBlocksPenalty

func (rd *RatingStep) ConsecutiveMissedBlocksPenalty() float32

ConsecutiveMissedBlocksPenalty will return the penalty increase for consecutive block misses

func (*RatingStep) ProposerDecreaseRatingStep

func (rd *RatingStep) ProposerDecreaseRatingStep() int32

ProposerDecreaseRatingStep will return the rating step decrease for proposer

func (*RatingStep) ProposerIncreaseRatingStep

func (rd *RatingStep) ProposerIncreaseRatingStep() int32

ProposerIncreaseRatingStep will return the rating step increase for validator

func (*RatingStep) ValidatorDecreaseRatingStep

func (rd *RatingStep) ValidatorDecreaseRatingStep() int32

ValidatorDecreaseRatingStep will return the rating step decrease for validator

func (*RatingStep) ValidatorIncreaseRatingStep

func (rd *RatingStep) ValidatorIncreaseRatingStep() int32

ValidatorIncreaseRatingStep will return the rating step increase for validator

type RatingsData

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

RatingsData will store information about ratingsComputation

func NewRatingsData

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

NewRatingsData creates a new RatingsData instance

func (*RatingsData) IsInterfaceNil

func (rd *RatingsData) IsInterfaceNil() bool

IsInterfaceNil returns true if underlying object is nil

func (*RatingsData) MaxRating

func (rd *RatingsData) MaxRating() uint32

MaxRating will return the max rating

func (*RatingsData) MetaChainRatingsStepHandler

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

MetaChainRatingsStepHandler returns the RatingsStepHandler used for the Metachain

func (*RatingsData) MinRating

func (rd *RatingsData) MinRating() uint32

MinRating will return the min rating

func (*RatingsData) SelectionChances

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

SelectionChances will return the array of selectionChances and thresholds

func (*RatingsData) ShardChainRatingsStepHandler

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

ShardChainRatingsStepHandler returns the RatingsStepHandler used for the ShardChains

func (*RatingsData) SignedBlocksThreshold

func (rd *RatingsData) SignedBlocksThreshold() float32

SignedBlocksThreshold will return the signed blocks threshold

func (*RatingsData) StartRating

func (rd *RatingsData) StartRating() uint32

StartRating will return the start rating

type RatingsDataArg

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

type SelectionChance struct {
	MaxThreshold  uint32
	ChancePercent uint32
}

SelectionChance contains the threshold and chancePercent to be selected

func (*SelectionChance) GetChancePercent

func (sc *SelectionChance) GetChancePercent() uint32

GetChancePercent returns the chances percentage to be selected

func (*SelectionChance) GetMaxThreshold

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