@@ -83,7 +83,8 @@ func FinalityDelay(b abstract.BeaconState) uint64 {
8383 return PreviousEpoch (b ) - b .FinalizedCheckpoint ().Epoch ()
8484}
8585
86- // Implementation of is_in_inactivity_leak. tells us if network is in danger pretty much. defined in ETH 2.0 specs.
86+ // InactivityLeaking returns whether epochs are in inactivity penalty.
87+ // Implementation of is_in_inactivity_leak as defined in the ETH 2.0 specs.
8788func InactivityLeaking (b abstract.BeaconState ) bool {
8889 return FinalityDelay (b ) > b .BeaconConfig ().MinEpochsToInactivityPenalty
8990}
@@ -147,7 +148,7 @@ func IsValidIndexedAttestation(b abstract.BeaconStateBasic, att *cltypes.Indexed
147148 return true , nil
148149}
149150
150- // getUnslashedParticipatingIndices returns set of currently unslashed participating indexes
151+ // GetUnslashedParticipatingIndices returns set of currently unslashed participating indexes.
151152func GetUnslashedParticipatingIndices (b abstract.BeaconState , flagIndex int , epoch uint64 ) (validatorSet []uint64 , err error ) {
152153 var participation * solid.BitList
153154 // Must be either previous or current epoch
@@ -172,24 +173,28 @@ func GetUnslashedParticipatingIndices(b abstract.BeaconState, flagIndex int, epo
172173 return
173174}
174175
175- // Implementation of is_eligible_for_activation_queue. Specs at: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#is_eligible_for_activation_queue
176+ // IsValidatorEligibleForActivationQueue returns whether the validator is eligible to be placed into the activation queue.
177+ // Implementation of is_eligible_for_activation_queue.
178+ // Specs at: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#is_eligible_for_activation_queue
176179func IsValidatorEligibleForActivationQueue (b abstract.BeaconState , validator solid.Validator ) bool {
177180 return validator .ActivationEligibilityEpoch () == b .BeaconConfig ().FarFutureEpoch &&
178181 validator .EffectiveBalance () == b .BeaconConfig ().MaxEffectiveBalance
179182}
180183
181- // Implementation of is_eligible_for_activation. Specs at: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#is_eligible_for_activation
184+ // IsValidatorEligibleForActivation returns whether the validator is eligible for activation.
185+ // Implementation of is_eligible_for_activation.
186+ // Specs at: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#is_eligible_for_activation
182187func IsValidatorEligibleForActivation (b abstract.BeaconState , validator solid.Validator ) bool {
183188 return validator .ActivationEligibilityEpoch () <= b .FinalizedCheckpoint ().Epoch () &&
184189 validator .ActivationEpoch () == b .BeaconConfig ().FarFutureEpoch
185190}
186191
187- // Check whether a merge transition is complete by verifying the presence of a valid execution payload header.
192+ // IsMergeTransitionComplete returns whether a merge transition is complete by verifying the presence of a valid execution payload header.
188193func IsMergeTransitionComplete (b abstract.BeaconState ) bool {
189194 return ! b .LatestExecutionPayloadHeader ().IsZero ()
190195}
191196
192- // Compute the Unix timestamp at the specified slot number.
197+ // ComputeTimestampAtSlot computes the Unix timestamp at the specified slot number.
193198func ComputeTimestampAtSlot (b abstract.BeaconState , slot uint64 ) uint64 {
194199 return b .GenesisTime () + (slot - b .BeaconConfig ().GenesisSlot )* b .BeaconConfig ().SecondsPerSlot
195200}
0 commit comments