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

refactor: linter warnings in multiple files #956

Open
wants to merge 36 commits into
base: v1.4-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
08d27b7
build(deps): Bump github.com/vektra/mockery/v2 from 2.41.0 to 2.46.2
dependabot[bot] Oct 11, 2024
ed05eea
chore: update deps
lklimek Oct 11, 2024
35627d9
build(deps): Upgrade go to 1.23
lklimek Oct 11, 2024
e924ddc
chore: trigger workflow
lklimek Oct 11, 2024
cdd6e63
Merge remote-tracking branch 'origin/dependabot/go_modules/github.com…
lklimek Oct 11, 2024
f7430f2
chore: make mockery
lklimek Oct 11, 2024
19ddf57
chore: fix typo
lklimek Oct 11, 2024
ed40649
Merge branch 'v1.3-dev' into build/go-1.23
lklimek Oct 11, 2024
809073e
build(deps): upgrade golangci-lint to 1.61
lklimek Oct 11, 2024
e7d0b64
fix: linter warnings in multiple files
lklimek Oct 11, 2024
402f737
chore: fix linter issues, WIP
lklimek Oct 11, 2024
3119130
chore: lint issues, continued
lklimek Oct 11, 2024
0ce78fd
chore: linter, wip
lklimek Oct 11, 2024
821a3ea
chore: linter, wip
lklimek Oct 11, 2024
8440f24
Merge remote-tracking branch 'origin/v1.3-dev' into fix/lint
lklimek Oct 16, 2024
a642c5b
chore: apply lint suggestions
lklimek Oct 16, 2024
5346c28
chore: lint, wip
lklimek Oct 16, 2024
8561eed
chore: lint issues
lklimek Oct 16, 2024
8831e1a
chore: change ChannelID to 32 bit to match proto
lklimek Oct 16, 2024
9c444b3
chore: lint allow ripemd160
lklimek Nov 2, 2024
e963de0
Merge branch 'v1.3-dev' into fix/lint
lklimek Nov 2, 2024
52ca522
Merge remote-tracking branch 'origin/v1.3-dev' into fix/lint
lklimek Nov 2, 2024
0848cbe
chore(github): check whole code base in gha
lklimek Nov 2, 2024
6be42b4
Merge remote-tracking branch 'origin/v1.3-dev' into fix/lint
lklimek Nov 4, 2024
3f1ff7f
Merge branch 'v1.3-dev' into fix/lint
lklimek Nov 4, 2024
a0b2032
chore: lint green
lklimek Nov 4, 2024
1e8004a
Merge remote-tracking branch 'origin/v1.3-dev' into fix/lint
lklimek Nov 4, 2024
608b253
chore: remove deprecated golancci config statements
lklimek Nov 4, 2024
7cf54c9
chore: fix ripemd150 lint
lklimek Nov 4, 2024
80bdc9a
chore: self review
lklimek Nov 4, 2024
3732ec0
chore: fix some tests
lklimek Nov 4, 2024
0fb6f06
chore: fix some errors
lklimek Nov 4, 2024
0103d09
chore: fix test
lklimek Nov 4, 2024
08ed97a
chore: fix another test
lklimek Nov 4, 2024
0e8ac6f
test: fix some tests
lklimek Nov 4, 2024
dacfd53
Merge branch 'v1.3-dev' into fix/lint
lklimek Nov 6, 2024
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 .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ jobs:
version: v1.61
args: --timeout 10m
github-token: ${{ secrets.github_token }}
only-new-issues: true
only-new-issues: false
if: env.GIT_DIFF
6 changes: 1 addition & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ linters:
- dogsled
- dupl
- errcheck
- exportloopref
- copyloopvar
# - funlen
# - gochecknoglobals
# - gochecknoinits
Expand Down Expand Up @@ -47,14 +47,10 @@ issues:
linters-settings:
dogsled:
max-blank-identifiers: 3
golint:
min-confidence: 0
goconst:
min-len: 5
min-occurrences: 5
ignore-tests: true
maligned:
suggest-new: true
misspell:
locale: US
revive:
Expand Down
2 changes: 0 additions & 2 deletions abci/client/socket_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ func TestSocketClientTimeout(t *testing.T) {
logger := log.NewTestingLogger(t)

for i, tc := range testCases {
i := i
tc := tc
t.Run(tc.name, func(t *testing.T) {

// wait until all threads end, otherwise we'll get data race in t.Log()
Expand Down
5 changes: 3 additions & 2 deletions abci/cmd/abci-cli/abci-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/dashpay/tenderdash/abci/types"
"github.com/dashpay/tenderdash/config"
"github.com/dashpay/tenderdash/libs/log"
tmmath "github.com/dashpay/tenderdash/libs/math"
"github.com/dashpay/tenderdash/proto/tendermint/crypto"
tmproto "github.com/dashpay/tenderdash/proto/tendermint/types"
pbversion "github.com/dashpay/tenderdash/proto/tendermint/version"
Expand Down Expand Up @@ -568,7 +569,7 @@ func cmdFinalizeBlock(cmd *cobra.Command, args []string) error {
txs[i] = txBytes
}
res, err := client.FinalizeBlock(cmd.Context(), &types.RequestFinalizeBlock{
Height: int64(height),
Height: tmmath.MustConvertInt64(height),
Block: &tmproto.Block{
Header: tmproto.Header{AppHash: appHash},
Data: tmproto.Data{Txs: txs},
Expand Down Expand Up @@ -837,5 +838,5 @@ func processProposalArgs(args []string) (int64, [][]byte, error) {
}
txsBytesArray[i] = txBytes
}
return int64(height), txsBytesArray, nil
return tmmath.MustConvertInt64(height), txsBytesArray, nil
}
10 changes: 6 additions & 4 deletions abci/example/counter/counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/dashpay/tenderdash/abci/example/code"
"github.com/dashpay/tenderdash/abci/types"
tmcrypto "github.com/dashpay/tenderdash/crypto"
tmmath "github.com/dashpay/tenderdash/libs/math"
tmtypes "github.com/dashpay/tenderdash/types"
)

Expand All @@ -34,7 +35,7 @@ func (app *Application) InitCoreChainLock(initCoreChainHeight uint32, step int32
app.CoreChainLockStep = step
app.HasCoreChainLocks = true
app.CurrentCoreChainLockHeight = initCoreChainHeight
app.lastCoreChainLock = tmtypes.NewMockChainLock(app.CurrentCoreChainLockHeight)
app.lastCoreChainLock = tmtypes.NewMockChainLock(tmmath.MustConvertUint32(app.CurrentCoreChainLockHeight))
}

func (app *Application) Info(_ context.Context, _ *types.RequestInfo) (*types.ResponseInfo, error) {
Expand All @@ -51,7 +52,7 @@ func (app *Application) CheckTx(_ context.Context, req *types.RequestCheckTx) (*
tx8 := make([]byte, 8)
copy(tx8[len(tx8)-len(req.Tx):], req.Tx)
txValue := binary.BigEndian.Uint64(tx8)
if txValue < uint64(app.txCount) {
if txValue < tmmath.MustConvertUint64(app.txCount) {
return &types.ResponseCheckTx{
Code: code.CodeTypeBadNonce,
}, nil
Expand Down Expand Up @@ -122,7 +123,7 @@ func (app *Application) handleTxs(txs [][]byte) []*types.ExecTxResult {
tx8 := make([]byte, 8)
copy(tx8[len(tx8)-len(tx):], tx)
txValue := binary.BigEndian.Uint64(tx8)
if txValue != uint64(app.txCount) {
if txValue != tmmath.MustConvertUint64(app.txCount) {
txResults = append(txResults, &types.ExecTxResult{
Code: code.CodeTypeBadNonce,
Log: fmt.Sprintf("Invalid nonce. Expected %v, got %v", app.txCount, txValue),
Expand All @@ -138,6 +139,7 @@ func (app *Application) updateCoreChainLock() {
if !app.HasCoreChainLocks {
return
}
app.CurrentCoreChainLockHeight += uint32(app.CoreChainLockStep)
// this allows negative CoreChainLockStep, but will panic if it goes below 0
app.CurrentCoreChainLockHeight = tmmath.MustConvertUint32(int64(app.CurrentCoreChainLockHeight) + int64(app.CoreChainLockStep))
app.lastCoreChainLock = tmtypes.NewMockChainLock(app.CurrentCoreChainLockHeight)
}
14 changes: 7 additions & 7 deletions abci/example/kvstore/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Config struct {

// SnapshotInterval specifies the height interval at which the application
// will take state sync snapshots. Defaults to 0 (disabled).
SnapshotInterval uint64 `toml:"snapshot_interval"`
SnapshotInterval int64 `toml:"snapshot_interval"`

// RetainBlocks specifies the number of recent blocks to retain. Defaults to
// 0, which retains all blocks. Must be greater that PersistInterval,
Expand All @@ -38,7 +38,7 @@ type Config struct {
// PersistInterval specifies the height interval at which the application
// will persist state to disk. Defaults to 1 (every height), setting this to
// 0 disables state persistence.
PersistInterval uint64 `toml:"persist_interval"`
PersistInterval int64 `toml:"persist_interval"`

// ValidatorUpdates is a map of heights to validator names and their power,
// and will be returned by the ABCI application. For example, the following
Expand All @@ -58,11 +58,11 @@ type Config struct {

// Add artificial delays to each of the main ABCI calls to mimic computation time
// of the application
PrepareProposalDelayMS uint64 `toml:"prepare_proposal_delay_ms"`
ProcessProposalDelayMS uint64 `toml:"process_proposal_delay_ms"`
CheckTxDelayMS uint64 `toml:"check_tx_delay_ms"`
VoteExtensionDelayMS uint64 `toml:"vote_extension_delay_ms"`
FinalizeBlockDelayMS uint64 `toml:"finalize_block_delay_ms"`
PrepareProposalDelayMS int64 `toml:"prepare_proposal_delay_ms"`
ProcessProposalDelayMS int64 `toml:"process_proposal_delay_ms"`
CheckTxDelayMS int64 `toml:"check_tx_delay_ms"`
VoteExtensionDelayMS int64 `toml:"vote_extension_delay_ms"`
FinalizeBlockDelayMS int64 `toml:"finalize_block_delay_ms"`

// dash parameters
ThesholdPublicKeyUpdate map[string]string `toml:"threshold_public_key_update"`
Expand Down
12 changes: 7 additions & 5 deletions abci/example/kvstore/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/dashpay/tenderdash/internal/libs/protoio"
tmbytes "github.com/dashpay/tenderdash/libs/bytes"
"github.com/dashpay/tenderdash/libs/log"
tmmath "github.com/dashpay/tenderdash/libs/math"
types1 "github.com/dashpay/tenderdash/proto/tendermint/types"
"github.com/dashpay/tenderdash/types"
"github.com/dashpay/tenderdash/version"
Expand Down Expand Up @@ -302,7 +303,7 @@ func (app *Application) InitChain(_ context.Context, req *abci.RequestInitChain)
if !ok {
consensusParams = types1.ConsensusParams{
Version: &types1.VersionParams{
AppVersion: uint64(app.LastCommittedState.GetHeight()) + 1,
AppVersion: tmmath.MustConvertUint64(app.LastCommittedState.GetHeight() + 1),
},
}
}
Expand Down Expand Up @@ -581,15 +582,16 @@ func (app *Application) ApplySnapshotChunk(_ context.Context, req *abci.RequestA
}
func (app *Application) appVersionForHeight(height int64) uint64 {
if app.appVersion == 0 {
return uint64(height)
return tmmath.MustConvertUint64(height)
}

return app.appVersion
}

func (app *Application) createSnapshot() error {
height := app.LastCommittedState.GetHeight()
if app.cfg.SnapshotInterval == 0 || uint64(height)%app.cfg.SnapshotInterval != 0 {

if app.cfg.SnapshotInterval == 0 || height%app.cfg.SnapshotInterval != 0 {
return nil
}
_, err := app.snapshots.Create(app.LastCommittedState)
Expand Down Expand Up @@ -851,7 +853,7 @@ func (app *Application) chainLockUpdate(height int64) (*types1.CoreChainLock, er
if err != nil {
return nil, fmt.Errorf("invalid number chainLockUpdate value %q: %w", chainLockUpdateStr, err)
}
chainLock := types.NewMockChainLock(uint32(chainLockUpdate))
chainLock := types.NewMockChainLock(tmmath.MustConvertUint32(chainLockUpdate))
return chainLock.ToProto(), nil
}

Expand Down Expand Up @@ -904,7 +906,7 @@ func (app *Application) persist() error {

// persistInterval persists application state according to persist-interval parameter
func (app *Application) persistInterval() error {
if app.cfg.PersistInterval == 0 || app.LastCommittedState.GetHeight()%int64(app.cfg.PersistInterval) != 0 {
if app.cfg.PersistInterval == 0 || app.LastCommittedState.GetHeight()%app.cfg.PersistInterval != 0 {
return nil
}
return app.persist()
Expand Down
9 changes: 5 additions & 4 deletions abci/example/kvstore/kvstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
tmcrypto "github.com/dashpay/tenderdash/crypto"
tmbytes "github.com/dashpay/tenderdash/libs/bytes"
"github.com/dashpay/tenderdash/libs/log"
tmmath "github.com/dashpay/tenderdash/libs/math"
"github.com/dashpay/tenderdash/libs/service"
tmproto "github.com/dashpay/tenderdash/proto/tendermint/types"
pbversion "github.com/dashpay/tenderdash/proto/tendermint/version"
Expand Down Expand Up @@ -51,7 +52,7 @@ func testKVStore(ctx context.Context, t *testing.T, app types.Application, tx []
reqProcess := &types.RequestProcessProposal{
Txs: [][]byte{tx},
Height: height,
Version: &pbversion.Consensus{App: uint64(height)},
Version: &pbversion.Consensus{App: tmmath.MustConvertUint64(height)},
}
respProcess, err := app.ProcessProposal(ctx, reqProcess)
require.NoError(t, err)
Expand Down Expand Up @@ -290,7 +291,7 @@ func makeApplyBlock(
Hash: hash,
Height: height,
Txs: txs,
Version: &pbversion.Consensus{App: uint64(height)},
Version: &pbversion.Consensus{App: tmmath.MustConvertUint64(height)},
})
require.NoError(t, err)
require.NotZero(t, respProcessProposal)
Expand Down Expand Up @@ -415,7 +416,7 @@ func testClient(ctx context.Context, t *testing.T, app abciclient.Client, height
rpp, err := app.ProcessProposal(ctx, &types.RequestProcessProposal{
Txs: [][]byte{tx},
Height: height,
Version: &pbversion.Consensus{App: uint64(height)},
Version: &pbversion.Consensus{App: tmmath.MustConvertUint64(height)},
})
require.NoError(t, err)
require.NotZero(t, rpp)
Expand Down Expand Up @@ -555,7 +556,7 @@ func assertRespInfo(t *testing.T, expectLastBlockHeight int64, expectAppHash tmb
LastBlockHeight: expectLastBlockHeight,
LastBlockAppHash: expectAppHash,
Version: version.ABCIVersion,
AppVersion: uint64(expectLastBlockHeight + 1),
AppVersion: tmmath.MustConvertUint64(expectLastBlockHeight + 1),
Data: fmt.Sprintf(`{"appHash":"%s"}`, expectAppHash.String()),
}

Expand Down
3 changes: 2 additions & 1 deletion abci/example/kvstore/snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/dashpay/tenderdash/crypto"
tmbytes "github.com/dashpay/tenderdash/libs/bytes"
"github.com/dashpay/tenderdash/libs/ds"
tmmath "github.com/dashpay/tenderdash/libs/math"
)

const (
Expand Down Expand Up @@ -118,7 +119,7 @@ func (s *SnapshotStore) Create(state State) (abci.Snapshot, error) {
}

snapshot := abci.Snapshot{
Height: uint64(height),
Height: tmmath.MustConvertUint64(height),
Version: 1,
Hash: hasher.Sum(nil),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/abcidump/cmd/capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (captureCmd *CaptureCmd) Command() *cobra.Command {
Short: "capture TCP traffic, parse as ABCI protocol and display it in JSON format",

RunE: captureCmd.RunE,
PostRun: func(cmd *cobra.Command, args []string) {
PostRun: func(_ *cobra.Command, _ []string) {
if captureCmd.Input != nil {
if closer, ok := captureCmd.Input.(io.Closer); ok {
closer.Close()
Expand Down
2 changes: 1 addition & 1 deletion cmd/abcidump/cmd/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (cborCmd *CborCmd) Command() *cobra.Command {
Short: "Decode a CBOR-encoded message",
PreRunE: cborCmd.PreRunE,
RunE: cborCmd.RunE,
PostRun: func(cmd *cobra.Command, args []string) {
PostRun: func(_ *cobra.Command, _ []string) {
if cborCmd.Input != nil {
if closer, ok := cborCmd.Input.(io.Closer); ok {
closer.Close()
Expand Down
2 changes: 1 addition & 1 deletion cmd/abcidump/cmd/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (parseCmd *ParseCmd) Command() *cobra.Command {

PreRunE: parseCmd.PreRunE,
RunE: parseCmd.RunE,
PostRun: func(cmd *cobra.Command, args []string) {
PostRun: func(_ *cobra.Command, _ []string) {
if parseCmd.Input != nil {
if closer, ok := parseCmd.Input.(io.Closer); ok {
closer.Close()
Expand Down
2 changes: 1 addition & 1 deletion cmd/abcidump/cmd/rootcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func MakeRootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "abcidump",
Short: "Parse dump of protobuf communication between two nodes",
PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
PersistentPreRunE: func(_ *cobra.Command, _ []string) (err error) {
logger, err = log.NewDefaultLogger(log.LogFormatPlain, logLevel)
if err != nil {
return fmt.Errorf("cannot initialize logging: %w", err)
Expand Down
1 change: 0 additions & 1 deletion cmd/tenderdash/commands/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func compactGoLevelDBs(rootDir string, logger log.Logger) {
wg := sync.WaitGroup{}

for _, dbName := range dbNames {
dbName := dbName
wg.Add(1)
go func() {
defer wg.Done()
Expand Down
3 changes: 2 additions & 1 deletion cmd/tenderdash/commands/debug/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/dashpay/tenderdash/config"
"github.com/dashpay/tenderdash/libs/cli"
"github.com/dashpay/tenderdash/libs/log"
"github.com/dashpay/tenderdash/libs/math"
rpchttp "github.com/dashpay/tenderdash/rpc/client/http"
)

Expand Down Expand Up @@ -75,7 +76,7 @@ if enabled.`,
}
dumpDebugData(ctx, logger, rpc, dumpArgs)

ticker := time.NewTicker(time.Duration(frequency) * time.Second)
ticker := time.NewTicker(time.Duration(math.MustConvert[uint, int64](frequency)) * time.Second)
for range ticker.C {
dumpDebugData(ctx, logger, rpc, dumpArgs)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/debug/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ func writeStateJSONToFile(state interface{}, dir, filename string) error {
return fmt.Errorf("failed to encode state dump: %w", err)
}

return os.WriteFile(path.Join(dir, filename), stateJSON, os.ModePerm)
return os.WriteFile(path.Join(dir, filename), stateJSON, 0600)
}
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/debug/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ func dumpProfile(dir, addr, profile string, debug int) error {
return fmt.Errorf("failed to read %s profile response body: %w", profile, err)
}

return os.WriteFile(path.Join(dir, fmt.Sprintf("%s.out", profile)), body, os.ModePerm)
return os.WriteFile(path.Join(dir, fmt.Sprintf("%s.out", profile)), body, 0600)
}
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/gen_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func MakeGenValidatorCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "gen-validator",
Short: "Generate new validator keypair",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
pv := privval.GenFilePV("", "")

jsbz, err := json.Marshal(pv)
Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func MakeInspectCommand(conf *config.Config, logger log.Logger) *cobra.Command {
The inspect command can be used to query the block and state store using Tendermint
RPC calls to debug issues of inconsistent state.
`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
ctx, cancel := signal.NotifyContext(cmd.Context(), syscall.SIGTERM, syscall.SIGINT)
defer cancel()

Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/key_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func MakeKeyMigrateCommand(conf *config.Config, logger log.Logger) *cobra.Comman
cmd := &cobra.Command{
Use: "key-migrate",
Short: "Run Database key migration",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
return RunDatabaseMigration(cmd.Context(), logger, conf)
},
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/tenderdash/commands/reindex_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/dashpay/tenderdash/internal/state/indexer/sink/psql"
"github.com/dashpay/tenderdash/internal/store"
"github.com/dashpay/tenderdash/libs/log"
tmmath "github.com/dashpay/tenderdash/libs/math"
"github.com/dashpay/tenderdash/libs/os"
"github.com/dashpay/tenderdash/rpc/coretypes"
"github.com/dashpay/tenderdash/types"
Expand Down Expand Up @@ -51,7 +52,7 @@ either or both arguments.
tendermint reindex-event --end-height 10
tendermint reindex-event --start-height 2 --end-height 10
`,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
bs, ss, err := loadStateAndBlockStore(conf)
if err != nil {
return fmt.Errorf("%s: %w", reindexFailed, err)
Expand Down Expand Up @@ -210,7 +211,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error {
for i := range b.Data.Txs {
tr := abcitypes.TxResult{
Height: b.Height,
Index: uint32(i),
Index: tmmath.MustConvertUint32(i),
Tx: b.Data.Txs[i],
Result: *(r.ProcessProposal.TxResults[i]),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/tenderdash/commands/reindex_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func setupReIndexEventCmd(ctx context.Context, conf *config.Config, logger log.L

reIndexEventCmd := &cobra.Command{
Use: cmd.Use,
Run: func(cmd *cobra.Command, args []string) {},
Run: func(_ *cobra.Command, _ []string) {},
}

_ = reIndexEventCmd.ExecuteContext(ctx)
Expand Down
Loading
Loading