Skip to content

Commit

Permalink
chore: fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Jan 30, 2024
1 parent 47c3b33 commit e2db0e2
Show file tree
Hide file tree
Showing 54 changed files with 137 additions and 139 deletions.
2 changes: 1 addition & 1 deletion abci/server/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ func (app *gRPCApplication) Echo(_ context.Context, req *types.RequestEcho) (*ty
return &types.ResponseEcho{Message: req.Message}, nil
}

func (app *gRPCApplication) Flush(_ context.Context, req *types.RequestFlush) (*types.ResponseFlush, error) {
func (app *gRPCApplication) Flush(_ context.Context, _req *types.RequestFlush) (*types.ResponseFlush, error) {
return &types.ResponseFlush{}, nil
}
2 changes: 1 addition & 1 deletion abci/tests/server/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func FinalizeBlock(ctx context.Context, client abciclient.Client, txBytes [][]by
return nil
}

func PrepareProposal(ctx context.Context, client abciclient.Client, txBytes [][]byte, codeExp []types.TxRecord_TxAction, dataExp []byte) error {
func PrepareProposal(ctx context.Context, client abciclient.Client, txBytes [][]byte, codeExp []types.TxRecord_TxAction, _dataExp []byte) error {
res, _ := client.PrepareProposal(ctx, &types.RequestPrepareProposal{Txs: txBytes})
for i, tx := range res.TxRecords {
if tx.Action != codeExp[i] {
Expand Down
20 changes: 10 additions & 10 deletions abci/types/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,45 +55,45 @@ func NewBaseApplication() *BaseApplication {
return &BaseApplication{}
}

func (BaseApplication) Info(_ context.Context, req *RequestInfo) (*ResponseInfo, error) {
func (BaseApplication) Info(_ context.Context, _req *RequestInfo) (*ResponseInfo, error) {
return &ResponseInfo{}, nil
}

func (BaseApplication) CheckTx(_ context.Context, req *RequestCheckTx) (*ResponseCheckTx, error) {
func (BaseApplication) CheckTx(_ context.Context, _req *RequestCheckTx) (*ResponseCheckTx, error) {
return &ResponseCheckTx{Code: CodeTypeOK}, nil
}

func (BaseApplication) ExtendVote(_ context.Context, req *RequestExtendVote) (*ResponseExtendVote, error) {
func (BaseApplication) ExtendVote(_ context.Context, _req *RequestExtendVote) (*ResponseExtendVote, error) {
return &ResponseExtendVote{}, nil
}

func (BaseApplication) VerifyVoteExtension(_ context.Context, req *RequestVerifyVoteExtension) (*ResponseVerifyVoteExtension, error) {
func (BaseApplication) VerifyVoteExtension(_ context.Context, _req *RequestVerifyVoteExtension) (*ResponseVerifyVoteExtension, error) {
return &ResponseVerifyVoteExtension{
Status: ResponseVerifyVoteExtension_ACCEPT,
}, nil
}

func (BaseApplication) Query(_ context.Context, req *RequestQuery) (*ResponseQuery, error) {
func (BaseApplication) Query(_ context.Context, _req *RequestQuery) (*ResponseQuery, error) {
return &ResponseQuery{Code: CodeTypeOK}, nil
}

func (BaseApplication) InitChain(_ context.Context, req *RequestInitChain) (*ResponseInitChain, error) {
func (BaseApplication) InitChain(_ context.Context, _req *RequestInitChain) (*ResponseInitChain, error) {
return &ResponseInitChain{}, nil
}

func (BaseApplication) ListSnapshots(_ context.Context, req *RequestListSnapshots) (*ResponseListSnapshots, error) {
func (BaseApplication) ListSnapshots(_ context.Context, _req *RequestListSnapshots) (*ResponseListSnapshots, error) {
return &ResponseListSnapshots{}, nil
}

func (BaseApplication) OfferSnapshot(_ context.Context, req *RequestOfferSnapshot) (*ResponseOfferSnapshot, error) {
func (BaseApplication) OfferSnapshot(_ context.Context, _req *RequestOfferSnapshot) (*ResponseOfferSnapshot, error) {
return &ResponseOfferSnapshot{}, nil
}

func (BaseApplication) LoadSnapshotChunk(_ context.Context, _ *RequestLoadSnapshotChunk) (*ResponseLoadSnapshotChunk, error) {
return &ResponseLoadSnapshotChunk{}, nil
}

func (BaseApplication) ApplySnapshotChunk(_ context.Context, req *RequestApplySnapshotChunk) (*ResponseApplySnapshotChunk, error) {
func (BaseApplication) ApplySnapshotChunk(_ context.Context, _req *RequestApplySnapshotChunk) (*ResponseApplySnapshotChunk, error) {
return &ResponseApplySnapshotChunk{}, nil
}

Expand Down Expand Up @@ -132,7 +132,7 @@ func (BaseApplication) ProcessProposal(_ context.Context, req *RequestProcessPro
}, nil
}

func (BaseApplication) FinalizeBlock(_ context.Context, req *RequestFinalizeBlock) (*ResponseFinalizeBlock, error) {
func (BaseApplication) FinalizeBlock(_ context.Context, _req *RequestFinalizeBlock) (*ResponseFinalizeBlock, error) {

return &ResponseFinalizeBlock{}, nil
}
2 changes: 1 addition & 1 deletion cmd/abcidump/cmd/capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (captureCmd *CaptureCmd) Command() *cobra.Command {
}

// RunE executes traffic capture
func (captureCmd *CaptureCmd) RunE(cmd *cobra.Command, args []string) error {
func (captureCmd *CaptureCmd) RunE(_cmd *cobra.Command, _args []string) error {
logger.Debug("Starting packet capture", "port", captureCmd.Port)

return captureCmd.capture()
Expand Down
4 changes: 2 additions & 2 deletions cmd/abcidump/cmd/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (cborCmd *CborCmd) Command() *cobra.Command {
}

// PreRunE parses command line arguments
func (cborCmd *CborCmd) PreRunE(_ *cobra.Command, args []string) (err error) {
func (cborCmd *CborCmd) PreRunE(_ *cobra.Command, _args []string) (err error) {
if cborCmd.Input, err = loadInputData(cborCmd.InputData, cborCmd.InputFormat); err != nil {
return err
}
Expand Down Expand Up @@ -142,7 +142,7 @@ func marshalMap(mapToMarshal map[interface{}]interface{}, indent []byte, out io.
}

// RunE executes main logic of this command
func (cborCmd *CborCmd) RunE(_ *cobra.Command, args []string) error {
func (cborCmd *CborCmd) RunE(_ *cobra.Command, _args []string) error {
data, err := io.ReadAll(cborCmd.Input)
if err != nil {
return fmt.Errorf("cannot read data: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions cmd/abcidump/cmd/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (parseCmd *ParseCmd) Command() *cobra.Command {
}

// PreRunE parses command line arguments
func (parseCmd *ParseCmd) PreRunE(cmd *cobra.Command, args []string) (err error) {
func (parseCmd *ParseCmd) PreRunE(_cmd *cobra.Command, _args []string) (err error) {
if parseCmd.Input, err = loadInputData(parseCmd.InputData, parseCmd.InputFormat); err != nil {
return err
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func loadInputData(input, format string) (reader io.Reader, err error) {
}

// RunE executes parsing logic
func (parseCmd *ParseCmd) RunE(cmd *cobra.Command, args []string) error {
func (parseCmd *ParseCmd) RunE(cmd *cobra.Command, _args []string) error {
var err error

parser := parser.NewParser(cmd.InOrStdin())
Expand Down
4 changes: 2 additions & 2 deletions cmd/tenderdash/commands/gen_node_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Seed phrase and optional password is read from standard input.`,
return cmd
}

func genNodeKeyFlagsPreRunE(cmd *cobra.Command, args []string) error {
func genNodeKeyFlagsPreRunE(_cmd *cobra.Command, _args []string) error {
if useSeedPhrase && pemFile != "" {
return fmt.Errorf("--%s cannot be be used with --%s", flagFromMnemonic, flagFromPem)
}
Expand Down Expand Up @@ -138,7 +138,7 @@ func readMnemonic(in io.Reader, out io.Writer) (mnemonic string, password string
}

// nodeKeyFromMnemonic reads BIP39 mnemonic and optional passphrase from stdin, and derives node key from it.
func nodeKeyFromMnemonic(cmd *cobra.Command, args []string) (types.NodeKey, error) {
func nodeKeyFromMnemonic(cmd *cobra.Command, _args []string) (types.NodeKey, error) {
mnemonic, password, err := readMnemonic(cmd.InOrStdin(), cmd.OutOrStdout())
if err != nil {
return types.NodeKey{}, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func ResetState(dbDir string, logger log.Logger) error {
// ResetFilePV loads the file private validator and resets the watermark to 0. If used on an existing network,
// this can cause the node to double sign.
// XXX: this is unsafe and should only suitable for testnets.
func ResetFilePV(privValKeyFile, privValStateFile string, logger log.Logger, keyType string) error {
func ResetFilePV(privValKeyFile, privValStateFile string, logger log.Logger, _keyType string) error {
if _, err := os.Stat(privValKeyFile); err == nil {
pv, err := privval.LoadFilePVEmptyState(privValKeyFile, privValStateFile)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions crypto/secp256k1/secp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ func (privKey PrivKey) SignDigest(msg []byte) ([]byte, error) {
return sigBytes, nil
}

func (pubKey PubKey) AggregateSignatures(sigSharesData [][]byte, messages [][]byte) ([]byte, error) {
func (pubKey PubKey) AggregateSignatures(_sigSharesData [][]byte, _messages [][]byte) ([]byte, error) {
return nil, errors.New("should not aggregate an edwards signature")
}

func (pubKey PubKey) VerifyAggregateSignature(messages [][]byte, sig []byte) bool {
func (pubKey PubKey) VerifyAggregateSignature(_messages [][]byte, _sig []byte) bool {
return false
}

func (pubKey PubKey) VerifySignatureDigest(hash []byte, sig []byte) bool {
func (pubKey PubKey) VerifySignatureDigest(_hash []byte, _sig []byte) bool {
return false
}

Expand Down
4 changes: 2 additions & 2 deletions dash/quorum/validator_conn_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ func setup(
}

// cleanup frees some resources allocated for tests
func cleanup(t *testing.T, bus *eventbus.EventBus, dialer p2p.DashDialer, vc *ValidatorConnExecutor) {
func cleanup(_t *testing.T, bus *eventbus.EventBus, _dialer p2p.DashDialer, vc *ValidatorConnExecutor) {
bus.Stop()
vc.Stop()
}
Expand Down Expand Up @@ -620,7 +620,7 @@ func makeState(nVals int, height int64) (sm.State, dbm.DB) {
return s, stateDB
}

func makeBlock(ctx context.Context, t *testing.T, blockExec *sm.BlockExecutor, state sm.State, height int64, commit *types.Commit) *types.Block {
func makeBlock(ctx context.Context, t *testing.T, blockExec *sm.BlockExecutor, state sm.State, _height int64, commit *types.Commit) *types.Block {
block, crs, err := blockExec.CreateProposalBlock(ctx, 1, 0, state, commit, state.Validators.Proposer.ProTxHash, 1)
require.NoError(t, err)

Expand Down
4 changes: 2 additions & 2 deletions internal/blocksync/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ func makeReactor(
t *testing.T,
conf *config.Config,
proTxHash types.ProTxHash,
nodeID types.NodeID,
_nodeID types.NodeID,
genDoc *types.GenesisDoc,
privVal types.PrivValidator,
_privVal types.PrivValidator,
channelCreator p2p.ChannelCreator,
peerEvents p2p.PeerEventSubscriber) *Reactor {

Expand Down
8 changes: 4 additions & 4 deletions internal/consensus/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func signVotes(
voteType tmproto.SignedMsgType,
chainID string,
blockID types.BlockID,
appHash []byte,
_appHash []byte,
quorumType btcjson.LLMQType,
quorumHash crypto.QuorumHash,
vss ...*validatorStub,
Expand Down Expand Up @@ -362,7 +362,7 @@ func validatePrevote(
}
}

func validateLastCommit(ctx context.Context, t *testing.T, cs *State, privVal *validatorStub, blockHash []byte) {
func validateLastCommit(_ctx context.Context, t *testing.T, cs *State, _privVal *validatorStub, blockHash []byte) {
t.Helper()

stateData := cs.GetStateData()
Expand Down Expand Up @@ -852,7 +852,7 @@ func consensusLogger(t *testing.T) log.Logger {
func makeConsensusState(
ctx context.Context,
t *testing.T,
cfg *config.Config,
_cfg *config.Config,
nValidators int,
testName string,
tickerFunc func() TimeoutTicker,
Expand Down Expand Up @@ -1031,7 +1031,7 @@ type genesisStateArgs struct {
Time time.Time
}

func makeGenesisState(ctx context.Context, t *testing.T, cfg *config.Config, args genesisStateArgs) (sm.State, []types.PrivValidator) {
func makeGenesisState(_ctx context.Context, t *testing.T, _cfg *config.Config, args genesisStateArgs) (sm.State, []types.PrivValidator) {
t.Helper()
if args.Power == 0 {
args.Power = 1
Expand Down
4 changes: 2 additions & 2 deletions internal/consensus/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func NewCounterApplication() *CounterApplication {
return &CounterApplication{}
}

func (app *CounterApplication) Info(_ context.Context, req *abci.RequestInfo) (*abci.ResponseInfo, error) {
func (app *CounterApplication) Info(_ context.Context, _req *abci.RequestInfo) (*abci.ResponseInfo, error) {
app.mu.Lock()
defer app.mu.Unlock()

Expand All @@ -310,7 +310,7 @@ func (app *CounterApplication) txResults(txs [][]byte) []*abci.ExecTxResult {
return respTxs
}

func (app *CounterApplication) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) {
func (app *CounterApplication) FinalizeBlock(_ context.Context, _req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) {
return &abci.ResponseFinalizeBlock{}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/pbts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func timestampedCollector(ctx context.Context, t *testing.T, eb *eventbus.EventB
return eventCh
}

func collectHeightResults(ctx context.Context, t *testing.T, eventCh <-chan timestampedEvent, height int64, proTxHash crypto.ProTxHash) heightResult {
func collectHeightResults(_ctx context.Context, t *testing.T, eventCh <-chan timestampedEvent, height int64, proTxHash crypto.ProTxHash) heightResult {
t.Helper()
var res heightResult
for event := range eventCh {
Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func (r *Reactor) peerUp(ctx context.Context, peerUpdate p2p.PeerUpdate, retries
}
}

func (r *Reactor) peerDown(_ context.Context, peerUpdate p2p.PeerUpdate, chans channelBundle) {
func (r *Reactor) peerDown(_ context.Context, peerUpdate p2p.PeerUpdate, _chans channelBundle) {
r.mtx.RLock()
ps, ok := r.peers[peerUpdate.NodeID]
r.mtx.RUnlock()
Expand Down
16 changes: 8 additions & 8 deletions internal/consensus/replay_stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (emptyMempool) Size() int { return 0 }
func (emptyMempool) CheckTx(context.Context, types.Tx, func(*abci.ResponseCheckTx), mempool.TxInfo) error {
return nil
}
func (emptyMempool) RemoveTxByKey(txKey types.TxKey) error { return nil }
func (emptyMempool) RemoveTxByKey(_txKey types.TxKey) error { return nil }
func (emptyMempool) ReapMaxBytesMaxGas(_, _ int64) types.Txs { return types.Txs{} }
func (emptyMempool) ReapMaxTxs(_n int) types.Txs { return types.Txs{} }
func (emptyMempool) Update(
Expand All @@ -39,11 +39,11 @@ func (emptyMempool) Update(
) error {
return nil
}
func (emptyMempool) Flush() {}
func (emptyMempool) FlushAppConn(ctx context.Context) error { return nil }
func (emptyMempool) TxsAvailable() <-chan struct{} { return make(chan struct{}) }
func (emptyMempool) EnableTxsAvailable() {}
func (emptyMempool) SizeBytes() int64 { return 0 }
func (emptyMempool) Flush() {}
func (emptyMempool) FlushAppConn(_ctx context.Context) error { return nil }
func (emptyMempool) TxsAvailable() <-chan struct{} { return make(chan struct{}) }
func (emptyMempool) EnableTxsAvailable() {}
func (emptyMempool) SizeBytes() int64 { return 0 }

func (emptyMempool) TxsFront() *clist.CElement { return nil }
func (emptyMempool) TxsWaitChan() <-chan struct{} { return nil }
Expand Down Expand Up @@ -104,15 +104,15 @@ type mockProxyApp struct {
abciResponses *tmstate.ABCIResponses
}

func (mock *mockProxyApp) ProcessProposal(_ context.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
func (mock *mockProxyApp) ProcessProposal(_ context.Context, _req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
r := mock.abciResponses.ProcessProposal
if r == nil {
return &abci.ResponseProcessProposal{}, nil
}
return r, nil
}

func (mock *mockProxyApp) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) {
func (mock *mockProxyApp) FinalizeBlock(_ context.Context, _req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) {
r := mock.abciResponses.FinalizeBlock
mock.txCount++
if r == nil {
Expand Down
10 changes: 5 additions & 5 deletions internal/consensus/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1212,10 +1212,10 @@ func (bs *mockBlockStore) Base() int64 { return bs.base }
func (bs *mockBlockStore) Size() int64 { return bs.Height() - bs.Base() + 1 }
func (bs *mockBlockStore) LoadBaseMeta() *types.BlockMeta { return bs.LoadBlockMeta(bs.base) }
func (bs *mockBlockStore) LoadBlock(height int64) *types.Block { return bs.chain[height-1] }
func (bs *mockBlockStore) LoadBlockByHash(hash []byte) *types.Block {
func (bs *mockBlockStore) LoadBlockByHash(_hash []byte) *types.Block {
return bs.chain[int64(len(bs.chain))-1]
}
func (bs *mockBlockStore) LoadBlockMetaByHash(hash []byte) *types.BlockMeta { return nil }
func (bs *mockBlockStore) LoadBlockMetaByHash(_hash []byte) *types.BlockMeta { return nil }
func (bs *mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta {
block := bs.chain[height-1]
bps, err := block.MakePartSet(types.BlockPartSizeBytes)
Expand All @@ -1227,10 +1227,10 @@ func (bs *mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta {
Header: block.Header,
}
}
func (bs *mockBlockStore) LoadBlockPart(height int64, index int) *types.Part { return nil }
func (bs *mockBlockStore) LoadBlockPart(_height int64, _index int) *types.Part { return nil }
func (bs *mockBlockStore) SaveBlock(
block *types.Block,
blockParts *types.PartSet,
_blockParts *types.PartSet,
seenCommit *types.Commit,
) {
bs.chain = append(bs.chain, block)
Expand Down Expand Up @@ -1456,7 +1456,7 @@ type initChainApp struct {
initialCoreHeight uint32
}

func (ica *initChainApp) InitChain(_ context.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) {
func (ica *initChainApp) InitChain(_ context.Context, _req *abci.RequestInitChain) (*abci.ResponseInitChain, error) {
resp := abci.ResponseInitChain{
InitialCoreHeight: ica.initialCoreHeight,
}
Expand Down
1 change: 0 additions & 1 deletion internal/consensus/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3164,7 +3164,6 @@ func TestStateTryAddCommitCallsProcessProposal(t *testing.T) {
css0StateData.Votes.Precommits(0),
css0StateData.Validators,
privvals,
block.StateID(),
)
require.NoError(t, err)

Expand Down
14 changes: 7 additions & 7 deletions internal/consensus/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,12 @@ type nilWAL struct{}

var _ WAL = nilWAL{}

func (nilWAL) Write(m WALMessage) error { return nil }
func (nilWAL) WriteSync(m WALMessage) error { return nil }
func (nilWAL) FlushAndSync() error { return nil }
func (nilWAL) SearchForEndHeight(height int64, options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) {
func (nilWAL) Write(_m WALMessage) error { return nil }
func (nilWAL) WriteSync(_m WALMessage) error { return nil }
func (nilWAL) FlushAndSync() error { return nil }
func (nilWAL) SearchForEndHeight(_height int64, _options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) {
return nil, false, nil
}
func (nilWAL) Start(context.Context) error { return nil }
func (nilWAL) Stop() {}
func (nilWAL) Wait() {}
func (nilWAL) Start(_ctx context.Context) error { return nil }
func (nilWAL) Stop() {}
func (nilWAL) Wait() {}
Loading

0 comments on commit e2db0e2

Please sign in to comment.