Documentation ¶
Index ¶
- Constants
- Variables
- func GetEffectiveBalance(balance float64) float64
- func IsActive(validator phase0.Validator, epoch phase0.Epoch) bool
- func ProcessAttestations(customState *ForkStateContentBase, participation []altair.ParticipationFlags)
- type EpochData
- type ForkStateContentBase
- func GetCustomState(bstate spec.VersionedBeaconState, iApi *http.Service) (ForkStateContentBase, error)
- func NewAltairState(bstate spec.VersionedBeaconState, iApi *http.Service) ForkStateContentBase
- func NewBellatrixState(bstate spec.VersionedBeaconState, iApi *http.Service) ForkStateContentBase
- func NewPhase0State(bstate spec.VersionedBeaconState, iApi *http.Service) ForkStateContentBase
- func (p ForkStateContentBase) Balance(valIdx uint64) (uint64, error)
- func (p ForkStateContentBase) GetActiveVals() []uint64
- func (p ForkStateContentBase) GetAllVals() []uint64
- func (p ForkStateContentBase) GetMissingFlagCount(flagIndex int) uint64
- func (p *ForkStateContentBase) GetTotalActiveEffBalance() uint64
- func (p ForkStateContentBase) GetTotalActiveRealBalance() uint64
- func (p ForkStateContentBase) GetValStatus(valIdx uint64) string
- func (p ForkStateContentBase) MissingFlags(valIdx uint64) []bool
- func (p *ForkStateContentBase) Setup() error
- func (p *ForkStateContentBase) TrackMissingBlocks()
- func (p ForkStateContentBase) TrackPrevMissingBlock() uint64
- func (p ForkStateContentBase) ValsEffectiveBalance(valList []uint64) uint64
- type ValVote
Constants ¶
const ( MAX_EFFECTIVE_INCREMENTS = 32 BASE_REWARD_FACTOR = 64 BASE_REWARD_PER_EPOCH = 4 EFFECTIVE_BALANCE_INCREMENT = 1000000000 SLOTS_PER_EPOCH = 32 SHUFFLE_ROUND_COUNT = uint64(90) PROPOSER_REWARD_QUOTIENT = 8 GENESIS_EPOCH = 0 SLOTS_PER_HISTORICAL_ROOT = 8192 )
Variables ¶
var ( TIMELY_SOURCE_WEIGHT = 14 TIMELY_TARGET_WEIGHT = 26 TIMELY_HEAD_WEIGHT = 14 PARTICIPATING_FLAGS_WEIGHT = []int{TIMELY_SOURCE_WEIGHT, TIMELY_TARGET_WEIGHT, TIMELY_HEAD_WEIGHT} SYNC_REWARD_WEIGHT = 2 PROPOSER_WEIGHT = 8 WEIGHT_DENOMINATOR = 64 SYNC_COMMITTEE_SIZE = 512 )
Functions ¶
func GetEffectiveBalance ¶
func ProcessAttestations ¶
func ProcessAttestations(customState *ForkStateContentBase, participation []altair.ParticipationFlags)
Types ¶
type EpochData ¶
type EpochData struct { ProposerDuties []*api.ProposerDuty BeaconCommittees []*api.BeaconCommittee // Beacon Committees organized by slot for the whole epoch ValidatorAttSlot map[uint64]uint64 // for each validator we have which slot it had to attest to ValidatorsPerSlot map[uint64][]uint64 // each Slot, which validators had to attest }
func (EpochData) GetValList ¶
func (p EpochData) GetValList(slot uint64, committeeIndex uint64) []phase0.ValidatorIndex
type ForkStateContentBase ¶
type ForkStateContentBase struct { Version spec.DataVersion Balances []uint64 // balance of each validator Validators []*phase0.Validator // list of validators TotalActiveBalance uint64 // effective balance TotalActiveRealBalance uint64 // real balance AttestingBalance []uint64 // one attesting balance per flag MaxAttestingBalance uint64 // the effective balance of validators that did attest in any manner EpochStructs EpochData // structs about beacon committees, proposers and attestation CorrectFlags [][]uint64 // one aray per flag AttestingVals []bool // the number of validators that did attest in the last epoch PrevAttestations []*phase0.PendingAttestation // array of attestations (currently only for Phase0) NumAttestingVals uint64 // number of validators that attested in the last epoch NumActiveVals uint64 // number of active validators in the epoch ValAttestationInclusion map[uint64]ValVote // one map per validator including which slots it had to attest and when it was included AttestedValsPerSlot map[uint64][]uint64 // for each slot in the epoch, how many vals attested Epoch uint64 // Epoch of the state Slot uint64 // Slot of the state BlockRoots [][]byte // array of block roots at this point (8192) MissedBlocks []uint64 // blocks missed in the epoch until this point SyncCommittee altair.SyncCommittee // list of pubkeys in the current sync committe }
This Wrapper is meant to include all common objects across Ethereum Hard Fork Specs
func GetCustomState ¶
func GetCustomState(bstate spec.VersionedBeaconState, iApi *http.Service) (ForkStateContentBase, error)
func NewAltairState ¶
func NewAltairState(bstate spec.VersionedBeaconState, iApi *http.Service) ForkStateContentBase
This Wrapper is meant to include all necessary data from the Altair Fork
func NewBellatrixState ¶
func NewBellatrixState(bstate spec.VersionedBeaconState, iApi *http.Service) ForkStateContentBase
This Wrapper is meant to include all necessary data from the Bellatrix Fork
func NewPhase0State ¶
func NewPhase0State(bstate spec.VersionedBeaconState, iApi *http.Service) ForkStateContentBase
This Wrapper is meant to include all necessary data from the Phase0 Fork
func (ForkStateContentBase) Balance ¶
func (p ForkStateContentBase) Balance(valIdx uint64) (uint64, error)
func (ForkStateContentBase) GetActiveVals ¶
func (p ForkStateContentBase) GetActiveVals() []uint64
List of validators that were active in the epoch of the state Lenght of the list is variable, each position containing the valIdx
func (ForkStateContentBase) GetAllVals ¶
func (p ForkStateContentBase) GetAllVals() []uint64
List of validators that were in the epoch of the state Length of the list is variable, each position containing the valIdx
func (ForkStateContentBase) GetMissingFlagCount ¶
func (p ForkStateContentBase) GetMissingFlagCount(flagIndex int) uint64
Argument: 0 for source, 1 for target and 2 for head Return the count of missing flag in the previous epoch participation / attestations
func (*ForkStateContentBase) GetTotalActiveEffBalance ¶
func (p *ForkStateContentBase) GetTotalActiveEffBalance() uint64
Edit NumActiveVals
func (ForkStateContentBase) GetTotalActiveRealBalance ¶
func (p ForkStateContentBase) GetTotalActiveRealBalance() uint64
Not effective balance, but balance
func (ForkStateContentBase) GetValStatus ¶
func (p ForkStateContentBase) GetValStatus(valIdx uint64) string
func (ForkStateContentBase) MissingFlags ¶
func (p ForkStateContentBase) MissingFlags(valIdx uint64) []bool
Returns a list of missing flags for the corresponding valIdx
func (*ForkStateContentBase) Setup ¶
func (p *ForkStateContentBase) Setup() error
Initialize all necessary arrays and process anything standard
func (*ForkStateContentBase) TrackMissingBlocks ¶
func (p *ForkStateContentBase) TrackMissingBlocks()
We use blockroots to track missed blocks. When there is a missed block, the block root is repeated
func (ForkStateContentBase) TrackPrevMissingBlock ¶
func (p ForkStateContentBase) TrackPrevMissingBlock() uint64
check if there was a missed block at last slot of previous epoch
func (ForkStateContentBase) ValsEffectiveBalance ¶
func (p ForkStateContentBase) ValsEffectiveBalance(valList []uint64) uint64
the length of the valList = number of validators each position represents a valIdx if the item has a number > 0, count it