From c0e9389e051d1d5c2fbbd1756931923bff3f8316 Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Sun, 25 Feb 2024 08:38:22 -0500 Subject: [PATCH 1/3] fix(depinject): Authtx was not accepting custom signers (#19549) (cherry picked from commit 7c05f4188bade723942e9459f98a68624c905bc7) --- x/auth/tx/config/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/x/auth/tx/config/config.go b/x/auth/tx/config/config.go index 957b3a93e98b..63169370534a 100644 --- a/x/auth/tx/config/config.go +++ b/x/auth/tx/config/config.go @@ -7,6 +7,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" grpcstatus "google.golang.org/grpc/status" + "google.golang.org/protobuf/reflect/protoreflect" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" @@ -51,6 +52,7 @@ type ModuleInputs struct { AccountKeeper ante.AccountKeeper `optional:"true"` FeeGrantKeeper ante.FeegrantKeeper `optional:"true"` CustomSignModeHandlers func() []txsigning.SignModeHandler `optional:"true"` + CustomGetSigners []txsigning.CustomGetSigner `optional:"true"` } type ModuleOutputs struct { @@ -77,10 +79,17 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { FileResolver: in.ProtoFileResolver, AddressCodec: in.AddressCodec, ValidatorAddressCodec: in.ValidatorAddressCodec, + CustomGetSigners: make(map[protoreflect.FullName]txsigning.GetSignersFunc), }, CustomSignModes: customSignModeHandlers, } + if in.CustomGetSigners != nil { + for _, mode := range in.CustomGetSigners { + txConfigOptions.SigningOptions.CustomGetSigners[mode.MsgType] = mode.Fn + } + } + // enable SIGN_MODE_TEXTUAL only if bank keeper is available if in.MetadataBankKeeper != nil { txConfigOptions.EnabledSignModes = append(txConfigOptions.EnabledSignModes, signingtypes.SignMode_SIGN_MODE_TEXTUAL) From 2bf4f5de60825231aca014a8faf2da3fca576b14 Mon Sep 17 00:00:00 2001 From: Qt Date: Mon, 26 Feb 2024 05:54:05 +0800 Subject: [PATCH 2/3] refactor(x/auth): simplify unnecessary code (#19552) --- x/auth/tx/config/config.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x/auth/tx/config/config.go b/x/auth/tx/config/config.go index 63169370534a..1a6bba6b4da5 100644 --- a/x/auth/tx/config/config.go +++ b/x/auth/tx/config/config.go @@ -84,10 +84,8 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { CustomSignModes: customSignModeHandlers, } - if in.CustomGetSigners != nil { - for _, mode := range in.CustomGetSigners { - txConfigOptions.SigningOptions.CustomGetSigners[mode.MsgType] = mode.Fn - } + for _, mode := range in.CustomGetSigners { + txConfigOptions.SigningOptions.CustomGetSigners[mode.MsgType] = mode.Fn } // enable SIGN_MODE_TEXTUAL only if bank keeper is available From a33b9c92fbec2adc1cf233890186d4593f29c7e3 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 26 Feb 2024 08:48:31 +0100 Subject: [PATCH 3/3] add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f99cedc4737..e7f96bc690d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bug Fixes + +* (x/auth) [#19549](https://github.com/cosmos/cosmos-sdk/pull/19549) Accept custom get signers when injecting `x/auth/tx`. + ## [v0.50.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.4) - 2023-02-19 ### Features