diff --git a/CHANGELOG.md b/CHANGELOG.md index feef3d8ef041..fd789a2602ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#13178](https://github.com/cosmos/cosmos-sdk/pull/13178) Add `cosmos.msg.v1.service` protobuf annotation to allow tooling to distinguish between Msg and Query services via reflection. * [#13236](https://github.com/cosmos/cosmos-sdk/pull/13236) Integrate Filter Logging * [#13433](https://github.com/cosmos/cosmos-sdk/pull/13433) Remove dead code in cacheMergeIterator `Domain()`. +* [#13528](https://github.com/cosmos/cosmos-sdk/pull/13528) Update `ValidateMemoDecorator` to only check memo against `MaxMemoCharacters` param when a memo is present. ### State Machine Breaking diff --git a/baseapp/block_gas_test.go b/baseapp/block_gas_test.go index f243dd027a07..4f765e340fb1 100644 --- a/baseapp/block_gas_test.go +++ b/baseapp/block_gas_test.go @@ -166,7 +166,7 @@ func TestBaseApp_BlockGas(t *testing.T) { require.Equal(t, []byte("ok"), okValue) } // check block gas is always consumed - baseGas := uint64(52864) // baseGas is the gas consumed before tx msg + baseGas := uint64(51822) // baseGas is the gas consumed before tx msg expGasConsumed := addUint64Saturating(tc.gasToConsume, baseGas) if expGasConsumed > txtypes.MaxGasWanted { // capped by gasLimit diff --git a/x/auth/ante/basic.go b/x/auth/ante/basic.go index 52c219f79e4d..c14d511e6b09 100644 --- a/x/auth/ante/basic.go +++ b/x/auth/ante/basic.go @@ -53,14 +53,15 @@ func (vmd ValidateMemoDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") } - params := vmd.ak.GetParams(ctx) - memoLength := len(memoTx.GetMemo()) - if uint64(memoLength) > params.MaxMemoCharacters { - return ctx, sdkerrors.Wrapf(sdkerrors.ErrMemoTooLarge, - "maximum number of characters is %d but received %d characters", - params.MaxMemoCharacters, memoLength, - ) + if memoLength > 0 { + params := vmd.ak.GetParams(ctx) + if uint64(memoLength) > params.MaxMemoCharacters { + return ctx, sdkerrors.Wrapf(sdkerrors.ErrMemoTooLarge, + "maximum number of characters is %d but received %d characters", + params.MaxMemoCharacters, memoLength, + ) + } } return next(ctx, tx, simulate)