diff --git a/CHANGELOG.md b/CHANGELOG.md index d999ef21db13..cc9a32b78b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements * [\#10262](https://github.com/cosmos/cosmos-sdk/pull/10262) Remove unnecessary logging in `x/feegrant` simulation. +* [\#10327](https://github.com/cosmos/cosmos-sdk/pull/10327) Add null guard for possible nil `Amount` in tx fee `Coins` ### Bug Fixes diff --git a/types/coin.go b/types/coin.go index f6627c4c3a81..fd81cb58203a 100644 --- a/types/coin.go +++ b/types/coin.go @@ -181,7 +181,7 @@ func (coin Coin) IsNegative() bool { // IsNil returns true if the coin amount is nil and false otherwise. func (coin Coin) IsNil() bool { - return coin.Amount.BigInt() == nil + return coin.Amount.i == nil } //----------------------------------------------------------------------------- diff --git a/types/coin_test.go b/types/coin_test.go index 0c746ffb6206..2f9873ab42a8 100644 --- a/types/coin_test.go +++ b/types/coin_test.go @@ -1319,6 +1319,7 @@ func (s *coinTestSuite) TestCoinsIsAnyNil() { s.Require().True(sdk.Coins{twoAtom, nilAtom, fiveAtom, threeEth}.IsAnyNil()) s.Require().True(sdk.Coins{nilAtom, twoAtom, fiveAtom, threeEth}.IsAnyNil()) s.Require().False(sdk.Coins{twoAtom, fiveAtom, threeEth}.IsAnyNil()) + } func (s *coinTestSuite) TestMarshalJSONCoins() { diff --git a/types/tx/types.go b/types/tx/types.go index b8a61946538c..ac2f01e404ca 100644 --- a/types/tx/types.go +++ b/types/tx/types.go @@ -66,7 +66,7 @@ func (t *Tx) ValidateBasic() error { } if fee.Amount.IsAnyNil() { - return errorsmod.Wrapf( + return sdkerrors.Wrapf( sdkerrors.ErrInsufficientFee, "invalid fee provided: null", )