Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: correct comment naming #1420

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mod/da/pkg/blob/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewSidecarFactory[
}
}

// BuildSidecar builds a sidecar.
// BuildSidecars builds a sidecar.
func (f *SidecarFactory[BeaconBlockT, BeaconBlockBodyT]) BuildSidecars(
blk BeaconBlockT,
bundle engineprimitives.BlobsBundle,
Expand Down
2 changes: 1 addition & 1 deletion mod/da/pkg/kzg/ckzg/ckzg.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Implementation = "ethereum/c-kzg-4844"
// Verifier is a verifier that utilizies the CKZG library.
type Verifier struct{}

// Implementation returns the implementation of the verifier.
// GetImplementation returns the implementation of the verifier.
func (v Verifier) GetImplementation() string {
return Implementation
}
Expand Down
2 changes: 1 addition & 1 deletion mod/da/pkg/kzg/gokzg/gokzg.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (v Verifier) GetImplementation() string {
return Implementation
}

// VerifyProof verifies the KZG proof that the polynomial represented by the
// VerifyBlobProof verifies the KZG proof that the polynomial represented by the
// blob evaluated at the given point is the claimed value.
func (v Verifier) VerifyBlobProof(
blob *eip4844.Blob,
Expand Down
2 changes: 1 addition & 1 deletion mod/da/pkg/kzg/noop/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (v Verifier) GetImplementation() string {
return "noop"
}

// VerifyProof is a no-op.
// VerifyBlobProof is a no-op.
func (v Verifier) VerifyBlobProof(
*eip4844.Blob,
eip4844.KZGProof,
Expand Down
1 change: 0 additions & 1 deletion mod/da/pkg/store/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type BlockEvent[BeaconBlockT BeaconBlock] interface {

// IndexDB is a database that allows prefixing by index.
type IndexDB interface {
// Has
Has(index uint64, key []byte) (bool, error)
Set(index uint64, key []byte, value []byte) error
}
Expand Down
2 changes: 1 addition & 1 deletion mod/da/pkg/types/sidecars.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/sourcegraph/conc/iter"
)

// SideCars is a slice of blob side cars to be included in the block.
// BlobSidecars is a slice of blob side cars to be included in the block.
//
//go:generate go run github.com/ferranbt/fastssz/sszgen -path ./sidecars.go -objs BlobSidecars -include ../../../consensus-types/pkg/types,../../../primitives/pkg/bytes,./sidecar.go,../../../primitives/pkg/math,../../../primitives/mod.go,../../../primitives/pkg/eip4844,$GETH_PKG_INCLUDE/common,$GETH_PKG_INCLUDE/common/hexutil -output sidecars.ssz.go
type BlobSidecars struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (p *PayloadAttributes[Withdrawal]) IsNil() bool {
return p == nil
}

// GetSuggestionsFeeRecipient returns the suggested fee recipient.
// GetSuggestedFeeRecipient returns the suggested fee recipient.
func (
p *PayloadAttributes[Withdrawal],
) GetSuggestedFeeRecipient() common.ExecutionAddress {
Expand Down
2 changes: 1 addition & 1 deletion mod/engine-primitives/pkg/engine-primitives/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type ForkchoiceResponseV1 struct {
PayloadID *PayloadID `json:"payloadId"`
}

// ForkchoicStateV1 as per the EngineAPI Specification:
// ForkchoiceStateV1 as per the EngineAPI Specification:
// https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#forkchoicestatev1
//
//nolint:lll // link.
Expand Down
3 changes: 1 addition & 2 deletions mod/engine-primitives/pkg/engine-primitives/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func BuildNewPayloadRequest[
}
}

// HasHValidVersionAndBlockHashes checks if the version and block hashes are
// HasValidVersionedAndBlockHashes checks if the version and block hashes are
// valid.
// As per the Ethereum 2.0 specification:
// https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.2/specs/deneb/beacon-chain.md#is_valid_block_hash
Expand Down Expand Up @@ -229,7 +229,6 @@ func (n *NewPayloadRequest[ExecutionPayloadT, WithdrawalT]) HasValidVersionedAnd
return nil
}

// ForkchoiceUpdateRequest.
type ForkchoiceUpdateRequest struct {
// State is the forkchoice state.
State *ForkchoiceStateV1
Expand Down
2 changes: 1 addition & 1 deletion mod/engine-primitives/pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var (
ErrNilForkchoiceResponse = errors.New(
"nil forkchoice response",
)
/// ErrNilBlobsBundle is returned when nil blobs bundle is received.
// ErrNilBlobsBundle is returned when nil blobs bundle is received.
ErrNilBlobsBundle = errors.New(
"nil blobs bundle received from execution client")

Expand Down
2 changes: 1 addition & 1 deletion mod/errors/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type DetailedError struct {
fatal bool
}

// Error returns the error message.
// WrapNonFatal returns the error message.
func WrapNonFatal(err error) error {
return &DetailedError{
error: err,
Expand Down
4 changes: 2 additions & 2 deletions mod/execution/pkg/client/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type EngineCache struct {
]
}

// NewEngineCacheWithConfig creates a new EngineCache with the given config.
// NewEngineCache creates a new EngineCache with the given config.
func NewEngineCache(
config Config,
) *EngineCache {
Expand All @@ -62,7 +62,7 @@ func NewEngineCache(
}
}

// NewEngineCache creates a new EngineCache.
// NewEngineCacheWithDefaultConfig creates a new EngineCache.
func NewEngineCacheWithDefaultConfig() *EngineCache {
return NewEngineCache(DefaultConfig())
}
Expand Down
4 changes: 2 additions & 2 deletions mod/execution/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func New[ExecutionPayloadT interface {
}
}

// StartWithHTTP starts the engine client.
// Start the engine client.
func (s *EngineClient[ExecutionPayloadT]) Start(
ctx context.Context,
) error {
Expand Down Expand Up @@ -149,7 +149,7 @@ func (s *EngineClient[ExecutionPayloadT]) WaitForHealthy(
}
}

// Checks the chain ID of the execution client to ensure
// VerifyChainID Checks the chain ID of the execution client to ensure
// it matches local parameters of what Prysm expects.
func (s *EngineClient[ExecutionPayloadT]) VerifyChainID(
ctx context.Context,
Expand Down
2 changes: 1 addition & 1 deletion mod/interfaces/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Deposit[
GetIndex() uint64
}

// Marshallable is an interface that combines the ssz.Marshaler and
// SSZMarshallable is an interface that combines the ssz.Marshaler and
// ssz.Unmarshaler interfaces.
type SSZMarshallable interface {
// MarshalSSZTo marshals the object into the provided byte slice and returns
Expand Down
4 changes: 3 additions & 1 deletion mod/node-api/server/validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ func ValidateUint64(fl validator.FieldLevel) bool {
return false
}

// hex encoded public key (any bytes48 with 0x prefix) or validator index.
// ValidateValidatorID checks if the provided field is a valid
// validator identifier. It validates against a hex-encoded public key
// or a numeric validator index.
func ValidateValidatorID(fl validator.FieldLevel) bool {
valid, err := validateRegex(fl, `^0x[0-9a-fA-F]{1,96}$`)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion mod/node-core/pkg/components/jwt_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/spf13/cast"
)

// TrustedSetupInput is the input for the dep inject framework.
// JWTSecretInput is the input for the dep inject framework.
type JWTSecretInput struct {
depinject.In
AppOpts servertypes.AppOptions
Expand Down
2 changes: 1 addition & 1 deletion mod/node-core/pkg/components/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type BlsSignerInput struct {
PrivKey LegacyKey `optional:"true"`
}

// type alias to LegacyKey used for LegacySinger construction.
// LegacyKey type alias to LegacyKey used for LegacySinger construction.
type LegacyKey = signer.LegacyKey

// ProvideBlsSigner is a function that provides the module to the application.
Expand Down
2 changes: 1 addition & 1 deletion mod/node-core/pkg/components/trusted_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type TrustedSetupInput struct {
AppOpts servertypes.AppOptions
}

// ProvideBlsSigner is a function that provides the module to the application.
// ProvideTrustedSetup provides the module to the application.
func ProvideTrustedSetup(
in TrustedSetupInput,
) (*gokzg4844.JSONTrustedSetup, error) {
Expand Down
4 changes: 2 additions & 2 deletions mod/node-core/pkg/config/viper/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/mitchellh/mapstructure"
)

// StringToSliceHookFunc returns a DecodeHookFunc that converts
// StringToExecutionAddressFunc returns a DecodeHookFunc that converts
// string to a `primitives.ExecutionAddresses` by parsing the string.
func StringToExecutionAddressFunc() mapstructure.DecodeHookFunc {
return StringTo(
Expand All @@ -53,7 +53,7 @@ func StringToDialURLFunc() mapstructure.DecodeHookFunc {
)
}

// StringToDialURLFunc returns a DecodeHookFunc that converts
// StringToConnectionURLFunc returns a DecodeHookFunc that converts
// string to *beaconurl.ConnectionURL by parsing the string.
func StringToConnectionURLFunc() mapstructure.DecodeHookFunc {
return StringTo(beaconurl.NewFromRaw)
Expand Down
2 changes: 1 addition & 1 deletion mod/payload/pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type PayloadBuilder[
]
}

// NewService creates a new service.
// New creates a new service.
func New[
BeaconStateT BeaconState[ExecutionPayloadHeaderT],
ExecutionPayloadT interface {
Expand Down
8 changes: 4 additions & 4 deletions mod/payload/pkg/builder/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/berachain/beacon-kit/mod/primitives/pkg/math"
)

// RequestPayload builds a payload for the given slot and
// RequestPayloadAsync builds a payload for the given slot and
// returns the payload ID.
func (pb *PayloadBuilder[
BeaconStateT, ExecutionPayloadT, ExecutionPayloadHeaderT,
Expand Down Expand Up @@ -102,7 +102,7 @@ func (pb *PayloadBuilder[
return payloadID, nil
}

// RequestPayload request a payload for the given slot and
// RequestPayloadSync request a payload for the given slot and
// blocks until the payload is delivered.
func (pb *PayloadBuilder[
BeaconStateT, ExecutionPayloadT, ExecutionPayloadHeaderT,
Expand Down Expand Up @@ -160,7 +160,7 @@ func (pb *PayloadBuilder[
)
}

// RetrieveOrBuildPayload attempts to pull a previously built payload
// RetrievePayload attempts to pull a previously built payload
// by reading a payloadID from the builder's cache. If it fails to
// retrieve a payload, it will build a new payload and wait for the
// execution client to return the payload.
Expand Down Expand Up @@ -229,7 +229,7 @@ func (pb *PayloadBuilder[
return envelope, err
}

// RequestPayload builds a payload for the given slot and
// SendForceHeadFCU builds a payload for the given slot and
// returns the payload ID.
//
// TODO: This should be moved onto a "sync service"
Expand Down
4 changes: 2 additions & 2 deletions mod/payload/pkg/cache/payload_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewPayloadIDCache[
}
}

// Get retrieves the payload ID associated with a given slot and eth1 hash.
// Has retrieves the payload ID associated with a given slot and eth1 hash.
// Has checks if a payload ID exists for a given slot and eth1 hash.
func (p *PayloadIDCache[PayloadIDT, RootT, SlotT]) Has(
slot SlotT,
Expand All @@ -66,7 +66,7 @@ func (p *PayloadIDCache[PayloadIDT, RootT, SlotT]) Has(
return ok
}

// was successful.
// Get was successful.
func (p *PayloadIDCache[PayloadIDT, RootT, SlotT]) Get(
slot SlotT,
stateRoot RootT,
Expand Down
2 changes: 1 addition & 1 deletion mod/runtime/pkg/p2p/noop_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/berachain/beacon-kit/mod/runtime/pkg/encoding"
)

// NoopGossipHandler is a gossip handler that simply returns the
// NoopBlobHandler is a gossip handler that simply returns the
// ssz marshalled data as a "reference" to the object it receives.
type NoopBlobHandler[BlobT ssz.Marshallable, ReqT encoding.ABCIRequest] struct {
NoopGossipHandler[BlobT, []byte]
Expand Down
2 changes: 1 addition & 1 deletion mod/runtime/pkg/p2p/noop_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/berachain/beacon-kit/mod/runtime/pkg/encoding"
)

// NoopGossipHandler is a gossip handler that simply returns the
// NoopBlockGossipHandler is a gossip handler that simply returns the
// ssz marshalled data as a "reference" to the object it receives.
type NoopBlockGossipHandler[BeaconBlockT interface {
ssz.Marshallable
Expand Down
1 change: 1 addition & 0 deletions mod/runtime/pkg/runtime/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
appmodulev2 "cosmossdk.io/core/appmodule/v2"
)

// InitGenesis
// TODO: InitGenesis should be calling into the StateProcessor.
func (r BeaconKitRuntime[
AvailabilityStoreT, BeaconBlockT, BeaconBlockBodyT,
Expand Down
2 changes: 1 addition & 1 deletion mod/runtime/pkg/runtime/middleware/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
// BeaconBlockTxIndex represents the index of the beacon block transaction.
// It is the first transaction in the tx list.
BeaconBlockTxIndex uint = iota
// BlobSidecarTxIndex represents the index of the blob sidecar transaction.
// BlobSidecarsTxIndex represents the index of the blob sidecar transaction.
// It follows the beacon block transaction in the tx list.
BlobSidecarsTxIndex
)
2 changes: 1 addition & 1 deletion mod/runtime/pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (r *BeaconKitRuntime[
return r.services.StartAll(ctx)
}

// ABCIHandler returns the ABCI handler.
// ABCIFinalizeBlockMiddleware returns the ABCI handler.
func (r *BeaconKitRuntime[
AvailabilityStoreT, BeaconBlockT, BeaconBlockBodyT, BeaconStateT,
BlobSidecarsT, DepositStoreT, StorageBackendT,
Expand Down
4 changes: 2 additions & 2 deletions mod/runtime/pkg/service/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ func (s *Registry) Statuses(services ...string) map[string]error {
return m
}

// Statuses returns a map of Service type -> error. The map will be populated
// with the results of each service.Status() method call.
// WaitForHealthy blocks until all specified services are considered healthy.
// It waits for each service's WaitForHealthy method to complete.
func (s *Registry) WaitForHealthy(ctx context.Context, services ...string) {
wg := conc.NewWaitGroup()
for _, typeName := range services {
Expand Down
4 changes: 2 additions & 2 deletions mod/state-transition/pkg/core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type StateDB[
cs primitives.ChainSpec
}

// NewBeaconState creates a new beacon state from an underlying state db.
// NewBeaconStateFromDB creates a new beacon state from an underlying state db.
func NewBeaconStateFromDB[
BeaconStateT any,
KVStoreT KVStore[
Expand Down Expand Up @@ -278,7 +278,7 @@ func (s *StateDB[
return withdrawals, nil
}

// Store is the interface for the beacon store.
// HashTreeRoot is the interface for the beacon store.
//
//nolint:funlen,gocognit // todo fix somehow
func (s *StateDB[
Expand Down
2 changes: 1 addition & 1 deletion mod/state-transition/pkg/core/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ type Withdrawal[WithdrawalT any] interface {
Equals(WithdrawalT) bool
// GetAmount returns the amount of the withdrawal.
GetAmount() math.Gwei
// GetPubkey returns the public key of the validator.
// GetIndex returns the public key of the validator.
GetIndex() math.U64
// GetValidatorIndex returns the index of the validator.
GetValidatorIndex() math.ValidatorIndex
Expand Down
2 changes: 1 addition & 1 deletion mod/storage/pkg/beacondb/encoding/ssz_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type SSZInterfaceCodec[T interface {
latestVersion uint32
}

// SetForkVersion sets the fork version for the codec.
// SetActiveForkVersion sets the fork version for the codec.
func (cdc *SSZInterfaceCodec[T]) SetActiveForkVersion(version uint32) {
cdc.latestVersion = version
}
Expand Down
2 changes: 1 addition & 1 deletion mod/storage/pkg/beacondb/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (kv *KVStore[
return kv.blockRoots.Set(kv.ctx, index, root[:])
}

// GetBlockRoot retrieves the block root from the BeaconStore.
// GetBlockRootAtIndex retrieves the block root from the BeaconStore.
func (kv *KVStore[
ForkT, BeaconBlockHeaderT, ExecutionPayloadT, Eth1DataT, ValidatorT,
]) GetBlockRootAtIndex(
Expand Down
2 changes: 1 addition & 1 deletion mod/storage/pkg/beacondb/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ type KVStore[
totalSlashing sdkcollections.Item[uint64]
}

// Store creates a new instance of Store.
// New creates a new instance of Store.
//
//nolint:funlen // its not overly complex.
func New[
Expand Down
4 changes: 2 additions & 2 deletions mod/storage/pkg/beacondb/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (kv *KVStore[
return kv.validators.Remove(kv.ctx, uint64(idx))
}

// ValidatorPubKeyByIndex returns the validator address by index.
// ValidatorIndexByPubkey returns the validator address by index.
func (kv *KVStore[
ForkT, BeaconBlockHeaderT, ExecutionPayloadT, Eth1DataT, ValidatorT,
]) ValidatorIndexByPubkey(
Expand All @@ -82,7 +82,7 @@ func (kv *KVStore[
return math.ValidatorIndex(idx), nil
}

// ValidatorByIndex returns the validator address by index.
// ValidatorIndexByCometBFTAddress returns the validator address by index.
func (kv *KVStore[
ForkT, BeaconBlockHeaderT, ExecutionPayloadT, Eth1DataT, ValidatorT,
]) ValidatorIndexByCometBFTAddress(
Expand Down
Loading
Loading