Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Jun 10, 2024
1 parent 94d97cc commit 0be2cd2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion simapp/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ func TestAppImportExport(t *testing.T) {
ctxA := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
_, err = newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState)

if err != nil {
if strings.Contains(err.Error(), "validator set is empty after InitGenesis") {
logger.Info("Skipping simulation as all validators have been unbonded")
Expand Down
1 change: 0 additions & 1 deletion store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,6 @@ func (rs *Store) Snapshot(height uint64, protoWriter protoio.Writer) error {

return nil
}()

if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions x/bank/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -36,6 +35,7 @@ import (
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
_ "github.com/cosmos/cosmos-sdk/x/params"
_ "github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

type (
Expand Down Expand Up @@ -476,7 +476,7 @@ var (
func (h *MockBankHooksReceiver) TrackBeforeSend(ctx context.Context, from, to sdk.AccAddress, amount sdk.Coins) {
for _, coin := range amount {
if coin.Amount.Equal(sdkmath.NewInt(50)) {
countTrackBeforeSend += 1
countTrackBeforeSend++
}
}
}
Expand Down Expand Up @@ -527,6 +527,7 @@ func TestHooks(t *testing.T) {
err = s.BankKeeper.SendCoinsFromAccountToModule(ctx, addr1, stakingtypes.BondedPoolName, invalidBlockSendAmount)
require.Error(t, err)
err = s.BankKeeper.SendCoinsFromAccountToModule(ctx, addr1, stakingtypes.BondedPoolName, triggerTrackSendAmount)
require.NoError(t, err)
require.Equal(t, countTrackBeforeSend, expNextCount)
expNextCount++

Expand All @@ -536,6 +537,7 @@ func TestHooks(t *testing.T) {
err = s.BankKeeper.SendCoinsFromModuleToAccount(ctx, stakingtypes.BondedPoolName, addr1, invalidBlockSendAmount)
require.Error(t, err)
err = s.BankKeeper.SendCoinsFromModuleToAccount(ctx, stakingtypes.BondedPoolName, addr1, triggerTrackSendAmount)
require.NoError(t, err)
require.Equal(t, countTrackBeforeSend, expNextCount)
expNextCount++

Expand All @@ -546,6 +548,7 @@ func TestHooks(t *testing.T) {
// there should be no error since module to module does not call block before send hooks
require.NoError(t, err)
err = s.BankKeeper.SendCoinsFromModuleToModule(ctx, stakingtypes.BondedPoolName, stakingtypes.NotBondedPoolName, triggerTrackSendAmount)
require.NoError(t, err)
require.Equal(t, countTrackBeforeSend, expNextCount)
expNextCount++

Expand All @@ -555,6 +558,7 @@ func TestHooks(t *testing.T) {
err = s.BankKeeper.DelegateCoins(ctx, addr1, s.AccountKeeper.GetModuleAddress(stakingtypes.BondedPoolName), invalidBlockSendAmount)
require.Error(t, err)
err = s.BankKeeper.DelegateCoins(ctx, addr1, s.AccountKeeper.GetModuleAddress(stakingtypes.BondedPoolName), triggerTrackSendAmount)
require.NoError(t, err)
require.Equal(t, countTrackBeforeSend, expNextCount)
expNextCount++

Expand All @@ -565,6 +569,7 @@ func TestHooks(t *testing.T) {
require.Error(t, err)

err = s.BankKeeper.UndelegateCoins(ctx, s.AccountKeeper.GetModuleAddress(stakingtypes.BondedPoolName), addr1, triggerTrackSendAmount)
require.NoError(t, err)
require.Equal(t, countTrackBeforeSend, expNextCount)
expNextCount++
}
4 changes: 2 additions & 2 deletions x/bank/keeper/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ func (k BaseSendKeeper) InputOutputCoins(ctx context.Context, input types.Input,
}

// SendCoinsWithoutBlockHook calls sendCoins without calling the `BlockBeforeSend` hook.
func (k BaseSendKeeper) SendCoinsWithoutBlockHook(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error {
func (k BaseSendKeeper) SendCoinsWithoutBlockHook(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error {
return k.sendCoins(ctx, fromAddr, toAddr, amt)
}

// SendCoins transfers amt coins from a sending account to a receiving account.
// An error is returned upon failure.
func (k BaseSendKeeper) SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error {
func (k BaseSendKeeper) SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error {
// BlockBeforeSend hook should always be called before the TrackBeforeSend hook.
err := k.BlockBeforeSend(ctx, fromAddr, toAddr, amt)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion x/distribution/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ func (k Querier) DelegatorValidators(ctx context.Context, req *types.QueryDelega
return false
},
)

if err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion x/gov/keeper/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func (keeper Keeper) Tally(ctx context.Context, proposal v1.Proposal) (passes, b

return false, keeper.Votes.Remove(ctx, collections.Join(vote.ProposalId, sdk.AccAddress(voter)))
})

if err != nil {
return false, false, tallyResults, err
}
Expand Down
2 changes: 0 additions & 2 deletions x/group/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,6 @@ func SimulateMsgWithdrawProposal(
}

_, _, err = app.SimDeliver(txGen.TxEncoder(), tx)

if err != nil {
if strings.Contains(err.Error(), "group was modified") || strings.Contains(err.Error(), "group policy was modified") {
return simtypes.NoOpMsg(group.ModuleName, sdk.MsgTypeURL(msg), "no-op:group/group-policy was modified"), nil, nil
Expand Down Expand Up @@ -1066,7 +1065,6 @@ func SimulateMsgVote(
}

_, _, err = app.SimDeliver(txGen.TxEncoder(), tx)

if err != nil {
if strings.Contains(err.Error(), "group was modified") || strings.Contains(err.Error(), "group policy was modified") {
return simtypes.NoOpMsg(group.ModuleName, sdk.MsgTypeURL(msg), "no-op:group/group-policy was modified"), nil, nil
Expand Down

0 comments on commit 0be2cd2

Please sign in to comment.