From 7c05f4188bade723942e9459f98a68624c905bc7 Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Sun, 25 Feb 2024 08:38:22 -0500 Subject: [PATCH] fix(depinject): Authtx was not accepting custom signers (#19549) --- x/auth/tx/config/depinject.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/x/auth/tx/config/depinject.go b/x/auth/tx/config/depinject.go index 2ee9467ccb5c..d2cf230fd115 100644 --- a/x/auth/tx/config/depinject.go +++ b/x/auth/tx/config/depinject.go @@ -8,6 +8,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" @@ -50,6 +51,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 { @@ -76,10 +78,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)