From 71e7f675eb28d12c235f6ab7dc540dc2eae9e07d Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Fri, 25 Oct 2024 16:16:29 +0200 Subject: [PATCH] fix: rename EnablesSignModes --- client/v2/offchain/sign.go | 2 +- client/v2/offchain/verify.go | 2 +- client/v2/offchain/verify_test.go | 2 +- client/v2/tx/config.go | 10 +++++----- client/v2/tx/config_test.go | 4 ++-- client/v2/tx/tx.go | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/v2/offchain/sign.go b/client/v2/offchain/sign.go index b5bec13aaa76..8dfcb907c089 100644 --- a/client/v2/offchain/sign.go +++ b/client/v2/offchain/sign.go @@ -44,7 +44,7 @@ func Sign(ctx client.Context, rawBytes []byte, fromName, encoding, signMode, out AddressCodec: ctx.AddressCodec, Cdc: ctx.Codec, ValidatorAddressCodec: ctx.ValidatorAddressCodec, - EnablesSignModes: enabledSignModes, + EnabledSignModes: enabledSignModes, }) if err != nil { return "", err diff --git a/client/v2/offchain/verify.go b/client/v2/offchain/verify.go index 7a0d01c70278..2c064faccc71 100644 --- a/client/v2/offchain/verify.go +++ b/client/v2/offchain/verify.go @@ -22,7 +22,7 @@ func Verify(ctx client.Context, digest []byte, fileFormat string) error { AddressCodec: ctx.AddressCodec, Cdc: ctx.Codec, ValidatorAddressCodec: ctx.ValidatorAddressCodec, - EnablesSignModes: enabledSignModes, + EnabledSignModes: enabledSignModes, }) if err != nil { return err diff --git a/client/v2/offchain/verify_test.go b/client/v2/offchain/verify_test.go index 9797c4da55de..56345504d80e 100644 --- a/client/v2/offchain/verify_test.go +++ b/client/v2/offchain/verify_test.go @@ -93,7 +93,7 @@ func Test_unmarshal(t *testing.T) { AddressCodec: address.NewBech32Codec("cosmos"), Cdc: getCodec(), ValidatorAddressCodec: address.NewBech32Codec("cosmosvaloper"), - EnablesSignModes: enabledSignModes, + EnabledSignModes: enabledSignModes, }) require.NoError(t, err) tests := []struct { diff --git a/client/v2/tx/config.go b/client/v2/tx/config.go index a88c1d3d6068..7c12b3b21ce1 100644 --- a/client/v2/tx/config.go +++ b/client/v2/tx/config.go @@ -83,7 +83,7 @@ type ConfigOptions struct { CustomGetSigner map[protoreflect.FullName]signing.GetSignersFunc MaxRecursionDepth int - EnablesSignModes []apitxsigning.SignMode + EnabledSignModes []apitxsigning.SignMode CustomSignModes []signing.SignModeHandler TextualCoinMetadataQueryFn textual.CoinMetadataQueryFn } @@ -102,8 +102,8 @@ func (c *ConfigOptions) validate() error { } // set default signModes if none are provided - if len(c.EnablesSignModes) == 0 { - c.EnablesSignModes = defaultEnabledSignModes + if len(c.EnabledSignModes) == 0 { + c.EnabledSignModes = defaultEnabledSignModes } return nil } @@ -308,10 +308,10 @@ func newSigningContext(opts ConfigOptions) (*signing.Context, error) { // newHandlerMap constructs a new HandlerMap based on the provided ConfigOptions and signing context. // It initializes handlers for each enabled and custom sign mode specified in the options. func newHandlerMap(opts ConfigOptions, signingCtx *signing.Context) (*signing.HandlerMap, error) { - lenSignModes := len(opts.EnablesSignModes) + lenSignModes := len(opts.EnabledSignModes) handlers := make([]signing.SignModeHandler, lenSignModes+len(opts.CustomSignModes)) - for i, m := range opts.EnablesSignModes { + for i, m := range opts.EnabledSignModes { var err error switch m { case apitxsigning.SignMode_SIGN_MODE_DIRECT: diff --git a/client/v2/tx/config_test.go b/client/v2/tx/config_test.go index 7d1f223d1214..887756f37f6d 100644 --- a/client/v2/tx/config_test.go +++ b/client/v2/tx/config_test.go @@ -111,7 +111,7 @@ func Test_newHandlerMap(t *testing.T) { Decoder: decoder, Cdc: cdc, ValidatorAddressCodec: address.NewBech32Codec("cosmosvaloper"), - EnablesSignModes: []apitxsigning.SignMode{apitxsigning.SignMode_SIGN_MODE_DIRECT}, + EnabledSignModes: []apitxsigning.SignMode{apitxsigning.SignMode_SIGN_MODE_DIRECT}, }, }, { @@ -136,7 +136,7 @@ func Test_newHandlerMap(t *testing.T) { handlerMap, err := newHandlerMap(tt.opts, signingCtx) require.NoError(t, err) require.NotNil(t, handlerMap) - require.Equal(t, len(handlerMap.SupportedModes()), len(tt.opts.EnablesSignModes)+len(tt.opts.CustomSignModes)) + require.Equal(t, len(handlerMap.SupportedModes()), len(tt.opts.EnabledSignModes)+len(tt.opts.CustomSignModes)) }) } } diff --git a/client/v2/tx/tx.go b/client/v2/tx/tx.go index 64e0199d8172..c761611fdec8 100644 --- a/client/v2/tx/tx.go +++ b/client/v2/tx/tx.go @@ -56,7 +56,7 @@ func newFactory(ctx client.Context, flagSet *pflag.FlagSet) (Factory, error) { AddressCodec: ctx.AddressCodec, Cdc: ctx.Codec, ValidatorAddressCodec: ctx.ValidatorAddressCodec, - EnablesSignModes: ctx.TxConfig.SignModeHandler().SupportedModes(), + EnabledSignModes: ctx.TxConfig.SignModeHandler().SupportedModes(), }) if err != nil { return Factory{}, err