diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ede87dcfe8c2..a469332919cd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -53,6 +53,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.47.2 + args: --config=.golangci.yml --out-${NO_FUTURE}format colored-line-number build: name: Build diff --git a/.golangci.yml b/.golangci.yml index d3cc30f97f45..03df11a504e2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,7 @@ linters: enable: - gofmt - goimports - - deadcode + - unused - errcheck - gosimple - gocognit diff --git a/api/client/beacon/checkpoint.go b/api/client/beacon/checkpoint.go index 9616c4f62414..02346554da3e 100644 --- a/api/client/beacon/checkpoint.go +++ b/api/client/beacon/checkpoint.go @@ -21,7 +21,7 @@ import ( // OriginData represents the BeaconState and SignedBeaconBlock necessary to start an empty Beacon Node // using Checkpoint Sync. type OriginData struct { - wsd *WeakSubjectivityData + wsd *WeakSubjectivityData // nolint:unused sb []byte bb []byte st state.BeaconState diff --git a/api/client/beacon/client.go b/api/client/beacon/client.go index 0fb82f1433c5..1fd85886ed99 100644 --- a/api/client/beacon/client.go +++ b/api/client/beacon/client.go @@ -95,8 +95,6 @@ func WithTimeout(timeout time.Duration) ClientOpt { // Client provides a collection of helper methods for calling the Eth Beacon Node API endpoints. type Client struct { hc *http.Client - host string - scheme string baseURL *url.URL } diff --git a/beacon-chain/execution/service.go b/beacon-chain/execution/service.go index b5ccd20cfd58..1fc830630fd9 100644 --- a/beacon-chain/execution/service.go +++ b/beacon-chain/execution/service.go @@ -316,7 +316,7 @@ func (s *Service) updateBeaconNodeStats() { s.cfg.beaconNodeStatsUpdater.Update(bs) } -func (s *Service) updateCurrHttpEndpoint(endpoint network.Endpoint) { +func (s *Service) updateCurrHttpEndpoint(endpoint network.Endpoint) { // nolint:unused s.cfg.currHttpEndpoint = endpoint s.updateBeaconNodeStats() } diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index 0609905c5b8c..30124ffdea75 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -105,7 +105,6 @@ type BeaconNode struct { slasherAttestationsFeed *event.Feed finalizedStateAtStartUp state.BeaconState serviceFlagOpts *serviceFlagOpts - blockchainFlagOpts []blockchain.Option GenesisInitializer genesis.Initializer CheckpointInitializer checkpoint.Initializer } diff --git a/beacon-chain/rpc/eth/validator/validator.go b/beacon-chain/rpc/eth/validator/validator.go index b1cd32e8d155..338076afbab2 100644 --- a/beacon-chain/rpc/eth/validator/validator.go +++ b/beacon-chain/rpc/eth/validator/validator.go @@ -195,11 +195,11 @@ func (vs *Server) GetProposerDuties(ctx context.Context, req *ethpbv1.ProposerDu // where `epoch` is described as `epoch // EPOCHS_PER_SYNC_COMMITTEE_PERIOD <= current_epoch // EPOCHS_PER_SYNC_COMMITTEE_PERIOD + 1`. // // Algorithm: -// - Get the last valid epoch. This is the last epoch of the next sync committee period. -// - Get the state for the requested epoch. If it's a future epoch from the current sync committee period -// or an epoch from the next sync committee period, then get the current state. -// - Get the state's current sync committee. If it's an epoch from the next sync committee period, then get the next sync committee. -// - Get duties. +// - Get the last valid epoch. This is the last epoch of the next sync committee period. +// - Get the state for the requested epoch. If it's a future epoch from the current sync committee period +// or an epoch from the next sync committee period, then get the current state. +// - Get the state's current sync committee. If it's an epoch from the next sync committee period, then get the next sync committee. +// - Get duties. func (vs *Server) GetSyncCommitteeDuties(ctx context.Context, req *ethpbv2.SyncCommitteeDutiesRequest) (*ethpbv2.SyncCommitteeDutiesResponse, error) { ctx, span := trace.StartSpan(ctx, "validator.GetSyncCommitteeDuties") defer span.End() @@ -1035,19 +1035,6 @@ func v1ValidatorStatusToV1Alpha1(valStatus ethpbv1.ValidatorStatus) ethpbalpha.V } } -func (vs *Server) v1BeaconBlock(ctx context.Context, req *ethpbv1.ProduceBlockRequest) (*ethpbv1.BeaconBlock, error) { - v1alpha1req := ðpbalpha.BlockRequest{ - Slot: req.Slot, - RandaoReveal: req.RandaoReveal, - Graffiti: req.Graffiti, - } - v1alpha1resp, err := vs.V1Alpha1Server.GetBeaconBlock(ctx, v1alpha1req) - if err != nil { - return nil, err - } - return migration.V1Alpha1ToV1Block(v1alpha1resp.GetPhase0()) -} - func syncCommitteeDutiesLastValidEpoch(currentEpoch types.Epoch) types.Epoch { currentSyncPeriodIndex := currentEpoch / params.BeaconConfig().EpochsPerSyncCommitteePeriod // Return the last epoch of the next sync committee. diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/status.go b/beacon-chain/rpc/prysm/v1alpha1/validator/status.go index c778618cfc12..798708aac7b4 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/status.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/status.go @@ -30,13 +30,14 @@ var errParticipation = status.Errorf(codes.Internal, "Failed to obtain epoch par // ValidatorStatus returns the validator status of the current epoch. // The status response can be one of the following: -// DEPOSITED - validator's deposit has been recognized by Ethereum 1, not yet recognized by Ethereum. -// PENDING - validator is in Ethereum's activation queue. -// ACTIVE - validator is active. -// EXITING - validator has initiated an an exit request, or has dropped below the ejection balance and is being kicked out. -// EXITED - validator is no longer validating. -// SLASHING - validator has been kicked out due to meeting a slashing condition. -// UNKNOWN_STATUS - validator does not have a known status in the network. +// +// DEPOSITED - validator's deposit has been recognized by Ethereum 1, not yet recognized by Ethereum. +// PENDING - validator is in Ethereum's activation queue. +// ACTIVE - validator is active. +// EXITING - validator has initiated an an exit request, or has dropped below the ejection balance and is being kicked out. +// EXITED - validator is no longer validating. +// SLASHING - validator has been kicked out due to meeting a slashing condition. +// UNKNOWN_STATUS - validator does not have a known status in the network. func (vs *Server) ValidatorStatus( ctx context.Context, req *ethpb.ValidatorStatusRequest, @@ -363,15 +364,6 @@ func (vs *Server) validatorStatus( } } -func (vs *Server) retrieveAfterEpochTransition(ctx context.Context, epoch types.Epoch) (state.BeaconState, error) { - endSlot, err := slots.EpochEnd(epoch) - if err != nil { - return nil, err - } - // replay to first slot of following epoch - return vs.ReplayerBuilder.ReplayerForSlot(endSlot).ReplayToSlot(ctx, endSlot+1) -} - func checkValidatorsAreRecent(headEpoch types.Epoch, req *ethpb.DoppelGangerRequest) (bool, *ethpb.DoppelGangerResponse) { validatorsAreRecent := true resp := ðpb.DoppelGangerResponse{ diff --git a/beacon-chain/state/stategen/replayer.go b/beacon-chain/state/stategen/replayer.go index dae7c74a18bb..755aee12352e 100644 --- a/beacon-chain/state/stategen/replayer.go +++ b/beacon-chain/state/stategen/replayer.go @@ -63,7 +63,7 @@ type chainer interface { } type stateReplayer struct { - s state.BeaconState + s state.BeaconState // nolint:unused target types.Slot method retrievalMethod chainer chainer diff --git a/config/params/testnet_e2e_config.go b/config/params/testnet_e2e_config.go index 7e25bb88b58a..2a8407518a64 100644 --- a/config/params/testnet_e2e_config.go +++ b/config/params/testnet_e2e_config.go @@ -2,7 +2,7 @@ package params const ( altairE2EForkEpoch = 6 - bellatrixE2EForkEpoch = 8 //nolint:deadcode + bellatrixE2EForkEpoch = 8 ) // E2ETestConfig retrieves the configurations made specifically for E2E testing.