From d6a57780c184f6680a92f99494b4158e34f39026 Mon Sep 17 00:00:00 2001 From: vishal Date: Wed, 24 May 2023 17:26:34 +0530 Subject: [PATCH 01/17] changed the data type for FeePayer and FeeGranter --- types/tx_msg.go | 4 ++-- x/auth/ante/fee.go | 5 +++-- x/auth/tx/builder.go | 4 ++-- x/auth/tx/direct_aux.go | 8 +++++--- x/auth/tx/direct_aux_test.go | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/types/tx_msg.go b/types/tx_msg.go index ba4e1238523b..cb945af1df0b 100644 --- a/types/tx_msg.go +++ b/types/tx_msg.go @@ -49,8 +49,8 @@ type ( Tx GetGas() uint64 GetFee() Coins - FeePayer() AccAddress - FeeGranter() AccAddress + FeePayer() []byte + FeeGranter() []byte } // TxWithMemo must have GetMemo() method to use ValidateMemoDecorator diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index c7404a5d6ed0..00f271a6b103 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -1,6 +1,7 @@ package ante import ( + "bytes" "fmt" errorsmod "cosmossdk.io/errors" @@ -88,7 +89,7 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee if feeGranter != nil { if dfd.feegrantKeeper == nil { return sdkerrors.ErrInvalidRequest.Wrap("fee grants are not enabled") - } else if !feeGranter.Equals(feePayer) { + } else if !bytes.Equal(feeGranter, feePayer) { err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, sdkTx.GetMsgs()) if err != nil { return errorsmod.Wrapf(err, "%s does not allow to pay fees for %s", feeGranter, feePayer) @@ -115,7 +116,7 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee sdk.NewEvent( sdk.EventTypeTx, sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()), - sdk.NewAttribute(sdk.AttributeKeyFeePayer, deductFeesFrom.String()), + sdk.NewAttribute(sdk.AttributeKeyFeePayer, string(deductFeesFrom[:])), ), } ctx.EventManager().EmitEvents(events) diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index d9452a170a7f..6913f9d65342 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -138,7 +138,7 @@ func (w *wrapper) GetFee() sdk.Coins { return w.tx.AuthInfo.Fee.Amount } -func (w *wrapper) FeePayer() sdk.AccAddress { +func (w *wrapper) FeePayer() []byte { feePayer := w.tx.AuthInfo.Fee.Payer if feePayer != "" { return sdk.MustAccAddressFromBech32(feePayer) @@ -147,7 +147,7 @@ func (w *wrapper) FeePayer() sdk.AccAddress { return w.GetSigners()[0] } -func (w *wrapper) FeeGranter() sdk.AccAddress { +func (w *wrapper) FeeGranter() []byte { feePayer := w.tx.AuthInfo.Fee.Granter if feePayer != "" { return sdk.MustAccAddressFromBech32(feePayer) diff --git a/x/auth/tx/direct_aux.go b/x/auth/tx/direct_aux.go index ff09cfd2b81c..317fc54bfb30 100644 --- a/x/auth/tx/direct_aux.go +++ b/x/auth/tx/direct_aux.go @@ -51,12 +51,14 @@ func (signModeDirectAuxHandler) GetSignBytes( return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "got empty address in %s handler", signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } - feePayer := protoTx.FeePayer().String() + feePayer := protoTx.FeePayer() + + feepayer := sdk.AccAddress(feePayer) // Fee payer cannot use SIGN_MODE_DIRECT_AUX, because SIGN_MODE_DIRECT_AUX // does not sign over fees, which would create malleability issues. - if feePayer == data.Address { - return nil, sdkerrors.ErrUnauthorized.Wrapf("fee payer %s cannot sign with %s", feePayer, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) + if feepayer.String() == data.Address { + return nil, sdkerrors.ErrUnauthorized.Wrapf("fee payer %s cannot sign with %s", feepayer, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } signDocDirectAux := types.SignDocDirectAux{ diff --git a/x/auth/tx/direct_aux_test.go b/x/auth/tx/direct_aux_test.go index 27a5764dbefc..7755792093af 100644 --- a/x/auth/tx/direct_aux_test.go +++ b/x/auth/tx/direct_aux_test.go @@ -79,8 +79,9 @@ func TestDirectAuxHandler(t *testing.T) { modeHandler := signModeDirectAuxHandler{} - t.Log("verify fee payer cannot use SIGN_MODE_DIRECT_AUX") + // t.Log("verify fee payer cannot use SIGN_MODE_DIRECT_AUX") _, err = modeHandler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_DIRECT_AUX, feePayerSigningData, txBuilder.GetTx()) + require.EqualError(t, err, fmt.Sprintf("fee payer %s cannot sign with %s: unauthorized", feePayerAddr.String(), signingtypes.SignMode_SIGN_MODE_DIRECT_AUX)) t.Log("verify GetSignBytes with generating sign bytes by marshaling signDocDirectAux") From 5722e743da10e7dac3e3cebe80578492eb311188 Mon Sep 17 00:00:00 2001 From: vishal Date: Wed, 24 May 2023 20:32:33 +0530 Subject: [PATCH 02/17] uncommented the log --- x/auth/tx/direct_aux_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/tx/direct_aux_test.go b/x/auth/tx/direct_aux_test.go index 7755792093af..2ca7903d66e2 100644 --- a/x/auth/tx/direct_aux_test.go +++ b/x/auth/tx/direct_aux_test.go @@ -79,7 +79,7 @@ func TestDirectAuxHandler(t *testing.T) { modeHandler := signModeDirectAuxHandler{} - // t.Log("verify fee payer cannot use SIGN_MODE_DIRECT_AUX") + t.Log("verify fee payer cannot use SIGN_MODE_DIRECT_AUX") _, err = modeHandler.GetSignBytes(signingtypes.SignMode_SIGN_MODE_DIRECT_AUX, feePayerSigningData, txBuilder.GetTx()) require.EqualError(t, err, fmt.Sprintf("fee payer %s cannot sign with %s: unauthorized", feePayerAddr.String(), signingtypes.SignMode_SIGN_MODE_DIRECT_AUX)) From 1f239a5db77adf767a12a8677041c146a5e5abeb Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 30 May 2023 12:42:15 +0530 Subject: [PATCH 03/17] fix: solved the error in test files --- x/auth/tx/builder_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/tx/builder_test.go b/x/auth/tx/builder_test.go index c817b1718d80..31583bc8ad4e 100644 --- a/x/auth/tx/builder_test.go +++ b/x/auth/tx/builder_test.go @@ -317,5 +317,5 @@ func TestBuilderFeeGranter(t *testing.T) { // set fee granter txBuilder.SetFeeGranter(addr1) - require.Equal(t, addr1.String(), txBuilder.GetTx().FeeGranter()) + require.Equal(t, addr1.String(), sdk.AccAddress(txBuilder.GetTx().FeeGranter()).String()) } From 2af76cedb62faa3d0c07bcb371744224cd13ff9f Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 11:51:22 +0530 Subject: [PATCH 04/17] change added in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e316cd793ca6..babc892ac781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] ### Features +* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272)Now the FeeGranter in the FeeTx takes the byte type. ### Improvements From 072c86fbd6a3b8bcfe1f63e735f60a328eb6443f Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 12:23:27 +0530 Subject: [PATCH 05/17] mentioned the change in changelog under the API breaking changes --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index babc892ac781..6b05185d1b85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] ### Features -* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272)Now the FeeGranter in the FeeTx takes the byte type. + ### Improvements @@ -51,7 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [#16841](https://github.com/cosmos/cosmos-sdk/pull/16841) correctly process legacy `DenomAddressIndex` values. ### API Breaking Changes - +* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) Now the FeeGranter in the FeeTx takes the byte type . * (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16798) Remove aliases in `types/math.go` (part 2). * (x/distribution) [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: * remove `Keeper`: `SetDelegatorWithdrawAddr`, `DeleteDelegatorWithdrawAddr`, `IterateDelegatorWithdrawAddrs`. From 616030b808cfdc707e8d2c03dd75ee10774271a3 Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 12:26:01 +0530 Subject: [PATCH 06/17] Revert "mentioned the change in changelog under the API breaking changes" This reverts commit 072c86fbd6a3b8bcfe1f63e735f60a328eb6443f. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b05185d1b85..babc892ac781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] ### Features - +* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272)Now the FeeGranter in the FeeTx takes the byte type. ### Improvements @@ -51,7 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [#16841](https://github.com/cosmos/cosmos-sdk/pull/16841) correctly process legacy `DenomAddressIndex` values. ### API Breaking Changes -* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) Now the FeeGranter in the FeeTx takes the byte type . + * (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16798) Remove aliases in `types/math.go` (part 2). * (x/distribution) [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: * remove `Keeper`: `SetDelegatorWithdrawAddr`, `DeleteDelegatorWithdrawAddr`, `IterateDelegatorWithdrawAddrs`. From 40cccf16843aaea95fb8462b66907e2d23b1034f Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 12:26:50 +0530 Subject: [PATCH 07/17] mentioned the change in changelog under the API breaking changes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index babc892ac781..cbcbee3ab2f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [#16841](https://github.com/cosmos/cosmos-sdk/pull/16841) correctly process legacy `DenomAddressIndex` values. ### API Breaking Changes - +* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) Now the `FeeGranter` in the `FeeTx` takes the byte type . * (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16798) Remove aliases in `types/math.go` (part 2). * (x/distribution) [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: * remove `Keeper`: `SetDelegatorWithdrawAddr`, `DeleteDelegatorWithdrawAddr`, `IterateDelegatorWithdrawAddrs`. From eb5bcc235a16df19529ccb9fc5fb012e01645941 Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 12:41:55 +0530 Subject: [PATCH 08/17] changed name of the variable and used the Equalfold method --- CHANGELOG.md | 2 +- x/auth/tx/direct_aux.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbcbee3ab2f8..431d527ae317 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [#16841](https://github.com/cosmos/cosmos-sdk/pull/16841) correctly process legacy `DenomAddressIndex` values. ### API Breaking Changes -* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) Now the `FeeGranter` in the `FeeTx` takes the byte type . +* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) From now the `FeeGranter` in the `FeeTx` interface takes the byte types instead of string. * (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16798) Remove aliases in `types/math.go` (part 2). * (x/distribution) [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: * remove `Keeper`: `SetDelegatorWithdrawAddr`, `DeleteDelegatorWithdrawAddr`, `IterateDelegatorWithdrawAddrs`. diff --git a/x/auth/tx/direct_aux.go b/x/auth/tx/direct_aux.go index 317fc54bfb30..cb6437eae939 100644 --- a/x/auth/tx/direct_aux.go +++ b/x/auth/tx/direct_aux.go @@ -1,6 +1,7 @@ package tx import ( + "bytes" "fmt" errorsmod "cosmossdk.io/errors" @@ -51,13 +52,13 @@ func (signModeDirectAuxHandler) GetSignBytes( return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "got empty address in %s handler", signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } - feePayer := protoTx.FeePayer() + payer := protoTx.FeePayer() - feepayer := sdk.AccAddress(feePayer) + feepayer := sdk.AccAddress(payer) // Fee payer cannot use SIGN_MODE_DIRECT_AUX, because SIGN_MODE_DIRECT_AUX // does not sign over fees, which would create malleability issues. - if feepayer.String() == data.Address { + if bytes.EqualFold([]byte(feepayer.String()), []byte(data.Address)) { return nil, sdkerrors.ErrUnauthorized.Wrapf("fee payer %s cannot sign with %s", feepayer, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } From 717a478054aaaa676c7312cad5fdd4e19b8ac3b7 Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 13:44:17 +0530 Subject: [PATCH 09/17] used the strings.EqualFold method --- x/auth/tx/direct_aux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/auth/tx/direct_aux.go b/x/auth/tx/direct_aux.go index cb6437eae939..2de977f45113 100644 --- a/x/auth/tx/direct_aux.go +++ b/x/auth/tx/direct_aux.go @@ -1,8 +1,8 @@ package tx import ( - "bytes" "fmt" + "strings" errorsmod "cosmossdk.io/errors" @@ -58,7 +58,7 @@ func (signModeDirectAuxHandler) GetSignBytes( // Fee payer cannot use SIGN_MODE_DIRECT_AUX, because SIGN_MODE_DIRECT_AUX // does not sign over fees, which would create malleability issues. - if bytes.EqualFold([]byte(feepayer.String()), []byte(data.Address)) { + if strings.EqualFold(feepayer.String(), data.Address) { return nil, sdkerrors.ErrUnauthorized.Wrapf("fee payer %s cannot sign with %s", feepayer, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } From 3ed1d9dc27d8be2533ba13ee1088693f7e4592ad Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 13:54:22 +0530 Subject: [PATCH 10/17] mades changes as per request --- CHANGELOG.md | 2 +- x/auth/ante/fee.go | 6 +++--- x/auth/tx/builder.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 431d527ae317..4447e0d1b04c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] ### Features -* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272)Now the FeeGranter in the FeeTx takes the byte type. + ### Improvements diff --git a/x/auth/ante/fee.go b/x/auth/ante/fee.go index a15c72343d86..d28f9f999752 100644 --- a/x/auth/ante/fee.go +++ b/x/auth/ante/fee.go @@ -91,8 +91,8 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee if dfd.feegrantKeeper == nil { return sdkerrors.ErrInvalidRequest.Wrap("fee grants are not enabled") - } else if !bytes.Equal(feeGranter, feePayer) { - err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, sdkTx.GetMsgs()) + } 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) } @@ -118,7 +118,7 @@ func (dfd DeductFeeDecorator) checkDeductFee(ctx sdk.Context, sdkTx sdk.Tx, fee sdk.NewEvent( sdk.EventTypeTx, sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()), - sdk.NewAttribute(sdk.AttributeKeyFeePayer, string(deductFeesFrom[:])), + sdk.NewAttribute(sdk.AttributeKeyFeePayer, sdk.AccAddress(deductFeesFrom).String()), ), } ctx.EventManager().EmitEvents(events) diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index 504dc13de883..d5c9af1b48f8 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -211,9 +211,9 @@ func (w *wrapper) FeePayer() []byte { } func (w *wrapper) FeeGranter() []byte { - feePayer := w.tx.AuthInfo.Fee.Granter - if feePayer != "" { - return sdk.MustAccAddressFromBech32(feePayer) + feeGranter := w.tx.AuthInfo.Fee.Granter + if feeGranter != "" { + return sdk.MustAccAddressFromBech32(feeGranter) } return nil } From 56d10d2c6303f7bc52d06fefee60087256c583c8 Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 14:58:45 +0530 Subject: [PATCH 11/17] removed the extra line in the changelog --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4447e0d1b04c..ee343683d3ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,8 +39,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] ### Features - - ### Improvements * (all) [#16537](https://github.com/cosmos/cosmos-sdk/pull/16537) Properly propagated fmt.Errorf errors + using errors.New where appropriate. From 6d609faaf7ab5f238c316faa8cc54682282463e7 Mon Sep 17 00:00:00 2001 From: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> Date: Fri, 7 Jul 2023 15:03:57 +0530 Subject: [PATCH 12/17] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee343683d3ec..917a1b4b06fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [#16841](https://github.com/cosmos/cosmos-sdk/pull/16841) correctly process legacy `DenomAddressIndex` values. ### API Breaking Changes + * (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) From now the `FeeGranter` in the `FeeTx` interface takes the byte types instead of string. * (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16798) Remove aliases in `types/math.go` (part 2). * (x/distribution) [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: From 40c8d4f88f47bee5c8520d71012593889c87d020 Mon Sep 17 00:00:00 2001 From: vishal Date: Fri, 7 Jul 2023 15:15:35 +0530 Subject: [PATCH 13/17] made changes as per the review --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee343683d3ec..9c4b5c6ad5ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] ### Features + ### Improvements * (all) [#16537](https://github.com/cosmos/cosmos-sdk/pull/16537) Properly propagated fmt.Errorf errors + using errors.New where appropriate. @@ -49,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/bank) [#16841](https://github.com/cosmos/cosmos-sdk/pull/16841) correctly process legacy `DenomAddressIndex` values. ### API Breaking Changes + * (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) From now the `FeeGranter` in the `FeeTx` interface takes the byte types instead of string. * (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16798) Remove aliases in `types/math.go` (part 2). * (x/distribution) [#16440](https://github.com/cosmos/cosmos-sdk/pull/16440) use collections for `DelegatorWithdrawAddresState`: From ee10450b3b115183d7eeb7a666ab05e862c9aa7d Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 11 Jul 2023 14:40:34 +0530 Subject: [PATCH 14/17] removed the extra variable --- x/auth/tx/direct_aux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/auth/tx/direct_aux.go b/x/auth/tx/direct_aux.go index 2de977f45113..e3e9dadc5a60 100644 --- a/x/auth/tx/direct_aux.go +++ b/x/auth/tx/direct_aux.go @@ -54,11 +54,11 @@ func (signModeDirectAuxHandler) GetSignBytes( payer := protoTx.FeePayer() - feepayer := sdk.AccAddress(payer) + feepayer := sdk.AccAddress(payer).String() // Fee payer cannot use SIGN_MODE_DIRECT_AUX, because SIGN_MODE_DIRECT_AUX // does not sign over fees, which would create malleability issues. - if strings.EqualFold(feepayer.String(), data.Address) { + if strings.EqualFold(feepayer, data.Address) { return nil, sdkerrors.ErrUnauthorized.Wrapf("fee payer %s cannot sign with %s", feepayer, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } From 7037cae181cb09bafef2b36c371189734f554620 Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 11 Jul 2023 15:05:13 +0530 Subject: [PATCH 15/17] reverted the variable --- x/auth/tx/direct_aux.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/x/auth/tx/direct_aux.go b/x/auth/tx/direct_aux.go index e3e9dadc5a60..621b5becc5a5 100644 --- a/x/auth/tx/direct_aux.go +++ b/x/auth/tx/direct_aux.go @@ -51,10 +51,9 @@ func (signModeDirectAuxHandler) GetSignBytes( if addr == "" { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "got empty address in %s handler", signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } + feePayer := protoTx.FeePayer() - payer := protoTx.FeePayer() - - feepayer := sdk.AccAddress(payer).String() + feepayer := sdk.AccAddress(feePayer).String() // Fee payer cannot use SIGN_MODE_DIRECT_AUX, because SIGN_MODE_DIRECT_AUX // does not sign over fees, which would create malleability issues. From d0093c8b2a2cc8519c57813877df153a8325268d Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 11 Jul 2023 15:12:38 +0530 Subject: [PATCH 16/17] removed the variable --- x/auth/tx/direct_aux.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x/auth/tx/direct_aux.go b/x/auth/tx/direct_aux.go index 621b5becc5a5..31a3d9572384 100644 --- a/x/auth/tx/direct_aux.go +++ b/x/auth/tx/direct_aux.go @@ -51,14 +51,13 @@ func (signModeDirectAuxHandler) GetSignBytes( if addr == "" { return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "got empty address in %s handler", signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } - feePayer := protoTx.FeePayer() - feepayer := sdk.AccAddress(feePayer).String() + feePayer := protoTx.FeePayer() // Fee payer cannot use SIGN_MODE_DIRECT_AUX, because SIGN_MODE_DIRECT_AUX // does not sign over fees, which would create malleability issues. - if strings.EqualFold(feepayer, data.Address) { - return nil, sdkerrors.ErrUnauthorized.Wrapf("fee payer %s cannot sign with %s", feepayer, signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) + if strings.EqualFold(sdk.AccAddress(feePayer).String(), data.Address) { + return nil, sdkerrors.ErrUnauthorized.Wrapf("fee payer %s cannot sign with %s", sdk.AccAddress(feePayer).String(), signingtypes.SignMode_SIGN_MODE_DIRECT_AUX) } signDocDirectAux := types.SignDocDirectAux{ From 5142197a000b1a98a63e320a90cccab037592dff Mon Sep 17 00:00:00 2001 From: vishal Date: Tue, 11 Jul 2023 15:40:53 +0530 Subject: [PATCH 17/17] made suggested change in the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a8395cc76b6..a00fe6f11dd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes -* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) From now the `FeeGranter` in the `FeeTx` interface takes the byte types instead of string. +* (types) [#16272](https://github.com/cosmos/cosmos-sdk/pull/16272) From now the `FeeGranter` in the `FeeTx` interface takes the byte type instead of string. * (testutil) [#16899](https://github.com/cosmos/cosmos-sdk/pull/16899) The *cli testutil* `QueryBalancesExec` has been removed. Use the gRPC or REST query instead. * (x/auth) [#16650](https://github.com/cosmos/cosmos-sdk/pull/16650) The *cli testutil* `QueryAccountExec` has been removed. Use the gRPC or REST query instead. * (types/math) [#16040](https://github.com/cosmos/cosmos-sdk/pull/16798) Remove aliases in `types/math.go` (part 2).