chore: lint v2 (#24118)

This commit is contained in:
Alex | Interchain Labs
2025-03-25 15:57:24 +00:00
committed by GitHub
parent 9acd7716dd
commit b7a20b81f6
87 changed files with 298 additions and 288 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ func TestParseQueryResponse(t *testing.T) {
res, err := authclient.ParseQueryResponse(bz)
require.NoError(t, err)
require.Equal(t, 10, int(res.GasInfo.GasUsed))
require.Equal(t, 10, int(res.GasUsed))
require.NotNil(t, res.Result)
res, err = authclient.ParseQueryResponse([]byte("fuzzy"))
+2 -2
View File
@@ -26,7 +26,7 @@ func BenchmarkAccountMapperGetAccountFound(b *testing.B) {
)
require.NoError(b, err)
ctx := app.BaseApp.NewContext(false)
ctx := app.NewContext(false)
// assumes b.N < 2**24
for i := 0; i < b.N; i++ {
@@ -53,7 +53,7 @@ func BenchmarkAccountMapperSetAccount(b *testing.B) {
), &accountKeeper)
require.NoError(b, err)
ctx := app.BaseApp.NewContext(false)
ctx := app.NewContext(false)
b.ResetTimer()
+1 -1
View File
@@ -112,7 +112,7 @@ func (ss StdSignature) GetPubKey() cryptotypes.PubKey {
func (ss StdSignature) MarshalYAML() (interface{}, error) {
pk := ""
if ss.PubKey != nil {
pk = ss.PubKey.String()
pk = ss.String()
}
bz, err := yaml.Marshal(struct {
+2 -2
View File
@@ -38,11 +38,11 @@ func (s *StdTxBuilder) SetSignatures(signatures ...signing.SignatureV2) error {
}
func (s *StdTxBuilder) SetFeeAmount(amount sdk.Coins) {
s.StdTx.Fee.Amount = amount
s.Fee.Amount = amount
}
func (s *StdTxBuilder) SetGasLimit(limit uint64) {
s.StdTx.Fee.Gas = limit
s.Fee.Gas = limit
}
// SetMemo implements TxBuilder.SetMemo
+1 -1
View File
@@ -73,7 +73,7 @@ func TestMigrateVestingAccounts(t *testing.T) {
legacySubspace := newMockSubspace(authtypes.DefaultParams())
require.NoError(t, v4.Migrate(ctx, storeService, legacySubspace, cdc))
ctx = app.BaseApp.NewContextLegacy(false, cmtproto.Header{Time: time.Now()})
ctx = app.NewContextLegacy(false, cmtproto.Header{Time: time.Now()})
require.NoError(t, stakingKeeper.SetParams(ctx, stakingtypes.DefaultParams()))
lastAccNum := uint64(1000)
createBaseAccount := func(addr sdk.AccAddress) *authtypes.BaseAccount {
+1 -1
View File
@@ -69,7 +69,7 @@ func TestMigrateMapAccAddressToAccNumberKey(t *testing.T) {
randAccNumber := uint64(rand.Intn(100000-10000) + 10000)
acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), randAccNumber, 0)
ctx = app.BaseApp.NewContextLegacy(false, cmtproto.Header{Time: time.Now()})
ctx = app.NewContextLegacy(false, cmtproto.Header{Time: time.Now()})
// migrator
m := keeper.NewMigrator(accountKeeper, app.GRPCQueryRouter(), legacySubspace)
+1 -1
View File
@@ -24,7 +24,7 @@ func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
&accountKeeper)
require.NoError(t, err)
ctx := app.BaseApp.NewContext(false)
ctx := app.NewContext(false)
acc := accountKeeper.GetAccount(ctx, types.NewModuleAddress(types.FeeCollectorName))
require.NotNil(t, acc)
}
+1 -1
View File
@@ -30,7 +30,7 @@ func RandomGenesisAccounts(simState *module.SimulationState) types.GenesisAccoun
// Only consider making a vesting account once the initial bonded validator
// set is exhausted due to needing to track DelegatedVesting.
if !(int64(i) > simState.NumBonded && simState.Rand.Intn(100) < 50) {
if int64(i) <= simState.NumBonded || simState.Rand.Intn(100) >= 50 {
genesisAccs[i] = bacc
continue
}
+18 -18
View File
@@ -48,20 +48,20 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre
}
ctx := sdk.UnwrapSDKContext(goCtx)
if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
if err := s.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
return nil, err
}
if s.BankKeeper.BlockedAddr(to) {
if s.BlockedAddr(to) {
return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress)
}
if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil {
if acc := s.GetAccount(ctx, to); acc != nil {
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
}
baseAccount := authtypes.NewBaseAccountWithAddress(to)
baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
baseAccount = s.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
baseVestingAccount, err := types.NewBaseVestingAccount(baseAccount, msg.Amount.Sort(), msg.EndTime)
if err != nil {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
@@ -74,7 +74,7 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre
vestingAccount = types.NewContinuousVestingAccountRaw(baseVestingAccount, ctx.BlockTime().Unix())
}
s.AccountKeeper.SetAccount(ctx, vestingAccount)
s.SetAccount(ctx, vestingAccount)
defer func() {
telemetry.IncrCounter(1, "new", "account")
@@ -90,7 +90,7 @@ func (s msgServer) CreateVestingAccount(goCtx context.Context, msg *types.MsgCre
}
}()
if err = s.BankKeeper.SendCoins(ctx, from, to, msg.Amount); err != nil {
if err = s.SendCoins(ctx, from, to, msg.Amount); err != nil {
return nil, err
}
@@ -113,26 +113,26 @@ func (s msgServer) CreatePermanentLockedAccount(goCtx context.Context, msg *type
}
ctx := sdk.UnwrapSDKContext(goCtx)
if err := s.BankKeeper.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
if err := s.IsSendEnabledCoins(ctx, msg.Amount...); err != nil {
return nil, err
}
if s.BankKeeper.BlockedAddr(to) {
if s.BlockedAddr(to) {
return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress)
}
if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil {
if acc := s.GetAccount(ctx, to); acc != nil {
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
}
baseAccount := authtypes.NewBaseAccountWithAddress(to)
baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
baseAccount = s.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
vestingAccount, err := types.NewPermanentLockedAccount(baseAccount, msg.Amount)
if err != nil {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}
s.AccountKeeper.SetAccount(ctx, vestingAccount)
s.SetAccount(ctx, vestingAccount)
defer func() {
telemetry.IncrCounter(1, "new", "account")
@@ -148,7 +148,7 @@ func (s msgServer) CreatePermanentLockedAccount(goCtx context.Context, msg *type
}
}()
if err = s.BankKeeper.SendCoins(ctx, from, to, msg.Amount); err != nil {
if err = s.SendCoins(ctx, from, to, msg.Amount); err != nil {
return nil, err
}
@@ -183,27 +183,27 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *type
totalCoins = totalCoins.Add(period.Amount...)
}
if s.BankKeeper.BlockedAddr(to) {
if s.BlockedAddr(to) {
return nil, errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to receive funds", msg.ToAddress)
}
ctx := sdk.UnwrapSDKContext(goCtx)
if acc := s.AccountKeeper.GetAccount(ctx, to); acc != nil {
if acc := s.GetAccount(ctx, to); acc != nil {
return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "account %s already exists", msg.ToAddress)
}
if err := s.BankKeeper.IsSendEnabledCoins(ctx, totalCoins...); err != nil {
if err := s.IsSendEnabledCoins(ctx, totalCoins...); err != nil {
return nil, err
}
baseAccount := authtypes.NewBaseAccountWithAddress(to)
baseAccount = s.AccountKeeper.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
baseAccount = s.NewAccount(ctx, baseAccount).(*authtypes.BaseAccount)
vestingAccount, err := types.NewPeriodicVestingAccount(baseAccount, totalCoins.Sort(), msg.StartTime, msg.VestingPeriods)
if err != nil {
return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, err.Error())
}
s.AccountKeeper.SetAccount(ctx, vestingAccount)
s.SetAccount(ctx, vestingAccount)
defer func() {
telemetry.IncrCounter(1, "new", "account")
@@ -219,7 +219,7 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *type
}
}()
if err = s.BankKeeper.SendCoins(ctx, from, to, totalCoins); err != nil {
if err = s.SendCoins(ctx, from, to, totalCoins); err != nil {
return nil, err
}
+4 -4
View File
@@ -229,7 +229,7 @@ func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coi
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
// defined as the vesting coins that are not delegated.
func (cva ContinuousVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins {
return cva.BaseVestingAccount.LockedCoinsFromVesting(cva.GetVestingCoins(blockTime))
return cva.LockedCoinsFromVesting(cva.GetVestingCoins(blockTime))
}
// TrackDelegation tracks a desired delegation amount by setting the appropriate
@@ -334,7 +334,7 @@ func (pva PeriodicVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
// defined as the vesting coins that are not delegated.
func (pva PeriodicVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins {
return pva.BaseVestingAccount.LockedCoinsFromVesting(pva.GetVestingCoins(blockTime))
return pva.LockedCoinsFromVesting(pva.GetVestingCoins(blockTime))
}
// TrackDelegation tracks a desired delegation amount by setting the appropriate
@@ -433,7 +433,7 @@ func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
// defined as the vesting coins that are not delegated.
func (dva DelayedVestingAccount) LockedCoins(blockTime time.Time) sdk.Coins {
return dva.BaseVestingAccount.LockedCoinsFromVesting(dva.GetVestingCoins(blockTime))
return dva.LockedCoinsFromVesting(dva.GetVestingCoins(blockTime))
}
// TrackDelegation tracks a desired delegation amount by setting the appropriate
@@ -489,7 +489,7 @@ func (plva PermanentLockedAccount) GetVestingCoins(_ time.Time) sdk.Coins {
// LockedCoins returns the set of coins that are not spendable (i.e. locked),
// defined as the vesting coins that are not delegated.
func (plva PermanentLockedAccount) LockedCoins(_ time.Time) sdk.Coins {
return plva.BaseVestingAccount.LockedCoinsFromVesting(plva.OriginalVesting)
return plva.LockedCoinsFromVesting(plva.OriginalVesting)
}
// TrackDelegation tracks a desired delegation amount by setting the appropriate