Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(depinject): Authtx was not accepting custom signers #19549

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions x/auth/tx/config/depinject.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The introduction of the CustomGetSigners field to ModuleInputs is a key change that enables the support for custom signers. This addition is essential for the SDK to accommodate a broader range of signing algorithms, improving its adaptability for various projects. It's important to ensure that this field is properly documented to guide developers on how to utilize this new functionality effectively.

Consider adding comprehensive documentation for the CustomGetSigners field to explain its purpose, usage, and how developers can implement custom signers using this new feature.

}

type ModuleOutputs struct {
Expand All @@ -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)
Expand Down
Loading