From 77dd7329e85a24341fe3f32f27eb2b171ae6fc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Toledano?= Date: Tue, 16 Jul 2024 11:17:34 +0200 Subject: [PATCH] fix(auth): UseGrantedFees error (#20963) --- x/auth/CHANGELOG.md | 3 ++- x/auth/ante/fee.go | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/x/auth/CHANGELOG.md b/x/auth/CHANGELOG.md index 6fe1a31ff4..594f89f872 100644 --- a/x/auth/CHANGELOG.md +++ b/x/auth/CHANGELOG.md @@ -63,4 +63,5 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#19148](https://github.com/cosmos/cosmos-sdk/pull/19148) Checks the consumed gas for verifying a multisig pubKey signature during simulation. * [#19239](https://github.com/cosmos/cosmos-sdk/pull/19239) Sets from flag in multi-sign command to avoid no key name provided error. * [#19099](https://github.com/cosmos/cosmos-sdk/pull/19099) `verifyIsOnCurve` now checks if we are simulating to avoid malformed public key error. -* [#20323](https://github.com/cosmos/cosmos-sdk/pull/20323) Ignore undecodable txs in GetBlocksWithTxs. \ No newline at end of file +* [#20323](https://github.com/cosmos/cosmos-sdk/pull/20323) Ignore undecodable txs in GetBlocksWithTxs. +* [#20963](https://github.com/cosmos/cosmos-sdk/pull/20963) UseGrantedFees used to return error with raw addresses. Now it uses addresses in string format. \ No newline at end of file diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index 21b5300fd5..298fae30a4 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -98,7 +98,15 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee } else if !bytes.Equal(feeGranterAddr, feePayer) { err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranterAddr, feePayer, fee, sdkTx.GetMsgs()) if err != nil { - return errorsmod.Wrapf(err, "%s does not allow to pay fees for %s", feeGranter, feePayer) + granterAddr, acErr := dfd.accountKeeper.AddressCodec().BytesToString(feeGranter) + if acErr != nil { + return errorsmod.Wrapf(err, "%s, feeGranter does not allow to pay fees", acErr.Error()) + } + payerAddr, acErr := dfd.accountKeeper.AddressCodec().BytesToString(feePayer) + if acErr != nil { + return errorsmod.Wrapf(err, "%s, feeGranter does not allow to pay fees", acErr.Error()) + } + return errorsmod.Wrapf(err, "%s does not allow to pay fees for %s", granterAddr, payerAddr) } }