From 147374bc92dfc4768bfa90bdf8ad8f173ea8fea6 Mon Sep 17 00:00:00 2001 From: permor Date: Tue, 16 Apr 2024 23:04:37 +0900 Subject: [PATCH 1/2] chore: fix comments --- cl/phase1/core/state/accessors.go | 12 ++++++------ eth/tracers/logger/access_list_tracer.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cl/phase1/core/state/accessors.go b/cl/phase1/core/state/accessors.go index b39aedd7572..a19f38a36ef 100644 --- a/cl/phase1/core/state/accessors.go +++ b/cl/phase1/core/state/accessors.go @@ -83,7 +83,7 @@ func FinalityDelay(b abstract.BeaconState) uint64 { return PreviousEpoch(b) - b.FinalizedCheckpoint().Epoch() } -// Implementation of is_in_inactivity_leak. tells us if network is in danger pretty much. defined in ETH 2.0 specs. +// InactivityLeaking Implementation of is_in_inactivity_leak. tells us if network is in danger pretty much. defined in ETH 2.0 specs. func InactivityLeaking(b abstract.BeaconState) bool { return FinalityDelay(b) > b.BeaconConfig().MinEpochsToInactivityPenalty } @@ -147,7 +147,7 @@ func IsValidIndexedAttestation(b abstract.BeaconStateBasic, att *cltypes.Indexed return true, nil } -// getUnslashedParticipatingIndices returns set of currently unslashed participating indexes +// GetUnslashedParticipatingIndices returns set of currently unslashed participating indexes func GetUnslashedParticipatingIndices(b abstract.BeaconState, flagIndex int, epoch uint64) (validatorSet []uint64, err error) { var participation *solid.BitList // Must be either previous or current epoch @@ -172,24 +172,24 @@ func GetUnslashedParticipatingIndices(b abstract.BeaconState, flagIndex int, epo return } -// 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 +// IsValidatorEligibleForActivationQueue 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 func IsValidatorEligibleForActivationQueue(b abstract.BeaconState, validator solid.Validator) bool { return validator.ActivationEligibilityEpoch() == b.BeaconConfig().FarFutureEpoch && validator.EffectiveBalance() == b.BeaconConfig().MaxEffectiveBalance } -// 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 +// IsValidatorEligibleForActivation 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 func IsValidatorEligibleForActivation(b abstract.BeaconState, validator solid.Validator) bool { return validator.ActivationEligibilityEpoch() <= b.FinalizedCheckpoint().Epoch() && validator.ActivationEpoch() == b.BeaconConfig().FarFutureEpoch } -// Check whether a merge transition is complete by verifying the presence of a valid execution payload header. +// IsMergeTransitionComplete Check whether a merge transition is complete by verifying the presence of a valid execution payload header. func IsMergeTransitionComplete(b abstract.BeaconState) bool { return !b.LatestExecutionPayloadHeader().IsZero() } -// Compute the Unix timestamp at the specified slot number. +// ComputeTimestampAtSlot Compute the Unix timestamp at the specified slot number. func ComputeTimestampAtSlot(b abstract.BeaconState, slot uint64) uint64 { return b.GenesisTime() + (slot-b.BeaconConfig().GenesisSlot)*b.BeaconConfig().SecondsPerSlot } diff --git a/eth/tracers/logger/access_list_tracer.go b/eth/tracers/logger/access_list_tracer.go index fa78ee15a52..a869ea036ec 100644 --- a/eth/tracers/logger/access_list_tracer.go +++ b/eth/tracers/logger/access_list_tracer.go @@ -252,7 +252,7 @@ func (a *AccessListTracer) AccessList() types2.AccessList { return a.list.accessList() } -// AccessList returns the current accesslist maintained by the tracer. +// AccessListSorted returns the current accesslist maintained by the tracer. func (a *AccessListTracer) AccessListSorted() types2.AccessList { return a.list.accessListSorted() } From 4b9fd857441e7b093b6c449ff2a15afd698409b4 Mon Sep 17 00:00:00 2001 From: persmor Date: Thu, 18 Apr 2024 21:46:01 +0900 Subject: [PATCH 2/2] chore: fix function comments --- cl/phase1/core/state/accessors.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cl/phase1/core/state/accessors.go b/cl/phase1/core/state/accessors.go index a19f38a36ef..7d08c683235 100644 --- a/cl/phase1/core/state/accessors.go +++ b/cl/phase1/core/state/accessors.go @@ -83,7 +83,8 @@ func FinalityDelay(b abstract.BeaconState) uint64 { return PreviousEpoch(b) - b.FinalizedCheckpoint().Epoch() } -// InactivityLeaking Implementation of is_in_inactivity_leak. tells us if network is in danger pretty much. defined in ETH 2.0 specs. +// InactivityLeaking returns whether epochs are in inactivity penalty. +// Implementation of is_in_inactivity_leak as defined in the ETH 2.0 specs. func InactivityLeaking(b abstract.BeaconState) bool { return FinalityDelay(b) > b.BeaconConfig().MinEpochsToInactivityPenalty } @@ -147,7 +148,7 @@ func IsValidIndexedAttestation(b abstract.BeaconStateBasic, att *cltypes.Indexed return true, nil } -// GetUnslashedParticipatingIndices returns set of currently unslashed participating indexes +// GetUnslashedParticipatingIndices returns set of currently unslashed participating indexes. func GetUnslashedParticipatingIndices(b abstract.BeaconState, flagIndex int, epoch uint64) (validatorSet []uint64, err error) { var participation *solid.BitList // Must be either previous or current epoch @@ -172,24 +173,28 @@ func GetUnslashedParticipatingIndices(b abstract.BeaconState, flagIndex int, epo return } -// IsValidatorEligibleForActivationQueue 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 +// IsValidatorEligibleForActivationQueue returns whether the validator is eligible to be placed into the activation queue. +// 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 func IsValidatorEligibleForActivationQueue(b abstract.BeaconState, validator solid.Validator) bool { return validator.ActivationEligibilityEpoch() == b.BeaconConfig().FarFutureEpoch && validator.EffectiveBalance() == b.BeaconConfig().MaxEffectiveBalance } -// IsValidatorEligibleForActivation 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 +// IsValidatorEligibleForActivation returns whether the validator is eligible for activation. +// 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 func IsValidatorEligibleForActivation(b abstract.BeaconState, validator solid.Validator) bool { return validator.ActivationEligibilityEpoch() <= b.FinalizedCheckpoint().Epoch() && validator.ActivationEpoch() == b.BeaconConfig().FarFutureEpoch } -// IsMergeTransitionComplete Check whether a merge transition is complete by verifying the presence of a valid execution payload header. +// IsMergeTransitionComplete returns whether a merge transition is complete by verifying the presence of a valid execution payload header. func IsMergeTransitionComplete(b abstract.BeaconState) bool { return !b.LatestExecutionPayloadHeader().IsZero() } -// ComputeTimestampAtSlot Compute the Unix timestamp at the specified slot number. +// ComputeTimestampAtSlot computes the Unix timestamp at the specified slot number. func ComputeTimestampAtSlot(b abstract.BeaconState, slot uint64) uint64 { return b.GenesisTime() + (slot-b.BeaconConfig().GenesisSlot)*b.BeaconConfig().SecondsPerSlot }