diff --git a/api/cosmos/gov/v1/gov.pulsar.go b/api/cosmos/gov/v1/gov.pulsar.go index 3a1022a415f2..9efdf3c56d3f 100644 --- a/api/cosmos/gov/v1/gov.pulsar.go +++ b/api/cosmos/gov/v1/gov.pulsar.go @@ -9119,22 +9119,22 @@ type VoteOption int32 const ( // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 - // VOTE_OPTION_ONE defines the first proposal vote option. - VoteOption_VOTE_OPTION_ONE VoteOption = 1 // VOTE_OPTION_YES defines the yes proposal vote option. VoteOption_VOTE_OPTION_YES VoteOption = 1 - // VOTE_OPTION_TWO defines the second proposal vote option. - VoteOption_VOTE_OPTION_TWO VoteOption = 2 + // VOTE_OPTION_ONE defines the first proposal vote option. + VoteOption_VOTE_OPTION_ONE VoteOption = 1 // VOTE_OPTION_ABSTAIN defines the abstain proposal vote option. VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 - // VOTE_OPTION_THREE defines the third proposal vote option. - VoteOption_VOTE_OPTION_THREE VoteOption = 3 + // VOTE_OPTION_TWO defines the second proposal vote option. + VoteOption_VOTE_OPTION_TWO VoteOption = 2 // VOTE_OPTION_NO defines the no proposal vote option. VoteOption_VOTE_OPTION_NO VoteOption = 3 - // VOTE_OPTION_FOUR defines the fourth proposal vote option. - VoteOption_VOTE_OPTION_FOUR VoteOption = 4 + // VOTE_OPTION_THREE defines the third proposal vote option. + VoteOption_VOTE_OPTION_THREE VoteOption = 3 // VOTE_OPTION_NO_WITH_VETO defines the no with veto proposal vote option. VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 + // VOTE_OPTION_FOUR defines the fourth proposal vote option. + VoteOption_VOTE_OPTION_FOUR VoteOption = 4 // VOTE_OPTION_SPAM defines the spam proposal vote option. VoteOption_VOTE_OPTION_SPAM VoteOption = 5 ) @@ -9143,26 +9143,26 @@ const ( var ( VoteOption_name = map[int32]string{ 0: "VOTE_OPTION_UNSPECIFIED", - 1: "VOTE_OPTION_ONE", - // Duplicate value: 1: "VOTE_OPTION_YES", - 2: "VOTE_OPTION_TWO", - // Duplicate value: 2: "VOTE_OPTION_ABSTAIN", - 3: "VOTE_OPTION_THREE", - // Duplicate value: 3: "VOTE_OPTION_NO", - 4: "VOTE_OPTION_FOUR", - // Duplicate value: 4: "VOTE_OPTION_NO_WITH_VETO", + 1: "VOTE_OPTION_YES", + // Duplicate value: 1: "VOTE_OPTION_ONE", + 2: "VOTE_OPTION_ABSTAIN", + // Duplicate value: 2: "VOTE_OPTION_TWO", + 3: "VOTE_OPTION_NO", + // Duplicate value: 3: "VOTE_OPTION_THREE", + 4: "VOTE_OPTION_NO_WITH_VETO", + // Duplicate value: 4: "VOTE_OPTION_FOUR", 5: "VOTE_OPTION_SPAM", } VoteOption_value = map[string]int32{ "VOTE_OPTION_UNSPECIFIED": 0, - "VOTE_OPTION_ONE": 1, "VOTE_OPTION_YES": 1, - "VOTE_OPTION_TWO": 2, + "VOTE_OPTION_ONE": 1, "VOTE_OPTION_ABSTAIN": 2, - "VOTE_OPTION_THREE": 3, + "VOTE_OPTION_TWO": 2, "VOTE_OPTION_NO": 3, - "VOTE_OPTION_FOUR": 4, + "VOTE_OPTION_THREE": 3, "VOTE_OPTION_NO_WITH_VETO": 4, + "VOTE_OPTION_FOUR": 4, "VOTE_OPTION_SPAM": 5, } ) @@ -10583,17 +10583,17 @@ var file_cosmos_gov_v1_gov_proto_rawDesc = []byte{ 0x01, 0x0a, 0x0a, 0x56, 0x6f, 0x74, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x4f, - 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, - 0x13, 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, - 0x45, 0x53, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, - 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x57, 0x4f, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x56, 0x4f, 0x54, - 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, - 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x56, 0x4f, 0x54, - 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, 0x14, 0x0a, - 0x10, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x55, - 0x52, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, + 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, + 0x13, 0x0a, 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, + 0x4e, 0x45, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, + 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x13, 0x0a, + 0x0f, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x57, 0x4f, + 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, + 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, + 0x18, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, + 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x56, + 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x46, 0x4f, 0x55, 0x52, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x56, 0x4f, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x50, 0x41, 0x4d, 0x10, 0x05, 0x1a, 0x02, 0x10, 0x01, 0x2a, 0xce, 0x01, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, diff --git a/x/gov/client/utils/utils_test.go b/x/gov/client/utils/utils_test.go index 135d64c2b79e..1ff88f1f16dc 100644 --- a/x/gov/client/utils/utils_test.go +++ b/x/gov/client/utils/utils_test.go @@ -15,31 +15,31 @@ func TestNormalizeWeightedVoteOptions(t *testing.T) { }{ "simple Yes": { options: "Yes", - normalized: "VOTE_OPTION_ONE=1", + normalized: "VOTE_OPTION_YES=1", }, "simple yes": { options: "yes", - normalized: "VOTE_OPTION_ONE=1", + normalized: "VOTE_OPTION_YES=1", }, "formal yes": { options: "yes=1", - normalized: "VOTE_OPTION_ONE=1", + normalized: "VOTE_OPTION_YES=1", }, "half yes half no": { options: "yes=0.5,no=0.5", - normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.5", + normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.5", }, "3 options": { options: "Yes=0.5,No=0.4,NoWithVeto=0.1", - normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.4,VOTE_OPTION_FOUR=0.1", + normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.4,VOTE_OPTION_NO_WITH_VETO=0.1", }, "zero weight option": { options: "Yes=0.5,No=0.5,NoWithVeto=0", - normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.5,VOTE_OPTION_FOUR=0", + normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.5,VOTE_OPTION_NO_WITH_VETO=0", }, "minus weight option": { options: "Yes=0.5,No=0.6,NoWithVeto=-0.1", - normalized: "VOTE_OPTION_ONE=0.5,VOTE_OPTION_THREE=0.6,VOTE_OPTION_FOUR=-0.1", + normalized: "VOTE_OPTION_YES=0.5,VOTE_OPTION_NO=0.6,VOTE_OPTION_NO_WITH_VETO=-0.1", }, "empty options": { options: "", diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 3f0632d06fc0..5425c3fd215b 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -726,7 +726,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_ONE weight:"0.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_YES weight:"0.000000000000000000" : invalid vote option`, }, "negative weight": { preRun: func() uint64 { @@ -738,7 +738,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_ONE weight:"-1.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_YES weight:"-1.000000000000000000" : invalid vote option`, }, "individual weight > 1 but weights sum == 1": { preRun: func() uint64 { @@ -751,7 +751,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_ONE weight:"2.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_YES weight:"2.000000000000000000" : invalid vote option`, }, "empty options": { preRun: func() uint64 { @@ -1368,7 +1368,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_ONE weight:"0.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_YES weight:"0.000000000000000000" : invalid vote option`, }, "negative weight": { preRun: func() uint64 { @@ -1383,7 +1383,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { voter: proposer, metadata: "", expErr: true, - expErrMsg: `option:VOTE_OPTION_ONE weight:"-1.000000000000000000" : invalid vote option`, + expErrMsg: `option:VOTE_OPTION_YES weight:"-1.000000000000000000" : invalid vote option`, }, "empty options": { preRun: func() uint64 { diff --git a/x/gov/proto/cosmos/gov/v1/gov.proto b/x/gov/proto/cosmos/gov/v1/gov.proto index 3d9ff64f9269..3ce0608c69ad 100644 --- a/x/gov/proto/cosmos/gov/v1/gov.proto +++ b/x/gov/proto/cosmos/gov/v1/gov.proto @@ -33,22 +33,22 @@ enum VoteOption { // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. VOTE_OPTION_UNSPECIFIED = 0; - // VOTE_OPTION_ONE defines the first proposal vote option. - VOTE_OPTION_ONE = 1; // VOTE_OPTION_YES defines the yes proposal vote option. VOTE_OPTION_YES = 1; - // VOTE_OPTION_TWO defines the second proposal vote option. - VOTE_OPTION_TWO = 2; + // VOTE_OPTION_ONE defines the first proposal vote option. + VOTE_OPTION_ONE = 1; // VOTE_OPTION_ABSTAIN defines the abstain proposal vote option. VOTE_OPTION_ABSTAIN = 2; - // VOTE_OPTION_THREE defines the third proposal vote option. - VOTE_OPTION_THREE = 3; + // VOTE_OPTION_TWO defines the second proposal vote option. + VOTE_OPTION_TWO = 2; // VOTE_OPTION_NO defines the no proposal vote option. VOTE_OPTION_NO = 3; - // VOTE_OPTION_FOUR defines the fourth proposal vote option. - VOTE_OPTION_FOUR = 4; + // VOTE_OPTION_THREE defines the third proposal vote option. + VOTE_OPTION_THREE = 3; // VOTE_OPTION_NO_WITH_VETO defines the no with veto proposal vote option. VOTE_OPTION_NO_WITH_VETO = 4; + // VOTE_OPTION_FOUR defines the fourth proposal vote option. + VOTE_OPTION_FOUR = 4; // VOTE_OPTION_SPAM defines the spam proposal vote option. VOTE_OPTION_SPAM = 5; } diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index b9ee0a367ea7..9dfd99de9af0 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -79,49 +79,49 @@ type VoteOption int32 const ( // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 - // VOTE_OPTION_ONE defines the first proposal vote option. - VoteOption_VOTE_OPTION_ONE VoteOption = 1 // VOTE_OPTION_YES defines the yes proposal vote option. VoteOption_VOTE_OPTION_YES VoteOption = 1 - // VOTE_OPTION_TWO defines the second proposal vote option. - VoteOption_VOTE_OPTION_TWO VoteOption = 2 + // VOTE_OPTION_ONE defines the first proposal vote option. + VoteOption_VOTE_OPTION_ONE VoteOption = 1 // VOTE_OPTION_ABSTAIN defines the abstain proposal vote option. VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 - // VOTE_OPTION_THREE defines the third proposal vote option. - VoteOption_VOTE_OPTION_THREE VoteOption = 3 + // VOTE_OPTION_TWO defines the second proposal vote option. + VoteOption_VOTE_OPTION_TWO VoteOption = 2 // VOTE_OPTION_NO defines the no proposal vote option. VoteOption_VOTE_OPTION_NO VoteOption = 3 - // VOTE_OPTION_FOUR defines the fourth proposal vote option. - VoteOption_VOTE_OPTION_FOUR VoteOption = 4 + // VOTE_OPTION_THREE defines the third proposal vote option. + VoteOption_VOTE_OPTION_THREE VoteOption = 3 // VOTE_OPTION_NO_WITH_VETO defines the no with veto proposal vote option. VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 + // VOTE_OPTION_FOUR defines the fourth proposal vote option. + VoteOption_VOTE_OPTION_FOUR VoteOption = 4 // VOTE_OPTION_SPAM defines the spam proposal vote option. VoteOption_VOTE_OPTION_SPAM VoteOption = 5 ) var VoteOption_name = map[int32]string{ 0: "VOTE_OPTION_UNSPECIFIED", - 1: "VOTE_OPTION_ONE", - // Duplicate value: 1: "VOTE_OPTION_YES", - 2: "VOTE_OPTION_TWO", - // Duplicate value: 2: "VOTE_OPTION_ABSTAIN", - 3: "VOTE_OPTION_THREE", - // Duplicate value: 3: "VOTE_OPTION_NO", - 4: "VOTE_OPTION_FOUR", - // Duplicate value: 4: "VOTE_OPTION_NO_WITH_VETO", + 1: "VOTE_OPTION_YES", + // Duplicate value: 1: "VOTE_OPTION_ONE", + 2: "VOTE_OPTION_ABSTAIN", + // Duplicate value: 2: "VOTE_OPTION_TWO", + 3: "VOTE_OPTION_NO", + // Duplicate value: 3: "VOTE_OPTION_THREE", + 4: "VOTE_OPTION_NO_WITH_VETO", + // Duplicate value: 4: "VOTE_OPTION_FOUR", 5: "VOTE_OPTION_SPAM", } var VoteOption_value = map[string]int32{ "VOTE_OPTION_UNSPECIFIED": 0, - "VOTE_OPTION_ONE": 1, "VOTE_OPTION_YES": 1, - "VOTE_OPTION_TWO": 2, + "VOTE_OPTION_ONE": 1, "VOTE_OPTION_ABSTAIN": 2, - "VOTE_OPTION_THREE": 3, + "VOTE_OPTION_TWO": 2, "VOTE_OPTION_NO": 3, - "VOTE_OPTION_FOUR": 4, + "VOTE_OPTION_THREE": 3, "VOTE_OPTION_NO_WITH_VETO": 4, + "VOTE_OPTION_FOUR": 4, "VOTE_OPTION_SPAM": 5, } @@ -1322,7 +1322,7 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1/gov.proto", fileDescriptor_e05cb1c0d030febb) } var fileDescriptor_e05cb1c0d030febb = []byte{ - // 1856 bytes of a gzipped FileDescriptorProto + // 1854 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcd, 0x73, 0xe3, 0x48, 0x15, 0x1f, 0xd9, 0x8e, 0x63, 0xbf, 0x38, 0x8e, 0xa6, 0x93, 0xd9, 0x28, 0xc9, 0xe6, 0x63, 0xcc, 0xd6, 0x56, 0x6a, 0xd8, 0xd8, 0x64, 0x61, 0x28, 0x6a, 0x59, 0x0a, 0xec, 0x58, 0x43, 0x34, 0x24, @@ -1424,21 +1424,21 @@ var fileDescriptor_e05cb1c0d030febb = []byte{ 0xed, 0x3d, 0xdd, 0xde, 0xd9, 0x6d, 0x19, 0x3b, 0xba, 0x9a, 0x41, 0xef, 0x82, 0x36, 0x0a, 0x69, 0xb5, 0x2d, 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 0xa3, 0x2a, 0x8f, 0xfe, + 0xae, 0x40, 0x79, 0xf4, 0x9b, 0x01, 0x5a, 0x87, 0x95, 0x61, 0xb0, 0x3a, 0x56, 0xdd, 0x7a, 0xd6, + 0x19, 0x0b, 0x42, 0x05, 0xd6, 0xc6, 0x01, 0x4d, 0xbd, 0xdd, 0xea, 0x18, 0x96, 0xdd, 0xd6, 0x4d, + 0xa3, 0x35, 0x9e, 0x32, 0x89, 0x39, 0x6c, 0x59, 0xc6, 0xc1, 0x8f, 0x63, 0x48, 0x66, 0x24, 0xe3, + 0x12, 0xd2, 0xae, 0x77, 0x3a, 0x7a, 0x53, 0x6c, 0x72, 0x5c, 0x67, 0xea, 0x4f, 0xf5, 0x1d, 0x9e, + 0xb1, 0x49, 0xcc, 0x27, 0x75, 0x63, 0x4f, 0x6f, 0xaa, 0x53, 0x8d, 0xc7, 0x9f, 0xbd, 0x5e, 0x53, + 0x3e, 0x7f, 0xbd, 0xa6, 0xfc, 0xfb, 0xf5, 0x9a, 0xf2, 0xc9, 0x9b, 0xb5, 0x7b, 0x9f, 0xbf, 0x59, + 0xbb, 0xf7, 0x8f, 0x37, 0x6b, 0xf7, 0x7e, 0xb6, 0x22, 0x8a, 0x35, 0x72, 0x7f, 0x59, 0xf5, 0x48, + 0xed, 0x92, 0x7f, 0x8d, 0x63, 0x3f, 0x43, 0xa3, 0xda, 0xf9, 0xf6, 0x71, 0x9e, 0x77, 0xe4, 0xb7, + 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x80, 0xb6, 0x5a, 0xab, 0x13, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { diff --git a/x/gov/types/v1/vote_test.go b/x/gov/types/v1/vote_test.go new file mode 100644 index 000000000000..c2d17e496b0e --- /dev/null +++ b/x/gov/types/v1/vote_test.go @@ -0,0 +1,61 @@ +package v1_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + v1 "cosmossdk.io/x/gov/types/v1" + + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" +) + +func TestVoteAlias(t *testing.T) { + cdc := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}).Codec + + testCases := []struct { + name string + input string + expected v1.MsgVote + expectedErrMsg string + }{ + { + name: "valid vote", + input: `{"proposal_id":"1","voter":"cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66","option":"VOTE_OPTION_YES","metadata":"test"}`, + expected: v1.MsgVote{ + ProposalId: 1, + Voter: "cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66", + Option: v1.VoteOption_VOTE_OPTION_YES, + Metadata: "test", + }, + }, + { + name: "valid vote alias", + input: `{"proposal_id":"1","voter":"cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66","option":"VOTE_OPTION_ONE","metadata":"test"}`, + expected: v1.MsgVote{ + ProposalId: 1, + Voter: "cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66", + Option: v1.VoteOption_VOTE_OPTION_ONE, + Metadata: "test", + }, + }, + { + name: "invalid vote", + input: `{"proposal_id":"1","voter":"cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66","option":"VOTE_OPTION_HELLO","metadata":"test"}`, + expectedErrMsg: "unknown value \"VOTE_OPTION_HELLO\" for enum cosmos.gov.v1.VoteOption", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + vote := &v1.MsgVote{} + err := cdc.UnmarshalJSON([]byte(tc.input), vote) + if tc.expectedErrMsg != "" { + require.ErrorContains(t, err, tc.expectedErrMsg) + } else { + require.NoError(t, err) + } + }) + } +}