mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 20:37:17 +00:00
Type for process epoch optimization (#3783)
This commit is contained in:
parent
86a8ec035c
commit
a62ac97a35
8
beacon-chain/core/epoch/precompute/BUILD.bazel
Normal file
8
beacon-chain/core/epoch/precompute/BUILD.bazel
Normal file
@ -0,0 +1,8 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["type.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch/precompute",
|
||||
visibility = ["//beacon-chain:__subpackages__"],
|
||||
)
|
54
beacon-chain/core/epoch/precompute/type.go
Normal file
54
beacon-chain/core/epoch/precompute/type.go
Normal file
@ -0,0 +1,54 @@
|
||||
package precompute
|
||||
|
||||
// Validator stores the pre computation of individual validator's attesting records these records
|
||||
// consist of attestation votes, block inclusion record. Pre computing and storing such record
|
||||
// is essential for process epoch optimizations.
|
||||
type Validator struct {
|
||||
// IsSlashed is true if the validator has been slashed.
|
||||
IsSlashed bool
|
||||
// IsWithdrawableCurrentEpoch is true if the validator can withdraw current epoch.
|
||||
IsWithdrawableCurrentEpoch bool
|
||||
// IsActiveCurrentEpoch is true if the validator was active current epoch.
|
||||
IsActiveCurrentEpoch bool
|
||||
// IsActivePrevEpoch is true if the validator was active prev epoch.
|
||||
IsActivePrevEpoch bool
|
||||
// IsCurrentEpochAttester is true if the validator attested current epoch.
|
||||
IsCurrentEpochAttester bool
|
||||
// IsCurrentEpochTargetAttester is true if the validator attested current epoch target.
|
||||
IsCurrentEpochTargetAttester bool
|
||||
// IsPrevEpochAttester is true if the validator attested previous epoch.
|
||||
IsPrevEpochAttester bool
|
||||
// IsPrevEpochTargetAttester is true if the validator attested previous epoch target.
|
||||
IsPrevEpochTargetAttester bool
|
||||
// IsHeadAttester is true if the validator attested head.
|
||||
IsPrevEpochHeadAttester bool
|
||||
|
||||
// CurrentEpochEffectiveBalance is how much effective balance this validator validator has current epoch.
|
||||
CurrentEpochEffectiveBalance uint64
|
||||
// InclusionDistance is the distance between the assigned slot and this validator's attestation was included in block.
|
||||
InclusionDistance uint64
|
||||
// ProposerIndex is the index of proposer at slot where this validator's attestation was included.
|
||||
ProposerIndex uint64
|
||||
}
|
||||
|
||||
// Balance stores the pre computation of the total participated balances for a given epoch
|
||||
// Pre computing and storing such record is essential for process epoch optimizations.
|
||||
type Balance struct {
|
||||
// CurrentEpoch is the total effective balance of all active validators during current epoch.
|
||||
CurrentEpoch uint64
|
||||
// PrevEpoch is the total effective balance of all active validators during prev epoch.
|
||||
PrevEpoch uint64
|
||||
// CurrentEpochAttesters is the total effective balance of all validators who attested during current epoch.
|
||||
CurrentEpochAttesters uint64
|
||||
// CurrentEpochTargetAttesters is the total effective balance of all validators who attested
|
||||
// for epoch boundary block during current epoch.
|
||||
CurrentEpochTargetAttesters uint64
|
||||
// PrevEpochAttesters is the total effective balance of all validators who attested during prev epoch.
|
||||
PrevEpochAttesters uint64
|
||||
// PrevEpochTargetAttesters is the total effective balance of all validators who attested
|
||||
// for epoch boundary block during prev epoch.
|
||||
PrevEpochTargetAttesters uint64
|
||||
// PrevEpochHeadAttesters is the total effective balance of all validators who attested
|
||||
// correctly for head block during prev epoch.
|
||||
PrevEpochHeadAttesters uint64
|
||||
}
|
Loading…
Reference in New Issue
Block a user