diff --git a/.golangci.yml b/.golangci.yml index 078833cd5..6d458a5b7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,6 +17,7 @@ linters: - errcheck - gosimple - gocognit + - whitespace - misspell linters-settings: diff --git a/api/client/builder/client.go b/api/client/builder/client.go index 537e14338..2462431db 100644 --- a/api/client/builder/client.go +++ b/api/client/builder/client.go @@ -246,7 +246,6 @@ func (c *Client) GetHeader(ctx context.Context, slot primitives.Slot, parentHash default: return nil, fmt.Errorf("unsupported header version %s", strings.ToLower(v.Version)) } - } // RegisterValidator encodes the SignedValidatorRegistrationV1 message to json (including hex-encoding the byte diff --git a/beacon-chain/blockchain/log.go b/beacon-chain/blockchain/log.go index fc73eecb4..3cb2e13d4 100644 --- a/beacon-chain/blockchain/log.go +++ b/beacon-chain/blockchain/log.go @@ -60,7 +60,6 @@ func logStateTransitionData(b interfaces.ReadOnlyBeaconBlock) error { log = log.WithField("txCount", len(txs)) txsPerSlotCount.Set(float64(len(txs))) } - } log.Info("Finished applying state transition") return nil diff --git a/beacon-chain/blockchain/process_attestation_helpers.go b/beacon-chain/blockchain/process_attestation_helpers.go index 064650fe2..67f4d56fe 100644 --- a/beacon-chain/blockchain/process_attestation_helpers.go +++ b/beacon-chain/blockchain/process_attestation_helpers.go @@ -55,7 +55,6 @@ func (s *Service) getAttPreState(ctx context.Context, c *ethpb.Checkpoint) (stat return nil, errors.Wrap(err, "could not save checkpoint state to cache") } return baseState, nil - } // verifyAttTargetEpoch validates attestation is from the current or previous epoch. diff --git a/beacon-chain/blockchain/process_block.go b/beacon-chain/blockchain/process_block.go index 3ae627e9f..fde371217 100644 --- a/beacon-chain/blockchain/process_block.go +++ b/beacon-chain/blockchain/process_block.go @@ -283,7 +283,6 @@ func (s *Service) onBlock(ctx context.Context, signed interfaces.ReadOnlySignedB log.WithError(err).Error("Could not insert finalized deposits.") } }() - } defer reportAttestationInclusion(b) if err := s.handleEpochBoundary(ctx, postState); err != nil { diff --git a/beacon-chain/core/epoch/precompute/reward_penalty.go b/beacon-chain/core/epoch/precompute/reward_penalty.go index fee457d2e..0c49016f1 100644 --- a/beacon-chain/core/epoch/precompute/reward_penalty.go +++ b/beacon-chain/core/epoch/precompute/reward_penalty.go @@ -104,7 +104,6 @@ func attestationDelta(pBal *Balance, sqrtActiveCurrentEpoch uint64, v *Validator } else { rewardNumerator := br * (pBal.PrevEpochAttested / effectiveBalanceIncrement) r += rewardNumerator / currentEpochBalance - } } else { p += br diff --git a/beacon-chain/db/kv/state.go b/beacon-chain/db/kv/state.go index a0322154d..7f6b9b802 100644 --- a/beacon-chain/db/kv/state.go +++ b/beacon-chain/db/kv/state.go @@ -874,5 +874,4 @@ func (s *Store) isStateValidatorMigrationOver() (bool, error) { return returnFlag, err } return returnFlag, nil - } diff --git a/beacon-chain/execution/service.go b/beacon-chain/execution/service.go index 4ec118519..850886260 100644 --- a/beacon-chain/execution/service.go +++ b/beacon-chain/execution/service.go @@ -425,7 +425,6 @@ func (s *Service) batchRequestHeaders(startBlock, endBlock uint64) ([]*types.Hea Error: error(nil), }) headers = append(headers, header) - } ioErr := s.rpcClient.BatchCall(elems) if ioErr != nil { diff --git a/beacon-chain/execution/testing/mock_execution_chain.go b/beacon-chain/execution/testing/mock_execution_chain.go index baf194610..157748d77 100644 --- a/beacon-chain/execution/testing/mock_execution_chain.go +++ b/beacon-chain/execution/testing/mock_execution_chain.go @@ -246,7 +246,6 @@ func (r *RPCClient) BatchCall(b []rpc.BatchElem) error { return err } *e.Result.(*types.HeaderInfo) = types.HeaderInfo{Number: h.Number, Time: h.Time, Hash: h.Hash()} - } return nil } diff --git a/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go b/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go index 6106e7dd7..054a7c036 100644 --- a/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go +++ b/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go @@ -560,7 +560,6 @@ func (f *ForkChoice) ForkChoiceDump(ctx context.Context) (*v1.ForkChoiceDump, er ForkChoiceNodes: nodes, } return resp, nil - } // SetBalancesByRooter sets the balanceByRoot handler in forkchoice diff --git a/beacon-chain/gateway/helpers.go b/beacon-chain/gateway/helpers.go index eb7b1992d..508506c7c 100644 --- a/beacon-chain/gateway/helpers.go +++ b/beacon-chain/gateway/helpers.go @@ -28,7 +28,6 @@ func DefaultConfig(enableDebugRPCEndpoints bool, httpModules string) MuxConfig { } if enableDebugRPCEndpoints { v1AlphaRegistrations = append(v1AlphaRegistrations, ethpbalpha.RegisterDebugHandler) - } v1AlphaMux := gwruntime.NewServeMux( gwruntime.WithMarshalerOption(gwruntime.MIMEWildcard, &gwruntime.HTTPBodyMarshaler{ @@ -60,7 +59,6 @@ func DefaultConfig(enableDebugRPCEndpoints bool, httpModules string) MuxConfig { } if enableDebugRPCEndpoints { ethRegistrations = append(ethRegistrations, ethpbservice.RegisterBeaconDebugHandler) - } ethMux := gwruntime.NewServeMux( gwruntime.WithMarshalerOption(gwruntime.MIMEWildcard, &gwruntime.HTTPBodyMarshaler{ diff --git a/beacon-chain/monitor/process_block.go b/beacon-chain/monitor/process_block.go index 6f4be7b2a..b863a1f0e 100644 --- a/beacon-chain/monitor/process_block.go +++ b/beacon-chain/monitor/process_block.go @@ -133,7 +133,6 @@ func (s *Service) processSlashings(blk interfaces.ReadOnlyBeaconBlock) { "SourceEpoch2": slashing.Attestation_2.Data.Source.Epoch, "TargetEpoch2": slashing.Attestation_2.Data.Target.Epoch, }).Info("Attester slashing was included") - } } } diff --git a/beacon-chain/operations/blstoexec/pool.go b/beacon-chain/operations/blstoexec/pool.go index 8a383f978..d9bd1931a 100644 --- a/beacon-chain/operations/blstoexec/pool.go +++ b/beacon-chain/operations/blstoexec/pool.go @@ -127,7 +127,6 @@ func (p *Pool) InsertBLSToExecChange(change *ethpb.SignedBLSToExecutionChange) { p.m[change.Message.ValidatorIndex] = p.pending.Last() blsToExecMessageInPoolTotal.Inc() - } // MarkIncluded is used when an object has been included in a beacon block. Every block seen by this diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators.go index 0eff25056..b0607d56d 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators.go @@ -887,7 +887,6 @@ func (bs *Server) GetIndividualVotes( val, err := st.ValidatorAtIndexReadOnly(index) if err != nil { return nil, status.Errorf(codes.Internal, "Could not retrieve validator: %v", err) - } pb := val.PublicKey() votes = append(votes, ðpb.IndividualVotesRespond_IndividualVote{ diff --git a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream.go b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream.go index ac371c49c..fe499422a 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream.go +++ b/beacon-chain/rpc/prysm/v1alpha1/beacon/validators_stream.go @@ -284,7 +284,6 @@ func (is *infostream) generateValidatorsInfo(pubKeys [][]byte) ([]*ethpb.Validat v, err := headState.ValidatorAtIndexReadOnly(i) if err != nil { return nil, status.Errorf(codes.Internal, "Could not retrieve validator: %v", err) - } info, err := is.generateValidatorInfo(pubKey, v, headState, epoch) if err != nil { diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go index 34ccbd4a9..4234f791f 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer.go @@ -229,7 +229,6 @@ func (vs *Server) GetFeeRecipientByPubKey(ctx context.Context, request *ethpb.Fe log.WithError(err).Error("An error occurred while retrieving validator index") return nil, err } - } address, err := vs.BeaconDB.FeeRecipientByValidatorID(ctx, resp.GetIndex()) if err != nil { diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_eth1data.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_eth1data.go index cc5b8efc2..283a39503 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_eth1data.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_eth1data.go @@ -97,7 +97,6 @@ func (vs *Server) canonicalEth1Data( ctx context.Context, beaconState state.BeaconState, currentVote *ethpb.Eth1Data) (*ethpb.Eth1Data, *big.Int, error) { - var eth1BlockHash [32]byte // Add in current vote, to get accurate vote tally diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/status.go b/beacon-chain/rpc/prysm/v1alpha1/validator/status.go index 26868c2cb..73d571f31 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/status.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/status.go @@ -265,7 +265,6 @@ func (vs *Server) optimisticStatus(ctx context.Context) error { } return status.Errorf(codes.Unavailable, errOptimisticMode.Error()) - } // validatorStatus searches for the requested validator's state and deposit to retrieve its inclusion estimate. Also returns the validators index. diff --git a/beacon-chain/slasher/detect_attestations.go b/beacon-chain/slasher/detect_attestations.go index d00e465b6..98b37f7bb 100644 --- a/beacon-chain/slasher/detect_attestations.go +++ b/beacon-chain/slasher/detect_attestations.go @@ -84,7 +84,6 @@ func (s *Service) detectAllAttesterSlashings( args *chunkUpdateArgs, attestations []*slashertypes.IndexedAttestationWrapper, ) ([]*ethpb.AttesterSlashing, error) { - // Map of updated chunks by chunk index, which will be saved at the end. updatedChunks := make(map[uint64]Chunker) groupedAtts := s.groupByChunkIndex(attestations) diff --git a/beacon-chain/slasher/service.go b/beacon-chain/slasher/service.go index b50823fdc..9c27b6306 100644 --- a/beacon-chain/slasher/service.go +++ b/beacon-chain/slasher/service.go @@ -204,7 +204,6 @@ func (s *Service) waitForChainInitialization() { return } } - } func (s *Service) waitForSync(genesisTime time.Time) { diff --git a/beacon-chain/state/fieldtrie/field_trie.go b/beacon-chain/state/fieldtrie/field_trie.go index 05f1b7415..0ff909f9a 100644 --- a/beacon-chain/state/fieldtrie/field_trie.go +++ b/beacon-chain/state/fieldtrie/field_trie.go @@ -79,7 +79,6 @@ func NewFieldTrie(field types.FieldIndex, dataType types.DataType, elements inte default: return nil, errors.Errorf("unrecognized data type in field map: %v", reflect.TypeOf(dataType).Name()) } - } // RecomputeTrie rebuilds the affected branches in the trie according to the provided diff --git a/beacon-chain/state/state-native/getters_participation.go b/beacon-chain/state/state-native/getters_participation.go index bb7742a22..54ee45527 100644 --- a/beacon-chain/state/state-native/getters_participation.go +++ b/beacon-chain/state/state-native/getters_participation.go @@ -57,7 +57,6 @@ func (b *BeaconState) UnrealizedCheckpointBalances() (uint64, uint64, uint64, er } return stateutil.UnrealizedCheckpointBalances(cp, pp, b.validators, currentEpoch) - } // currentEpochParticipationVal corresponding to participation bits on the beacon chain. diff --git a/beacon-chain/state/state-native/state_trie.go b/beacon-chain/state/state-native/state_trie.go index 19f3510dd..916ce5a0f 100644 --- a/beacon-chain/state/state-native/state_trie.go +++ b/beacon-chain/state/state-native/state_trie.go @@ -899,7 +899,6 @@ func finalizerCleanup(b *BeaconState) { if b.stateFieldLeaves[field].FieldReference() != nil { b.stateFieldLeaves[field].FieldReference().MinusRef() } - } for i := range b.dirtyFields { delete(b.dirtyFields, i) diff --git a/beacon-chain/state/testing/getters.go b/beacon-chain/state/testing/getters.go index 6b9dc5531..b0a6b4387 100644 --- a/beacon-chain/state/testing/getters.go +++ b/beacon-chain/state/testing/getters.go @@ -123,7 +123,6 @@ func VerifyBeaconStateValidatorByPubkey(t *testing.T, factory getState) { n := b.Copy() // Append to another state assert.NoError(t, n.AppendValidator(ðpb.Validator{PublicKey: key[:]})) - }, exists: false, expectedIdx: 0, @@ -136,7 +135,6 @@ func VerifyBeaconStateValidatorByPubkey(t *testing.T, factory getState) { n := b.Copy() // Append to another state assert.NoError(t, n.AppendValidator(ðpb.Validator{PublicKey: key[:]})) - }, exists: false, expectedIdx: 0, diff --git a/beacon-chain/state/testing/getters_block.go b/beacon-chain/state/testing/getters_block.go index 13a59b9e8..4262344cd 100644 --- a/beacon-chain/state/testing/getters_block.go +++ b/beacon-chain/state/testing/getters_block.go @@ -56,7 +56,6 @@ func VerifyBeaconStateBlockRootsNative( } else { want[i] = make([]byte, 32) } - } s, err = factoryBR(want) require.NoError(t, err) diff --git a/cmd/prysmctl/p2p/request_blocks.go b/cmd/prysmctl/p2p/request_blocks.go index 0757c5e7e..40645eaa3 100644 --- a/cmd/prysmctl/p2p/request_blocks.go +++ b/cmd/prysmctl/p2p/request_blocks.go @@ -214,7 +214,6 @@ func cliActionRequestBlocks(cliCtx *cli.Context) error { "timeFromSendingToProcessingResponse": end, "totalBlocksWithExecutionPayloads": totalExecutionBlocks, }).Info("Received blocks from peer") - } return nil } diff --git a/cmd/prysmctl/validator/withdraw.go b/cmd/prysmctl/validator/withdraw.go index d7bd83a6c..6578de73c 100644 --- a/cmd/prysmctl/validator/withdraw.go +++ b/cmd/prysmctl/validator/withdraw.go @@ -76,7 +76,6 @@ func getWithdrawalMessagesFromPathFlag(c *cli.Context) ([]*apimiddleware.SignedB Signature: to[i].Signature, }) } - } if len(setWithdrawalAddressJsons) == 0 { return setWithdrawalAddressJsons, errors.New("the list of signed requests is empty") diff --git a/cmd/validator/accounts/wallet_utils.go b/cmd/validator/accounts/wallet_utils.go index 5551a3309..c9fc54ba2 100644 --- a/cmd/validator/accounts/wallet_utils.go +++ b/cmd/validator/accounts/wallet_utils.go @@ -27,7 +27,6 @@ func walletWithKeymanager(c *cli.Context) (*wallet.Wallet, keymanager.IKeymanage return nil, nil, errors.Wrap(err, accounts.ErrCouldNotInitializeKeymanager) } return w, km, nil - } func walletWithWeb3SignerKeymanager(c *cli.Context, config *remote_web3signer.SetupConfig) (*wallet.Wallet, keymanager.IKeymanager, error) { diff --git a/consensus-types/blocks/getters.go b/consensus-types/blocks/getters.go index c184314e2..1b13d6ebc 100644 --- a/consensus-types/blocks/getters.go +++ b/consensus-types/blocks/getters.go @@ -112,7 +112,6 @@ func (b *SignedBeaconBlock) PbGenericBlock() (*eth.GenericSignedBeaconBlock, err default: return nil, errIncorrectBlockVersion } - } // PbPhase0Block returns the underlying protobuf object. diff --git a/crypto/bls/blst/public_key.go b/crypto/bls/blst/public_key.go index 8b5132805..618a0464d 100644 --- a/crypto/bls/blst/public_key.go +++ b/crypto/bls/blst/public_key.go @@ -92,7 +92,6 @@ func (p *PublicKey) Equals(p2 common.PublicKey) bool { // Aggregate two public keys. func (p *PublicKey) Aggregate(p2 common.PublicKey) common.PublicKey { - agg := new(blstAggregatePublicKey) // No group check here since it is checked at decompression time agg.Add(p.p, false) diff --git a/crypto/keystore/keystore.go b/crypto/keystore/keystore.go index adcf782c8..1d67b3754 100644 --- a/crypto/keystore/keystore.go +++ b/crypto/keystore/keystore.go @@ -259,7 +259,6 @@ func kdfKey(cryptoJSON cryptoJSON, auth string) ([]byte, error) { r := ensureInt(cryptoJSON.KDFParams["r"]) p := ensureInt(cryptoJSON.KDFParams["p"]) return scrypt.Key(authArray, salt, n, r, p, dkLen) - } else if cryptoJSON.KDF == "pbkdf2" { c := ensureInt(cryptoJSON.KDFParams["c"]) prf, ok := cryptoJSON.KDFParams["prf"].(string) diff --git a/math/math_helper.go b/math/math_helper.go index 3c278344a..0bfe77df5 100644 --- a/math/math_helper.go +++ b/math/math_helper.go @@ -188,7 +188,7 @@ func Mod64(a, b uint64) (uint64, error) { return val, nil } -// Int returns the integer value of the uint64 argument. If there is an overlow, then an error is +// Int returns the integer value of the uint64 argument. If there is an overflow, then an error is // returned. func Int(u uint64) (int, error) { if u > stdmath.MaxInt { @@ -208,7 +208,6 @@ func AddInt(i ...int) (int, error) { } sum += ii - } return sum, nil } diff --git a/monitoring/journald/journalhook_linux.go b/monitoring/journald/journalhook_linux.go index 6a3f2b259..091c645e4 100644 --- a/monitoring/journald/journalhook_linux.go +++ b/monitoring/journald/journalhook_linux.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/coreos/go-systemd/journal" - logrus "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus" ) type JournalHook struct{} @@ -52,7 +52,6 @@ func stringifyKey(key string) string { func stringifyEntries(data map[string]interface{}) map[string]string { entries := make(map[string]string) for k, v := range data { - key := stringifyKey(k) entries[key] = fmt.Sprint(v) } diff --git a/testing/endtoend/components/eth1/transactions.go b/testing/endtoend/components/eth1/transactions.go index 180b78d21..9a8bb6c13 100644 --- a/testing/endtoend/components/eth1/transactions.go +++ b/testing/endtoend/components/eth1/transactions.go @@ -119,7 +119,6 @@ func SendTransaction(client *rpc.Client, key *ecdsa.PrivateKey, f *filler.Filler err = backend.SendTransaction(context.Background(), signedTx) return nil }) - } return g.Wait() } diff --git a/testing/endtoend/evaluators/operations.go b/testing/endtoend/evaluators/operations.go index 8a75cb19d..3749f1d14 100644 --- a/testing/endtoend/evaluators/operations.go +++ b/testing/endtoend/evaluators/operations.go @@ -659,7 +659,6 @@ func validatorsAreWithdrawn(ec *e2etypes.EvaluationContext, conns ...*grpc.Clien if bal > 1*params.BeaconConfig().GweiPerEth { return errors.Errorf("Validator index %d with key %#x hasn't withdrawn. Their balance is %d.", valIdx, key, bal) } - } return nil } diff --git a/testing/endtoend/evaluators/slashing.go b/testing/endtoend/evaluators/slashing.go index f2fbc27ed..648805550 100644 --- a/testing/endtoend/evaluators/slashing.go +++ b/testing/endtoend/evaluators/slashing.go @@ -116,7 +116,6 @@ func validatorsLoseBalance(_ *e2eTypes.EvaluationContext, conns ...*grpc.ClientC valResp.EffectiveBalance, ) } - } return nil } diff --git a/testing/endtoend/helpers/epochTimer.go b/testing/endtoend/helpers/epochTimer.go index 3f60a636e..51c596189 100644 --- a/testing/endtoend/helpers/epochTimer.go +++ b/testing/endtoend/helpers/epochTimer.go @@ -45,7 +45,6 @@ func (s *EpochTicker) start( secondsPerEpoch uint64, since, until func(time.Time) time.Duration, after func(time.Duration) <-chan time.Time) { - d := time.Duration(secondsPerEpoch) * time.Second go func() { diff --git a/testing/spectest/shared/common/forkchoice/builder.go b/testing/spectest/shared/common/forkchoice/builder.go index 5a3258333..a7c7faa16 100644 --- a/testing/spectest/shared/common/forkchoice/builder.go +++ b/testing/spectest/shared/common/forkchoice/builder.go @@ -147,5 +147,4 @@ func (bb *Builder) Check(t testing.TB, c *Check) { got := fmt.Sprintf("%#x", bb.service.ProposerBoost()) require.DeepEqual(t, want, got) } - } diff --git a/testing/spectest/shared/common/forkchoice/runner.go b/testing/spectest/shared/common/forkchoice/runner.go index 06e369dbe..b0f239645 100644 --- a/testing/spectest/shared/common/forkchoice/runner.go +++ b/testing/spectest/shared/common/forkchoice/runner.go @@ -131,7 +131,6 @@ func runTest(t *testing.T, config string, fork int, basePath string) { } if step.PayloadStatus != nil { require.NoError(t, builder.SetPayloadStatus(step.PayloadStatus)) - } if step.PowBlock != nil { powBlockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), fmt.Sprint(*step.PowBlock, ".ssz_snappy")) diff --git a/time/slots/slotticker.go b/time/slots/slotticker.go index 4d616b70f..a96604f4d 100644 --- a/time/slots/slotticker.go +++ b/time/slots/slotticker.go @@ -74,7 +74,6 @@ func (s *SlotTicker) start( secondsPerSlot uint64, since, until func(time.Time) time.Duration, after func(time.Duration) <-chan time.Time) { - d := time.Duration(secondsPerSlot) * time.Second go func() { diff --git a/tools/bootnode/bootnode.go b/tools/bootnode/bootnode.go index 18e55c2fe..830d080ec 100644 --- a/tools/bootnode/bootnode.go +++ b/tools/bootnode/bootnode.go @@ -253,7 +253,6 @@ func extractPrivateKey() *ecdsa.PrivateKey { if err != nil { panic(err) } - } else { privInterfaceKey, _, err := crypto.GenerateSecp256k1Key(rand.Reader) if err != nil { diff --git a/tools/exploredb/main.go b/tools/exploredb/main.go index 529abc55f..9452373d3 100644 --- a/tools/exploredb/main.go +++ b/tools/exploredb/main.go @@ -364,7 +364,6 @@ func printStates(stateC <-chan *modifiedState, doneC chan<- bool) { log.Infof("previous_justified_checkpoint : sizeSSZ = %s", humanize.Bytes(uint64(st.PreviousJustifiedCheckpoint().SizeSSZ()))) log.Infof("current_justified_checkpoint : sizeSSZ = %s", humanize.Bytes(uint64(st.CurrentJustifiedCheckpoint().SizeSSZ()))) log.Infof("finalized_checkpoint : sizeSSZ = %s", humanize.Bytes(uint64(st.FinalizedCheckpoint().SizeSSZ()))) - } doneC <- true } diff --git a/tools/gocovmerge/main.go b/tools/gocovmerge/main.go index 022520bea..c4fe41560 100644 --- a/tools/gocovmerge/main.go +++ b/tools/gocovmerge/main.go @@ -18,35 +18,29 @@ import ( func mergeProfiles(p, merge *cover.Profile) { if p.Mode != merge.Mode { log.Fatalf("cannot merge profiles with different modes") - } // Since the blocks are sorted, we can keep track of where the last block // was inserted and only look at the blocks after that as targets for merge startIndex := 0 for _, b := range merge.Blocks { startIndex = mergeProfileBlock(p, b, startIndex) - } - } func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int) int { sortFunc := func(i int) bool { pi := p.Blocks[i+startIndex] return pi.StartLine >= pb.StartLine && (pi.StartLine != pb.StartLine || pi.StartCol >= pb.StartCol) - } i := 0 if !sortFunc(i) { i = sort.Search(len(p.Blocks)-startIndex, sortFunc) - } i += startIndex if i < len(p.Blocks) && p.Blocks[i].StartLine == pb.StartLine && p.Blocks[i].StartCol == pb.StartCol { if p.Blocks[i].EndLine != pb.EndLine || p.Blocks[i].EndCol != pb.EndCol { log.Fatalf("OVERLAP MERGE: %v %v %v", p.FileName, p.Blocks[i], pb) - } switch p.Mode { case "set": @@ -55,54 +49,42 @@ func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int) p.Blocks[i].Count += pb.Count default: log.Fatalf("unsupported covermode: '%s'", p.Mode) - } - } else { if i > 0 { pa := p.Blocks[i-1] if pa.EndLine >= pb.EndLine && (pa.EndLine != pb.EndLine || pa.EndCol > pb.EndCol) { log.Fatalf("OVERLAP BEFORE: %v %v %v", p.FileName, pa, pb) - } - } if i < len(p.Blocks)-1 { pa := p.Blocks[i+1] if pa.StartLine <= pb.StartLine && (pa.StartLine != pb.StartLine || pa.StartCol < pb.StartCol) { log.Fatalf("OVERLAP AFTER: %v %v %v", p.FileName, pa, pb) - } - } p.Blocks = append(p.Blocks, cover.ProfileBlock{}) copy(p.Blocks[i+1:], p.Blocks[i:]) p.Blocks[i] = pb - } return i + 1 - } func addProfile(profiles []*cover.Profile, p *cover.Profile) []*cover.Profile { i := sort.Search(len(profiles), func(i int) bool { return profiles[i].FileName >= p.FileName }) if i < len(profiles) && profiles[i].FileName == p.FileName { mergeProfiles(profiles[i], p) - } else { profiles = append(profiles, nil) copy(profiles[i+1:], profiles[i:]) profiles[i] = p - } return profiles - } func dumpProfiles(profiles []*cover.Profile, out io.Writer) { if len(profiles) == 0 { return - } if _, err := fmt.Fprintf(out, "mode: %s\n", profiles[0].Mode); err != nil { panic(err) @@ -112,11 +94,8 @@ func dumpProfiles(profiles []*cover.Profile, out io.Writer) { if _, err := fmt.Fprintf(out, "%s:%d.%d,%d.%d %d %d\n", p.FileName, b.StartLine, b.StartCol, b.EndLine, b.EndCol, b.NumStmt, b.Count); err != nil { panic(err) } - } - } - } func main() { @@ -128,15 +107,11 @@ func main() { profiles, err := cover.ParseProfiles(file) if err != nil { log.WithError(err).Fatal("failed to parse profiles") - } for _, p := range profiles { merged = addProfile(merged, p) - } - } dumpProfiles(merged, os.Stdout) - } diff --git a/validator/accounts/wallet/wallet.go b/validator/accounts/wallet/wallet.go index bd90fe7e7..de15b9a99 100644 --- a/validator/accounts/wallet/wallet.go +++ b/validator/accounts/wallet/wallet.go @@ -383,7 +383,6 @@ func (w *Wallet) ReadKeymanagerConfigFromDisk(_ context.Context) (io.ReadCloser, } w.configFilePath = configFilePath return os.Open(configFilePath) // #nosec G304 - } // WriteKeymanagerConfigToDisk takes an encoded keymanager config file diff --git a/validator/client/aggregate.go b/validator/client/aggregate.go index 5cc956255..187a9b8d4 100644 --- a/validator/client/aggregate.go +++ b/validator/client/aggregate.go @@ -113,7 +113,6 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot primitives if v.emitAccountMetrics { ValidatorAggSuccessVec.WithLabelValues(fmtKey).Inc() } - } // Signs input slot with domain selection proof. This is used to create the signature for aggregator selection. diff --git a/validator/client/beacon-api/duties.go b/validator/client/beacon-api/duties.go index 12a2e400d..86a8112de 100644 --- a/validator/client/beacon-api/duties.go +++ b/validator/client/beacon-api/duties.go @@ -224,7 +224,6 @@ func (c beaconApiDutiesProvider) GetCommittees(ctx context.Context, epoch primit // GetAttesterDuties retrieves the attester duties for the given epoch and validatorIndices func (c beaconApiDutiesProvider) GetAttesterDuties(ctx context.Context, epoch primitives.Epoch, validatorIndices []primitives.ValidatorIndex) ([]*apimiddleware.AttesterDutyJson, error) { - jsonValidatorIndices := make([]string, len(validatorIndices)) for index, validatorIndex := range validatorIndices { jsonValidatorIndices[index] = strconv.FormatUint(uint64(validatorIndex), 10) diff --git a/validator/client/validator.go b/validator/client/validator.go index 7df849a10..3800049e4 100644 --- a/validator/client/validator.go +++ b/validator/client/validator.go @@ -725,7 +725,6 @@ func (v *validator) RolesAt(ctx context.Context, slot primitives.Slot) (map[[fie if aggregator { roles = append(roles, iface.RoleAggregator) } - } // Being assigned to a sync committee for a given slot means that the validator produces and diff --git a/validator/keymanager/derived/keymanager.go b/validator/keymanager/derived/keymanager.go index 1d2335f70..6e9270fe0 100644 --- a/validator/keymanager/derived/keymanager.go +++ b/validator/keymanager/derived/keymanager.go @@ -172,5 +172,4 @@ func (km *Keymanager) ListKeymanagerAccounts(ctx context.Context, cfg keymanager fmt.Println(" ") } return nil - } diff --git a/validator/keymanager/local/keymanager.go b/validator/keymanager/local/keymanager.go index 5f870003f..dac9789e8 100644 --- a/validator/keymanager/local/keymanager.go +++ b/validator/keymanager/local/keymanager.go @@ -277,7 +277,6 @@ func (km *Keymanager) SaveStoreAndReInitialize(ctx context.Context, store *accou accountsKeystore, err := CreateAccountsKeystoreRepresentation(ctx, store, km.wallet.Password()) if err != nil { return err - } encodedAccounts, err := json.MarshalIndent(accountsKeystore, "", "\t") if err != nil { diff --git a/validator/keymanager/remote-web3signer/v1/custom_mappers.go b/validator/keymanager/remote-web3signer/v1/custom_mappers.go index 0d7462048..b9931be91 100644 --- a/validator/keymanager/remote-web3signer/v1/custom_mappers.go +++ b/validator/keymanager/remote-web3signer/v1/custom_mappers.go @@ -348,7 +348,6 @@ func MapBeaconBlockBodyAltair(body *ethpb.BeaconBlockBodyAltair) (*BeaconBlockBo block.Deposits[i] = deposit } for i, exit := range body.VoluntaryExits { - exit, err := MapSignedVoluntaryExit(exit) if err != nil { return nil, fmt.Errorf("could not map signed voluntary exit at index %v: %v", i, err) diff --git a/validator/keymanager/remote-web3signer/v1/mock/mocks.go b/validator/keymanager/remote-web3signer/v1/mock/mocks.go index c9072a5eb..6537f41fb 100644 --- a/validator/keymanager/remote-web3signer/v1/mock/mocks.go +++ b/validator/keymanager/remote-web3signer/v1/mock/mocks.go @@ -620,7 +620,6 @@ func MockForkInfo() *v1.ForkInfo { }, GenesisValidatorsRoot: make([]byte, fieldparams.RootLength), } - } // MockAttestation is a mock implementation of the Attestation. diff --git a/validator/node/node.go b/validator/node/node.go index 7d3713752..d3ec35da2 100644 --- a/validator/node/node.go +++ b/validator/node/node.go @@ -230,7 +230,6 @@ func (c *ValidatorClient) initializeFromCLI(cliCtx *cli.Context) error { "to use for your validator data", ) } - } if err := clearDB(cliCtx.Context, dataDir, forceClearFlag); err != nil { return err @@ -314,7 +313,6 @@ func (c *ValidatorClient) initializeForWeb(cliCtx *cli.Context) error { "to use for your validator data", ) } - } if err := clearDB(cliCtx.Context, dataDir, forceClearFlag); err != nil { return err @@ -376,7 +374,6 @@ func (c *ValidatorClient) registerPrometheusService(cliCtx *cli.Context) error { } func (c *ValidatorClient) registerValidatorService(cliCtx *cli.Context) error { - endpoint := c.cliCtx.String(flags.BeaconRPCProviderFlag.Name) dataDir := c.cliCtx.String(cmd.DataDirFlag.Name) logValidatorBalances := !c.cliCtx.Bool(flags.DisablePenaltyRewardLogFlag.Name) @@ -596,7 +593,6 @@ func proposerSettings(cliCtx *cli.Context) (*validatorServiceConfig.ProposerSett }, BuilderConfig: option.BuilderConfig, } - } } diff --git a/validator/rpc/slashing.go b/validator/rpc/slashing.go index 016ccbce4..8c078c176 100644 --- a/validator/rpc/slashing.go +++ b/validator/rpc/slashing.go @@ -42,7 +42,6 @@ func (s *Server) ExportSlashingProtection(ctx context.Context, _ *empty.Empty) ( return &pb.ExportSlashingProtectionResponse{ File: string(encoded), }, nil - } // ImportSlashingProtection reads an input slashing protection EIP-3076 diff --git a/validator/testing/mock_slasher.go b/validator/testing/mock_slasher.go index 6c7c87bf8..dcefa6d63 100644 --- a/validator/testing/mock_slasher.go +++ b/validator/testing/mock_slasher.go @@ -28,7 +28,6 @@ func (MockSlasher) HighestAttestations(_ context.Context, _ *eth.HighestAttestat func (ms MockSlasher) IsSlashableAttestation(_ context.Context, in *eth.IndexedAttestation, _ ...grpc.CallOption) (*eth.AttesterSlashingResponse, error) { ms.IsSlashableAttestationCalled = true // skipcq: RVV-B0006 if ms.SlashAttestation { - slashingAtt, ok := proto.Clone(in).(*eth.IndexedAttestation) if !ok { return nil, errors.New("object is not of type *eth.IndexedAttestation")