diff --git a/app/ante/commission_test.go b/app/ante/commission_test.go index 9cbd18982..fd4d6ca50 100644 --- a/app/ante/commission_test.go +++ b/app/ante/commission_test.go @@ -1,8 +1,6 @@ package ante_test import ( - "testing" - "cosmossdk.io/math" sdkclienttx "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" @@ -109,7 +107,7 @@ func (s *AnteTestSuite) TestAnteDecoratorStakingCommission() { wantErr: ante.ErrMaxValidatorCommission.Error(), }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { txGasCoins := sdk.NewCoins( sdk.NewCoin("unibi", math.NewInt(1_000)), sdk.NewCoin("utoken", math.NewInt(500)), diff --git a/app/ante/fixed_gas_test.go b/app/ante/fixed_gas_test.go index 0d11b3b2d..4e45f6b6b 100644 --- a/app/ante/fixed_gas_test.go +++ b/app/ante/fixed_gas_test.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/signing" - "github.com/cosmos/cosmos-sdk/x/bank/types" + bank "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/NibiruChain/nibiru/v2/app/ante" "github.com/NibiruChain/nibiru/v2/app/appconst" @@ -62,7 +62,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { Feeder: addr.String(), Validator: addr.String(), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -74,7 +74,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { { name: "Two messages in a transaction, one of them is an oracle vote message should fail (with MsgAggregateExchangeRatePrevote) permutation 2", messages: []sdk.Msg{ - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -97,7 +97,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { Feeder: addr.String(), Validator: addr.String(), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -109,7 +109,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { { name: "Two messages in a transaction, one of them is an oracle vote message should fail (with MsgAggregateExchangeRateVote) permutation 2", messages: []sdk.Msg{ - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -169,7 +169,7 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { Feeder: addr.String(), Validator: addr.String(), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), @@ -186,25 +186,25 @@ func (suite *AnteTestSuite) TestOraclePostPriceTransactionsHaveFixedPrice() { { name: "Other two messages", messages: []sdk.Msg{ - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 100)), }, - &types.MsgSend{ + &bank.MsgSend{ FromAddress: addr.String(), ToAddress: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin(appconst.BondDenom, 200)), }, }, - expectedGas: 67193, + expectedGas: 38175, expectedErr: nil, }, } for _, tc := range tests { tc := tc - suite.T().Run(tc.name, func(t *testing.T) { + suite.Run(tc.name, func() { suite.SetupTest() // setup suite.txBuilder = suite.clientCtx.TxConfig.NewTxBuilder() diff --git a/app/evmante/suite_test.go b/app/evmante/suite_test.go index 2150aebe3..621778582 100644 --- a/app/evmante/suite_test.go +++ b/app/evmante/suite_test.go @@ -60,7 +60,7 @@ func (s *TestSuite) TestGenesis() { wantErr: "min_commission must be positive", }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { genStakingJson := s.encCfg.Codec.MustMarshalJSON(tc.gen) err := app.StakingModule{}.ValidateGenesis( s.encCfg.Codec, diff --git a/app/modules_test.go b/app/modules_test.go index 5abd63267..44e59599f 100644 --- a/app/modules_test.go +++ b/app/modules_test.go @@ -60,7 +60,7 @@ func (s *TestSuite) TestGenesis() { wantErr: "min_commission must be positive", }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { genStakingJson := s.encCfg.Codec.MustMarshalJSON(tc.gen) err := app.StakingModule{}.ValidateGenesis( s.encCfg.Codec, diff --git a/eth/rpc/block_test.go b/eth/rpc/block_test.go index fde99b14c..1fd502272 100644 --- a/eth/rpc/block_test.go +++ b/eth/rpc/block_test.go @@ -7,6 +7,7 @@ import ( grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/ethereum/go-ethereum/common" + "github.com/rs/zerolog/log" "github.com/stretchr/testify/suite" "google.golang.org/grpc/metadata" ) @@ -129,7 +130,7 @@ func (s *BlockSuite) TestUnmarshalBlockNumberOrHash() { } for _, tc := range testCases { - fmt.Printf("Case %s", tc.msg) + log.Info().Msgf("Case %s", tc.msg) // reset input bnh = new(BlockNumberOrHash) err := bnh.UnmarshalJSON(tc.input) diff --git a/x/common/paginate_test.go b/x/common/paginate_test.go index 4aa410041..f3a3744be 100644 --- a/x/common/paginate_test.go +++ b/x/common/paginate_test.go @@ -74,7 +74,7 @@ func (s *paginateSuite) TestParsePagination() { wantOffset: 99, }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { gotPageReq, gotPage, gotErr := common.ParsePagination(tc.pageReq) s.EqualValues(tc.wantPage, gotPage) diff --git a/x/common/testutil/testnetwork/tx_test.go b/x/common/testutil/testnetwork/tx_test.go index 94a9db6bd..7912b8cea 100644 --- a/x/common/testutil/testnetwork/tx_test.go +++ b/x/common/testutil/testnetwork/tx_test.go @@ -1,8 +1,6 @@ package testnetwork_test import ( - "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "cosmossdk.io/math" @@ -37,7 +35,7 @@ func (s *TestSuite) TestExecTx() { s.NoError(err) s.EqualValues(0, txResp.Code) - s.T().Run("test tx option changes", func(t *testing.T) { + s.Run("test tx option changes", func() { defaultOpts := testnetwork.DEFAULT_TX_OPTIONS opts := testnetwork.WithTxOptions(testnetwork.TxOptionChanges{ BroadcastMode: &defaultOpts.BroadcastMode, @@ -52,7 +50,7 @@ func (s *TestSuite) TestExecTx() { s.EqualValues(0, txResp.Code) }) - s.T().Run("fail when validators are missing", func(t *testing.T) { + s.Run("fail when validators are missing", func() { networkNoVals := new(testnetwork.Network) *networkNoVals = *s.network networkNoVals.Validators = []*testnetwork.Validator{} diff --git a/x/devgas/v1/ante/ante_test.go b/x/devgas/v1/ante/ante_test.go index 8e9a6f5c8..75a974e04 100644 --- a/x/devgas/v1/ante/ante_test.go +++ b/x/devgas/v1/ante/ante_test.go @@ -236,7 +236,8 @@ func (suite *AnteTestSuite) TestDevGasPayout() { } for _, tc := range testCases { - suite.T().Run(tc.name, func(t *testing.T) { + suite.Run(tc.name, func() { + t := suite.T() bapp, ctx := tc.setup() ctx = ctx.WithChainID("mock-chain-id") anteDecorator := devgasante.NewDevGasPayoutDecorator( diff --git a/x/devgas/v1/genesis_test.go b/x/devgas/v1/genesis_test.go index 332f10f2b..7c450f608 100644 --- a/x/devgas/v1/genesis_test.go +++ b/x/devgas/v1/genesis_test.go @@ -109,7 +109,7 @@ func (s *GenesisTestSuite) TestGenesis() { } for _, tc := range testCases { - s.T().Run(fmt.Sprintf("Case %s", tc.name), func(t *testing.T) { + s.Run(fmt.Sprintf("Case %s", tc.name), func() { s.SetupTest() // reset if tc.expPanic { diff --git a/x/devgas/v1/types/msg_test.go b/x/devgas/v1/types/msg_test.go index fb41cba0f..38ef569cf 100644 --- a/x/devgas/v1/types/msg_test.go +++ b/x/devgas/v1/types/msg_test.go @@ -276,7 +276,7 @@ func (s *MsgsTestSuite) TestQuery_ValidateBasic() { }, }, } { - s.T().Run(tc.name, func(t *testing.T) { + s.Run(tc.name, func() { tc.test() }) } diff --git a/x/evm/keeper/bank_extension.go b/x/evm/keeper/bank_extension.go index e4afbba09..7bbbefb5a 100644 --- a/x/evm/keeper/bank_extension.go +++ b/x/evm/keeper/bank_extension.go @@ -1,6 +1,7 @@ package keeper import ( + store "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -91,9 +92,9 @@ func (bk NibiruBankKeeper) ForceGasInvariant( ) error { gasMeterBefore := ctx.GasMeter() gasConsumedBefore := gasMeterBefore.GasConsumed() - baseOpGasConsumed := uint64(0) // Start baseGasConsumed at 0 in case we panic before BaseOp completes and // baseGasConsumed gets a value assignment + baseOpGasConsumed := uint64(0) defer func() { gasMeterBefore.RefundGas(gasMeterBefore.GasConsumed(), "") gasMeterBefore.ConsumeGas(gasConsumedBefore+baseOpGasConsumed, "NibiruBankKeeper invariant") @@ -101,7 +102,9 @@ func (bk NibiruBankKeeper) ForceGasInvariant( // Note that because the ctx gas meter uses private variables to track gas, // we have to branch off with a new gas meter instance to avoid mutating the // "true" gas meter (called GasMeterBefore here). - ctx = ctx.WithGasMeter(sdk.NewGasMeter(gasMeterBefore.Limit())) + ctx = ctx. + WithGasMeter(sdk.NewGasMeter(gasMeterBefore.Limit())). + WithKVGasConfig(store.GasConfig{}) err := BaseOp(ctx) baseOpGasConsumed = ctx.GasMeter().GasConsumed()