From 7f8cbfddb44ebdfc42d20b75261de256e4e48924 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 13:56:54 +0200 Subject: [PATCH] feat: EIP191 sign mode (backport #11533) (#11545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: EIP191 sign mode (#11533) ## Description Adds [EIP-191](https://eips.ethereum.org/EIPS/eip-191) as a supported sign mode. Ref: https://github.com/cosmos/cosmos-sdk/pull/10553#issuecomment-974079401 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) (cherry picked from commit dc66ddd28208b4e6a492706e2fe42a256d819b63) # Conflicts: # CHANGELOG.md # api/cosmos/distribution/v1beta1/tx.pulsar.go # api/cosmos/tx/signing/v1beta1/signing.pulsar.go # client/cmd.go # client/flags/flags.go # client/tx/factory.go # go.sum # types/tx/signing/signing.pb.go # x/distribution/types/tx.pb.go * fix conflicts * fix conflicts++ Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: marbar3778 --- CHANGELOG.md | 1 + client/cmd.go | 1 - client/flags/flags.go | 2 + client/tx/factory.go | 2 + proto/cosmos/tx/signing/v1beta1/signing.proto | 12 +++ types/tx/signing/signing.pb.go | 79 +++++++++++-------- x/auth/tx/config.go | 9 ++- 7 files changed, 69 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29e4768fdb80..2030d0d742a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (tx) [#\11533](https://github.com/cosmos/cosmos-sdk/pull/11533) Register [`EIP191`](https://eips.ethereum.org/EIPS/eip-191) as an available `SignMode` for chains to use. * [\#11430](https://github.com/cosmos/cosmos-sdk/pull/11430) Introduce a new `grpc-only` flag, such that when enabled, will start the node in a query-only mode. Note, gRPC MUST be enabled with this flag. * (x/bank) [\#11417](https://github.com/cosmos/cosmos-sdk/pull/11417) Introduce a new `SpendableBalances` gRPC query that retrieves an account's total (paginated) spendable balances. * (x/bank) [\#10771](https://github.com/cosmos/cosmos-sdk/pull/10771) Add safety check on bank module perms to allow module-specific mint restrictions (e.g. only minting a certain denom). diff --git a/client/cmd.go b/client/cmd.go index 0e401a9250f6..6ea3b3e66fba 100644 --- a/client/cmd.go +++ b/client/cmd.go @@ -250,7 +250,6 @@ func readTxCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, err clientCtx = clientCtx.WithSignModeStr(flags.SignModeLegacyAminoJSON) } } - return clientCtx, nil } diff --git a/client/flags/flags.go b/client/flags/flags.go index 1c0e1585c0ff..cfc0242c1023 100644 --- a/client/flags/flags.go +++ b/client/flags/flags.go @@ -35,6 +35,8 @@ const ( SignModeDirect = "direct" // SignModeLegacyAminoJSON is the value of the --sign-mode flag for SIGN_MODE_LEGACY_AMINO_JSON SignModeLegacyAminoJSON = "amino-json" + // SignModeEIP191 is the value of the --sign-mode flag for SIGN_MODE_EIP_191 + SignModeEIP191 = "eip-191" ) // List of CLI flags diff --git a/client/tx/factory.go b/client/tx/factory.go index 13860bba11e2..ebd43b7480ad 100644 --- a/client/tx/factory.go +++ b/client/tx/factory.go @@ -45,6 +45,8 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) Factory { signMode = signing.SignMode_SIGN_MODE_DIRECT case flags.SignModeLegacyAminoJSON: signMode = signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON + case flags.SignModeEIP191: + signMode = signing.SignMode_SIGN_MODE_EIP_191 } accNum, _ := flagSet.GetUint64(flags.FlagAccountNumber) diff --git a/proto/cosmos/tx/signing/v1beta1/signing.proto b/proto/cosmos/tx/signing/v1beta1/signing.proto index 4c1be40594d1..c76c231ad73f 100644 --- a/proto/cosmos/tx/signing/v1beta1/signing.proto +++ b/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -24,6 +24,18 @@ enum SignMode { // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses // Amino JSON and will be removed in the future SIGN_MODE_LEGACY_AMINO_JSON = 127; + + // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + // + // Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + // but is not implemented on the SDK by default. To enable EIP-191, you need + // to pass a custom `TxConfig` that has an implementation of + // `SignModeHandler` for EIP-191. The SDK may decide to fully support + // EIP-191 in the future. + // + // Since: cosmos-sdk 0.45.2 + SIGN_MODE_EIP_191 = 191; } // SignatureDescriptors wraps multiple SignatureDescriptor's. diff --git a/types/tx/signing/signing.pb.go b/types/tx/signing/signing.pb.go index f06a270c7cbd..dbf86219f6d3 100644 --- a/types/tx/signing/signing.pb.go +++ b/types/tx/signing/signing.pb.go @@ -41,6 +41,11 @@ const ( // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses // Amino JSON and will be removed in the future SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127 + // SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + // SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + // + // Since: cosmos-sdk 0.45 + SignMode_SIGN_MODE_EIP_191 SignMode = 191 ) var SignMode_name = map[int32]string{ @@ -48,6 +53,7 @@ var SignMode_name = map[int32]string{ 1: "SIGN_MODE_DIRECT", 2: "SIGN_MODE_TEXTUAL", 127: "SIGN_MODE_LEGACY_AMINO_JSON", + 191: "SIGN_MODE_EIP_191", } var SignMode_value = map[string]int32{ @@ -55,6 +61,7 @@ var SignMode_value = map[string]int32{ "SIGN_MODE_DIRECT": 1, "SIGN_MODE_TEXTUAL": 2, "SIGN_MODE_LEGACY_AMINO_JSON": 127, + "SIGN_MODE_EIP_191": 191, } func (x SignMode) String() string { @@ -391,41 +398,43 @@ func init() { } var fileDescriptor_9a54958ff3d0b1b9 = []byte{ - // 544 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0xed, 0x26, 0x8d, 0xd2, 0x29, 0x42, 0x61, 0x49, 0xa5, 0xc4, 0x20, 0x13, 0x95, 0x03, - 0x11, 0x52, 0xd6, 0x6a, 0x72, 0x40, 0x70, 0xcb, 0x1f, 0x93, 0x86, 0x36, 0x09, 0xd8, 0xa9, 0x04, - 0x5c, 0x2c, 0xdb, 0xd9, 0x1a, 0xab, 0xb1, 0xd7, 0x78, 0xd7, 0xa8, 0x3e, 0xf1, 0x0a, 0xbc, 0x06, - 0x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0, 0xf6, 0x4a, 0x02, - 0x2a, 0x43, 0x69, 0x53, 0xea, 0x0d, 0x34, 0xb5, 0x3b, 0x29, 0x89, 0xe8, 0x08, 0xee, 0x6d, 0xb2, - 0x13, 0xf5, 0xed, 0xe4, 0xa2, 0x7d, 0x5e, 0xda, 0x43, 0x8f, 0xe0, 0xc1, 0x26, 0x7d, 0xae, 0xf6, - 0xdb, 0xdd, 0x77, 0x46, 0x7b, 0x38, 0x18, 0x8d, 0x8d, 0x57, 0xfa, 0x78, 0x54, 0xfa, 0xdc, 0xe9, - 0x7f, 0x9f, 0xcb, 0xe2, 0xcd, 0x5c, 0x16, 0x7f, 0xce, 0x65, 0xf1, 0xcb, 0x42, 0x16, 0x6e, 0x16, - 0xb2, 0xf0, 0x63, 0x21, 0x0b, 0xef, 0x1b, 0x8e, 0xcb, 0x3f, 0x44, 0x16, 0xb6, 0xa9, 0xa7, 0x64, - 0x6f, 0x38, 0xf9, 0x34, 0xd8, 0xf4, 0x4a, 0xe1, 0x71, 0x40, 0xb6, 0x7f, 0x0c, 0x56, 0x21, 0x79, - 0x01, 0xad, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x86, 0x87, 0x55, 0xbf, 0x34, 0x04, 0x00, 0x00, + // 573 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0xc7, 0xed, 0x26, 0xad, 0xda, 0xe9, 0xa7, 0x4f, 0x66, 0x49, 0x51, 0x6a, 0x90, 0xa9, 0xca, + 0x81, 0x0a, 0xa9, 0x6b, 0xa5, 0x3d, 0xa0, 0x72, 0x73, 0x13, 0x93, 0x9a, 0x36, 0x69, 0xb1, 0x53, + 0xa9, 0x70, 0xb1, 0x6c, 0x67, 0x6b, 0xac, 0xc6, 0x5e, 0xe3, 0x5d, 0xa3, 0xfa, 0xc4, 0x2b, 0xf0,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xf4, + 0xa6, 0xf1, 0xdc, 0xd0, 0x5b, 0x92, 0x80, 0x6a, 0x20, 0xcd, 0x4a, 0x2d, 0xc3, 0xd4, 0x9b, 0x3d, + 0x49, 0x44, 0x1b, 0x70, 0x67, 0x96, 0xed, 0xe9, 0x17, 0xbd, 0x73, 0xed, 0x44, 0x5a, 0x42, 0x75, + 0xa8, 0xfd, 0x2e, 0xb6, 0xb5, 0xf3, 0x0b, 0xa9, 0x82, 0x1e, 0xc2, 0xfd, 0x59, 0xe5, 0x44, 0x6f, + 0x6b, 0xcd, 0x57, 0xb6, 0xd6, 0x31, 0xba, 0xa7, 0xf6, 0x0b, 0xeb, 0xb4, 0x2b, 0xbd, 0x47, 0xf7, + 0xe6, 0x89, 0xba, 0x71, 0x66, 0x37, 0x0e, 0x1a, 0xd2, 0x67, 0xf1, 0xb0, 0xfd, 0x75, 0xa8, 0x88, + 0x37, 0x43, 0x45, 0xfc, 0x3e, 0x54, 0xc4, 0x0f, 0x23, 0x45, 0xb8, 0x19, 0x29, 0xc2, 0xb7, 0x91, + 0x22, 0xbc, 0xde, 0xf5, 0x03, 0xfe, 0x26, 0x75, 0xb1, 0x47, 0x43, 0xb5, 0x7c, 0xf6, 0xf9, 0x67, + 0x97, 0xf5, 0xaf, 0x54, 0x9e, 0xc5, 0x64, 0xfe, 0x5f, 0xe2, 0xae, 0xe4, 0x8f, 0x66, 0xff, 0x67, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x3d, 0xad, 0x03, 0x67, 0x04, 0x00, 0x00, } func (m *SignatureDescriptors) Marshal() (dAtA []byte, err error) { diff --git a/x/auth/tx/config.go b/x/auth/tx/config.go index 8402423dbf77..b80e8dde0889 100644 --- a/x/auth/tx/config.go +++ b/x/auth/tx/config.go @@ -23,9 +23,16 @@ type config struct { // NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The // first enabled sign mode will become the default sign mode. +// NOTE: Use NewTxConfigWithHandler to provide a custom signing handler in case the sign mode +// is not supported by default (eg: SignMode_SIGN_MODE_EIP_191). func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signingtypes.SignMode) client.TxConfig { + return NewTxConfigWithHandler(protoCodec, makeSignModeHandler(enabledSignModes)) +} + +// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and signing handler. +func NewTxConfigWithHandler(protoCodec codec.ProtoCodecMarshaler, handler signing.SignModeHandler) client.TxConfig { return &config{ - handler: makeSignModeHandler(enabledSignModes), + handler: handler, decoder: DefaultTxDecoder(protoCodec), encoder: DefaultTxEncoder(), jsonDecoder: DefaultJSONTxDecoder(protoCodec),