Documentation ¶
Index ¶
- Variables
- func CalcValidatorGasPower(e inter.EventI, eTime, prevTime inter.Timestamp, prevGasPowerLeft uint64, ...) uint64
- func CalcValidatorGasPowerPerSec(validator idx.ValidatorID, validators *pos.Validators, config Config) (perSec uint64, maxGasPower uint64, startup uint64)
- type Checker
- type Config
- type Reader
- type ValidationContext
- type ValidatorState
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrWrongGasPowerLeft indicates that event's GasPowerLeft is miscalculated. ErrWrongGasPowerLeft = errors.New("event has wrong GasPowerLeft") )
Functions ¶
func CalcValidatorGasPower ¶
func CalcValidatorGasPowerPerSec ¶
func CalcValidatorGasPowerPerSec( validator idx.ValidatorID, validators *pos.Validators, config Config, ) ( perSec uint64, maxGasPower uint64, startup uint64, )
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker which checks gas power
func (*Checker) CalcGasPower ¶
CalcGasPower calculates available gas power for the event, i.e. how many gas its content may consume
type Config ¶
type Config struct { Idx int AllocPerSec uint64 MaxAllocPeriod inter.Timestamp MinEnsuredAlloc uint64 StartupAllocPeriod inter.Timestamp MinStartupGas uint64 }
Config for gaspower checking. There'll be 2 different configs for short-term and long-term gas power checks.
type Reader ¶
type Reader interface {
GetValidationContext() *ValidationContext
}
Reader is accessed by the validator to get the current state.
type ValidationContext ¶
type ValidationContext struct { Epoch idx.Epoch Configs [inter.GasPowerConfigs]Config EpochStart inter.Timestamp Validators *pos.Validators ValidatorStates []ValidatorState }
ValidationContext for gaspower checking
type ValidatorState ¶
type ValidatorState struct { PrevEpochEvent iblockproc.EventInfo GasRefund uint64 }
Click to show internal directories.
Click to hide internal directories.