Skip to content

Commit

Permalink
fix(depinject): Authtx was not accepting custom signers (backport #19549
Browse files Browse the repository at this point in the history
) (#19551)

Co-authored-by: Devon Bear <itsdevbear@berachain.com>
Co-authored-by: Qt <golang.chen@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
  • Loading branch information
4 people authored Feb 26, 2024
1 parent 3dcf24e commit a8b5e7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions x/auth/tx/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand All @@ -77,10 +79,15 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
FileResolver: in.ProtoFileResolver,
AddressCodec: in.AddressCodec,
ValidatorAddressCodec: in.ValidatorAddressCodec,
CustomGetSigners: make(map[protoreflect.FullName]txsigning.GetSignersFunc),
},
CustomSignModes: customSignModeHandlers,
}

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)
Expand Down

0 comments on commit a8b5e7f

Please sign in to comment.