diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bdf084b0d3..1bf0105d1ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -245,6 +245,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * Removed: keeper `GetConstantFee`, `SetConstantFee` * (x/mint) [#16329](https://github.com/cosmos/cosmos-sdk/pull/16329) Use collections for state management: * Removed: keeper `GetParams`, `SetParams`, `GetMinter`, `SetMinter`. +* (x/*all*) [#16052](https://github.com/cosmos/cosmos-sdk/pull/16062) `GetSignBytes` implementations on messages and global legacy amino codec definitions have been removed from all modules. +* (sims) [#16052](https://github.com/cosmos/cosmos-sdk/pull/16062) `GetOrGenerate` no longer requires a codec argument is now 4-arity instead of 5-arity. ### Client Breaking Changes diff --git a/UPGRADING.md b/UPGRADING.md index 76d422abc89..1c50a7ac75d 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -53,7 +53,11 @@ ClevelDB, BoltDB and BadgerDB are not supported anymore. To migrate from a unsup ### Protobuf -The SDK is in the process of removing all `gogoproto` annotations. +With the deprecation of the amino JSON codec defined in [cosmos/gogoproto](https://github.com/cosmos/gogoproto) in favor of the protoreflect powered x/tx/aminojson codec, module developers are encouraged verify that their messages have the correct protobuf annotations to deterministically produce identical output from both codecs. + +For core SDK types equivalence is asserted by generative testing of [SignableTypes](https://github.com/cosmos/cosmos-sdk/blob/76f0d101530ed78befc95506ab473c771d0d8a8c/tests/integration/rapidgen/rapidgen.go#L106) in [TestAminoJSON_Equivalence](https://github.com/cosmos/cosmos-sdk/blob/76f0d101530ed78befc95506ab473c771d0d8a8c/tests/integration/aminojson/aminojson_test.go#L90). + +TODO: summarize proto annotation requirements. #### Stringer @@ -181,6 +185,8 @@ The return type of the interface method `TxConfig.SignModeHandler()` has been ch The `sdk.Msg` interface has been updated to not require the implementation of the `ValidateBasic` method. It is now recommended to validate message directly in the message server. When the validation is performed in the message server, the `ValidateBasic` method on a message is no longer required and can be removed. +Messages no longer need to implement the `LegacyMsg` interface and implementations of `GetSignBytes` can be deleted. Because of this change, global legacy Amino codec definitions and their registration in `init()` can safely be removed as well. + #### `x/auth` For ante handler construction via `ante.NewAnteHandler`, the field `ante.HandlerOptions.SignModeHandler` has been updated to `x/tx/signing/HandlerMap` from `x/auth/signing/SignModeHandler`. Callers typically fetch this value from `client.TxConfig.SignModeHandler()` (which is also changed) so this change should be transparent to most users. diff --git a/api/cosmos/gov/v1/tx.pulsar.go b/api/cosmos/gov/v1/tx.pulsar.go index 121180aa3e2..89edabdeb45 100644 --- a/api/cosmos/gov/v1/tx.pulsar.go +++ b/api/cosmos/gov/v1/tx.pulsar.go @@ -7687,180 +7687,184 @@ var file_cosmos_gov_v1_tx_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe7, 0x02, 0x0a, 0x11, 0x4d, 0x73, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x03, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x12, 0x4d, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x0e, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x70, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, - 0x61, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, - 0x3a, 0x31, 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x8a, - 0xe7, 0xb0, 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, - 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x22, 0x3c, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, - 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, - 0x64, 0x22, 0xbb, 0x01, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, - 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x42, 0x1e, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, - 0x76, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, - 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, - 0x1e, 0x0a, 0x1c, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0xe5, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x0b, 0x70, - 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, - 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, - 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, 0x74, - 0x65, 0x72, 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, - 0x76, 0x31, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x3a, 0x24, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, - 0x2a, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, - 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x56, 0x6f, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xff, 0x01, 0x0a, 0x0f, 0x4d, - 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x35, - 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, - 0x6c, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, - 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x56, - 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x2c, - 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1d, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, - 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x22, 0x19, 0x0a, 0x17, - 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe6, 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x44, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, - 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, - 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x36, 0x0a, - 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x73, 0x12, 0x8a, 0x01, 0x0a, 0x0f, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x64, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, + 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0e, + 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x34, + 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x64, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, - 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, - 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x3a, 0x2b, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x6f, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, - 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x22, 0x14, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, - 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x38, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0x82, 0xe7, - 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, - 0x23, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x67, 0x6f, - 0x76, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x8a, 0x01, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, - 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, - 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x70, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x3a, 0x0d, 0x82, - 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x22, 0xc1, 0x01, 0x0a, - 0x19, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, - 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, - 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, - 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x0d, - 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, - 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x63, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0e, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x32, 0xe8, 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, - 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x11, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, - 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, - 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, - 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, - 0x04, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, - 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x1a, 0x1e, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, - 0x0c, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x1a, 0x26, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, + 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x78, 0x70, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64, 0x3a, 0x31, + 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x8a, 0xe7, 0xb0, + 0x2a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, + 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x22, 0x3c, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x22, + 0xbb, 0x01, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, + 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, + 0x1e, 0xca, 0xb4, 0x2d, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, + 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, + 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x1e, 0x0a, + 0x1c, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe5, 0x01, + 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x14, + 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, + 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, + 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, + 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, + 0x24, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x15, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, + 0x67, 0x56, 0x6f, 0x74, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xff, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, + 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x35, 0x0a, 0x0b, + 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, + 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, + 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x76, 0x6f, + 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, + 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x56, 0x6f, 0x74, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x3a, 0x2c, 0x82, 0xe7, + 0xb0, 0x2a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1d, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x56, 0x6f, + 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x12, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, - 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, - 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe6, 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x14, 0xea, 0xde, 0x1f, 0x0b, 0x70, + 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x64, + 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x12, 0x3c, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, + 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x3a, 0x2b, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, + 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, + 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x22, 0x14, + 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x12, 0x38, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, + 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, + 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0x82, 0xe7, 0xb0, 0x2a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x67, 0x6f, 0x76, 0x2f, + 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8a, 0x01, + 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, 0xde, 0x1f, 0x0b, 0x70, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, + 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x3a, 0x0d, 0x82, 0xe7, 0xb0, + 0x2a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x22, 0xc1, 0x01, 0x0a, 0x19, 0x4d, + 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0f, 0xea, + 0xde, 0x1f, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x52, 0x0a, + 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x0d, 0x63, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, + 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0c, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, + 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, + 0x64, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, + 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x65, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x32, 0xe8, + 0x04, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, + 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, + 0x62, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x11, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, + 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, + 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x26, + 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x04, 0x56, + 0x6f, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x1a, 0x1e, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, + 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, 0x56, + 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, + 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x1a, 0x26, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x56, + 0x6f, 0x74, 0x65, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x12, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x67, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0c, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x20, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, - 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x98, 0x01, 0x0a, 0x11, - 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, - 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x76, - 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x5c, 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, - 0x6f, 0x76, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x98, 0x01, 0x0a, 0x11, 0x63, 0x6f, + 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x67, 0x6f, 0x76, 0x2e, 0x76, 0x31, 0x42, + 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x67, 0x6f, 0x76, 0x2f, 0x76, 0x31, 0x3b, 0x67, 0x6f, 0x76, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x43, 0x47, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x47, 0x6f, 0x76, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, + 0x47, 0x6f, 0x76, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x47, 0x6f, 0x76, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/cosmos/tx/v1beta1/tx.pulsar.go b/api/cosmos/tx/v1beta1/tx.pulsar.go index 54eca117719..e96c797a907 100644 --- a/api/cosmos/tx/v1beta1/tx.pulsar.go +++ b/api/cosmos/tx/v1beta1/tx.pulsar.go @@ -2,6 +2,7 @@ package txv1beta1 import ( + _ "cosmossdk.io/api/amino" v1beta12 "cosmossdk.io/api/cosmos/base/v1beta1" v1beta11 "cosmossdk.io/api/cosmos/crypto/multisig/v1beta1" v1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" @@ -8972,168 +8973,172 @@ var file_cosmos_tx_v1beta1_tx_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, - 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, - 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, - 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, - 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, - 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x02, 0x54, 0x78, 0x12, 0x2d, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x78, 0x42, - 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x73, 0x22, 0x6e, 0x0a, 0x05, 0x54, 0x78, 0x52, 0x61, 0x77, 0x12, 0x1d, 0x0a, 0x0a, - 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x09, 0x62, 0x6f, 0x64, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x61, - 0x75, 0x74, 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x6f, 0x63, 0x12, + 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, + 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x27, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x74, 0x78, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x02, 0x54, 0x78, 0x12, 0x2d, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x54, 0x78, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x38, 0x0a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x61, 0x75, + 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x6e, 0x0a, 0x05, 0x54, 0x78, 0x52, 0x61, 0x77, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6f, 0x64, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, - 0x6f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, - 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, - 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xee, 0x01, 0x0a, 0x10, 0x53, 0x69, 0x67, - 0x6e, 0x44, 0x6f, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x75, 0x78, 0x12, 0x1d, 0x0a, - 0x0a, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x62, 0x6f, 0x64, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x0a, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x6f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x22, 0x92, 0x01, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x44, + 0x6f, 0x63, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6f, 0x64, 0x79, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x5f, 0x62, + 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, + 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xee, 0x01, 0x0a, 0x10, + 0x53, 0x69, 0x67, 0x6e, 0x44, 0x6f, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x75, 0x78, + 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x62, 0x6f, 0x64, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, + 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, + 0x25, 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x12, 0x28, 0x0a, 0x03, 0x74, 0x69, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x54, 0x69, 0x70, 0x52, 0x03, 0x74, 0x69, 0x70, 0x22, 0x95, 0x02, 0x0a, + 0x06, 0x54, 0x78, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, + 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x25, 0x0a, + 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x48, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x12, 0x42, 0x0a, 0x11, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xff, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, - 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x28, 0x0a, 0x03, 0x74, 0x69, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x54, 0x69, 0x70, 0x52, 0x03, 0x74, 0x69, 0x70, 0x22, 0x95, 0x02, 0x0a, 0x06, 0x54, 0x78, - 0x42, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0d, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x12, 0x42, 0x0a, 0x11, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xff, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x10, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5a, 0x0a, 0x1e, 0x6e, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x69, - 0x74, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xff, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x1b, 0x6e, 0x6f, 0x6e, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, - 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x40, - 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73, - 0x12, 0x28, 0x0a, 0x03, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x46, 0x65, 0x65, 0x52, 0x03, 0x66, 0x65, 0x65, 0x12, 0x28, 0x0a, 0x03, 0x74, 0x69, - 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x69, 0x70, 0x52, - 0x03, 0x74, 0x69, 0x70, 0x22, 0x97, 0x01, 0x0a, 0x0a, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x6d, 0x6f, 0x64, 0x65, - 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0xe0, - 0x02, 0x0a, 0x08, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3c, 0x0a, 0x06, 0x73, - 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, + 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x10, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x5a, 0x0a, 0x1e, 0x6e, 0x6f, 0x6e, 0x5f, + 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xff, 0x0f, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x1b, 0x6e, 0x6f, 0x6e, 0x43, 0x72, 0x69, 0x74, + 0x69, 0x63, 0x61, 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x40, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x73, 0x12, 0x28, 0x0a, 0x03, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x46, 0x65, 0x65, 0x52, 0x03, 0x66, 0x65, 0x65, 0x12, 0x28, 0x0a, + 0x03, 0x74, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, + 0x69, 0x70, 0x52, 0x03, 0x74, 0x69, 0x70, 0x22, 0x97, 0x01, 0x0a, 0x0a, 0x53, 0x69, 0x67, 0x6e, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x6d, + 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6d, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x22, 0xe0, 0x02, 0x0a, 0x08, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3c, + 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x69, 0x6e, 0x67, + 0x6c, 0x65, 0x48, 0x00, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x05, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x48, - 0x00, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x6d, 0x75, 0x6c, - 0x74, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x48, 0x00, 0x52, 0x05, 0x6d, - 0x75, 0x6c, 0x74, 0x69, 0x1a, 0x41, 0x0a, 0x06, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x37, - 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x6f, 0x64, - 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x1a, 0x90, 0x01, 0x0a, 0x05, 0x4d, 0x75, 0x6c, 0x74, - 0x69, 0x12, 0x4b, 0x0a, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x63, 0x72, 0x79, - 0x70, 0x74, 0x6f, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x42, 0x69, 0x74, 0x41, - 0x72, 0x72, 0x61, 0x79, 0x52, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, 0x72, 0x61, 0x79, 0x12, 0x3a, - 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x42, 0x05, 0x0a, 0x03, 0x73, 0x75, - 0x6d, 0x22, 0xeb, 0x01, 0x0a, 0x03, 0x46, 0x65, 0x65, 0x12, 0x63, 0x0a, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, - 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x70, - 0x61, 0x79, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x70, 0x61, 0x79, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x67, - 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x22, - 0x9c, 0x01, 0x0a, 0x03, 0x54, 0x69, 0x70, 0x12, 0x63, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, - 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, - 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x22, 0xce, - 0x01, 0x0a, 0x0d, 0x41, 0x75, 0x78, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x64, 0x6f, 0x63, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x44, - 0x6f, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x75, 0x78, 0x52, 0x07, 0x73, 0x69, 0x67, - 0x6e, 0x44, 0x6f, 0x63, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, - 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, - 0x69, 0x67, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x73, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x69, 0x67, 0x42, - 0xb4, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, - 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x74, 0x78, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x54, 0x78, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x11, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0xe2, 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x48, 0x00, + 0x52, 0x05, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x1a, 0x41, 0x0a, 0x06, 0x53, 0x69, 0x6e, 0x67, 0x6c, + 0x65, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, + 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x1a, 0x90, 0x01, 0x0a, 0x05, 0x4d, + 0x75, 0x6c, 0x74, 0x69, 0x12, 0x4b, 0x0a, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, 0x72, 0x61, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x42, + 0x69, 0x74, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, 0x72, 0x61, + 0x79, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, + 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x42, 0x05, 0x0a, + 0x03, 0x73, 0x75, 0x6d, 0x22, 0x81, 0x02, 0x0a, 0x03, 0x46, 0x65, 0x65, 0x12, 0x79, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, + 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x70, 0x61, 0x79, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x70, + 0x61, 0x79, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x22, 0xb2, 0x01, 0x0a, 0x03, 0x54, 0x69, 0x70, + 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, + 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, + 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x74, + 0x69, 0x70, 0x70, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x22, 0xce, 0x01, + 0x0a, 0x0d, 0x41, 0x75, 0x78, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x64, 0x6f, 0x63, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, + 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x6f, + 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x75, 0x78, 0x52, 0x07, 0x73, 0x69, 0x67, 0x6e, + 0x44, 0x6f, 0x63, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, + 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x73, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x73, 0x69, 0x67, 0x42, 0xb4, + 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x74, 0x78, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xa2, 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x54, 0x78, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, + 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/codec/proto_codec.go b/codec/proto_codec.go index 6a310e195ca..b66c0f348a0 100644 --- a/codec/proto_codec.go +++ b/codec/proto_codec.go @@ -2,6 +2,7 @@ package codec import ( "encoding/binary" + "encoding/json" "errors" "fmt" "strings" @@ -17,6 +18,7 @@ import ( "google.golang.org/protobuf/types/known/anypb" "cosmossdk.io/x/tx/signing/aminojson" + "github.com/cosmos/cosmos-sdk/codec/types" ) @@ -196,7 +198,23 @@ func (pc *ProtoCodec) MarshalAminoJSON(msg gogoproto.Message) ([]byte, error) { if err != nil { return nil, err } - return jsonBytes, nil + // TODO: remove this sort once https://github.com/cosmos/cosmos-sdk/issues/2350#issuecomment-1542715157 lands + // the encoder should be rendering in lexical order + return sortJSON(jsonBytes) +} + +// sortJSON sorts the JSON keys of the given JSON encoded byte slice. +func sortJSON(toSortJSON []byte) ([]byte, error) { + var c interface{} + err := json.Unmarshal(toSortJSON, &c) + if err != nil { + return nil, err + } + js, err := json.Marshal(c) + if err != nil { + return nil, err + } + return js, nil } // UnmarshalJSON implements JSONCodec.UnmarshalJSON method, diff --git a/core/coins/format.go b/core/coins/format.go index b31f18dae1d..315c96d78f4 100644 --- a/core/coins/format.go +++ b/core/coins/format.go @@ -67,7 +67,7 @@ func formatCoin(coin *basev1beta1.Coin, metadata *bankv1beta1.Metadata) (string, return vr + " " + dispDenom, err } -// formatCoins formats Coins into a value-rendered string, which uses +// FormatCoins formats Coins into a value-rendered string, which uses // `formatCoin` separated by ", " (a comma and a space), and sorted // alphabetically by value-rendered denoms. It expects an array of metadata // (optionally nil), where each metadata at index `i` MUST match the coin denom diff --git a/go.mod b/go.mod index 89adced18ac..fc75a59055d 100644 --- a/go.mod +++ b/go.mod @@ -159,6 +159,8 @@ require ( // Below are the short-lived replace of the Cosmos SDK replace ( + // TODO remove after cosmossdk.io/api release + cosmossdk.io/api => ./api // TODO: remove me after collections 0.2. is released. cosmossdk.io/collections => ./collections cosmossdk.io/core => ./core diff --git a/go.sum b/go.sum index cf31d5b6c30..7d9818f1d35 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.4.1 h1:0ikaYM6GyxTYYcfBiyR8YnLCfhNnhKpEFnaSepCTmqg= -cosmossdk.io/api v0.4.1/go.mod h1:jR7k5ok90LxW2lFUXvd8Vpo/dr4PpiyVegxdm7b1ZdE= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7.0.20230524212735-6cabb6aa5741 h1:BCRz06fvddw7cKGiEGDiSox3qMsjQ97f92K+PDZDHdc= diff --git a/proto/cosmos/gov/v1/tx.proto b/proto/cosmos/gov/v1/tx.proto index 7438c00ea14..57a062602b6 100644 --- a/proto/cosmos/gov/v1/tx.proto +++ b/proto/cosmos/gov/v1/tx.proto @@ -55,7 +55,12 @@ message MsgSubmitProposal { repeated google.protobuf.Any messages = 1; // initial_deposit is the deposit value that must be paid at proposal submission. - repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; // proposer is the account address of the proposer. string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto index a71a3e115dc..04f98cf57f6 100644 --- a/proto/cosmos/tx/v1beta1/tx.proto +++ b/proto/cosmos/tx/v1beta1/tx.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package cosmos.tx.v1beta1; +import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "cosmos/crypto/multisig/v1beta1/multisig.proto"; import "cosmos/base/v1beta1/coin.proto"; @@ -205,8 +206,12 @@ message ModeInfo { // which must be above some miminum to be accepted into the mempool. message Fee { // amount is the amount of coins to be paid as a fee - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; // gas_limit is the maximum gas that can be used in transaction processing // before an out of gas error occurs @@ -228,8 +233,12 @@ message Fee { // Since: cosmos-sdk 0.46 message Tip { // amount is the amount of the tip - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (amino.dont_omitempty) = true, + (amino.encoding) = "legacy_coins" + ]; // tipper is the address of the account paying for the tip string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } diff --git a/tests/integration/aminojson/aminojson_test.go b/tests/integration/aminojson/aminojson_test.go index 1339c60194e..fbe2777e9cc 100644 --- a/tests/integration/aminojson/aminojson_test.go +++ b/tests/integration/aminojson/aminojson_test.go @@ -7,6 +7,8 @@ import ( "testing" "time" + gov_v1_api "cosmossdk.io/api/cosmos/gov/v1" + msgv1 "cosmossdk.io/api/cosmos/msg/v1" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" @@ -36,6 +38,7 @@ import ( "cosmossdk.io/x/tx/signing/aminojson" signing_testutil "cosmossdk.io/x/tx/signing/testutil" "cosmossdk.io/x/upgrade" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" ed25519types "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" @@ -64,6 +67,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/distribution" disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/gov" + gov_v1_types "github.com/cosmos/cosmos-sdk/x/gov/types/v1" gov_v1beta1_types "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" groupmodule "github.com/cosmos/cosmos-sdk/x/group/module" "github.com/cosmos/cosmos-sdk/x/mint" @@ -94,10 +98,12 @@ func TestAminoJSON_Equivalence(t *testing.T) { distribution.AppModuleBasic{}, evidence.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, gov.AppModuleBasic{}, groupmodule.AppModuleBasic{}, mint.AppModuleBasic{}, params.AppModuleBasic{}, slashing.AppModuleBasic{}, staking.AppModuleBasic{}, upgrade.AppModuleBasic{}, vesting.AppModuleBasic{}) + legacytx.RegressionTestingAminoCodec = encCfg.Amino aj := aminojson.NewEncoder(aminojson.EncoderOptions{}) for _, tt := range rapidgen.DefaultGeneratedTypes { - name := string(tt.Pulsar.ProtoReflect().Descriptor().FullName()) + desc := tt.Pulsar.ProtoReflect().Descriptor() + name := string(desc.FullName()) t.Run(name, func(t *testing.T) { gen := rapidproto.MessageGenerator(tt.Pulsar, tt.Opts) fmt.Printf("testing %s\n", tt.Pulsar.ProtoReflect().Descriptor().FullName()) @@ -132,8 +138,7 @@ func TestAminoJSON_Equivalence(t *testing.T) { require.Equal(t, string(legacyAminoJSON), string(aminoJSON)) // test amino json signer handler equivalence - gogoMsg, ok := gogo.(legacytx.LegacyMsg) - if !ok { + if !proto.HasExtension(desc.Options(), msgv1.E_Signer) { // not signable return } @@ -163,7 +168,7 @@ func TestAminoJSON_Equivalence(t *testing.T) { legacyHandler := tx.NewSignModeLegacyAminoJSONHandler() txBuilder := encCfg.TxConfig.NewTxBuilder() - require.NoError(t, txBuilder.SetMsgs([]types.Msg{gogoMsg}...)) + require.NoError(t, txBuilder.SetMsgs([]types.Msg{tt.Gogo}...)) txBuilder.SetMemo(handlerOptions.Memo) txBuilder.SetFeeAmount(types.Coins{types.NewInt64Coin("uatom", 1000)}) txBuilder.SetTip(&txtypes.Tip{ @@ -201,7 +206,8 @@ func newAny(t *testing.T, msg proto.Message) *anypb.Any { func TestAminoJSON_LegacyParity(t *testing.T) { encCfg := testutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, authzmodule.AppModuleBasic{}, bank.AppModuleBasic{}, distribution.AppModuleBasic{}, slashing.AppModuleBasic{}, staking.AppModuleBasic{}, - vesting.AppModuleBasic{}) + vesting.AppModuleBasic{}, gov.AppModuleBasic{}) + legacytx.RegressionTestingAminoCodec = encCfg.Amino aj := aminojson.NewEncoder(aminojson.EncoderOptions{}) addr1 := types.AccAddress("addr1") @@ -332,6 +338,10 @@ func TestAminoJSON_LegacyParity(t *testing.T) { gogo: &banktypes.MsgMultiSend{}, pulsar: &bankapi.MsgMultiSend{}, }, + "gov/v1_msg_submit_proposal": { + gogo: &gov_v1_types.MsgSubmitProposal{}, + pulsar: &gov_v1_api.MsgSubmitProposal{}, + }, "slashing/params/empty_dec": { gogo: &slashingtypes.Params{DowntimeJailDuration: 1e9 + 7}, pulsar: &slashingapi.Params{DowntimeJailDuration: &durationpb.Duration{Seconds: 1, Nanos: 7}}, diff --git a/tests/integration/tx/decode_test.go b/tests/integration/tx/decode_test.go index 9efc85c6474..0e601a7e97d 100644 --- a/tests/integration/tx/decode_test.go +++ b/tests/integration/tx/decode_test.go @@ -3,6 +3,7 @@ package tx import ( "testing" + msgv1 "cosmossdk.io/api/cosmos/msg/v1" "github.com/cosmos/cosmos-proto/rapidproto" gogoproto "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" @@ -14,6 +15,7 @@ import ( "cosmossdk.io/x/tx/decode" txsigning "cosmossdk.io/x/tx/signing" "cosmossdk.io/x/upgrade" + "github.com/cosmos/cosmos-sdk/codec/legacy" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/tests/integration/rapidgen" @@ -44,6 +46,7 @@ func TestDecode(t *testing.T) { distribution.AppModuleBasic{}, evidence.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, gov.AppModuleBasic{}, groupmodule.AppModuleBasic{}, mint.AppModuleBasic{}, params.AppModuleBasic{}, slashing.AppModuleBasic{}, staking.AppModuleBasic{}, upgrade.AppModuleBasic{}, vesting.AppModuleBasic{}) + legacytx.RegressionTestingAminoCodec = encCfg.Amino fee := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) gas := uint64(200) @@ -74,7 +77,8 @@ func TestDecode(t *testing.T) { require.NoError(t, err) for _, tt := range rapidgen.SignableTypes { - name := string(tt.Pulsar.ProtoReflect().Descriptor().FullName()) + desc := tt.Pulsar.ProtoReflect().Descriptor() + name := string(desc.FullName()) t.Run(name, func(t *testing.T) { gen := rapidproto.MessageGenerator(tt.Pulsar, tt.Opts) rapid.Check(t, func(t *rapid.T) { @@ -102,10 +106,9 @@ func TestDecode(t *testing.T) { Sequence: accSeq, } - gogoMsg, ok := gogo.(legacytx.LegacyMsg) - require.True(t, ok) + require.True(t, proto.HasExtension(desc.Options(), msgv1.E_Signer)) - err = txBuilder.SetMsgs(gogoMsg) + err = txBuilder.SetMsgs(tt.Gogo) require.NoError(t, err) txBuilder.SetFeeAmount(fee) txBuilder.SetGasLimit(gas) @@ -129,7 +132,7 @@ func TestDecode(t *testing.T) { require.Equal(t, authInfoBytes, decodedTx.TxRaw.AuthInfoBytes) - anyGogoMsg, err := codectypes.NewAnyWithValue(gogoMsg) + anyGogoMsg, err := codectypes.NewAnyWithValue(tt.Gogo) require.NoError(t, err) txBody := &txtypes.TxBody{ @@ -145,6 +148,8 @@ func TestDecode(t *testing.T) { }) }) } + + legacytx.RegressionTestingAminoCodec = nil } type dummyAddressCodec struct{} diff --git a/testutil/sims/state_helpers.go b/testutil/sims/state_helpers.go index 73319ecaba4..e0d643a90fb 100644 --- a/testutil/sims/state_helpers.go +++ b/testutil/sims/state_helpers.go @@ -204,11 +204,11 @@ func AppStateRandomizedFn( initialStake math.Int ) appParams.GetOrGenerate( - cdc, StakePerAccount, &initialStake, r, + StakePerAccount, &initialStake, r, func(r *rand.Rand) { initialStake = math.NewInt(r.Int63n(1e12)) }, ) appParams.GetOrGenerate( - cdc, InitiallyBondedValidators, &numInitiallyBonded, r, + InitiallyBondedValidators, &numInitiallyBonded, r, func(r *rand.Rand) { numInitiallyBonded = int64(r.Intn(300)) }, ) diff --git a/testutil/testdata/tx.go b/testutil/testdata/tx.go index 9b4e081253f..7ceb62431de 100644 --- a/testutil/testdata/tx.go +++ b/testutil/testdata/tx.go @@ -1,7 +1,6 @@ package testdata import ( - "encoding/json" "testing" "gotest.tools/v3/assert" @@ -78,14 +77,6 @@ func NewTestMsg(addrs ...sdk.AccAddress) *TestMsg { var _ sdk.Msg = (*TestMsg)(nil) -func (msg *TestMsg) GetSignBytes() []byte { - bz, err := json.Marshal(msg.Signers) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(bz) -} - func (msg *TestMsg) GetSigners() []sdk.AccAddress { signers := make([]sdk.AccAddress, 0, len(msg.Signers)) for _, addr := range msg.Signers { diff --git a/types/result.go b/types/result.go index 16382a42277..46ff994f829 100644 --- a/types/result.go +++ b/types/result.go @@ -15,8 +15,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" ) -var cdc = codec.NewLegacyAmino() - func (gi GasInfo) String() string { bz, _ := codec.MarshalYAML(codec.NewProtoCodec(nil), &gi) return string(bz) @@ -50,6 +48,7 @@ func NewABCIMessageLog(i uint32, log string, events Events) ABCIMessageLog { // String implements the fmt.Stringer interface for the ABCIMessageLogs type. func (logs ABCIMessageLogs) String() (str string) { if logs != nil { + cdc := codec.NewLegacyAmino() raw, err := cdc.MarshalJSON(logs) if err == nil { str = string(raw) diff --git a/types/simulation/types.go b/types/simulation/types.go index 39d3e1677db..32bcd54520e 100644 --- a/types/simulation/types.go +++ b/types/simulation/types.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/gogoproto/proto" "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" ) @@ -158,7 +157,7 @@ type AppParams map[string]json.RawMessage // object. If it exists, it'll be decoded and returned. Otherwise, the provided // ParamSimulator is used to generate a random value or default value (eg: in the // case of operation weights where Rand is not used). -func (sp AppParams) GetOrGenerate(_ codec.JSONCodec, key string, ptr interface{}, r *rand.Rand, ps ParamSimulator) { +func (sp AppParams) GetOrGenerate(key string, ptr interface{}, r *rand.Rand, ps ParamSimulator) { if v, ok := sp[key]; ok && v != nil { err := json.Unmarshal(v, ptr) if err != nil { diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go index 8083c039df4..6782890cc9e 100644 --- a/types/tx/tx.pb.go +++ b/types/tx/tx.pb.go @@ -10,6 +10,7 @@ import ( types1 "github.com/cosmos/cosmos-sdk/crypto/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types2 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" signing "github.com/cosmos/cosmos-sdk/types/tx/signing" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -1020,71 +1021,73 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) } var fileDescriptor_96d1575ffde80842 = []byte{ - // 1015 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x66, 0x6d, 0xc7, 0x7e, 0x4d, 0xda, 0x74, 0x14, 0x21, 0xc7, 0x51, 0xdd, 0xe0, 0xaa, - 0xe0, 0x4b, 0x76, 0xd3, 0xf4, 0x40, 0x41, 0x08, 0xb0, 0x1b, 0xaa, 0x54, 0xa5, 0x20, 0x4d, 0x72, - 0xea, 0x65, 0x35, 0x5e, 0x4f, 0xd6, 0xa3, 0x7a, 0x67, 0x96, 0x9d, 0x59, 0xb0, 0xff, 0x08, 0xa4, - 0x0a, 0x09, 0x71, 0xe1, 0xc0, 0x99, 0x33, 0x7f, 0x44, 0x4f, 0xa8, 0xe2, 0xc4, 0x09, 0xaa, 0xe4, - 0x88, 0xc4, 0xbf, 0x00, 0x9a, 0xd9, 0xd9, 0x4d, 0x5a, 0x5c, 0x1b, 0x04, 0xea, 0x69, 0xe7, 0xc7, - 0xf7, 0xbe, 0xf9, 0xde, 0xbc, 0x6f, 0xdf, 0x40, 0x3b, 0x14, 0x32, 0x16, 0xd2, 0x57, 0x53, 0xff, - 0x8b, 0x5b, 0x43, 0xaa, 0xc8, 0x2d, 0x5f, 0x4d, 0xbd, 0x24, 0x15, 0x4a, 0xa0, 0xab, 0xf9, 0x9e, - 0xa7, 0xa6, 0x9e, 0xdd, 0x6b, 0x6f, 0x46, 0x22, 0x12, 0x66, 0xd7, 0xd7, 0xa3, 0x1c, 0xd8, 0xde, - 0xb5, 0x24, 0x61, 0x3a, 0x4b, 0x94, 0xf0, 0xe3, 0x6c, 0xa2, 0x98, 0x64, 0x51, 0xc9, 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x79, 0x3d, 0xd9, 0xee, 0x41, 0x5d, 0xb1, 0x24, - 0xa1, 0x69, 0xde, 0xd7, 0x16, 0xe8, 0xb3, 0xb8, 0xee, 0x4f, 0x0e, 0xac, 0xf7, 0xb3, 0x69, 0xfe, - 0x33, 0x1e, 0x10, 0x45, 0x74, 0x92, 0x24, 0x87, 0x1a, 0xb7, 0x2c, 0x4c, 0xd2, 0x02, 0xd1, 0x07, - 0xd0, 0xd0, 0x76, 0x0c, 0x46, 0x22, 0xb4, 0x6e, 0xbf, 0xf1, 0x8a, 0x0e, 0x73, 0xf1, 0x75, 0xc2, - 0xab, 0xd2, 0x3e, 0xa2, 0x85, 0xcb, 0xdd, 0x7f, 0xe9, 0x72, 0xb4, 0x01, 0xae, 0x64, 0x91, 0xa9, - 0xc6, 0x1a, 0xd6, 0xc3, 0xc1, 0x87, 0x4f, 0x4f, 0x3b, 0xce, 0xb3, 0xd3, 0x8e, 0xf3, 0xfc, 0xb4, - 0xe3, 0x3c, 0x39, 0xeb, 0x54, 0x9e, 0x9d, 0x75, 0x2a, 0xbf, 0x9c, 0x75, 0x2a, 0x8f, 0x6e, 0x2e, - 0xbf, 0x4e, 0x5f, 0x4d, 0x87, 0x75, 0xd3, 0x70, 0x6e, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, 0x4d, - 0x26, 0x62, 0x70, 0xd8, 0x09, 0x00, 0x00, + // 1052 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x41, 0x6f, 0x1b, 0xc5, + 0x17, 0xf7, 0x7a, 0x6d, 0xc7, 0x7e, 0x4d, 0xda, 0x64, 0x14, 0xfd, 0xe5, 0x38, 0xaa, 0x9b, 0xbf, + 0xab, 0x82, 0x55, 0x29, 0xbb, 0x6d, 0x7a, 0xa0, 0x20, 0x04, 0xd8, 0x0d, 0x51, 0xaa, 0x52, 0x90, + 0x36, 0x39, 0xf5,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34, 0x95, 0x74, 0xfd, 0x31, 0x0f, 0xcc, 0xcb, 0xb8, 0xfa, 0x8a, 0x6e, + 0x74, 0x76, 0x92, 0x79, 0x4b, 0xc2, 0x0c, 0xdc, 0xe2, 0x45, 0xd8, 0x7f, 0xf3, 0x45, 0xa0, 0x55, + 0xb0, 0x05, 0x0d, 0x75, 0x8d, 0x96, 0x3d, 0xb5, 0x1c, 0xbe, 0xfb, 0xe4, 0xb8, 0x6b, 0x3d, 0x3d, + 0xee, 0x5a, 0xcf, 0x8e, 0xbb, 0xd6, 0xa3, 0x93, 0x6e, 0xe5, 0xe9, 0x49, 0xb7, 0xf2, 0xf3, 0x49, + 0xb7, 0xf2, 0xe0, 0xda, 0xe2, 0x24, 0xbb, 0x72, 0x36, 0x6a, 0xe8, 0xe6, 0x74, 0xeb, 0x8f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x1f, 0x66, 0x4c, 0xda, 0x17, 0x0a, 0x00, 0x00, } func (m *Tx) Marshal() (dAtA []byte, err error) { diff --git a/types/tx_msg_test.go b/types/tx_msg_test.go index 6843af7d352..31ca01f5df6 100644 --- a/types/tx_msg_test.go +++ b/types/tx_msg_test.go @@ -27,7 +27,6 @@ func (s *testMsgSuite) TestMsg() { s.Require().NotNil(msg) s.Require().True(accAddr.Equals(msg.GetSigners()[0])) s.Require().Nil(msg.ValidateBasic()) - s.Require().NotPanics(func() { msg.GetSignBytes() }) } func (s *testMsgSuite) TestMsgTypeURL() { diff --git a/x/auth/migrations/legacytx/stdsign.go b/x/auth/migrations/legacytx/stdsign.go index dbe04471395..c4ef01b9d69 100644 --- a/x/auth/migrations/legacytx/stdsign.go +++ b/x/auth/migrations/legacytx/stdsign.go @@ -44,17 +44,18 @@ type StdSignDoc struct { Tip *StdTip `json:"tip,omitempty" yaml:"tip"` } +var RegressionTestingAminoCodec *codec.LegacyAmino + // StdSignBytes returns the bytes to sign for a transaction. // Deprecated: Please use x/tx/signing/aminojson instead. func StdSignBytes(chainID string, accnum, sequence, timeout uint64, fee StdFee, msgs []sdk.Msg, memo string, tip *tx.Tip) []byte { + if RegressionTestingAminoCodec == nil { + panic(fmt.Errorf("must set RegressionTestingAminoCodec before calling StdSignBytes")) + } msgsBytes := make([]json.RawMessage, 0, len(msgs)) for _, msg := range msgs { - legacyMsg, ok := msg.(LegacyMsg) - if !ok { - panic(fmt.Errorf("expected %T when using amino JSON", (*LegacyMsg)(nil))) - } - - msgsBytes = append(msgsBytes, json.RawMessage(legacyMsg.GetSignBytes())) + bz := RegressionTestingAminoCodec.MustMarshalJSON(msg) + msgsBytes = append(msgsBytes, sdk.MustSortJSON(bz)) } var stdTip *StdTip diff --git a/x/auth/migrations/legacytx/stdsignmsg.go b/x/auth/migrations/legacytx/stdsignmsg.go index 56e68b0f5b6..561a64463f5 100644 --- a/x/auth/migrations/legacytx/stdsignmsg.go +++ b/x/auth/migrations/legacytx/stdsignmsg.go @@ -19,11 +19,6 @@ type StdSignMsg struct { Memo string `json:"memo" yaml:"memo"` } -// get message bytes -func (msg StdSignMsg) Bytes() []byte { - return StdSignBytes(msg.ChainID, msg.AccountNumber, msg.Sequence, msg.TimeoutHeight, msg.Fee, msg.Msgs, msg.Memo, nil) -} - func (msg StdSignMsg) UnpackInterfaces(unpacker types.AnyUnpacker) error { for _, m := range msg.Msgs { err := types.UnpackInterfaces(m, unpacker) diff --git a/x/auth/migrations/legacytx/stdtx_test.go b/x/auth/migrations/legacytx/stdtx_test.go index 2e51ece29c2..f697f68ec04 100644 --- a/x/auth/migrations/legacytx/stdtx_test.go +++ b/x/auth/migrations/legacytx/stdtx_test.go @@ -1,19 +1,26 @@ package legacytx import ( + "context" "fmt" "testing" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/anypb" + basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" + txsigning "cosmossdk.io/x/tx/signing" + "cosmossdk.io/x/tx/signing/aminojson" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" ) @@ -22,31 +29,26 @@ var ( addr = sdk.AccAddress(priv.PubKey().Address()) ) -func init() { - amino := codec.NewLegacyAmino() - RegisterLegacyAminoCodec(amino) -} - -// Deprecated: use fee amount and gas limit separately on TxBuilder. -func NewTestStdFee() StdFee { - return NewStdFee(100000, - sdk.NewCoins(sdk.NewInt64Coin("atom", 150)), - ) -} - func TestStdSignBytes(t *testing.T) { type args struct { chainID string accnum uint64 sequence uint64 timeoutHeight uint64 - fee StdFee + fee *txv1beta1.Fee msgs []sdk.Msg memo string - tip *tx.Tip + tip *txv1beta1.Tip } - defaultFee := NewTestStdFee() - defaultTip := &tx.Tip{Tipper: addr.String(), Amount: sdk.NewCoins(sdk.NewInt64Coin("tiptoken", 150))} + defaultFee := &txv1beta1.Fee{ + Amount: []*basev1beta1.Coin{{Denom: "atom", Amount: "150"}}, + GasLimit: 100000, + } + defaultTip := &txv1beta1.Tip{ + Amount: []*basev1beta1.Coin{{Denom: "tiptoken", Amount: "150"}}, + Tipper: addr.String(), + } + msgStr := fmt.Sprintf(`{"type":"testpb/TestMsg","value":{"signers":["%s"]}}`, addr) tests := []struct { name string args args @@ -55,59 +57,91 @@ func TestStdSignBytes(t *testing.T) { { "with timeout height", args{"1234", 3, 6, 10, defaultFee, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[["%s"]],"sequence":"6","timeout_height":"10"}`, addr), + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[%s],"sequence":"6","timeout_height":"10"}`, msgStr), }, { "no timeout height (omitempty)", args{"1234", 3, 6, 0, defaultFee, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[["%s"]],"sequence":"6"}`, addr), + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[%s],"sequence":"6"}`, msgStr), }, { "empty fee", - args{"1234", 3, 6, 0, StdFee{}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[["%s"]],"sequence":"6"}`, addr), + args{"1234", 3, 6, 0, &txv1beta1.Fee{}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[%s],"sequence":"6"}`, msgStr), }, { "no fee payer and fee granter (both omitempty)", - args{"1234", 3, 6, 0, StdFee{Amount: defaultFee.Amount, Gas: defaultFee.Gas}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[["%s"]],"sequence":"6"}`, addr), + args{"1234", 3, 6, 0, &txv1beta1.Fee{Amount: defaultFee.Amount, GasLimit: defaultFee.GasLimit}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[%s],"sequence":"6"}`, msgStr), }, { "with fee granter, no fee payer (omitempty)", - args{"1234", 3, 6, 0, StdFee{Amount: defaultFee.Amount, Gas: defaultFee.Gas, Granter: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","granter":"%s"},"memo":"memo","msgs":[["%s"]],"sequence":"6"}`, addr, addr), + args{"1234", 3, 6, 0, &txv1beta1.Fee{Amount: defaultFee.Amount, GasLimit: defaultFee.GasLimit, Granter: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","granter":"%s"},"memo":"memo","msgs":[%s],"sequence":"6"}`, addr, msgStr), }, { "with fee payer, no fee granter (omitempty)", - args{"1234", 3, 6, 0, StdFee{Amount: defaultFee.Amount, Gas: defaultFee.Gas, Payer: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","payer":"%s"},"memo":"memo","msgs":[["%s"]],"sequence":"6"}`, addr, addr), + args{"1234", 3, 6, 0, &txv1beta1.Fee{Amount: defaultFee.Amount, GasLimit: defaultFee.GasLimit, Payer: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","payer":"%s"},"memo":"memo","msgs":[%s],"sequence":"6"}`, addr, msgStr), }, { "with fee payer and fee granter", - args{"1234", 3, 6, 0, StdFee{Amount: defaultFee.Amount, Gas: defaultFee.Gas, Payer: addr.String(), Granter: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","granter":"%s","payer":"%s"},"memo":"memo","msgs":[["%s"]],"sequence":"6"}`, addr, addr, addr), + args{"1234", 3, 6, 0, &txv1beta1.Fee{Amount: defaultFee.Amount, GasLimit: defaultFee.GasLimit, Payer: addr.String(), Granter: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", nil}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","granter":"%s","payer":"%s"},"memo":"memo","msgs":[%s],"sequence":"6"}`, addr, addr, msgStr), }, { "no fee, with tip", - args{"1234", 3, 6, 0, StdFee{}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", defaultTip}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[["%s"]],"sequence":"6","tip":{"amount":[{"amount":"150","denom":"tiptoken"}],"tipper":"%s"}}`, addr, addr), + args{"1234", 3, 6, 0, &txv1beta1.Fee{}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", defaultTip}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[%s],"sequence":"6","tip":{"amount":[{"amount":"150","denom":"tiptoken"}],"tipper":"%s"}}`, msgStr, addr), }, { "with fee and with tip", - args{"1234", 3, 6, 0, StdFee{Amount: defaultFee.Amount, Gas: defaultFee.Gas, Payer: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", defaultTip}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","payer":"%s"},"memo":"memo","msgs":[["%s"]],"sequence":"6","tip":{"amount":[{"amount":"150","denom":"tiptoken"}],"tipper":"%s"}}`, addr, addr, addr), + args{"1234", 3, 6, 0, &txv1beta1.Fee{Amount: defaultFee.Amount, GasLimit: defaultFee.GasLimit, Payer: addr.String()}, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", defaultTip}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000","payer":"%s"},"memo":"memo","msgs":[%s],"sequence":"6","tip":{"amount":[{"amount":"150","denom":"tiptoken"}],"tipper":"%s"}}`, addr, msgStr, addr), }, { "with empty tip (but not nil), tipper cannot be empty", - args{"1234", 3, 6, 0, defaultFee, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", &tx.Tip{Tipper: addr.String()}}, - fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[["%s"]],"sequence":"6","tip":{"amount":[],"tipper":"%s"}}`, addr, addr), + args{"1234", 3, 6, 0, defaultFee, []sdk.Msg{testdata.NewTestMsg(addr)}, "memo", &txv1beta1.Tip{Tipper: addr.String()}}, + fmt.Sprintf(`{"account_number":"3","chain_id":"1234","fee":{"amount":[{"amount":"150","denom":"atom"}],"gas":"100000"},"memo":"memo","msgs":[%s],"sequence":"6","tip":{"amount":[],"tipper":"%s"}}`, msgStr, addr), }, } + handler := aminojson.NewSignModeHandler(aminojson.SignModeHandlerOptions{ + FileResolver: proto.HybridResolver, + }) for i, tc := range tests { tc := tc t.Run(tc.name, func(t *testing.T) { - got := string(StdSignBytes(tc.args.chainID, tc.args.accnum, tc.args.sequence, tc.args.timeoutHeight, tc.args.fee, tc.args.msgs, tc.args.memo, tc.args.tip)) - require.Equal(t, tc.want, got, "Got unexpected result on test case i: %d", i) + anyMsgs := make([]*anypb.Any, len(tc.args.msgs)) + for j, msg := range tc.args.msgs { + legacyAny, err := codectypes.NewAnyWithValue(msg) + require.NoError(t, err) + anyMsgs[j] = &anypb.Any{ + TypeUrl: legacyAny.TypeUrl, + Value: legacyAny.Value, + } + } + got, err := handler.GetSignBytes( + context.TODO(), + txsigning.SignerData{ + Address: "foo", + ChainID: tc.args.chainID, + AccountNumber: tc.args.accnum, + Sequence: tc.args.sequence, + }, + txsigning.TxData{ + Body: &txv1beta1.TxBody{ + Memo: tc.args.memo, + Messages: anyMsgs, + TimeoutHeight: tc.args.timeoutHeight, + }, + AuthInfo: &txv1beta1.AuthInfo{ + Fee: tc.args.fee, + Tip: tc.args.tip, + }, + }, + ) + require.NoError(t, err) + require.Equal(t, tc.want, string(got), "Got unexpected result on test case i: %d", i) }) } } diff --git a/x/auth/simulation/genesis.go b/x/auth/simulation/genesis.go index 550064c07bd..1f9d45e5527 100644 --- a/x/auth/simulation/genesis.go +++ b/x/auth/simulation/genesis.go @@ -90,34 +90,19 @@ func GenSigVerifyCostSECP256K1(r *rand.Rand) uint64 { // RandomizedGenState generates a random GenesisState for auth func RandomizedGenState(simState *module.SimulationState, randGenAccountsFn types.RandomGenesisAccountsFn) { var maxMemoChars uint64 - simState.AppParams.GetOrGenerate( - simState.Cdc, MaxMemoChars, &maxMemoChars, simState.Rand, - func(r *rand.Rand) { maxMemoChars = GenMaxMemoChars(r) }, - ) + simState.AppParams.GetOrGenerate(MaxMemoChars, &maxMemoChars, simState.Rand, func(r *rand.Rand) { maxMemoChars = GenMaxMemoChars(r) }) var txSigLimit uint64 - simState.AppParams.GetOrGenerate( - simState.Cdc, TxSigLimit, &txSigLimit, simState.Rand, - func(r *rand.Rand) { txSigLimit = GenTxSigLimit(r) }, - ) + simState.AppParams.GetOrGenerate(TxSigLimit, &txSigLimit, simState.Rand, func(r *rand.Rand) { txSigLimit = GenTxSigLimit(r) }) var txSizeCostPerByte uint64 - simState.AppParams.GetOrGenerate( - simState.Cdc, TxSizeCostPerByte, &txSizeCostPerByte, simState.Rand, - func(r *rand.Rand) { txSizeCostPerByte = GenTxSizeCostPerByte(r) }, - ) + simState.AppParams.GetOrGenerate(TxSizeCostPerByte, &txSizeCostPerByte, simState.Rand, func(r *rand.Rand) { txSizeCostPerByte = GenTxSizeCostPerByte(r) }) var sigVerifyCostED25519 uint64 - simState.AppParams.GetOrGenerate( - simState.Cdc, SigVerifyCostED25519, &sigVerifyCostED25519, simState.Rand, - func(r *rand.Rand) { sigVerifyCostED25519 = GenSigVerifyCostED25519(r) }, - ) + simState.AppParams.GetOrGenerate(SigVerifyCostED25519, &sigVerifyCostED25519, simState.Rand, func(r *rand.Rand) { sigVerifyCostED25519 = GenSigVerifyCostED25519(r) }) var sigVerifyCostSECP256K1 uint64 - simState.AppParams.GetOrGenerate( - simState.Cdc, SigVerifyCostSECP256K1, &sigVerifyCostSECP256K1, simState.Rand, - func(r *rand.Rand) { sigVerifyCostSECP256K1 = GenSigVerifyCostSECP256K1(r) }, - ) + simState.AppParams.GetOrGenerate(SigVerifyCostSECP256K1, &sigVerifyCostSECP256K1, simState.Rand, func(r *rand.Rand) { sigVerifyCostSECP256K1 = GenSigVerifyCostSECP256K1(r) }) params := types.NewParams(maxMemoChars, txSigLimit, txSizeCostPerByte, sigVerifyCostED25519, sigVerifyCostSECP256K1) diff --git a/x/auth/tx/legacy_amino_json_test.go b/x/auth/tx/legacy_amino_json_test.go index 536df0a4aad..cdb7ee284d2 100644 --- a/x/auth/tx/legacy_amino_json_test.go +++ b/x/auth/tx/legacy_amino_json_test.go @@ -8,6 +8,8 @@ import ( "cosmossdk.io/x/tx/signing/aminojson" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -38,6 +40,7 @@ func buildTx(t *testing.T, bldr *wrapper) { } func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) { + legacytx.RegressionTestingAminoCodec = codec.NewLegacyAmino() var ( chainID = "test-chain" accNum uint64 = 7 @@ -152,6 +155,9 @@ func TestLegacyAminoJSONHandler_AllGetSignBytesComparison(t *testing.T) { modeHandler := aminojson.NewSignModeHandler(aminojson.SignModeHandlerOptions{}) mode, _ := signing.APISignModeToInternal(modeHandler.Mode()) + legacyAmino := codec.NewLegacyAmino() + legacy.RegisterAminoMsg(legacyAmino, &banktypes.MsgSend{}, "cosmos-sdk/MsgSend") + legacytx.RegressionTestingAminoCodec = legacyAmino testcases := []struct { name string @@ -221,6 +227,8 @@ func TestLegacyAminoJSONHandler_AllGetSignBytesComparison(t *testing.T) { require.Equal(t, string(tc.expectedSignBz), string(newSignBz)) }) } + + legacytx.RegressionTestingAminoCodec = nil } func TestLegacyAminoJSONHandler_DefaultMode(t *testing.T) { diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index 554e5dc73f5..ee9fdf48289 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -4,13 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the account interfaces and concrete types on the @@ -63,20 +59,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgUpdateParams{}, ) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/auth/types/msgs.go b/x/auth/types/msgs.go index df6930d5fd4..8beea7684e6 100644 --- a/x/auth/types/msgs.go +++ b/x/auth/types/msgs.go @@ -2,18 +2,9 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var ( - _ sdk.Msg = &MsgUpdateParams{} - _ legacytx.LegacyMsg = &MsgUpdateParams{} -) - -// GetSignBytes implements the LegacyMsg interface. -func (msg MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} +var _ sdk.Msg = &MsgUpdateParams{} // GetSigners returns the expected signers for a MsgUpdateParams message. func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { diff --git a/x/auth/vesting/types/codec.go b/x/auth/vesting/types/codec.go index 9a95ccf62a1..0b03bdff9f0 100644 --- a/x/auth/vesting/types/codec.go +++ b/x/auth/vesting/types/codec.go @@ -4,14 +4,10 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the @@ -66,20 +62,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/auth/vesting/types/msgs.go b/x/auth/vesting/types/msgs.go index 34732a96891..3d31b05bb26 100644 --- a/x/auth/vesting/types/msgs.go +++ b/x/auth/vesting/types/msgs.go @@ -2,17 +2,12 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) var ( _ sdk.Msg = &MsgCreateVestingAccount{} _ sdk.Msg = &MsgCreatePermanentLockedAccount{} _ sdk.Msg = &MsgCreatePeriodicVestingAccount{} - - _ legacytx.LegacyMsg = &MsgCreateVestingAccount{} - _ legacytx.LegacyMsg = &MsgCreatePermanentLockedAccount{} - _ legacytx.LegacyMsg = &MsgCreatePeriodicVestingAccount{} ) // NewMsgCreateVestingAccount returns a reference to a new MsgCreateVestingAccount. @@ -26,12 +21,6 @@ func NewMsgCreateVestingAccount(fromAddr, toAddr sdk.AccAddress, amount sdk.Coin } } -// GetSignBytes returns the bytes all expected signers must sign over for a -// MsgCreateVestingAccount. -func (msg MsgCreateVestingAccount) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - // GetSigners returns the expected signers for a MsgCreateVestingAccount. func (msg MsgCreateVestingAccount) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.FromAddress) @@ -47,12 +36,6 @@ func NewMsgCreatePermanentLockedAccount(fromAddr, toAddr sdk.AccAddress, amount } } -// GetSignBytes returns the bytes all expected signers must sign over for a -// MsgCreatePermanentLockedAccount. -func (msg MsgCreatePermanentLockedAccount) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - // GetSigners returns the expected signers for a MsgCreatePermanentLockedAccount. func (msg MsgCreatePermanentLockedAccount) GetSigners() []sdk.AccAddress { from, _ := sdk.AccAddressFromBech32(msg.FromAddress) @@ -77,9 +60,3 @@ func (msg MsgCreatePeriodicVestingAccount) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{from} } - -// GetSignBytes returns the bytes all expected signers must sign over for a -// MsgCreatePeriodicVestingAccount. -func (msg MsgCreatePeriodicVestingAccount) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} diff --git a/x/authz/codec.go b/x/authz/codec.go index c9a07702d95..d2e43b88316 100644 --- a/x/authz/codec.go +++ b/x/authz/codec.go @@ -6,9 +6,6 @@ import ( types "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the necessary x/authz interfaces and concrete types @@ -38,11 +35,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, MsgServiceDesc()) } - -func init() { - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/authz/codec/cdc.go b/x/authz/codec/cdc.go deleted file mode 100644 index 520e435afd6..00000000000 --- a/x/authz/codec/cdc.go +++ /dev/null @@ -1,18 +0,0 @@ -package codec - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(Amino) -) - -func init() { - cryptocodec.RegisterCrypto(Amino) - codec.RegisterEvidences(Amino) - sdk.RegisterLegacyAminoCodec(Amino) -} diff --git a/x/authz/msgs.go b/x/authz/msgs.go index 306a1762a04..c0ed9c0eada 100644 --- a/x/authz/msgs.go +++ b/x/authz/msgs.go @@ -3,9 +3,6 @@ package authz import ( "time" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - "github.com/cosmos/gogoproto/proto" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -18,11 +15,6 @@ var ( _ sdk.Msg = &MsgRevoke{} _ sdk.Msg = &MsgExec{} - // For amino support. - _ legacytx.LegacyMsg = &MsgGrant{} - _ legacytx.LegacyMsg = &MsgRevoke{} - _ legacytx.LegacyMsg = &MsgExec{} - _ cdctypes.UnpackInterfacesMessage = &MsgGrant{} _ cdctypes.UnpackInterfacesMessage = &MsgExec{} ) @@ -47,11 +39,6 @@ func (msg MsgGrant) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{granter} } -// GetSignBytes implements the LegacyMsg.GetSignBytes method. -func (msg MsgGrant) GetSignBytes() []byte { - return sdk.MustSortJSON(authzcodec.Amino.MustMarshalJSON(&msg)) -} - // GetAuthorization returns the cache value from the MsgGrant.Authorization if present. func (msg *MsgGrant) GetAuthorization() (Authorization, error) { return msg.Grant.GetAuthorization() @@ -104,11 +91,6 @@ func (msg MsgRevoke) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{granter} } -// GetSignBytes implements the LegacyMsg.GetSignBytes method. -func (msg MsgRevoke) GetSignBytes() []byte { - return sdk.MustSortJSON(authzcodec.Amino.MustMarshalJSON(&msg)) -} - // NewMsgExec creates a new MsgExecAuthorized func NewMsgExec(grantee sdk.AccAddress, msgs []sdk.Msg) MsgExec { msgsAny := make([]*cdctypes.Any, len(msgs)) @@ -146,8 +128,3 @@ func (msg MsgExec) GetSigners() []sdk.AccAddress { grantee, _ := sdk.AccAddressFromBech32(msg.Grantee) return []sdk.AccAddress{grantee} } - -// GetSignBytes implements the LegacyMsg.GetSignBytes method. -func (msg MsgExec) GetSignBytes() []byte { - return sdk.MustSortJSON(authzcodec.Amino.MustMarshalJSON(&msg)) -} diff --git a/x/authz/msgs_test.go b/x/authz/msgs_test.go index 6514dad55d3..bcd17cf4d86 100644 --- a/x/authz/msgs_test.go +++ b/x/authz/msgs_test.go @@ -1,14 +1,24 @@ package authz_test import ( + "context" + "fmt" "testing" "time" + "github.com/cosmos/gogoproto/proto" + "google.golang.org/protobuf/types/known/anypb" + + txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" + txsigning "cosmossdk.io/x/tx/signing" + "cosmossdk.io/x/tx/signing/aminojson" + "github.com/cosmos/cosmos-sdk/codec" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" + sdkmath "cosmossdk.io/math" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" @@ -39,8 +49,17 @@ func TestMsgGrantGetAuthorization(t *testing.T) { } func TestAminoJSON(t *testing.T) { + legacyAmino := codec.NewLegacyAmino() + authz.RegisterLegacyAminoCodec(legacyAmino) + banktypes.RegisterLegacyAminoCodec(legacyAmino) + stakingtypes.RegisterLegacyAminoCodec(legacyAmino) + legacytx.RegressionTestingAminoCodec = legacyAmino + + aminoHandler := aminojson.NewSignModeHandler(aminojson.SignModeHandlerOptions{ + FileResolver: proto.HybridResolver, + }) + tx := legacytx.StdTx{} - var msg legacytx.LegacyMsg blockTime := time.Date(1, 1, 1, 1, 1, 1, 1, time.UTC) expiresAt := blockTime.Add(time.Hour) msgSend := banktypes.MsgSend{FromAddress: "cosmos1ghi", ToAddress: "cosmos1jkl"} @@ -66,38 +85,64 @@ func TestAminoJSON(t *testing.T) { // This was a bug. Now, it's as below, See how there's `type` & `value` fields. // ref: https://github.com/cosmos/cosmos-sdk/issues/11190 // ref: https://github.com/cosmos/cosmjs/issues/1026 - msg = &authz.MsgGrant{Granter: "cosmos1abc", Grantee: "cosmos1def", Grant: grant} - tx.Msgs = []sdk.Msg{msg} - require.Equal(t, - `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgGrant","value":{"grant":{"authorization":{"type":"cosmos-sdk/GenericAuthorization","value":{"msg":"/cosmos.bank.v1beta1.MsgSend"}},"expiration":"0001-01-01T02:01:01.000000001Z"},"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, - string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo", nil)), - ) - - msg = &authz.MsgGrant{Granter: "cosmos1abc", Grantee: "cosmos1def", Grant: sendGrant} - tx.Msgs = []sdk.Msg{msg} - require.Equal(t, - `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgGrant","value":{"grant":{"authorization":{"type":"cosmos-sdk/SendAuthorization","value":{"spend_limit":[{"amount":"1000","denom":"stake"}]}},"expiration":"0001-01-01T02:01:01.000000001Z"},"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, - string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo", nil)), - ) - - msg = &authz.MsgGrant{Granter: "cosmos1abc", Grantee: "cosmos1def", Grant: delegateGrant} - tx.Msgs = []sdk.Msg{msg} - require.Equal(t, - `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgGrant","value":{"grant":{"authorization":{"type":"cosmos-sdk/StakeAuthorization","value":{"Validators":{"type":"cosmos-sdk/StakeAuthorization/AllowList","value":{"allow_list":{"address":["cosmosvaloper1xcy3els9ua75kdm783c3qu0rfa2eples6eavqq"]}}},"authorization_type":1,"max_tokens":{"amount":"1000","denom":"stake"}}}},"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, - string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo", nil)), - ) - - msg = &authz.MsgRevoke{Granter: "cosmos1abc", Grantee: "cosmos1def", MsgTypeUrl: typeURL} - tx.Msgs = []sdk.Msg{msg} - require.Equal(t, - `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgRevoke","value":{"grantee":"cosmos1def","granter":"cosmos1abc","msg_type_url":"/cosmos.bank.v1beta1.MsgSend"}}],"sequence":"1","timeout_height":"1"}`, - string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo", nil)), - ) - - msg = &authz.MsgExec{Grantee: "cosmos1def", Msgs: []*cdctypes.Any{msgSendAny}} - tx.Msgs = []sdk.Msg{msg} - require.Equal(t, - `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgExec","value":{"grantee":"cosmos1def","msgs":[{"type":"cosmos-sdk/MsgSend","value":{"amount":[],"from_address":"cosmos1ghi","to_address":"cosmos1jkl"}}]}}],"sequence":"1","timeout_height":"1"}`, - string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{msg}, "memo", nil)), - ) + tests := []struct { + msg sdk.Msg + exp string + }{ + { + msg: &authz.MsgGrant{Granter: "cosmos1abc", Grantee: "cosmos1def", Grant: grant}, + exp: `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgGrant","value":{"grant":{"authorization":{"type":"cosmos-sdk/GenericAuthorization","value":{"msg":"/cosmos.bank.v1beta1.MsgSend"}},"expiration":"0001-01-01T02:01:01.000000001Z"},"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, + }, + { + msg: &authz.MsgGrant{Granter: "cosmos1abc", Grantee: "cosmos1def", Grant: sendGrant}, + exp: `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgGrant","value":{"grant":{"authorization":{"type":"cosmos-sdk/SendAuthorization","value":{"spend_limit":[{"amount":"1000","denom":"stake"}]}},"expiration":"0001-01-01T02:01:01.000000001Z"},"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, + }, + { + msg: &authz.MsgGrant{Granter: "cosmos1abc", Grantee: "cosmos1def", Grant: delegateGrant}, + exp: `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgGrant","value":{"grant":{"authorization":{"type":"cosmos-sdk/StakeAuthorization","value":{"Validators":{"type":"cosmos-sdk/StakeAuthorization/AllowList","value":{"allow_list":{"address":["cosmosvaloper1xcy3els9ua75kdm783c3qu0rfa2eples6eavqq"]}}},"authorization_type":1,"max_tokens":{"amount":"1000","denom":"stake"}}}},"grantee":"cosmos1def","granter":"cosmos1abc"}}],"sequence":"1","timeout_height":"1"}`, + }, + { + msg: &authz.MsgRevoke{Granter: "cosmos1abc", Grantee: "cosmos1def", MsgTypeUrl: typeURL}, + exp: `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgRevoke","value":{"grantee":"cosmos1def","granter":"cosmos1abc","msg_type_url":"/cosmos.bank.v1beta1.MsgSend"}}],"sequence":"1","timeout_height":"1"}`, + }, + { + msg: &authz.MsgExec{Grantee: "cosmos1def", Msgs: []*cdctypes.Any{msgSendAny}}, + exp: `{"account_number":"1","chain_id":"foo","fee":{"amount":[],"gas":"0"},"memo":"memo","msgs":[{"type":"cosmos-sdk/MsgExec","value":{"grantee":"cosmos1def","msgs":[{"type":"cosmos-sdk/MsgSend","value":{"amount":[],"from_address":"cosmos1ghi","to_address":"cosmos1jkl"}}]}}],"sequence":"1","timeout_height":"1"}`, + }, + } + for i, tt := range tests { + t.Run(fmt.Sprintf("case %d", i), func(t *testing.T) { + tx.Msgs = []sdk.Msg{tt.msg} + legacyJSON := string(legacytx.StdSignBytes("foo", 1, 1, 1, legacytx.StdFee{}, []sdk.Msg{tt.msg}, "memo", nil)) + require.Equal(t, tt.exp, legacyJSON) + + legacyAny, err := cdctypes.NewAnyWithValue(tt.msg) + require.NoError(t, err) + anyMsg := &anypb.Any{ + TypeUrl: legacyAny.TypeUrl, + Value: legacyAny.Value, + } + aminoJSON, err := aminoHandler.GetSignBytes( + context.TODO(), + txsigning.SignerData{ + Address: "foo", + ChainID: "foo", + AccountNumber: 1, + Sequence: 1, + }, + txsigning.TxData{ + Body: &txv1beta1.TxBody{ + Memo: "memo", + Messages: []*anypb.Any{anyMsg}, + TimeoutHeight: 1, + }, + AuthInfo: &txv1beta1.AuthInfo{ + Fee: &txv1beta1.Fee{}, + }, + }, + ) + require.NoError(t, err) + require.Equal(t, tt.exp, string(aminoJSON)) + }) + } } diff --git a/x/authz/simulation/genesis.go b/x/authz/simulation/genesis.go index ab49f02aa67..8dfaf7ed181 100644 --- a/x/authz/simulation/genesis.go +++ b/x/authz/simulation/genesis.go @@ -58,12 +58,9 @@ func newAnyAuthorization(a authz.Authorization) *codectypes.Any { // RandomizedGenState generates a random GenesisState for authz. func RandomizedGenState(simState *module.SimulationState) { var grants []authz.GrantAuthorization - simState.AppParams.GetOrGenerate( - simState.Cdc, "authz", &grants, simState.Rand, - func(r *rand.Rand) { - grants = genGrant(r, simState.Accounts, simState.GenTimestamp) - }, - ) + simState.AppParams.GetOrGenerate("authz", &grants, simState.Rand, func(r *rand.Rand) { + grants = genGrant(r, simState.Accounts, simState.GenTimestamp) + }) authzGrantsGenesis := authz.NewGenesisState(grants) diff --git a/x/authz/simulation/operations.go b/x/authz/simulation/operations.go index ecdabd82a82..80063b2d09f 100644 --- a/x/authz/simulation/operations.go +++ b/x/authz/simulation/operations.go @@ -55,23 +55,17 @@ func WeightedOperations( weightRevoke int ) - appParams.GetOrGenerate(cdc, OpWeightMsgGrant, &weightMsgGrant, nil, - func(_ *rand.Rand) { - weightMsgGrant = WeightGrant - }, - ) + appParams.GetOrGenerate(OpWeightMsgGrant, &weightMsgGrant, nil, func(_ *rand.Rand) { + weightMsgGrant = WeightGrant + }) - appParams.GetOrGenerate(cdc, OpWeightExec, &weightExec, nil, - func(_ *rand.Rand) { - weightExec = WeightExec - }, - ) + appParams.GetOrGenerate(OpWeightExec, &weightExec, nil, func(_ *rand.Rand) { + weightExec = WeightExec + }) - appParams.GetOrGenerate(cdc, OpWeightRevoke, &weightRevoke, nil, - func(_ *rand.Rand) { - weightRevoke = WeightRevoke - }, - ) + appParams.GetOrGenerate(OpWeightRevoke, &weightRevoke, nil, func(_ *rand.Rand) { + weightRevoke = WeightRevoke + }) pCdc := codec.NewProtoCodec(registry) diff --git a/x/bank/simulation/genesis.go b/x/bank/simulation/genesis.go index 4f4745db1f0..1dd6fd3dc8a 100644 --- a/x/bank/simulation/genesis.go +++ b/x/bank/simulation/genesis.go @@ -72,10 +72,7 @@ func RandomGenesisBalances(simState *module.SimulationState) []types.Balance { // RandomizedGenState generates a random GenesisState for bank func RandomizedGenState(simState *module.SimulationState) { var defaultSendEnabledParam bool - simState.AppParams.GetOrGenerate( - simState.Cdc, string(types.KeyDefaultSendEnabled), &defaultSendEnabledParam, simState.Rand, - func(r *rand.Rand) { defaultSendEnabledParam = RandomGenesisDefaultSendEnabledParam(r) }, - ) + simState.AppParams.GetOrGenerate(string(types.KeyDefaultSendEnabled), &defaultSendEnabledParam, simState.Rand, func(r *rand.Rand) { defaultSendEnabledParam = RandomGenesisDefaultSendEnabledParam(r) }) sendEnabled := RandomGenesisSendEnabled(simState.Rand, simState.BondDenom) diff --git a/x/bank/simulation/operations.go b/x/bank/simulation/operations.go index 56b5c1ed0cc..33faddd5e85 100644 --- a/x/bank/simulation/operations.go +++ b/x/bank/simulation/operations.go @@ -33,17 +33,13 @@ func WeightedOperations( bk keeper.Keeper, ) simulation.WeightedOperations { var weightMsgSend, weightMsgMultiSend int - appParams.GetOrGenerate(cdc, OpWeightMsgSend, &weightMsgSend, nil, - func(_ *rand.Rand) { - weightMsgSend = DefaultWeightMsgSend - }, - ) + appParams.GetOrGenerate(OpWeightMsgSend, &weightMsgSend, nil, func(_ *rand.Rand) { + weightMsgSend = DefaultWeightMsgSend + }) - appParams.GetOrGenerate(cdc, OpWeightMsgMultiSend, &weightMsgMultiSend, nil, - func(_ *rand.Rand) { - weightMsgMultiSend = DefaultWeightMsgMultiSend - }, - ) + appParams.GetOrGenerate(OpWeightMsgMultiSend, &weightMsgMultiSend, nil, func(_ *rand.Rand) { + weightMsgMultiSend = DefaultWeightMsgMultiSend + }) return simulation.WeightedOperations{ simulation.NewWeightedOperation( diff --git a/x/bank/types/codec.go b/x/bank/types/codec.go index d23ef9c6238..72780f9d69c 100644 --- a/x/bank/types/codec.go +++ b/x/bank/types/codec.go @@ -4,13 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" "github.com/cosmos/cosmos-sdk/x/authz" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the necessary x/bank interfaces and concrete types @@ -38,20 +34,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/bank/types/msgs.go b/x/bank/types/msgs.go index f3a70d6f3e1..a020fdd47ec 100644 --- a/x/bank/types/msgs.go +++ b/x/bank/types/msgs.go @@ -2,17 +2,12 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) var ( _ sdk.Msg = &MsgSend{} _ sdk.Msg = &MsgMultiSend{} _ sdk.Msg = &MsgUpdateParams{} - - _ legacytx.LegacyMsg = &MsgSend{} - _ legacytx.LegacyMsg = &MsgMultiSend{} - _ legacytx.LegacyMsg = &MsgUpdateParams{} ) // NewMsgSend - construct a msg to send coins from one account to another. @@ -20,11 +15,6 @@ func NewMsgSend(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgSend { return &MsgSend{FromAddress: fromAddr.String(), ToAddress: toAddr.String(), Amount: amount} } -// GetSignBytes Implements Msg. -func (msg MsgSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - // GetSigners Implements Msg. func (msg MsgSend) GetSigners() []sdk.AccAddress { fromAddress, _ := sdk.AccAddressFromBech32(msg.FromAddress) @@ -36,11 +26,6 @@ func NewMsgMultiSend(in Input, out []Output) *MsgMultiSend { return &MsgMultiSend{Inputs: []Input{in}, Outputs: out} } -// GetSignBytes Implements Msg. -func (msg MsgMultiSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - // GetSigners Implements Msg. func (msg MsgMultiSend) GetSigners() []sdk.AccAddress { // should not happen as ValidateBasic would have failed @@ -59,13 +44,6 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{authority} } -// GetSignBytes returns the raw bytes for a MsgUpdateParams message that -// the expected signer needs to sign. -func (msg MsgUpdateParams) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // NewMsgSetSendEnabled Construct a message to set one or more SendEnabled entries. func NewMsgSetSendEnabled(authority string, sendEnabled []*SendEnabled, useDefaultFor []string) *MsgSetSendEnabled { return &MsgSetSendEnabled{ @@ -75,11 +53,6 @@ func NewMsgSetSendEnabled(authority string, sendEnabled []*SendEnabled, useDefau } } -// GetSignBytes implements the LegacyMsg interface. -func (msg MsgSetSendEnabled) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - // GetSigners returns the expected signers for MsgSoftwareUpgrade. func (msg MsgSetSendEnabled) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Authority) diff --git a/x/bank/types/msgs_test.go b/x/bank/types/msgs_test.go index 4f6462da26a..50c7a7f7aec 100644 --- a/x/bank/types/msgs_test.go +++ b/x/bank/types/msgs_test.go @@ -6,6 +6,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -16,7 +18,8 @@ func TestMsgSendGetSignBytes(t *testing.T) { addr2 := sdk.AccAddress([]byte("output")) coins := sdk.NewCoins(sdk.NewInt64Coin("atom", 10)) msg := NewMsgSend(addr1, addr2, coins) - res := msg.GetSignBytes() + res, err := codec.NewProtoCodec(types.NewInterfaceRegistry()).MarshalAminoJSON(msg) + require.NoError(t, err) expected := `{"type":"cosmos-sdk/MsgSend","value":{"amount":[{"amount":"10","denom":"atom"}],"from_address":"cosmos1d9h8qat57ljhcm","to_address":"cosmos1da6hgur4wsmpnjyg"}}` require.Equal(t, expected, string(res)) @@ -108,11 +111,12 @@ func TestMsgMultiSendGetSignBytes(t *testing.T) { addr1 := sdk.AccAddress([]byte("input")) addr2 := sdk.AccAddress([]byte("output")) coins := sdk.NewCoins(sdk.NewInt64Coin("atom", 10)) - msg := MsgMultiSend{ + msg := &MsgMultiSend{ Inputs: []Input{NewInput(addr1, coins)}, Outputs: []Output{NewOutput(addr2, coins)}, } - res := msg.GetSignBytes() + res, err := codec.NewProtoCodec(types.NewInterfaceRegistry()).MarshalAminoJSON(msg) + require.NoError(t, err) expected := `{"type":"cosmos-sdk/MsgMultiSend","value":{"inputs":[{"address":"cosmos1d9h8qat57ljhcm","coins":[{"amount":"10","denom":"atom"}]}],"outputs":[{"address":"cosmos1da6hgur4wsmpnjyg","coins":[{"amount":"10","denom":"atom"}]}]}}` require.Equal(t, expected, string(res)) @@ -152,7 +156,8 @@ func TestMsgSendGetSigners(t *testing.T) { func TestMsgSetSendEnabledGetSignBytes(t *testing.T) { msg := NewMsgSetSendEnabled("cartman", []*SendEnabled{{"casafiestacoin", false}, {"kylecoin", true}}, nil) expected := `{"type":"cosmos-sdk/MsgSetSendEnabled","value":{"authority":"cartman","send_enabled":[{"denom":"casafiestacoin"},{"denom":"kylecoin","enabled":true}]}}` - actualBz := msg.GetSignBytes() + actualBz, err := codec.NewProtoCodec(types.NewInterfaceRegistry()).MarshalAminoJSON(msg) + require.NoError(t, err) actual := string(actualBz) assert.Equal(t, expected, actual) } diff --git a/x/circuit/types/codec.go b/x/circuit/types/codec.go index 6b58fd3d217..2afe054d808 100644 --- a/x/circuit/types/codec.go +++ b/x/circuit/types/codec.go @@ -4,31 +4,10 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" types "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} - // RegisterLegacyAminoCodec registers the necessary x/bank interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { diff --git a/x/circuit/types/msgs.go b/x/circuit/types/msgs.go index 63a6333e766..216a26514b1 100644 --- a/x/circuit/types/msgs.go +++ b/x/circuit/types/msgs.go @@ -25,11 +25,6 @@ func (m MsgAuthorizeCircuitBreaker) Route() string { return sdk.MsgTypeURL(&m) } // Type Implements Msg. func (m MsgAuthorizeCircuitBreaker) Type() string { return sdk.MsgTypeURL(&m) } -// GetSignBytes Implements Msg. -func (m MsgAuthorizeCircuitBreaker) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgAuthorizeCircuitBreaker. func (m MsgAuthorizeCircuitBreaker) GetSigners() []sdk.AccAddress { granter := sdk.MustAccAddressFromBech32(m.Granter) @@ -51,11 +46,6 @@ func (m MsgTripCircuitBreaker) Route() string { return sdk.MsgTypeURL(&m) } // Type Implements Msg. func (m MsgTripCircuitBreaker) Type() string { return sdk.MsgTypeURL(&m) } -// GetSignBytes Implements Msg. -func (m MsgTripCircuitBreaker) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgTripCircuitBreaker. func (m MsgTripCircuitBreaker) GetSigners() []sdk.AccAddress { granter := sdk.MustAccAddressFromBech32(m.Authority) @@ -77,11 +67,6 @@ func (m MsgResetCircuitBreaker) Route() string { return sdk.MsgTypeURL(&m) } // Type Implements Msg. func (m MsgResetCircuitBreaker) Type() string { return sdk.MsgTypeURL(&m) } -// GetSignBytes Implements Msg. -func (m MsgResetCircuitBreaker) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgResetCircuitBreaker. func (m MsgResetCircuitBreaker) GetSigners() []sdk.AccAddress { granter := sdk.MustAccAddressFromBech32(m.Authority) diff --git a/x/consensus/types/codec.go b/x/consensus/types/codec.go index 205596743fa..048d9a42776 100644 --- a/x/consensus/types/codec.go +++ b/x/consensus/types/codec.go @@ -4,12 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) func RegisterInterfaces(registry types.InterfaceRegistry) { @@ -26,20 +22,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/consensus/MsgUpdateParams") } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgUpdate instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/consensus/types/msgs.go b/x/consensus/types/msgs.go index c04ac71da71..8b1a8345eef 100644 --- a/x/consensus/types/msgs.go +++ b/x/consensus/types/msgs.go @@ -5,13 +5,9 @@ import ( cmttypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var ( - _ sdk.Msg = &MsgUpdateParams{} - _ legacytx.LegacyMsg = &MsgUpdateParams{} -) +var _ sdk.Msg = &MsgUpdateParams{} // GetSigners returns the signer addresses that are expected to sign the result // of GetSignBytes. @@ -20,12 +16,6 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{authority} } -// GetSignBytes returns the raw bytes for a MsgUpdateParams message that -// the expected signer needs to sign. -func (msg MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(amino.MustMarshalJSON(&msg)) -} - func (msg MsgUpdateParams) ToProtoConsensusParams() cmtproto.ConsensusParams { return cmtproto.ConsensusParams{ Block: &cmtproto.BlockParams{ diff --git a/x/crisis/types/codec.go b/x/crisis/types/codec.go index 189c48a6ffb..934b0b78b1d 100644 --- a/x/crisis/types/codec.go +++ b/x/crisis/types/codec.go @@ -4,12 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the necessary x/crisis interfaces and concrete types @@ -28,20 +24,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - aminoCdc = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(aminoCdc) -) - -func init() { - RegisterLegacyAminoCodec(aminoCdc) - cryptocodec.RegisterCrypto(aminoCdc) - sdk.RegisterLegacyAminoCodec(aminoCdc) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/crisis/types/msgs.go b/x/crisis/types/msgs.go index 39b7f9813dc..9d2e3c7350a 100644 --- a/x/crisis/types/msgs.go +++ b/x/crisis/types/msgs.go @@ -2,13 +2,11 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) // ensure Msg interface compliance at compile time var ( - _, _ sdk.Msg = &MsgVerifyInvariant{}, &MsgUpdateParams{} - _, _ legacytx.LegacyMsg = &MsgVerifyInvariant{}, &MsgUpdateParams{} + _, _ sdk.Msg = &MsgVerifyInvariant{}, &MsgUpdateParams{} ) // NewMsgVerifyInvariant creates a new MsgVerifyInvariant object @@ -26,12 +24,6 @@ func (msg MsgVerifyInvariant) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } -// GetSignBytes gets the sign bytes for the msg MsgVerifyInvariant -func (msg MsgVerifyInvariant) GetSignBytes() []byte { - bz := aminoCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // FullInvariantRoute - get the messages full invariant route func (msg MsgVerifyInvariant) FullInvariantRoute() string { return msg.InvariantModuleName + "/" + msg.InvariantRoute @@ -43,10 +35,3 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { authority, _ := sdk.AccAddressFromBech32(msg.Authority) return []sdk.AccAddress{authority} } - -// GetSignBytes returns the raw bytes for a MsgUpdateParams message that -// the expected signer needs to sign. -func (msg MsgUpdateParams) GetSignBytes() []byte { - bz := aminoCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} diff --git a/x/distribution/simulation/genesis.go b/x/distribution/simulation/genesis.go index fd0be5a9047..1a509250de4 100644 --- a/x/distribution/simulation/genesis.go +++ b/x/distribution/simulation/genesis.go @@ -6,6 +6,7 @@ import ( "math/rand" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/distribution/types" ) @@ -29,16 +30,10 @@ func GenWithdrawEnabled(r *rand.Rand) bool { // RandomizedGenState generates a random GenesisState for distribution func RandomizedGenState(simState *module.SimulationState) { var communityTax math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, CommunityTax, &communityTax, simState.Rand, - func(r *rand.Rand) { communityTax = GenCommunityTax(r) }, - ) + simState.AppParams.GetOrGenerate(CommunityTax, &communityTax, simState.Rand, func(r *rand.Rand) { communityTax = GenCommunityTax(r) }) var withdrawEnabled bool - simState.AppParams.GetOrGenerate( - simState.Cdc, WithdrawEnabled, &withdrawEnabled, simState.Rand, - func(r *rand.Rand) { withdrawEnabled = GenWithdrawEnabled(r) }, - ) + simState.AppParams.GetOrGenerate(WithdrawEnabled, &withdrawEnabled, simState.Rand, func(r *rand.Rand) { withdrawEnabled = GenWithdrawEnabled(r) }) distrGenesis := types.GenesisState{ FeePool: types.InitialFeePool(), diff --git a/x/distribution/simulation/operations.go b/x/distribution/simulation/operations.go index ce6e8e510b4..8de9fe1ce55 100644 --- a/x/distribution/simulation/operations.go +++ b/x/distribution/simulation/operations.go @@ -39,32 +39,24 @@ func WeightedOperations( sk types.StakingKeeper, ) simulation.WeightedOperations { var weightMsgSetWithdrawAddress int - appParams.GetOrGenerate(cdc, OpWeightMsgSetWithdrawAddress, &weightMsgSetWithdrawAddress, nil, - func(_ *rand.Rand) { - weightMsgSetWithdrawAddress = DefaultWeightMsgSetWithdrawAddress - }, - ) + appParams.GetOrGenerate(OpWeightMsgSetWithdrawAddress, &weightMsgSetWithdrawAddress, nil, func(_ *rand.Rand) { + weightMsgSetWithdrawAddress = DefaultWeightMsgSetWithdrawAddress + }) var weightMsgWithdrawDelegationReward int - appParams.GetOrGenerate(cdc, OpWeightMsgWithdrawDelegationReward, &weightMsgWithdrawDelegationReward, nil, - func(_ *rand.Rand) { - weightMsgWithdrawDelegationReward = DefaultWeightMsgWithdrawDelegationReward - }, - ) + appParams.GetOrGenerate(OpWeightMsgWithdrawDelegationReward, &weightMsgWithdrawDelegationReward, nil, func(_ *rand.Rand) { + weightMsgWithdrawDelegationReward = DefaultWeightMsgWithdrawDelegationReward + }) var weightMsgWithdrawValidatorCommission int - appParams.GetOrGenerate(cdc, OpWeightMsgWithdrawValidatorCommission, &weightMsgWithdrawValidatorCommission, nil, - func(_ *rand.Rand) { - weightMsgWithdrawValidatorCommission = DefaultWeightMsgWithdrawValidatorCommission - }, - ) + appParams.GetOrGenerate(OpWeightMsgWithdrawValidatorCommission, &weightMsgWithdrawValidatorCommission, nil, func(_ *rand.Rand) { + weightMsgWithdrawValidatorCommission = DefaultWeightMsgWithdrawValidatorCommission + }) var weightMsgFundCommunityPool int - appParams.GetOrGenerate(cdc, OpWeightMsgFundCommunityPool, &weightMsgFundCommunityPool, nil, - func(_ *rand.Rand) { - weightMsgFundCommunityPool = DefaultWeightMsgFundCommunityPool - }, - ) + appParams.GetOrGenerate(OpWeightMsgFundCommunityPool, &weightMsgFundCommunityPool, nil, func(_ *rand.Rand) { + weightMsgFundCommunityPool = DefaultWeightMsgFundCommunityPool + }) return simulation.WeightedOperations{ simulation.NewWeightedOperation( diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index 348360a567e..3cf2c732ca6 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -4,13 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the necessary x/distribution interfaces @@ -47,21 +43,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec - // so that this can later be used to properly serialize MsgGrant and MsgExec - // instances. - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/distribution/types/msg.go b/x/distribution/types/msg.go index 0e6337769f3..f8b1f666d5e 100644 --- a/x/distribution/types/msg.go +++ b/x/distribution/types/msg.go @@ -2,7 +2,6 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) // Verify interface at compile time @@ -13,13 +12,6 @@ var ( _ sdk.Msg = (*MsgUpdateParams)(nil) _ sdk.Msg = (*MsgCommunityPoolSpend)(nil) _ sdk.Msg = (*MsgDepositValidatorRewardsPool)(nil) - - _ legacytx.LegacyMsg = (*MsgSetWithdrawAddress)(nil) - _ legacytx.LegacyMsg = (*MsgWithdrawDelegatorReward)(nil) - _ legacytx.LegacyMsg = (*MsgWithdrawValidatorCommission)(nil) - _ legacytx.LegacyMsg = (*MsgUpdateParams)(nil) - _ legacytx.LegacyMsg = (*MsgCommunityPoolSpend)(nil) - _ legacytx.LegacyMsg = (*MsgDepositValidatorRewardsPool)(nil) ) func NewMsgSetWithdrawAddress(delAddr, withdrawAddr sdk.AccAddress) *MsgSetWithdrawAddress { @@ -35,12 +27,6 @@ func (msg MsgSetWithdrawAddress) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{delegator} } -// get the bytes for the message signer to sign on -func (msg MsgSetWithdrawAddress) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - func NewMsgWithdrawDelegatorReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) *MsgWithdrawDelegatorReward { return &MsgWithdrawDelegatorReward{ DelegatorAddress: delAddr.String(), @@ -54,12 +40,6 @@ func (msg MsgWithdrawDelegatorReward) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{delegator} } -// get the bytes for the message signer to sign on -func (msg MsgWithdrawDelegatorReward) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - func NewMsgWithdrawValidatorCommission(valAddr sdk.ValAddress) *MsgWithdrawValidatorCommission { return &MsgWithdrawValidatorCommission{ ValidatorAddress: valAddr.String(), @@ -72,12 +52,6 @@ func (msg MsgWithdrawValidatorCommission) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sdk.AccAddress(valAddr)} } -// get the bytes for the message signer to sign on -func (msg MsgWithdrawValidatorCommission) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // NewMsgFundCommunityPool returns a new MsgFundCommunityPool with a sender and // a funding amount. func NewMsgFundCommunityPool(amount sdk.Coins, depositor sdk.AccAddress) *MsgFundCommunityPool { @@ -94,13 +68,6 @@ func (msg MsgFundCommunityPool) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{depositor} } -// GetSignBytes returns the raw bytes for a MsgFundCommunityPool message that -// the expected signer needs to sign. -func (msg MsgFundCommunityPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the signer addresses that are expected to sign the result // of GetSignBytes. func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { @@ -108,13 +75,6 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{authority} } -// GetSignBytes returns the raw bytes for a MsgUpdateParams message that -// the expected signer needs to sign. -func (msg MsgUpdateParams) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the signer addresses that are expected to sign the result // of GetSignBytes, which is the authority. func (msg MsgCommunityPoolSpend) GetSigners() []sdk.AccAddress { @@ -122,13 +82,6 @@ func (msg MsgCommunityPoolSpend) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{authority} } -// GetSignBytes returns the raw bytes for a MsgCommunityPoolSpend message that -// the expected signer needs to sign. -func (msg MsgCommunityPoolSpend) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // NewMsgDepositValidatorRewardsPool returns a new MsgDepositValidatorRewardsPool // with a depositor and a funding amount. func NewMsgDepositValidatorRewardsPool(depositor sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coins) *MsgDepositValidatorRewardsPool { @@ -145,10 +98,3 @@ func (msg MsgDepositValidatorRewardsPool) GetSigners() []sdk.AccAddress { depositor, _ := sdk.AccAddressFromBech32(msg.Depositor) return []sdk.AccAddress{depositor} } - -// GetSignBytes returns the raw bytes for a MsgDepositValidatorRewardsPool message -// that the expected signer needs to sign. -func (msg MsgDepositValidatorRewardsPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} diff --git a/x/evidence/simulation/genesis.go b/x/evidence/simulation/genesis.go index cc22fcade7f..24b95627469 100644 --- a/x/evidence/simulation/genesis.go +++ b/x/evidence/simulation/genesis.go @@ -24,10 +24,7 @@ func GenEvidences(_ *rand.Rand, _ []simtypes.Account) []exported.Evidence { func RandomizedGenState(simState *module.SimulationState) { var ev []exported.Evidence - simState.AppParams.GetOrGenerate( - simState.Cdc, evidence, &ev, simState.Rand, - func(r *rand.Rand) { ev = GenEvidences(r, simState.Accounts) }, - ) + simState.AppParams.GetOrGenerate(evidence, &ev, simState.Rand, func(r *rand.Rand) { ev = GenEvidences(r, simState.Accounts) }) evidenceGenesis := types.NewGenesisState(ev) diff --git a/x/evidence/types/codec.go b/x/evidence/types/codec.go index afc88be8ca4..62ffa37cfde 100644 --- a/x/evidence/types/codec.go +++ b/x/evidence/types/codec.go @@ -6,12 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -33,20 +29,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/evidence/types/msgs.go b/x/evidence/types/msgs.go index 10c747174d6..c78d59c7dd4 100644 --- a/x/evidence/types/msgs.go +++ b/x/evidence/types/msgs.go @@ -3,17 +3,16 @@ package types import ( "fmt" - "cosmossdk.io/x/evidence/exported" "github.com/cosmos/gogoproto/proto" + "cosmossdk.io/x/evidence/exported" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) var ( _ sdk.Msg = &MsgSubmitEvidence{} - _ legacytx.LegacyMsg = &MsgSubmitEvidence{} _ types.UnpackInterfacesMessage = MsgSubmitEvidence{} _ exported.MsgSubmitEvidenceI = &MsgSubmitEvidence{} ) @@ -31,12 +30,6 @@ func NewMsgSubmitEvidence(s sdk.AccAddress, evi exported.Evidence) (*MsgSubmitEv return &MsgSubmitEvidence{Submitter: s.String(), Evidence: any}, nil } -// GetSignBytes returns the raw bytes a signer is expected to sign when submitting -// a MsgSubmitEvidence message. -func (m MsgSubmitEvidence) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the single expected signer for a MsgSubmitEvidence. func (m MsgSubmitEvidence) GetSigners() []sdk.AccAddress { submitter, _ := sdk.AccAddressFromBech32(m.Submitter) diff --git a/x/feegrant/codec.go b/x/feegrant/codec.go index 5007271a712..19c2d46f756 100644 --- a/x/feegrant/codec.go +++ b/x/feegrant/codec.go @@ -4,12 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the necessary x/feegrant interfaces and concrete types @@ -41,27 +37,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/feegrant module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/feegrant and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 140df73de9f..a80beb21696 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -27,7 +27,7 @@ require ( require ( cosmossdk.io/collections v0.1.0 // indirect - cosmossdk.io/x/tx v0.6.3 // indirect + cosmossdk.io/x/tx v0.7.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect @@ -155,6 +155,7 @@ replace ( // TODO: remove me when collections v0.2.0 is released cosmossdk.io/collections => ../../collections cosmossdk.io/core => ../../core + cosmossdk.io/store => ../../store cosmossdk.io/x/tx => ../tx cosmossdk.io/store => ../../store github.com/cosmos/cosmos-sdk => ../../ diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index e37b8c65617..9fd5797511c 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -45,8 +45,6 @@ cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0= cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4= cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= -cosmossdk.io/store v0.1.0-alpha.1.0.20230524212735-6cabb6aa5741 h1:FkLRZDiqtcb9OSbNQULnB93W4W44zwbW1fRYZiJwGVM= -cosmossdk.io/store v0.1.0-alpha.1.0.20230524212735-6cabb6aa5741/go.mod h1:hGr2ujwG6vkDTxzwWEBU3CC38HHP9G5LPSrtHae9VR8= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= diff --git a/x/feegrant/msgs.go b/x/feegrant/msgs.go index 1ff00590eb3..655c7bcb902 100644 --- a/x/feegrant/msgs.go +++ b/x/feegrant/msgs.go @@ -8,15 +8,11 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) var ( - _, _ sdk.Msg = &MsgGrantAllowance{}, &MsgRevokeAllowance{} - // For amino support. - _, _ legacytx.LegacyMsg = &MsgGrantAllowance{}, &MsgRevokeAllowance{} - - _ types.UnpackInterfacesMessage = &MsgGrantAllowance{} + _, _ sdk.Msg = &MsgGrantAllowance{}, &MsgRevokeAllowance{} + _ types.UnpackInterfacesMessage = &MsgGrantAllowance{} ) // NewMsgGrantAllowance creates a new MsgGrantAllowance. @@ -43,11 +39,6 @@ func (msg MsgGrantAllowance) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{granter} } -// GetSignBytes implements the LegacyMsg.GetSignBytes method. -func (msg MsgGrantAllowance) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - // GetFeeAllowanceI returns unpacked FeeAllowance func (msg MsgGrantAllowance) GetFeeAllowanceI() (FeeAllowanceI, error) { allowance, ok := msg.Allowance.GetCachedValue().(FeeAllowanceI) @@ -78,8 +69,3 @@ func (msg MsgRevokeAllowance) GetSigners() []sdk.AccAddress { granter, _ := sdk.AccAddressFromBech32(msg.Granter) return []sdk.AccAddress{granter} } - -// GetSignBytes implements the LegacyMsg.GetSignBytes method. -func (msg MsgRevokeAllowance) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} diff --git a/x/feegrant/msgs_test.go b/x/feegrant/msgs_test.go index 5e33f131dae..337bbe952e4 100644 --- a/x/feegrant/msgs_test.go +++ b/x/feegrant/msgs_test.go @@ -6,14 +6,19 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/x/feegrant" + + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) func TestAminoJSON(t *testing.T) { + legacyAmino := codec.NewLegacyAmino() + feegrant.RegisterLegacyAminoCodec(legacyAmino) + legacytx.RegressionTestingAminoCodec = legacyAmino tx := legacytx.StdTx{} - var msg legacytx.LegacyMsg + var msg sdk.Msg allowanceAny, err := codectypes.NewAnyWithValue(&feegrant.BasicAllowance{SpendLimit: sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(100)))}) require.NoError(t, err) diff --git a/x/feegrant/simulation/decoder_test.go b/x/feegrant/simulation/decoder_test.go index 2c7d288d1ab..e1f1bfddb46 100644 --- a/x/feegrant/simulation/decoder_test.go +++ b/x/feegrant/simulation/decoder_test.go @@ -10,6 +10,7 @@ import ( "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/module" "cosmossdk.io/x/feegrant/simulation" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" diff --git a/x/feegrant/simulation/genesis.go b/x/feegrant/simulation/genesis.go index ef995a979a8..95b2212fed5 100644 --- a/x/feegrant/simulation/genesis.go +++ b/x/feegrant/simulation/genesis.go @@ -6,6 +6,7 @@ import ( sdkmath "cosmossdk.io/math" "cosmossdk.io/x/feegrant" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -64,7 +65,7 @@ func RandomizedGenState(simState *module.SimulationState) { var feegrants []feegrant.Grant simState.AppParams.GetOrGenerate( - simState.Cdc, "feegrant", &feegrants, simState.Rand, + "feegrant", &feegrants, simState.Rand, func(r *rand.Rand) { feegrants = genFeeGrants(r, simState.Accounts) }, ) diff --git a/x/feegrant/simulation/operations.go b/x/feegrant/simulation/operations.go index 8dbcf1f7f90..488ab82e8c9 100644 --- a/x/feegrant/simulation/operations.go +++ b/x/feegrant/simulation/operations.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/core/address" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -43,13 +44,13 @@ func WeightedOperations( weightMsgRevokeAllowance int ) - appParams.GetOrGenerate(cdc, OpWeightMsgGrantAllowance, &weightMsgGrantAllowance, nil, + appParams.GetOrGenerate(OpWeightMsgGrantAllowance, &weightMsgGrantAllowance, nil, func(_ *rand.Rand) { weightMsgGrantAllowance = DefaultWeightGrantAllowance }, ) - appParams.GetOrGenerate(cdc, OpWeightMsgRevokeAllowance, &weightMsgRevokeAllowance, nil, + appParams.GetOrGenerate(OpWeightMsgRevokeAllowance, &weightMsgRevokeAllowance, nil, func(_ *rand.Rand) { weightMsgRevokeAllowance = DefaultWeightRevokeAllowance }, diff --git a/x/feegrant/simulation/operations_test.go b/x/feegrant/simulation/operations_test.go index e639c3f20e4..341b1da6884 100644 --- a/x/feegrant/simulation/operations_test.go +++ b/x/feegrant/simulation/operations_test.go @@ -9,6 +9,8 @@ import ( "cosmossdk.io/log" _ "cosmossdk.io/x/feegrant/module" + "github.com/cosmos/gogoproto/proto" + "github.com/cosmos/cosmos-sdk/client" _ "github.com/cosmos/cosmos-sdk/x/auth" _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" @@ -18,7 +20,6 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/mint" _ "github.com/cosmos/cosmos-sdk/x/params" _ "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/cosmos/gogoproto/proto" "cosmossdk.io/x/feegrant" "cosmossdk.io/x/feegrant/keeper" @@ -162,8 +163,8 @@ func (suite *SimTestSuite) TestSimulateMsgGrantAllowance() { require.NoError(err) var msg feegrant.MsgGrantAllowance - proto.Unmarshal(operationMsg.Msg, &msg) - + err = proto.Unmarshal(operationMsg.Msg, &msg) + require.NoError(err) require.True(operationMsg.OK) require.Equal(accounts[2].Address.String(), msg.Granter) require.Equal(accounts[1].Address.String(), msg.Grantee) @@ -204,8 +205,8 @@ func (suite *SimTestSuite) TestSimulateMsgRevokeAllowance() { require.NoError(err) var msg feegrant.MsgRevokeAllowance - proto.Unmarshal(operationMsg.Msg, &msg) - + err = proto.Unmarshal(operationMsg.Msg, &msg) + require.NoError(err) require.True(operationMsg.OK) require.Equal(granter.Address.String(), msg.Granter) require.Equal(grantee.Address.String(), msg.Grantee) diff --git a/x/gov/codec/cdc.go b/x/gov/codec/cdc.go deleted file mode 100644 index 520e435afd6..00000000000 --- a/x/gov/codec/cdc.go +++ /dev/null @@ -1,18 +0,0 @@ -package codec - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(Amino) -) - -func init() { - cryptocodec.RegisterCrypto(Amino) - codec.RegisterEvidences(Amino) - sdk.RegisterLegacyAminoCodec(Amino) -} diff --git a/x/gov/module.go b/x/gov/module.go index 584b74d0bd3..042cb1b6fde 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -359,7 +359,7 @@ func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { // WeightedOperations returns the all the gov module operations with their respective weights. func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { return simulation.WeightedOperations( - simState.AppParams, simState.Cdc, simState.TxConfig, + simState.AppParams, simState.TxConfig, am.accountKeeper, am.bankKeeper, am.keeper, simState.ProposalMsgs, simState.LegacyProposalContents, ) diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index e0d76aecd4d..16c58a914ce 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -99,70 +99,37 @@ func RandomizedGenState(simState *module.SimulationState) { startingProposalID := uint64(simState.Rand.Intn(100)) var minDeposit sdk.Coins - simState.AppParams.GetOrGenerate( - simState.Cdc, MinDeposit, &minDeposit, simState.Rand, - func(r *rand.Rand) { minDeposit = GenMinDeposit(r, simState.BondDenom) }, - ) + simState.AppParams.GetOrGenerate(MinDeposit, &minDeposit, simState.Rand, func(r *rand.Rand) { minDeposit = GenMinDeposit(r, simState.BondDenom) }) var expeditedMinDeposit sdk.Coins - simState.AppParams.GetOrGenerate( - simState.Cdc, ExpeditedMinDeposit, &expeditedMinDeposit, simState.Rand, - func(r *rand.Rand) { expeditedMinDeposit = GenExpeditedMinDeposit(r, simState.BondDenom) }, - ) + simState.AppParams.GetOrGenerate(ExpeditedMinDeposit, &expeditedMinDeposit, simState.Rand, func(r *rand.Rand) { expeditedMinDeposit = GenExpeditedMinDeposit(r, simState.BondDenom) }) var depositPeriod time.Duration - simState.AppParams.GetOrGenerate( - simState.Cdc, DepositPeriod, &depositPeriod, simState.Rand, - func(r *rand.Rand) { depositPeriod = GenDepositPeriod(r) }, - ) + simState.AppParams.GetOrGenerate(DepositPeriod, &depositPeriod, simState.Rand, func(r *rand.Rand) { depositPeriod = GenDepositPeriod(r) }) var minInitialDepositRatio sdkmath.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, MinInitialRatio, &minInitialDepositRatio, simState.Rand, - func(r *rand.Rand) { minInitialDepositRatio = GenDepositMinInitialDepositRatio(r) }, - ) + simState.AppParams.GetOrGenerate(MinInitialRatio, &minInitialDepositRatio, simState.Rand, func(r *rand.Rand) { minInitialDepositRatio = GenDepositMinInitialDepositRatio(r) }) var proposalCancelRate sdkmath.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, ProposalCancelRate, &proposalCancelRate, simState.Rand, - func(r *rand.Rand) { proposalCancelRate = GenProposalCancelRate(r) }, - ) + simState.AppParams.GetOrGenerate(ProposalCancelRate, &proposalCancelRate, simState.Rand, func(r *rand.Rand) { proposalCancelRate = GenProposalCancelRate(r) }) var votingPeriod time.Duration - simState.AppParams.GetOrGenerate( - simState.Cdc, VotingPeriod, &votingPeriod, simState.Rand, - func(r *rand.Rand) { votingPeriod = GenVotingPeriod(r) }, - ) + simState.AppParams.GetOrGenerate(VotingPeriod, &votingPeriod, simState.Rand, func(r *rand.Rand) { votingPeriod = GenVotingPeriod(r) }) var expeditedVotingPeriod time.Duration - simState.AppParams.GetOrGenerate( - simState.Cdc, ExpeditedVotingPeriod, &expeditedVotingPeriod, simState.Rand, - func(r *rand.Rand) { expeditedVotingPeriod = GenExpeditedVotingPeriod(r) }, - ) + simState.AppParams.GetOrGenerate(ExpeditedVotingPeriod, &expeditedVotingPeriod, simState.Rand, func(r *rand.Rand) { expeditedVotingPeriod = GenExpeditedVotingPeriod(r) }) var quorum sdkmath.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, Quorum, &quorum, simState.Rand, - func(r *rand.Rand) { quorum = GenQuorum(r) }, - ) + simState.AppParams.GetOrGenerate(Quorum, &quorum, simState.Rand, func(r *rand.Rand) { quorum = GenQuorum(r) }) var threshold sdkmath.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, Threshold, &threshold, simState.Rand, - func(r *rand.Rand) { threshold = GenThreshold(r) }, - ) + simState.AppParams.GetOrGenerate(Threshold, &threshold, simState.Rand, func(r *rand.Rand) { threshold = GenThreshold(r) }) var expitedVotingThreshold sdkmath.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, ExpeditedThreshold, &expitedVotingThreshold, simState.Rand, - func(r *rand.Rand) { expitedVotingThreshold = GenExpeditedThreshold(r) }, - ) + simState.AppParams.GetOrGenerate(ExpeditedThreshold, &expitedVotingThreshold, simState.Rand, func(r *rand.Rand) { expitedVotingThreshold = GenExpeditedThreshold(r) }) var veto sdkmath.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, Veto, &veto, simState.Rand, - func(r *rand.Rand) { veto = GenVeto(r) }, - ) + simState.AppParams.GetOrGenerate(Veto, &veto, simState.Rand, func(r *rand.Rand) { veto = GenVeto(r) }) govGenesis := v1.NewGenesisState( startingProposalID, diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 5fa12549c36..dbf48baae1c 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -12,7 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -50,7 +49,6 @@ const ( // WeightedOperations returns all the operations from the module with their respective weights func WeightedOperations( appParams simtypes.AppParams, - cdc codec.JSONCodec, txGen client.TxConfig, ak types.AccountKeeper, bk types.BankKeeper, @@ -65,25 +63,25 @@ func WeightedOperations( weightMsgCancelProposal int ) - appParams.GetOrGenerate(cdc, OpWeightMsgDeposit, &weightMsgDeposit, nil, + appParams.GetOrGenerate(OpWeightMsgDeposit, &weightMsgDeposit, nil, func(_ *rand.Rand) { weightMsgDeposit = DefaultWeightMsgDeposit }, ) - appParams.GetOrGenerate(cdc, OpWeightMsgVote, &weightMsgVote, nil, + appParams.GetOrGenerate(OpWeightMsgVote, &weightMsgVote, nil, func(_ *rand.Rand) { weightMsgVote = DefaultWeightMsgVote }, ) - appParams.GetOrGenerate(cdc, OpWeightMsgVoteWeighted, &weightMsgVoteWeighted, nil, + appParams.GetOrGenerate(OpWeightMsgVoteWeighted, &weightMsgVoteWeighted, nil, func(_ *rand.Rand) { weightMsgVoteWeighted = DefaultWeightMsgVoteWeighted }, ) - appParams.GetOrGenerate(cdc, OpWeightMsgCancelProposal, &weightMsgCancelProposal, nil, + appParams.GetOrGenerate(OpWeightMsgCancelProposal, &weightMsgCancelProposal, nil, func(_ *rand.Rand) { weightMsgCancelProposal = DefaultWeightMsgCancelProposal }, @@ -94,7 +92,7 @@ func WeightedOperations( for _, wMsg := range wMsgs { wMsg := wMsg // pin variable var weight int - appParams.GetOrGenerate(cdc, wMsg.AppParamsKey(), &weight, nil, + appParams.GetOrGenerate(wMsg.AppParamsKey(), &weight, nil, func(_ *rand.Rand) { weight = wMsg.DefaultWeight() }, ) @@ -112,7 +110,7 @@ func WeightedOperations( for _, wContent := range wContents { wContent := wContent // pin variable var weight int - appParams.GetOrGenerate(cdc, wContent.AppParamsKey(), &weight, nil, + appParams.GetOrGenerate(wContent.AppParamsKey(), &weight, nil, func(_ *rand.Rand) { weight = wContent.DefaultWeight() }, ) diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index d524808395c..f1c264a35e6 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -29,7 +29,6 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/distribution" dk "github.com/cosmos/cosmos-sdk/x/distribution/keeper" _ "github.com/cosmos/cosmos-sdk/x/gov" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/simulation" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -95,7 +94,7 @@ func TestWeightedOperations(t *testing.T) { ctx.WithChainID("test-chain") appParams := make(simtypes.AppParams) - weightesOps := simulation.WeightedOperations(appParams, govcodec.ModuleCdc, suite.TxConfig, suite.AccountKeeper, + weightesOps := simulation.WeightedOperations(appParams, suite.TxConfig, suite.AccountKeeper, suite.BankKeeper, suite.GovKeeper, mockWeightedProposalMsg(3), mockWeightedLegacyProposalContent(1), ) diff --git a/x/gov/types/v1/codec.go b/x/gov/types/v1/codec.go index 1a0031578ce..c4b0b2b4956 100644 --- a/x/gov/types/v1/codec.go +++ b/x/gov/types/v1/codec.go @@ -6,9 +6,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -35,11 +32,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -func init() { - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/gov/types/v1/msgs.go b/x/gov/types/v1/msgs.go index 7ba8e69a97e..552fe559f56 100644 --- a/x/gov/types/v1/msgs.go +++ b/x/gov/types/v1/msgs.go @@ -4,14 +4,11 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdktx "github.com/cosmos/cosmos-sdk/types/tx" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - "github.com/cosmos/cosmos-sdk/x/gov/codec" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) var ( _, _, _, _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgCancelProposal{} - _, _, _, _, _, _, _ legacytx.LegacyMsg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{}, &MsgExecLegacyContent{}, &MsgUpdateParams{}, &MsgCancelProposal{} _, _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{}, &MsgExecLegacyContent{} ) @@ -58,12 +55,6 @@ func (m *MsgSubmitProposal) SetMsgs(msgs []sdk.Msg) error { return nil } -// GetSignBytes returns the message bytes to sign over. -func (m MsgSubmitProposal) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgSubmitProposal. func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { proposer, _ := sdk.AccAddressFromBech32(m.Proposer) @@ -80,12 +71,6 @@ func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins return &MsgDeposit{proposalID, depositor.String(), amount} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgDeposit) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgDeposit. func (msg MsgDeposit) GetSigners() []sdk.AccAddress { depositor, _ := sdk.AccAddressFromBech32(msg.Depositor) @@ -97,12 +82,6 @@ func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption, meta return &MsgVote{proposalID, voter.String(), option, metadata} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgVote) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgVote. func (msg MsgVote) GetSigners() []sdk.AccAddress { voter, _ := sdk.AccAddressFromBech32(msg.Voter) @@ -114,12 +93,6 @@ func NewMsgVoteWeighted(voter sdk.AccAddress, proposalID uint64, options Weighte return &MsgVoteWeighted{proposalID, voter.String(), options, metadata} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgVoteWeighted) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgVoteWeighted. func (msg MsgVoteWeighted) GetSigners() []sdk.AccAddress { voter, _ := sdk.AccAddressFromBech32(msg.Voter) @@ -134,12 +107,6 @@ func NewMsgExecLegacyContent(content *codectypes.Any, authority string) *MsgExec } } -// GetSignBytes returns the message bytes to sign over. -func (c MsgExecLegacyContent) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&c) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgExecLegacyContent. func (c MsgExecLegacyContent) GetSigners() []sdk.AccAddress { authority, _ := sdk.AccAddressFromBech32(c.Authority) @@ -162,12 +129,6 @@ func (c MsgExecLegacyContent) UnpackInterfaces(unpacker codectypes.AnyUnpacker) return unpacker.UnpackAny(c.Content, &content) } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgUpdateParams) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgUpdateParams. func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { authority, _ := sdk.AccAddressFromBech32(msg.Authority) @@ -182,12 +143,6 @@ func NewMsgCancelProposal(proposalID uint64, proposer string) *MsgCancelProposal } } -// GetSignBytes implements Msg -func (msg MsgCancelProposal) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners implements Msg func (msg MsgCancelProposal) GetSigners() []sdk.AccAddress { proposer, _ := sdk.AccAddressFromBech32(msg.Proposer) diff --git a/x/gov/types/v1/msgs_test.go b/x/gov/types/v1/msgs_test.go index 456e7429a57..332335bbd78 100644 --- a/x/gov/types/v1/msgs_test.go +++ b/x/gov/types/v1/msgs_test.go @@ -6,6 +6,8 @@ import ( "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" @@ -27,14 +29,16 @@ func init() { func TestMsgDepositGetSignBytes(t *testing.T) { addr := sdk.AccAddress("addr1") msg := v1.NewMsgDeposit(addr, 0, coinsPos) - res := msg.GetSignBytes() - + pc := codec.NewProtoCodec(types.NewInterfaceRegistry()) + res, err := pc.MarshalAminoJSON(msg) + require.NoError(t, err) expected := `{"type":"cosmos-sdk/v1/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"0"}}` require.Equal(t, expected, string(res)) } // this tests that Amino JSON MsgSubmitProposal.GetSignBytes() still works with Content as Any using the ModuleCdc func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { + pc := codec.NewProtoCodec(types.NewInterfaceRegistry()) testcases := []struct { name string proposal []sdk.Msg @@ -65,10 +69,8 @@ func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { t.Run(tc.name, func(t *testing.T) { msg, err := v1.NewMsgSubmitProposal(tc.proposal, sdk.NewCoins(), sdk.AccAddress{}.String(), "", tc.title, tc.summary, tc.expedited) require.NoError(t, err) - var bz []byte - require.NotPanics(t, func() { - bz = msg.GetSignBytes() - }) + bz, err := pc.MarshalAminoJSON(msg) + require.NoError(t, err) require.Equal(t, tc.expSignBz, string(bz)) }) } diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index e3049d67c15..5a57a0f2af4 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" @@ -43,7 +44,7 @@ type MsgSubmitProposal struct { // messages are the arbitrary messages to be executed if proposal passes. Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` // initial_deposit is the deposit value that must be paid at proposal submission. - InitialDeposit []types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit"` + InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit"` // proposer is the account address of the proposer. Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` // metadata is any arbitrary metadata attached to the proposal. @@ -102,7 +103,7 @@ func (m *MsgSubmitProposal) GetMessages() []*types.Any { return nil } -func (m *MsgSubmitProposal) GetInitialDeposit() []types1.Coin { +func (m *MsgSubmitProposal) GetInitialDeposit() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { return m.InitialDeposit } @@ -844,73 +845,75 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/tx.proto", fileDescriptor_9ff8f4a63b6fc9a9) } var fileDescriptor_9ff8f4a63b6fc9a9 = []byte{ - // 1042 bytes of a gzipped FileDescriptorProto + // 1076 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xe6, 0xc3, 0x4e, 0x26, 0x4d, 0xa2, 0xac, 0xdc, 0x76, 0xbd, 0x2a, 0x6b, 0x77, 0x8b, - 0xc0, 0x4a, 0xc8, 0x2e, 0x0e, 0xb4, 0x42, 0xa6, 0x42, 0xaa, 0x43, 0x05, 0x95, 0x30, 0x54, 0x5b, - 0x28, 0x12, 0x42, 0x8a, 0xc6, 0xde, 0x61, 0xb3, 0xc2, 0xbb, 0xb3, 0xf2, 0x8c, 0xad, 0xf8, 0x86, - 0x38, 0xf6, 0xd4, 0x3f, 0x83, 0x63, 0x0e, 0xbd, 0xf5, 0xc4, 0xad, 0xe2, 0x54, 0x71, 0xe2, 0x54, - 0x50, 0x22, 0x08, 0xe2, 0x9f, 0x00, 0xcd, 0xc7, 0xae, 0xf7, 0x2b, 0x1f, 0x70, 0xe0, 0x62, 0xed, - 0xfc, 0xde, 0xc7, 0xbc, 0xf7, 0x7b, 0x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 0x23, 0x26, 0xdd, 0xfb, 0x6b, 0x11, 0x2c, 0x74, 0xb0, 0x2b, + 0x7f, 0x05, 0x36, 0x32, 0x1f, 0x02, 0xf5, 0x4c, 0x9d, 0x73, 0x3b, 0x48, 0x6d, 0x5c, 0x64, 0x11, + 0x73, 0x01, 0xc1, 0x56, 0x7e, 0x01, 0x5d, 0xcf, 0xbb, 0xe7, 0x8c, 0xd4, 0x9d, 0x17, 0x30, 0x8a, + 0xaf, 0x79, 0x0f, 0x2c, 0xb2, 0x4d, 0x70, 0x39, 0xef, 0x44, 0xe5, 0xaa, 0x56, 0x2c, 0x8f, 0xfd, + 0x1f, 0x80, 0xb5, 0xd4, 0x38, 0x3d, 0xc7, 0x3e, 0xd2, 0xab, 0xaf, 0xcd, 0xd6, 0xc7, 0x71, 0x3f, + 0x04, 0xe5, 0x68, 0x12, 0x55, 0xf3, 0x2e, 0x42, 0xa5, 0x5e, 0x3b, 0x57, 0x95, 0x4c, 0x30, 0xd5, + 0xd3, 0x05, 0x09, 0x26, 0xf5, 0x45, 0x09, 0x16, 0xb5, 0x15, 0xad, 0x7e, 0xa6, 0xa5, 0x0a, 0xaa, + 0x9f, 0xb6, 0x28, 0xaa, 0x7e, 0x71, 0x27, 0xa8, 0x4b, 0xdf, 0xd2, 0xb1, 0xd0, 0xbe, 0xf3, 0xe4, + 0x44, 0x93, 0x9e, 0x9e, 0x68, 0xd2, 0xef, 0x27, 0x9a, 0xf4, 0xf0, 0x54, 0x9b, 0x7b, 0x7a, 0xaa, + 0xcd, 0xfd, 0x76, 0xaa, 0xcd, 0x7d, 0xb9, 0x33, 0xf3, 0x23, 0x90, 0xcf, 0x09, 0xf6, 0x29, 0x48, + 0x3f, 0xbc, 0x4b, 0xac, 0x0d, 0xde, 0xfa, 0x37, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x6f, 0x84, 0xd5, + 0xb8, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/gov/types/v1beta1/codec.go b/x/gov/types/v1beta1/codec.go index 7b50e7480d0..d5b8b90880e 100644 --- a/x/gov/types/v1beta1/codec.go +++ b/x/gov/types/v1beta1/codec.go @@ -6,9 +6,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -38,11 +35,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -func init() { - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/gov/types/v1beta1/msgs.go b/x/gov/types/v1beta1/msgs.go index 0cc741fd3bc..182e877846b 100644 --- a/x/gov/types/v1beta1/msgs.go +++ b/x/gov/types/v1beta1/msgs.go @@ -7,8 +7,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - "github.com/cosmos/cosmos-sdk/x/gov/codec" ) // Governance message types and routes @@ -20,8 +18,7 @@ const ( ) var ( - _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{} - _, _, _, _ legacytx.LegacyMsg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{} + _, _, _, _ sdk.Msg = &MsgSubmitProposal{}, &MsgDeposit{}, &MsgVote{}, &MsgVoteWeighted{} _ codectypes.UnpackInterfacesMessage = &MsgSubmitProposal{} ) @@ -81,12 +78,6 @@ func (m *MsgSubmitProposal) SetContent(content Content) error { return nil } -// GetSignBytes returns the message bytes to sign over. -func (m MsgSubmitProposal) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgSubmitProposal. func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { proposer, _ := sdk.AccAddressFromBech32(m.Proposer) @@ -104,12 +95,6 @@ func NewMsgDeposit(depositor sdk.AccAddress, proposalID uint64, amount sdk.Coins return &MsgDeposit{proposalID, depositor.String(), amount} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgDeposit) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgDeposit. func (msg MsgDeposit) GetSigners() []sdk.AccAddress { depositor, _ := sdk.AccAddressFromBech32(msg.Depositor) @@ -121,12 +106,6 @@ func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) *Msg return &MsgVote{proposalID, voter.String(), option} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgVote) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgVote. func (msg MsgVote) GetSigners() []sdk.AccAddress { voter, _ := sdk.AccAddressFromBech32(msg.Voter) @@ -138,12 +117,6 @@ func NewMsgVoteWeighted(voter sdk.AccAddress, proposalID uint64, options Weighte return &MsgVoteWeighted{proposalID, voter.String(), options} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgVoteWeighted) GetSignBytes() []byte { - bz := codec.Amino.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgVoteWeighted. func (msg MsgVoteWeighted) GetSigners() []sdk.AccAddress { voter, _ := sdk.AccAddressFromBech32(msg.Voter) diff --git a/x/gov/types/v1beta1/msgs_test.go b/x/gov/types/v1beta1/msgs_test.go index d041ccb834c..a190c80c3a7 100644 --- a/x/gov/types/v1beta1/msgs_test.go +++ b/x/gov/types/v1beta1/msgs_test.go @@ -5,6 +5,8 @@ import ( "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -20,7 +22,9 @@ func init() { func TestMsgDepositGetSignBytes(t *testing.T) { addr := sdk.AccAddress("addr1") msg := NewMsgDeposit(addr, 0, coinsPos) - res := msg.GetSignBytes() + pc := codec.NewProtoCodec(types.NewInterfaceRegistry()) + res, err := pc.MarshalAminoJSON(msg) + require.NoError(t, err) expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"0"}}` require.Equal(t, expected, string(res)) @@ -30,10 +34,9 @@ func TestMsgDepositGetSignBytes(t *testing.T) { func TestMsgSubmitProposal_GetSignBytes(t *testing.T) { msg, err := NewMsgSubmitProposal(NewTextProposal("test", "abcd"), sdk.NewCoins(), sdk.AccAddress{}) require.NoError(t, err) - var bz []byte - require.NotPanics(t, func() { - bz = msg.GetSignBytes() - }) + pc := codec.NewProtoCodec(types.NewInterfaceRegistry()) + bz, err := pc.MarshalAminoJSON(msg) + require.NoError(t, err) require.Equal(t, `{"type":"cosmos-sdk/MsgSubmitProposal","value":{"content":{"type":"cosmos-sdk/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`, string(bz)) diff --git a/x/group/codec.go b/x/group/codec.go index 8e89a7da1e8..937fea2a6c7 100644 --- a/x/group/codec.go +++ b/x/group/codec.go @@ -6,9 +6,6 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers all the necessary group module concrete @@ -63,11 +60,3 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &PercentageDecisionPolicy{}, ) } - -func init() { - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/group/codec/cdc.go b/x/group/codec/cdc.go deleted file mode 100644 index 520e435afd6..00000000000 --- a/x/group/codec/cdc.go +++ /dev/null @@ -1,18 +0,0 @@ -package codec - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(Amino) -) - -func init() { - cryptocodec.RegisterCrypto(Amino) - codec.RegisterEvidences(Amino) - sdk.RegisterLegacyAminoCodec(Amino) -} diff --git a/x/group/msgs.go b/x/group/msgs.go index ed00d5cc471..e8b58534923 100644 --- a/x/group/msgs.go +++ b/x/group/msgs.go @@ -9,19 +9,30 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" - "github.com/cosmos/cosmos-sdk/x/group/codec" ) var ( - _ sdk.Msg = &MsgCreateGroup{} - _ legacytx.LegacyMsg = &MsgCreateGroup{} -) + _ sdk.Msg = &MsgCreateGroup{} + _ sdk.Msg = &MsgUpdateGroupAdmin{} + _ sdk.Msg = &MsgUpdateGroupMetadata{} + _ sdk.Msg = &MsgUpdateGroupMembers{} + _ sdk.Msg = &MsgUpdateGroupMembers{} + _ sdk.Msg = &MsgCreateGroupWithPolicy{} + _ sdk.Msg = &MsgCreateGroupPolicy{} + _ sdk.Msg = &MsgUpdateGroupPolicyAdmin{} + _ sdk.Msg = &MsgUpdateGroupPolicyDecisionPolicy{} + _ sdk.Msg = &MsgUpdateGroupPolicyMetadata{} + _ sdk.Msg = &MsgLeaveGroup{} + _ sdk.Msg = &MsgExec{} + _ sdk.Msg = &MsgVote{} + _ sdk.Msg = &MsgWithdrawProposal{} + _ sdk.Msg = &MsgSubmitProposal{} + _ sdk.Msg = &MsgCreateGroupPolicy{} -// GetSignBytes Implements Msg. -func (m MsgCreateGroup) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} + _ types.UnpackInterfacesMessage = MsgCreateGroupPolicy{} + _ types.UnpackInterfacesMessage = MsgUpdateGroupPolicyDecisionPolicy{} + _ types.UnpackInterfacesMessage = MsgCreateGroupWithPolicy{} +) // GetSigners returns the expected signers for a MsgCreateGroup. func (m MsgCreateGroup) GetSigners() []sdk.AccAddress { @@ -30,16 +41,6 @@ func (m MsgCreateGroup) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{admin} } -var ( - _ sdk.Msg = &MsgUpdateGroupAdmin{} - _ legacytx.LegacyMsg = &MsgUpdateGroupAdmin{} -) - -// GetSignBytes Implements Msg. -func (m MsgUpdateGroupAdmin) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgUpdateGroupAdmin. func (m MsgUpdateGroupAdmin) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) @@ -52,16 +53,6 @@ func (m *MsgUpdateGroupAdmin) GetGroupID() uint64 { return m.GroupId } -var ( - _ sdk.Msg = &MsgUpdateGroupMetadata{} - _ legacytx.LegacyMsg = &MsgUpdateGroupMetadata{} -) - -// GetSignBytes Implements Msg. -func (m MsgUpdateGroupMetadata) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgUpdateGroupMetadata. func (m MsgUpdateGroupMetadata) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) @@ -74,18 +65,6 @@ func (m *MsgUpdateGroupMetadata) GetGroupID() uint64 { return m.GroupId } -var ( - _ sdk.Msg = &MsgUpdateGroupMembers{} - _ legacytx.LegacyMsg = &MsgUpdateGroupMembers{} -) - -// GetSignBytes Implements Msg. -func (m MsgUpdateGroupMembers) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - -var _ sdk.Msg = &MsgUpdateGroupMembers{} - // GetSigners returns the expected signers for a MsgUpdateGroupMembers. func (m MsgUpdateGroupMembers) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) @@ -98,13 +77,6 @@ func (m *MsgUpdateGroupMembers) GetGroupID() uint64 { return m.GroupId } -var ( - _ sdk.Msg = &MsgCreateGroupWithPolicy{} - _ legacytx.LegacyMsg = &MsgCreateGroupWithPolicy{} - - _ types.UnpackInterfacesMessage = MsgCreateGroupWithPolicy{} -) - // NewMsgCreateGroupWithPolicy creates a new MsgCreateGroupWithPolicy. func NewMsgCreateGroupWithPolicy(admin string, members []MemberRequest, groupMetadata, groupPolicyMetadata string, groupPolicyAsAdmin bool, decisionPolicy DecisionPolicy) (*MsgCreateGroupWithPolicy, error) { m := &MsgCreateGroupWithPolicy{ @@ -146,43 +118,18 @@ func (m MsgCreateGroupWithPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) e return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy) } -// GetSignBytes Implements Msg. -func (m MsgCreateGroupWithPolicy) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgCreateGroupWithPolicy. func (m MsgCreateGroupWithPolicy) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) return []sdk.AccAddress{admin} } -var ( - _ sdk.Msg = &MsgCreateGroupPolicy{} - _ legacytx.LegacyMsg = &MsgCreateGroupPolicy{} -) - -// GetSignBytes Implements Msg. -func (m MsgCreateGroupPolicy) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgCreateGroupPolicy. func (m MsgCreateGroupPolicy) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) return []sdk.AccAddress{admin} } -var ( - _ sdk.Msg = &MsgUpdateGroupPolicyAdmin{} - _ legacytx.LegacyMsg = &MsgUpdateGroupPolicyAdmin{} -) - -// GetSignBytes Implements Msg. -func (m MsgUpdateGroupPolicyAdmin) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgUpdateGroupPolicyAdmin. func (m MsgUpdateGroupPolicyAdmin) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) @@ -190,13 +137,6 @@ func (m MsgUpdateGroupPolicyAdmin) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{admin} } -var ( - _ sdk.Msg = &MsgUpdateGroupPolicyDecisionPolicy{} - _ legacytx.LegacyMsg = &MsgUpdateGroupPolicyDecisionPolicy{} - - _ types.UnpackInterfacesMessage = MsgUpdateGroupPolicyDecisionPolicy{} -) - // NewMsgUpdateGroupPolicyDecisionPolicy creates a new MsgUpdateGroupPolicyDecisionPolicy. func NewMsgUpdateGroupPolicyDecisionPolicy(admin, address sdk.AccAddress, decisionPolicy DecisionPolicy) (*MsgUpdateGroupPolicyDecisionPolicy, error) { m := &MsgUpdateGroupPolicyDecisionPolicy{ @@ -224,11 +164,6 @@ func (m *MsgUpdateGroupPolicyDecisionPolicy) SetDecisionPolicy(decisionPolicy De return nil } -// GetSignBytes Implements Msg. -func (m MsgUpdateGroupPolicyDecisionPolicy) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgUpdateGroupPolicyDecisionPolicy. func (m MsgUpdateGroupPolicyDecisionPolicy) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) @@ -252,16 +187,6 @@ func (m MsgUpdateGroupPolicyDecisionPolicy) UnpackInterfaces(unpacker types.AnyU return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy) } -var ( - _ sdk.Msg = &MsgUpdateGroupPolicyMetadata{} - _ legacytx.LegacyMsg = &MsgUpdateGroupPolicyMetadata{} -) - -// GetSignBytes Implements Msg. -func (m MsgUpdateGroupPolicyMetadata) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgUpdateGroupPolicyMetadata. func (m MsgUpdateGroupPolicyMetadata) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Admin) @@ -269,13 +194,6 @@ func (m MsgUpdateGroupPolicyMetadata) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{admin} } -var ( - _ sdk.Msg = &MsgCreateGroupPolicy{} - _ legacytx.LegacyMsg = &MsgCreateGroupPolicy{} - - _ types.UnpackInterfacesMessage = MsgCreateGroupPolicy{} -) - // NewMsgCreateGroupPolicy creates a new MsgCreateGroupPolicy. func NewMsgCreateGroupPolicy(admin sdk.AccAddress, group uint64, metadata string, decisionPolicy DecisionPolicy) (*MsgCreateGroupPolicy, error) { m := &MsgCreateGroupPolicy{ @@ -330,11 +248,6 @@ func (m MsgCreateGroupPolicy) UnpackInterfaces(unpacker types.AnyUnpacker) error return unpacker.UnpackAny(m.DecisionPolicy, &decisionPolicy) } -var ( - _ sdk.Msg = &MsgSubmitProposal{} - _ legacytx.LegacyMsg = &MsgSubmitProposal{} -) - // NewMsgSubmitProposal creates a new MsgSubmitProposal. func NewMsgSubmitProposal(address string, proposers []string, msgs []sdk.Msg, metadata string, exec Exec, title, summary string) (*MsgSubmitProposal, error) { m := &MsgSubmitProposal{ @@ -352,11 +265,6 @@ func NewMsgSubmitProposal(address string, proposers []string, msgs []sdk.Msg, me return m, nil } -// GetSignBytes Implements Msg. -func (m MsgSubmitProposal) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgSubmitProposal. func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { addrs, err := m.getProposerAccAddresses() @@ -401,16 +309,6 @@ func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { return tx.UnpackInterfaces(unpacker, m.Messages) } -var ( - _ sdk.Msg = &MsgWithdrawProposal{} - _ legacytx.LegacyMsg = &MsgWithdrawProposal{} -) - -// GetSignBytes Implements Msg. -func (m MsgWithdrawProposal) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgWithdrawProposal. func (m MsgWithdrawProposal) GetSigners() []sdk.AccAddress { admin := sdk.MustAccAddressFromBech32(m.Address) @@ -418,16 +316,6 @@ func (m MsgWithdrawProposal) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{admin} } -var ( - _ sdk.Msg = &MsgVote{} - _ legacytx.LegacyMsg = &MsgVote{} -) - -// GetSignBytes Implements Msg. -func (m MsgVote) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgVote. func (m MsgVote) GetSigners() []sdk.AccAddress { addr := sdk.MustAccAddressFromBech32(m.Voter) @@ -435,16 +323,6 @@ func (m MsgVote) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{addr} } -var ( - _ sdk.Msg = &MsgExec{} - _ legacytx.LegacyMsg = &MsgExec{} -) - -// GetSignBytes Implements Msg. -func (m MsgExec) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgExec. func (m MsgExec) GetSigners() []sdk.AccAddress { signer := sdk.MustAccAddressFromBech32(m.Executor) @@ -452,16 +330,6 @@ func (m MsgExec) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{signer} } -var ( - _ sdk.Msg = &MsgLeaveGroup{} - _ legacytx.LegacyMsg = &MsgLeaveGroup{} -) - -// GetSignBytes Implements Msg -func (m MsgLeaveGroup) GetSignBytes() []byte { - return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for a MsgLeaveGroup func (m MsgLeaveGroup) GetSigners() []sdk.AccAddress { signer := sdk.MustAccAddressFromBech32(m.Address) diff --git a/x/group/simulation/genesis.go b/x/group/simulation/genesis.go index 7b533cf5daa..e9396e3f165 100644 --- a/x/group/simulation/genesis.go +++ b/x/group/simulation/genesis.go @@ -180,38 +180,23 @@ func RandomizedGenState(simState *module.SimulationState) { // groups var groups []*group.GroupInfo - simState.AppParams.GetOrGenerate( - simState.Cdc, GroupInfo, &groups, simState.Rand, - func(r *rand.Rand) { groups = getGroups(r, simState.Accounts) }, - ) + simState.AppParams.GetOrGenerate(GroupInfo, &groups, simState.Rand, func(r *rand.Rand) { groups = getGroups(r, simState.Accounts) }) // group members var members []*group.GroupMember - simState.AppParams.GetOrGenerate( - simState.Cdc, GroupMembers, &members, simState.Rand, - func(r *rand.Rand) { members = getGroupMembers(r, simState.Accounts) }, - ) + simState.AppParams.GetOrGenerate(GroupMembers, &members, simState.Rand, func(r *rand.Rand) { members = getGroupMembers(r, simState.Accounts) }) // group policies var groupPolicies []*group.GroupPolicyInfo - simState.AppParams.GetOrGenerate( - simState.Cdc, GroupPolicyInfo, &groupPolicies, simState.Rand, - func(r *rand.Rand) { groupPolicies = getGroupPolicies(r, simState) }, - ) + simState.AppParams.GetOrGenerate(GroupPolicyInfo, &groupPolicies, simState.Rand, func(r *rand.Rand) { groupPolicies = getGroupPolicies(r, simState) }) // proposals var proposals []*group.Proposal - simState.AppParams.GetOrGenerate( - simState.Cdc, GroupProposals, &proposals, simState.Rand, - func(r *rand.Rand) { proposals = getProposals(r, simState, groupPolicies) }, - ) + simState.AppParams.GetOrGenerate(GroupProposals, &proposals, simState.Rand, func(r *rand.Rand) { proposals = getProposals(r, simState, groupPolicies) }) // votes var votes []*group.Vote - simState.AppParams.GetOrGenerate( - simState.Cdc, GroupVote, &votes, simState.Rand, - func(r *rand.Rand) { votes = getVotes(r, simState) }, - ) + simState.AppParams.GetOrGenerate(GroupVote, &votes, simState.Rand, func(r *rand.Rand) { votes = getVotes(r, simState) }) groupGenesis := group.GenesisState{ GroupSeq: 3, diff --git a/x/group/simulation/operations.go b/x/group/simulation/operations.go index 39c2d1ac134..edb87acfd06 100644 --- a/x/group/simulation/operations.go +++ b/x/group/simulation/operations.go @@ -101,76 +101,48 @@ func WeightedOperations( weightMsgCreateGroupWithPolicy int ) - appParams.GetOrGenerate(cdc, OpMsgCreateGroup, &weightMsgCreateGroup, nil, - func(_ *rand.Rand) { - weightMsgCreateGroup = WeightMsgCreateGroup - }, - ) - appParams.GetOrGenerate(cdc, OpMsgCreateGroupPolicy, &weightMsgCreateGroupPolicy, nil, - func(_ *rand.Rand) { - weightMsgCreateGroupPolicy = WeightMsgCreateGroupPolicy - }, - ) - appParams.GetOrGenerate(cdc, OpMsgLeaveGroup, &weightMsgLeaveGroup, nil, - func(_ *rand.Rand) { - weightMsgLeaveGroup = WeightMsgLeaveGroup - }, - ) - appParams.GetOrGenerate(cdc, OpMsgCreateGroupWithPolicy, &weightMsgCreateGroupWithPolicy, nil, - func(_ *rand.Rand) { - weightMsgCreateGroupWithPolicy = WeightMsgCreateGroupWithPolicy - }, - ) - appParams.GetOrGenerate(cdc, OpMsgSubmitProposal, &weightMsgSubmitProposal, nil, - func(_ *rand.Rand) { - weightMsgSubmitProposal = WeightMsgSubmitProposal - }, - ) - appParams.GetOrGenerate(cdc, OpMsgVote, &weightMsgVote, nil, - func(_ *rand.Rand) { - weightMsgVote = WeightMsgVote - }, - ) - appParams.GetOrGenerate(cdc, OpMsgExec, &weightMsgExec, nil, - func(_ *rand.Rand) { - weightMsgExec = WeightMsgExec - }, - ) - appParams.GetOrGenerate(cdc, OpMsgUpdateGroupMetadata, &weightMsgUpdateGroupMetadata, nil, - func(_ *rand.Rand) { - weightMsgUpdateGroupMetadata = WeightMsgUpdateGroupMetadata - }, - ) - appParams.GetOrGenerate(cdc, OpMsgUpdateGroupAdmin, &weightMsgUpdateGroupAdmin, nil, - func(_ *rand.Rand) { - weightMsgUpdateGroupAdmin = WeightMsgUpdateGroupAdmin - }, - ) - appParams.GetOrGenerate(cdc, OpMsgUpdateGroupMembers, &weightMsgUpdateGroupMembers, nil, - func(_ *rand.Rand) { - weightMsgUpdateGroupMembers = WeightMsgUpdateGroupMembers - }, - ) - appParams.GetOrGenerate(cdc, OpMsgUpdateGroupPolicyAdmin, &weightMsgUpdateGroupPolicyAdmin, nil, - func(_ *rand.Rand) { - weightMsgUpdateGroupPolicyAdmin = WeightMsgUpdateGroupPolicyAdmin - }, - ) - appParams.GetOrGenerate(cdc, OpMsgUpdateGroupPolicyDecisionPolicy, &weightMsgUpdateGroupPolicyDecisionPolicy, nil, - func(_ *rand.Rand) { - weightMsgUpdateGroupPolicyDecisionPolicy = WeightMsgUpdateGroupPolicyDecisionPolicy - }, - ) - appParams.GetOrGenerate(cdc, OpMsgUpdateGroupPolicyMetaData, &weightMsgUpdateGroupPolicyMetadata, nil, - func(_ *rand.Rand) { - weightMsgUpdateGroupPolicyMetadata = WeightMsgUpdateGroupPolicyMetadata - }, - ) - appParams.GetOrGenerate(cdc, OpMsgWithdrawProposal, &weightMsgWithdrawProposal, nil, - func(_ *rand.Rand) { - weightMsgWithdrawProposal = WeightMsgWithdrawProposal - }, - ) + appParams.GetOrGenerate(OpMsgCreateGroup, &weightMsgCreateGroup, nil, func(_ *rand.Rand) { + weightMsgCreateGroup = WeightMsgCreateGroup + }) + appParams.GetOrGenerate(OpMsgCreateGroupPolicy, &weightMsgCreateGroupPolicy, nil, func(_ *rand.Rand) { + weightMsgCreateGroupPolicy = WeightMsgCreateGroupPolicy + }) + appParams.GetOrGenerate(OpMsgLeaveGroup, &weightMsgLeaveGroup, nil, func(_ *rand.Rand) { + weightMsgLeaveGroup = WeightMsgLeaveGroup + }) + appParams.GetOrGenerate(OpMsgCreateGroupWithPolicy, &weightMsgCreateGroupWithPolicy, nil, func(_ *rand.Rand) { + weightMsgCreateGroupWithPolicy = WeightMsgCreateGroupWithPolicy + }) + appParams.GetOrGenerate(OpMsgSubmitProposal, &weightMsgSubmitProposal, nil, func(_ *rand.Rand) { + weightMsgSubmitProposal = WeightMsgSubmitProposal + }) + appParams.GetOrGenerate(OpMsgVote, &weightMsgVote, nil, func(_ *rand.Rand) { + weightMsgVote = WeightMsgVote + }) + appParams.GetOrGenerate(OpMsgExec, &weightMsgExec, nil, func(_ *rand.Rand) { + weightMsgExec = WeightMsgExec + }) + appParams.GetOrGenerate(OpMsgUpdateGroupMetadata, &weightMsgUpdateGroupMetadata, nil, func(_ *rand.Rand) { + weightMsgUpdateGroupMetadata = WeightMsgUpdateGroupMetadata + }) + appParams.GetOrGenerate(OpMsgUpdateGroupAdmin, &weightMsgUpdateGroupAdmin, nil, func(_ *rand.Rand) { + weightMsgUpdateGroupAdmin = WeightMsgUpdateGroupAdmin + }) + appParams.GetOrGenerate(OpMsgUpdateGroupMembers, &weightMsgUpdateGroupMembers, nil, func(_ *rand.Rand) { + weightMsgUpdateGroupMembers = WeightMsgUpdateGroupMembers + }) + appParams.GetOrGenerate(OpMsgUpdateGroupPolicyAdmin, &weightMsgUpdateGroupPolicyAdmin, nil, func(_ *rand.Rand) { + weightMsgUpdateGroupPolicyAdmin = WeightMsgUpdateGroupPolicyAdmin + }) + appParams.GetOrGenerate(OpMsgUpdateGroupPolicyDecisionPolicy, &weightMsgUpdateGroupPolicyDecisionPolicy, nil, func(_ *rand.Rand) { + weightMsgUpdateGroupPolicyDecisionPolicy = WeightMsgUpdateGroupPolicyDecisionPolicy + }) + appParams.GetOrGenerate(OpMsgUpdateGroupPolicyMetaData, &weightMsgUpdateGroupPolicyMetadata, nil, func(_ *rand.Rand) { + weightMsgUpdateGroupPolicyMetadata = WeightMsgUpdateGroupPolicyMetadata + }) + appParams.GetOrGenerate(OpMsgWithdrawProposal, &weightMsgWithdrawProposal, nil, func(_ *rand.Rand) { + weightMsgWithdrawProposal = WeightMsgWithdrawProposal + }) pCdc := codec.NewProtoCodec(registry) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index f543ffc2762..48ae9c3acf0 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -6,6 +6,7 @@ import ( "math/rand" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/mint/types" ) @@ -48,35 +49,20 @@ func GenGoalBonded(r *rand.Rand) math.LegacyDec { func RandomizedGenState(simState *module.SimulationState) { // minter var inflation math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, Inflation, &inflation, simState.Rand, - func(r *rand.Rand) { inflation = GenInflation(r) }, - ) + simState.AppParams.GetOrGenerate(Inflation, &inflation, simState.Rand, func(r *rand.Rand) { inflation = GenInflation(r) }) // params var inflationRateChange math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, InflationRateChange, &inflationRateChange, simState.Rand, - func(r *rand.Rand) { inflationRateChange = GenInflationRateChange(r) }, - ) + simState.AppParams.GetOrGenerate(InflationRateChange, &inflationRateChange, simState.Rand, func(r *rand.Rand) { inflationRateChange = GenInflationRateChange(r) }) var inflationMax math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, InflationMax, &inflationMax, simState.Rand, - func(r *rand.Rand) { inflationMax = GenInflationMax(r) }, - ) + simState.AppParams.GetOrGenerate(InflationMax, &inflationMax, simState.Rand, func(r *rand.Rand) { inflationMax = GenInflationMax(r) }) var inflationMin math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, InflationMin, &inflationMin, simState.Rand, - func(r *rand.Rand) { inflationMin = GenInflationMin(r) }, - ) + simState.AppParams.GetOrGenerate(InflationMin, &inflationMin, simState.Rand, func(r *rand.Rand) { inflationMin = GenInflationMin(r) }) var goalBonded math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, GoalBonded, &goalBonded, simState.Rand, - func(r *rand.Rand) { goalBonded = GenGoalBonded(r) }, - ) + simState.AppParams.GetOrGenerate(GoalBonded, &goalBonded, simState.Rand, func(r *rand.Rand) { goalBonded = GenGoalBonded(r) }) mintDenom := simState.BondDenom blocksPerYear := uint64(60 * 60 * 8766 / 5) diff --git a/x/mint/types/codec.go b/x/mint/types/codec.go index 000265950b3..bdbe4b9f50b 100644 --- a/x/mint/types/codec.go +++ b/x/mint/types/codec.go @@ -4,32 +4,10 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec - // so that this can later be used to properly serialize MsgGrant and MsgExec - // instances. - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} - // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(Params{}, "cosmos-sdk/x/mint/Params", nil) diff --git a/x/mint/types/msgs.go b/x/mint/types/msgs.go index 5c9ba09663e..e5a18898cdc 100644 --- a/x/mint/types/msgs.go +++ b/x/mint/types/msgs.go @@ -2,18 +2,9 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var ( - _ sdk.Msg = &MsgUpdateParams{} - _ legacytx.LegacyMsg = &MsgUpdateParams{} -) - -// GetSignBytes implements the LegacyMsg interface. -func (m MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} +var _ sdk.Msg = &MsgUpdateParams{} // GetSigners returns the expected signers for a MsgUpdateParams message. func (m MsgUpdateParams) GetSigners() []sdk.AccAddress { diff --git a/x/nft/simulation/genesis.go b/x/nft/simulation/genesis.go index da77be93b8d..b40f07f0450 100644 --- a/x/nft/simulation/genesis.go +++ b/x/nft/simulation/genesis.go @@ -4,6 +4,7 @@ import ( "math/rand" "cosmossdk.io/x/nft" + "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) @@ -46,13 +47,13 @@ func genNFT(r *rand.Rand, classID string, accounts []simtypes.Account) []*nft.En func RandomizedGenState(simState *module.SimulationState) { var classes []*nft.Class simState.AppParams.GetOrGenerate( - simState.Cdc, "nft", &classes, simState.Rand, + "nft", &classes, simState.Rand, func(r *rand.Rand) { classes = genClasses(r, simState.Accounts) }, ) var entries []*nft.Entry simState.AppParams.GetOrGenerate( - simState.Cdc, "nft", &entries, simState.Rand, + "nft", &entries, simState.Rand, func(r *rand.Rand) { class := classes[r.Int63n(int64(len(classes)))] entries = genNFT(r, class.Id, simState.Accounts) diff --git a/x/nft/simulation/operations.go b/x/nft/simulation/operations.go index 6c6fc72b510..2f76e648d4c 100644 --- a/x/nft/simulation/operations.go +++ b/x/nft/simulation/operations.go @@ -30,7 +30,7 @@ var TypeMsgSend = sdk.MsgTypeURL(&nft.MsgSend{}) func WeightedOperations( registry cdctypes.InterfaceRegistry, appParams simtypes.AppParams, - cdc codec.JSONCodec, + _ codec.JSONCodec, txCfg client.TxConfig, ak nft.AccountKeeper, bk nft.BankKeeper, @@ -38,7 +38,7 @@ func WeightedOperations( ) simulation.WeightedOperations { var weightMsgSend int - appParams.GetOrGenerate(cdc, OpWeightMsgSend, &weightMsgSend, nil, + appParams.GetOrGenerate(OpWeightMsgSend, &weightMsgSend, nil, func(_ *rand.Rand) { weightMsgSend = WeightSend }, @@ -54,7 +54,7 @@ func WeightedOperations( // SimulateMsgSend generates a MsgSend with random values. func SimulateMsgSend( - cdc *codec.ProtoCodec, + _ *codec.ProtoCodec, txCfg client.TxConfig, ak nft.AccountKeeper, bk nft.BankKeeper, diff --git a/x/slashing/simulation/genesis.go b/x/slashing/simulation/genesis.go index f5b00bc3965..533cad0ecb9 100644 --- a/x/slashing/simulation/genesis.go +++ b/x/slashing/simulation/genesis.go @@ -7,6 +7,7 @@ import ( "time" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -49,34 +50,19 @@ func GenSlashFractionDowntime(r *rand.Rand) math.LegacyDec { // RandomizedGenState generates a random GenesisState for slashing func RandomizedGenState(simState *module.SimulationState) { var signedBlocksWindow int64 - simState.AppParams.GetOrGenerate( - simState.Cdc, SignedBlocksWindow, &signedBlocksWindow, simState.Rand, - func(r *rand.Rand) { signedBlocksWindow = GenSignedBlocksWindow(r) }, - ) + simState.AppParams.GetOrGenerate(SignedBlocksWindow, &signedBlocksWindow, simState.Rand, func(r *rand.Rand) { signedBlocksWindow = GenSignedBlocksWindow(r) }) var minSignedPerWindow math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, MinSignedPerWindow, &minSignedPerWindow, simState.Rand, - func(r *rand.Rand) { minSignedPerWindow = GenMinSignedPerWindow(r) }, - ) + simState.AppParams.GetOrGenerate(MinSignedPerWindow, &minSignedPerWindow, simState.Rand, func(r *rand.Rand) { minSignedPerWindow = GenMinSignedPerWindow(r) }) var downtimeJailDuration time.Duration - simState.AppParams.GetOrGenerate( - simState.Cdc, DowntimeJailDuration, &downtimeJailDuration, simState.Rand, - func(r *rand.Rand) { downtimeJailDuration = GenDowntimeJailDuration(r) }, - ) + simState.AppParams.GetOrGenerate(DowntimeJailDuration, &downtimeJailDuration, simState.Rand, func(r *rand.Rand) { downtimeJailDuration = GenDowntimeJailDuration(r) }) var slashFractionDoubleSign math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, SlashFractionDoubleSign, &slashFractionDoubleSign, simState.Rand, - func(r *rand.Rand) { slashFractionDoubleSign = GenSlashFractionDoubleSign(r) }, - ) + simState.AppParams.GetOrGenerate(SlashFractionDoubleSign, &slashFractionDoubleSign, simState.Rand, func(r *rand.Rand) { slashFractionDoubleSign = GenSlashFractionDoubleSign(r) }) var slashFractionDowntime math.LegacyDec - simState.AppParams.GetOrGenerate( - simState.Cdc, SlashFractionDowntime, &slashFractionDowntime, simState.Rand, - func(r *rand.Rand) { slashFractionDowntime = GenSlashFractionDowntime(r) }, - ) + simState.AppParams.GetOrGenerate(SlashFractionDowntime, &slashFractionDowntime, simState.Rand, func(r *rand.Rand) { slashFractionDowntime = GenSlashFractionDowntime(r) }) params := types.NewParams( signedBlocksWindow, minSignedPerWindow, downtimeJailDuration, diff --git a/x/slashing/simulation/operations.go b/x/slashing/simulation/operations.go index 161d6a40c0f..a2618a522c5 100644 --- a/x/slashing/simulation/operations.go +++ b/x/slashing/simulation/operations.go @@ -36,11 +36,9 @@ func WeightedOperations( sk types.StakingKeeper, ) simulation.WeightedOperations { var weightMsgUnjail int - appParams.GetOrGenerate(cdc, OpWeightMsgUnjail, &weightMsgUnjail, nil, - func(_ *rand.Rand) { - weightMsgUnjail = DefaultWeightMsgUnjail - }, - ) + appParams.GetOrGenerate(OpWeightMsgUnjail, &weightMsgUnjail, nil, func(_ *rand.Rand) { + weightMsgUnjail = DefaultWeightMsgUnjail + }) return simulation.WeightedOperations{ simulation.NewWeightedOperation( diff --git a/x/slashing/types/codec.go b/x/slashing/types/codec.go index ce9fb7e4897..4b494a79eba 100644 --- a/x/slashing/types/codec.go +++ b/x/slashing/types/codec.go @@ -4,12 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers concrete types on LegacyAmino codec @@ -28,20 +24,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/slashing/types/msg.go b/x/slashing/types/msg.go index a4aa2925a9e..ed2604e6257 100644 --- a/x/slashing/types/msg.go +++ b/x/slashing/types/msg.go @@ -2,16 +2,12 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) // verify interface at compile time var ( _ sdk.Msg = &MsgUnjail{} _ sdk.Msg = &MsgUpdateParams{} - - _ legacytx.LegacyMsg = &MsgUnjail{} - _ legacytx.LegacyMsg = &MsgUpdateParams{} ) // NewMsgUnjail creates a new MsgUnjail instance @@ -27,17 +23,6 @@ func (msg MsgUnjail) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sdk.AccAddress(valAddr)} } -// GetSignBytes gets the bytes for the message signer to sign on -func (msg MsgUnjail) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSignBytes implements the LegacyMsg interface. -func (msg MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - // GetSigners returns the expected signers for a MsgUpdateParams message. func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(msg.Authority) diff --git a/x/slashing/types/msg_test.go b/x/slashing/types/msg_test.go index 31f7a70e75d..17f3ba6d603 100644 --- a/x/slashing/types/msg_test.go +++ b/x/slashing/types/msg_test.go @@ -5,13 +5,17 @@ import ( "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" ) func TestMsgUnjailGetSignBytes(t *testing.T) { addr := sdk.AccAddress("abcd") msg := NewMsgUnjail(sdk.ValAddress(addr)) - bytes := msg.GetSignBytes() + pc := codec.NewProtoCodec(types.NewInterfaceRegistry()) + bytes, err := pc.MarshalAminoJSON(msg) + require.NoError(t, err) require.Equal( t, `{"type":"cosmos-sdk/MsgUnjail","value":{"address":"cosmosvaloper1v93xxeqhg9nn6"}}`, diff --git a/x/staking/simulation/genesis.go b/x/staking/simulation/genesis.go index 19d25de7526..1716fff3da8 100644 --- a/x/staking/simulation/genesis.go +++ b/x/staking/simulation/genesis.go @@ -46,20 +46,11 @@ func RandomizedGenState(simState *module.SimulationState) { minCommissionRate sdkmath.LegacyDec ) - simState.AppParams.GetOrGenerate( - simState.Cdc, unbondingTime, &unbondTime, simState.Rand, - func(r *rand.Rand) { unbondTime = genUnbondingTime(r) }, - ) + simState.AppParams.GetOrGenerate(unbondingTime, &unbondTime, simState.Rand, func(r *rand.Rand) { unbondTime = genUnbondingTime(r) }) - simState.AppParams.GetOrGenerate( - simState.Cdc, maxValidators, &maxVals, simState.Rand, - func(r *rand.Rand) { maxVals = genMaxValidators(r) }, - ) + simState.AppParams.GetOrGenerate(maxValidators, &maxVals, simState.Rand, func(r *rand.Rand) { maxVals = genMaxValidators(r) }) - simState.AppParams.GetOrGenerate( - simState.Cdc, historicalEntries, &histEntries, simState.Rand, - func(r *rand.Rand) { histEntries = getHistEntries(r) }, - ) + simState.AppParams.GetOrGenerate(historicalEntries, &histEntries, simState.Rand, func(r *rand.Rand) { histEntries = getHistEntries(r) }) // NOTE: the slashing module need to be defined after the staking module on the // NewSimulationManager constructor for this to work diff --git a/x/staking/simulation/operations.go b/x/staking/simulation/operations.go index a74a3642bab..de8276d2912 100644 --- a/x/staking/simulation/operations.go +++ b/x/staking/simulation/operations.go @@ -5,6 +5,7 @@ import ( "math/rand" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" @@ -51,41 +52,29 @@ func WeightedOperations( weightMsgCancelUnbondingDelegation int ) - appParams.GetOrGenerate(cdc, OpWeightMsgCreateValidator, &weightMsgCreateValidator, nil, - func(_ *rand.Rand) { - weightMsgCreateValidator = DefaultWeightMsgCreateValidator - }, - ) + appParams.GetOrGenerate(OpWeightMsgCreateValidator, &weightMsgCreateValidator, nil, func(_ *rand.Rand) { + weightMsgCreateValidator = DefaultWeightMsgCreateValidator + }) - appParams.GetOrGenerate(cdc, OpWeightMsgEditValidator, &weightMsgEditValidator, nil, - func(_ *rand.Rand) { - weightMsgEditValidator = DefaultWeightMsgEditValidator - }, - ) + appParams.GetOrGenerate(OpWeightMsgEditValidator, &weightMsgEditValidator, nil, func(_ *rand.Rand) { + weightMsgEditValidator = DefaultWeightMsgEditValidator + }) - appParams.GetOrGenerate(cdc, OpWeightMsgDelegate, &weightMsgDelegate, nil, - func(_ *rand.Rand) { - weightMsgDelegate = DefaultWeightMsgDelegate - }, - ) + appParams.GetOrGenerate(OpWeightMsgDelegate, &weightMsgDelegate, nil, func(_ *rand.Rand) { + weightMsgDelegate = DefaultWeightMsgDelegate + }) - appParams.GetOrGenerate(cdc, OpWeightMsgUndelegate, &weightMsgUndelegate, nil, - func(_ *rand.Rand) { - weightMsgUndelegate = DefaultWeightMsgUndelegate - }, - ) + appParams.GetOrGenerate(OpWeightMsgUndelegate, &weightMsgUndelegate, nil, func(_ *rand.Rand) { + weightMsgUndelegate = DefaultWeightMsgUndelegate + }) - appParams.GetOrGenerate(cdc, OpWeightMsgBeginRedelegate, &weightMsgBeginRedelegate, nil, - func(_ *rand.Rand) { - weightMsgBeginRedelegate = DefaultWeightMsgBeginRedelegate - }, - ) + appParams.GetOrGenerate(OpWeightMsgBeginRedelegate, &weightMsgBeginRedelegate, nil, func(_ *rand.Rand) { + weightMsgBeginRedelegate = DefaultWeightMsgBeginRedelegate + }) - appParams.GetOrGenerate(cdc, OpWeightMsgCancelUnbondingDelegation, &weightMsgCancelUnbondingDelegation, nil, - func(_ *rand.Rand) { - weightMsgCancelUnbondingDelegation = DefaultWeightMsgCancelUnbondingDelegation - }, - ) + appParams.GetOrGenerate(OpWeightMsgCancelUnbondingDelegation, &weightMsgCancelUnbondingDelegation, nil, func(_ *rand.Rand) { + weightMsgCancelUnbondingDelegation = DefaultWeightMsgCancelUnbondingDelegation + }) return simulation.WeightedOperations{ simulation.NewWeightedOperation( diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 11c9aec9e86..60ee724fbbf 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -4,13 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" "github.com/cosmos/cosmos-sdk/x/authz" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers the necessary x/staking interfaces and concrete types @@ -49,20 +45,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 8b41c5bf6c1..89012d1b560 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -8,7 +8,6 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) var ( @@ -20,14 +19,6 @@ var ( _ sdk.Msg = &MsgBeginRedelegate{} _ sdk.Msg = &MsgCancelUnbondingDelegation{} _ sdk.Msg = &MsgUpdateParams{} - - _ legacytx.LegacyMsg = &MsgCreateValidator{} - _ legacytx.LegacyMsg = &MsgEditValidator{} - _ legacytx.LegacyMsg = &MsgDelegate{} - _ legacytx.LegacyMsg = &MsgUndelegate{} - _ legacytx.LegacyMsg = &MsgBeginRedelegate{} - _ legacytx.LegacyMsg = &MsgCancelUnbondingDelegation{} - _ legacytx.LegacyMsg = &MsgUpdateParams{} ) // NewMsgCreateValidator creates a new MsgCreateValidator instance. @@ -65,12 +56,6 @@ func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{valAccAddr} } -// GetSignBytes returns the message bytes to sign over. -func (msg MsgCreateValidator) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // Validate validates the MsgCreateValidator sdk msg. func (msg MsgCreateValidator) Validate() error { // note that unmarshaling from bech32 ensures both non-empty and valid @@ -135,12 +120,6 @@ func (msg MsgEditValidator) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sdk.AccAddress(valAddr)} } -// GetSignBytes implements the sdk.Msg interface. -func (msg MsgEditValidator) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // NewMsgDelegate creates a new MsgDelegate instance. func NewMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) *MsgDelegate { return &MsgDelegate{ @@ -156,12 +135,6 @@ func (msg MsgDelegate) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{delegator} } -// GetSignBytes implements the sdk.Msg interface. -func (msg MsgDelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // NewMsgBeginRedelegate creates a new MsgBeginRedelegate instance. func NewMsgBeginRedelegate( delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, amount sdk.Coin, @@ -180,12 +153,6 @@ func (msg MsgBeginRedelegate) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{delegator} } -// GetSignBytes implements the sdk.Msg interface. -func (msg MsgBeginRedelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // NewMsgUndelegate creates a new MsgUndelegate instance. func NewMsgUndelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) *MsgUndelegate { return &MsgUndelegate{ @@ -201,12 +168,6 @@ func (msg MsgUndelegate) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{delegator} } -// GetSignBytes implements the sdk.Msg interface. -func (msg MsgUndelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - // NewMsgCancelUnbondingDelegation creates a new MsgCancelUnbondingDelegation instance. func NewMsgCancelUnbondingDelegation(delAddr sdk.AccAddress, valAddr sdk.ValAddress, creationHeight int64, amount sdk.Coin) *MsgCancelUnbondingDelegation { return &MsgCancelUnbondingDelegation{ @@ -223,18 +184,6 @@ func (msg MsgCancelUnbondingDelegation) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{delegator} } -// GetSignBytes implements the sdk.Msg interface. -func (msg MsgCancelUnbondingDelegation) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSignBytes returns the raw bytes for a MsgUpdateParams message that -// the expected signer needs to sign. -func (m MsgUpdateParams) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - // GetSigners returns the expected signers for a MsgUpdateParams message func (m MsgUpdateParams) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Authority) diff --git a/x/tx/signing/aminojson/aminojson.go b/x/tx/signing/aminojson/aminojson.go index 5ccf26dfe20..6fc6e97e49b 100644 --- a/x/tx/signing/aminojson/aminojson.go +++ b/x/tx/signing/aminojson/aminojson.go @@ -115,6 +115,8 @@ func (h SignModeHandler) GetSignBytes(_ context.Context, signerData signing.Sign if err != nil { return nil, err } + // TODO: remove this sort once https://github.com/cosmos/cosmos-sdk/issues/2350#issuecomment-1542715157 lands + // the encoder should be rendering fields in lexical order return sortJSON(bz) } diff --git a/x/tx/signing/aminojson/json_marshal_test.go b/x/tx/signing/aminojson/json_marshal_test.go index 731f4eccae9..9b59c0f966b 100644 --- a/x/tx/signing/aminojson/json_marshal_test.go +++ b/x/tx/signing/aminojson/json_marshal_test.go @@ -1,14 +1,19 @@ package aminojson_test import ( + "fmt" "reflect" "testing" + "cosmossdk.io/x/tx/signing/aminojson/internal/aminojsonpb" "github.com/cosmos/cosmos-proto/rapidproto" "github.com/stretchr/testify/require" "github.com/tendermint/go-amino" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/dynamicpb" "pgregory.net/rapid" "gotest.tools/v3/assert" @@ -131,3 +136,20 @@ func checkRoundTrip(t *rapid.T, message proto.Message, marshaledBytes []byte) { err = cdc.UnmarshalJSON(marshaledBytes, message2) assert.NilError(t, err, "%s vs %s", string(marshaledBytes), string(goProtoJSON)) } + +func TestDynamicPb(t *testing.T) { + msg := &aminojsonpb.AminoSignFee{} + encoder := aminojson.NewEncoder(aminojson.EncoderOptions{}) + + desc, err := protoregistry.GlobalFiles.FindDescriptorByName(proto.MessageName(msg)) + require.NoError(t, err) + dynamicMsgType := dynamicpb.NewMessageType(desc.(protoreflect.MessageDescriptor)) + dynamicMsg := dynamicMsgType.New().Interface() + + bz, err := encoder.Marshal(msg) + require.NoError(t, err) + dynamicBz, err := encoder.Marshal(dynamicMsg) + require.NoError(t, err) + fmt.Printf("dynamicBz: %s\n", string(dynamicBz)) + require.Equal(t, string(bz), string(dynamicBz)) +} diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 74279ea3b6e..43c9b04c4ff 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -4,13 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec @@ -37,21 +33,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) - - // Register all Amino interfaces and concrete types on the authz and gov Amino codec - // so that this can later be used to properly serialize MsgGrant and MsgExec - // instances. - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} diff --git a/x/upgrade/types/msgs.go b/x/upgrade/types/msgs.go index f53c8576e4d..84ff4f6c926 100644 --- a/x/upgrade/types/msgs.go +++ b/x/upgrade/types/msgs.go @@ -2,18 +2,9 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var ( - _, _ sdk.Msg = &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{} - _, _ legacytx.LegacyMsg = &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{} -) - -// GetSignBytes implements the LegacyMsg interface. -func (m MsgSoftwareUpgrade) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} +var _, _ sdk.Msg = &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{} // GetSigners returns the expected signers for MsgSoftwareUpgrade. func (m *MsgSoftwareUpgrade) GetSigners() []sdk.AccAddress { @@ -21,11 +12,6 @@ func (m *MsgSoftwareUpgrade) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{addr} } -// GetSignBytes implements the LegacyMsg interface. -func (m MsgCancelUpgrade) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - // GetSigners returns the expected signers for MsgCancelUpgrade. func (m *MsgCancelUpgrade) GetSigners() []sdk.AccAddress { addr, _ := sdk.AccAddressFromBech32(m.Authority)