From f8897308d64b268a8543e748e90651f8ae7a498a Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 12 Mar 2020 01:29:38 +0100 Subject: [PATCH] fix error's raw log messages ugly encoding Closes: #5785 --- CHANGELOG.md | 3 +++ x/bank/keeper/keeper.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5054c888..22a94af27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ balances or a single balance by denom when the `denom` query parameter is presen * (client) [\#5640](https://github.com/cosmos/cosmos-sdk/pull/5640) The rest server endpoint `/swagger-ui/` is replaced by ´/´. * (x/auth) [\#5702](https://github.com/cosmos/cosmos-sdk/pull/5702) The `x/auth` querier route has changed from `"acc"` to `"auth"`. * (store/types) [\#5730](https://github.com/cosmos/cosmos-sdk/pull/5730) store.types.Cp() is removed in favour of types.CopyBytes(). +* [\#5785](https://github.com/cosmos/cosmos-sdk/issues/5785) JSON strings coerced to valid UTF-8 bytes at JSON marshalling time +are now replaced by human-readable expressions. This change can potentially break compatibility with all those client side tools +that parse log messages. ### API Breaking Changes diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index b1b2bdfa7..330ab201f 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -67,7 +67,7 @@ func (k BaseKeeper) DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr balance := k.GetBalance(ctx, delegatorAddr, coin.Denom) if balance.IsLT(coin) { return sdkerrors.Wrapf( - sdkerrors.ErrInsufficientFunds, "failed to delegate; %s < %s", balance, amt, + sdkerrors.ErrInsufficientFunds, "failed to delegate; %s is smaller than %s", balance, amt, ) } @@ -265,7 +265,7 @@ func (k BaseSendKeeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt _, hasNeg := sdk.Coins{spendable}.SafeSub(sdk.Coins{coin}) if hasNeg { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "%s < %s", spendable, coin) + return nil, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "%s is smaller than %s", spendable, coin) } newBalance := balance.Sub(coin)