Skip to content

Commit

Permalink
chore: remove unused local variables (cosmos#22340)
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code authored Oct 23, 2024
1 parent 8fa3090 commit 1515856
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,5 @@ linters-settings:
- regexpMust
- appendAssign
- ifElseChain
unused:
local-variables-are-used: false
2 changes: 0 additions & 2 deletions simapp/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []
// update bond intra-tx counters.
store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
counter := int16(0)

for ; iter.Valid(); iter.Next() {
addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key()))
Expand All @@ -238,7 +237,6 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []
if err = app.StakingKeeper.SetValidator(ctx, validator); err != nil {
panic(err)
}
counter++
}

if err := iter.Close(); err != nil {
Expand Down
2 changes: 0 additions & 2 deletions store/cachekv/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem corestore.KVSt
require.NoError(t, err)

krc := newKeyRangeCounter(r)
i := 0

for ; krc.valid(); krc.next() {
require.True(t, itr.Valid())
Expand All @@ -569,7 +568,6 @@ func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem corestore.KVSt

itr.Next()
itr2.Next()
i++
}

require.False(t, itr.Valid())
Expand Down
5 changes: 0 additions & 5 deletions types/mempool/priority_nonce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,8 @@ func (s *MempoolTestSuite) TestRandomTxOrderManyTimes() {
// validateOrder checks that the txs are ordered by priority and nonce
// in O(n^2) time by checking each tx against all the other txs
func validateOrder(mtxs []sdk.Tx) error {
iterations := 0
var itxs []txSpec
for i, mtx := range mtxs {
iterations++
tx := mtx.(testTx)
itxs = append(itxs, txSpec{p: int(tx.priority), n: int(tx.nonce), a: tx.address, i: i})
}
Expand All @@ -556,7 +554,6 @@ func validateOrder(mtxs []sdk.Tx) error {

for _, a := range itxs {
for _, b := range itxs {
iterations++
// when b is before a

// when a is before b
Expand All @@ -574,7 +571,6 @@ func validateOrder(mtxs []sdk.Tx) error {
// find a tx with same sender as b and lower nonce
found := false
for _, c := range itxs {
iterations++
if c.a.Equals(b.a) && c.n < b.n && c.p <= a.p {
found = true
break
Expand All @@ -588,7 +584,6 @@ func validateOrder(mtxs []sdk.Tx) error {
}
}
}
// fmt.Printf("validation in iterations: %d\n", iterations)
return nil
}

Expand Down
3 changes: 0 additions & 3 deletions x/staking/keeper/query_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,9 @@ func (k Keeper) GetDelegatorValidator(
func (k Keeper) GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]types.Delegation, error) {
delegations := make([]types.Delegation, 0)

var i int64
rng := collections.NewPrefixedPairRange[sdk.AccAddress, sdk.ValAddress](delegator)
err := k.Delegations.Walk(ctx, rng, func(key collections.Pair[sdk.AccAddress, sdk.ValAddress], del types.Delegation) (stop bool, err error) {
delegations = append(delegations, del)
i++

return false, nil
})
if err != nil {
Expand Down

0 comments on commit 1515856

Please sign in to comment.