diff --git a/Makefile b/Makefile index d0279849..873b8bfb 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ ifeq ($(EXPERIMENTAL),true) TEST_RACE_ARGS += experimental endif -test-unit: ARGS=-tags='$(UNIT_TEST_ARGS)' +test-unit: ARGS=-count=1 -tags='$(UNIT_TEST_ARGS)' test-unit-amino: ARGS=-tags='${AMINO_TEST_ARGS}' test-ledger: ARGS=-tags='${LEDGER_TEST_ARGS}' test-ledger-mock: ARGS=-tags='${LEDGER_MOCK_ARGS}' diff --git a/go.mod b/go.mod index b2dc25c7..8960399f 100644 --- a/go.mod +++ b/go.mod @@ -22,9 +22,9 @@ require ( github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.13 github.com/tendermint/tm-db v0.6.4 - golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8 // indirect + golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20211115160612-a5da7257a6f7 + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.40.0 google.golang.org/protobuf v1.27.1 pgregory.net/rapid v0.4.7 diff --git a/go.sum b/go.sum index 9b384f57..653eae26 100644 --- a/go.sum +++ b/go.sum @@ -813,8 +813,8 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8 h1:5QRxNnVsaJP6NAse0UdkRgL3zHMvCRRkrDVLNdNpdy4= -golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 h1:/pEO3GD/ABYAjuakUS6xSEmmlyVS4kxBNkeA9tLJiTI= +golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -901,8 +901,9 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f h1:w6wWR0H+nyVpbSAQbzVEIACVyr/h8l/BEkY6Sokc7Eg= golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1189,8 +1190,8 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20211115160612-a5da7257a6f7 h1:0LoCYJF53PEqtJOntKxGD72X/c8Xto5EZ4HLrt9D80I= -google.golang.org/genproto v0.0.0-20211115160612-a5da7257a6f7/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= diff --git a/orm/table.go b/orm/table.go index 82c5c3b5..664432db 100644 --- a/orm/table.go +++ b/orm/table.go @@ -149,7 +149,9 @@ func (a table) Set(ctx HasKVStore, rowID RowID, newValue codec.ProtoMarshaler) e var oldValue codec.ProtoMarshaler if a.Has(ctx, rowID) { oldValue = reflect.New(a.model).Interface().(codec.ProtoMarshaler) - a.GetOne(ctx, rowID, oldValue) + if err := a.GetOne(ctx, rowID, oldValue); err != nil { + return err + } } newValueEncoded, err := a.cdc.MarshalBinaryBare(newValue) diff --git a/proto/fetchai/group/v1alpha1/types.proto b/proto/fetchai/group/v1alpha1/types.proto index 4ba94277..afdf937a 100644 --- a/proto/fetchai/group/v1alpha1/types.proto +++ b/proto/fetchai/group/v1alpha1/types.proto @@ -275,10 +275,15 @@ message Vote { google.protobuf.Timestamp submitted_at = 5 [(gogoproto.nullable) = false]; } -// TallyPoll represents the sum of weighted votes for a poll. message TallyPoll { option (gogoproto.goproto_getters) = false; - map counts = 1; + repeated TallyPollEntry entries = 1; +} + +message TallyPollEntry { + option (gogoproto.goproto_getters) = false; + string option_title = 1; + string weight = 2; } // Options represents the choices voters can vote for a poll. diff --git a/x/group/client/testsuite/tx.go b/x/group/client/testsuite/tx.go index 0256d915..5a0059a4 100644 --- a/x/group/client/testsuite/tx.go +++ b/x/group/client/testsuite/tx.go @@ -545,7 +545,6 @@ func (s *IntegrationTestSuite) TestTxCreateGroup() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -666,7 +665,6 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -753,7 +751,6 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMetadata() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -876,7 +873,6 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupMembers() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -1001,7 +997,6 @@ func (s *IntegrationTestSuite) TestTxCreateGroupAccount() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -1105,7 +1100,6 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountAdmin() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -1209,7 +1203,6 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountDecisionPolicy() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -1328,7 +1321,6 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAccountMetadata() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -1529,7 +1521,6 @@ func (s *IntegrationTestSuite) TestTxCreateProposal() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -1718,7 +1709,6 @@ func (s *IntegrationTestSuite) TestTxVote() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -1771,7 +1761,6 @@ func (s *IntegrationTestSuite) TestTxVoteAgg() { s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &txResp), out.String()) s.Require().Equal(uint32(0), txResp.Code, out.String()) - s.network.WaitForNextBlock() voteFlags := []string{ fmt.Sprintf("--%s=json", tmcli.OutputFlag), @@ -1996,7 +1985,6 @@ func (s *IntegrationTestSuite) TestTxExec() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -2199,7 +2187,6 @@ func (s *IntegrationTestSuite) TestTxCreatePoll() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -2218,6 +2205,29 @@ func (s *IntegrationTestSuite) TestTxVotePoll() { s.Require().NoError(err) aliceAddr := sdk.AccAddress(aliceInfo.GetPubKey().Address()) + now := time.Now() + deadline := now.Add(time.Second * 3000) + timeout, err := gogotypes.TimestampProto(deadline) + s.Require().NoError(err) + timeoutStr := timeout.String() + + // create a valid poll + cmd := client.MsgCreatePollCmd() + out, err := cli.ExecTestCLICmd(clientCtx, cmd, append([]string{ + aliceAddr.String(), + "2", + "2023 Election", + "alice,bob,charlie,eva", + "2", + timeoutStr, + validMetadata, + }, commonFlags...)) + s.Require().NoError(err, out.String()) + resp := &sdk.TxResponse{} + s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), resp), out.String()) + s.Require().Equal(uint32(0), resp.Code, out.String()) + validPollID := strings.Trim(resp.Logs[0].Events[0].Attributes[0].Value, "\"") + testCases := []struct { name string args []string @@ -2230,7 +2240,7 @@ func (s *IntegrationTestSuite) TestTxVotePoll() { "correct data", append( []string{ - "2", + validPollID, aliceAddr.String(), "alice,bob", "", @@ -2294,7 +2304,6 @@ func (s *IntegrationTestSuite) TestTxVotePoll() { for _, tc := range testCases { tc := tc - s.Run(tc.name, func() { cmd := client.MsgVotePollCmd() @@ -2308,7 +2317,6 @@ func (s *IntegrationTestSuite) TestTxVotePoll() { txResp := tc.respType.(*sdk.TxResponse) s.Require().Equal(tc.expectedCode, txResp.Code, out.String()) } - s.Require().NoError(s.network.WaitForNextBlock()) }) } } @@ -2375,7 +2383,7 @@ func (s *IntegrationTestSuite) TestTxVotePollAgg() { fmt.Sprintf("--%s=json", tmcli.OutputFlag), } - pollID := "3" + pollID := strings.Trim(txResp.Logs[0].Events[0].Attributes[0].Value, "\"") // basic vote from alice cmd = client.GetVotePollBasicCmd() @@ -2465,8 +2473,11 @@ func (s *IntegrationTestSuite) TestTxVotePollAgg() { s.Require().NoError(err, out.String()) s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &pollRes)) s.Require().Equal(pollRes.Poll.Status, group.PollStatusSubmitted) - s.Require().Equal(pollRes.Poll.VoteState.Counts, map[string]string{ - "alice": "1", "bob": "2", "david": "6", "eva": "4", + s.Require().Equal(pollRes.Poll.VoteState.Entries, []*group.TallyPollEntry{ + {OptionTitle: "alice", Weight: "1"}, + {OptionTitle: "bob", Weight: "2"}, + {OptionTitle: "david", Weight: "6"}, + {OptionTitle: "eva", Weight: "4"}, }) // test invalid diff --git a/x/group/client/tx.go b/x/group/client/tx.go index 4976c8c1..5d09ab7b 100644 --- a/x/group/client/tx.go +++ b/x/group/client/tx.go @@ -814,29 +814,8 @@ Parameters: } // make sure group members are sorted by their addresses - sorted := sort.SliceIsSorted(groupMembers, func(i, j int) bool { - addri, err := sdk.AccAddressFromBech32(groupMembers[i].Member.Address) - if err != nil { - panic(err) - } - addrj, err := sdk.AccAddressFromBech32(groupMembers[j].Member.Address) - if err != nil { - panic(err) - } - return bytes.Compare(addri, addrj) < 0 - }) - if !sorted { - sort.Slice(groupMembers, func(i, j int) bool { - addri, err := sdk.AccAddressFromBech32(groupMembers[i].Member.Address) - if err != nil { - panic(err) - } - addrj, err := sdk.AccAddressFromBech32(groupMembers[j].Member.Address) - if err != nil { - panic(err) - } - return bytes.Compare(addri, addrj) < 0 - }) + if !sort.SliceIsSorted(groupMembers, sortGroupMembersFunc(groupMembers)) { + sort.SliceStable(groupMembers, sortGroupMembersFunc(groupMembers)) } index := make(map[string]int, len(groupMembers)) @@ -1023,29 +1002,8 @@ Parameters: } // make sure group members are sorted by their addresses - sorted := sort.SliceIsSorted(groupMembers, func(i, j int) bool { - addri, err := sdk.AccAddressFromBech32(groupMembers[i].Member.Address) - if err != nil { - panic(err) - } - addrj, err := sdk.AccAddressFromBech32(groupMembers[j].Member.Address) - if err != nil { - panic(err) - } - return bytes.Compare(addri, addrj) < 0 - }) - if !sorted { - sort.Slice(groupMembers, func(i, j int) bool { - addri, err := sdk.AccAddressFromBech32(groupMembers[i].Member.Address) - if err != nil { - panic(err) - } - addrj, err := sdk.AccAddressFromBech32(groupMembers[j].Member.Address) - if err != nil { - panic(err) - } - return bytes.Compare(addri, addrj) < 0 - }) + if !sort.SliceIsSorted(groupMembers, sortGroupMembersFunc(groupMembers)) { + sort.SliceStable(groupMembers, sortGroupMembersFunc(groupMembers)) } index := make(map[string]int, len(groupMembers)) @@ -1381,3 +1339,17 @@ Parameters: return cmd } + +func sortGroupMembersFunc(groupMembers []*group.GroupMember) func(i, j int) bool { + return func(i, j int) bool { + addri, err := sdk.AccAddressFromBech32(groupMembers[i].Member.Address) + if err != nil { + panic(err) + } + addrj, err := sdk.AccAddressFromBech32(groupMembers[j].Member.Address) + if err != nil { + panic(err) + } + return bytes.Compare(addri, addrj) < 0 + } +} diff --git a/x/group/msgs.go b/x/group/msgs.go index f9fe266a..6dcbaf5f 100644 --- a/x/group/msgs.go +++ b/x/group/msgs.go @@ -1100,9 +1100,9 @@ func (m MsgVotePollBasicResponse) VerifySignature() error { } // todo: repeated public keys can be coalesced in pairings - var pkss [][]*bls12381.PubKey - for _ = range m.Options.Titles { - pkss = append(pkss, []*bls12381.PubKey{pkBls}) + pkss := make([][]*bls12381.PubKey, len(m.Options.Titles)) + for i := range m.Options.Titles { + pkss[i] = []*bls12381.PubKey{pkBls} } if err := bls12381.VerifyAggregateSignature(msgsBytes, false, m.Sig, pkss); err != nil { diff --git a/x/group/msgs_test.go b/x/group/msgs_test.go index 6963b594..cf04c543 100644 --- a/x/group/msgs_test.go +++ b/x/group/msgs_test.go @@ -124,6 +124,7 @@ func TestMsgCreateGroupValidation(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { @@ -217,6 +218,7 @@ func TestMsgCreateGroupAccount(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { m, err := NewMsgCreateGroupAccount( spec.admin, @@ -298,6 +300,7 @@ func TestMsgCreateProposalRequest(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { @@ -380,6 +383,7 @@ func TestMsgVote(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { @@ -566,6 +570,7 @@ func TestMsgVoteBasicResponse(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { @@ -673,6 +678,7 @@ func TestMsgVoteAggRequest(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { @@ -694,7 +700,7 @@ func TestMsgCreatePollRequest(t *testing.T) { longTitle := strings.Repeat("my title", 256) manyOptions := make([]string, 300) - for i, _ := range manyOptions { + for i := range manyOptions { manyOptions[i] = fmt.Sprintf("option-%d", i) } @@ -853,6 +859,7 @@ func TestMsgCreatePollRequest(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { @@ -935,6 +942,7 @@ func TestMsgVotePoll(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { @@ -962,7 +970,10 @@ func TestMsgVotePollAggRequest(t *testing.T) { src: MsgVotePollAgg{ Sender: memberAddr, PollId: 1, - Votes: []Options{Options{Titles: []string{"alice", "bob"}}, Options{Titles: []string{"alice"}}}, + Votes: []Options{ + {Titles: []string{"alice", "bob"}}, + {Titles: []string{"alice"}}, + }, Expiry: *expiry, AggSig: []byte("does not check signature"), }, @@ -970,7 +981,10 @@ func TestMsgVotePollAggRequest(t *testing.T) { "poll required": { src: MsgVotePollAgg{ Sender: memberAddr, - Votes: []Options{Options{Titles: []string{"alice", "bob"}}, Options{Titles: []string{"alice"}}}, + Votes: []Options{ + {Titles: []string{"alice", "bob"}}, + {Titles: []string{"alice"}}, + }, Expiry: *expiry, AggSig: []byte("does not check signature"), }, @@ -989,7 +1003,10 @@ func TestMsgVotePollAggRequest(t *testing.T) { src: MsgVotePollAgg{ Sender: memberAddr, PollId: 1, - Votes: []Options{Options{Titles: []string{"alice", ""}}, Options{Titles: []string{"alice"}}}, + Votes: []Options{ + {Titles: []string{"alice", ""}}, + {Titles: []string{"alice"}}, + }, Expiry: *expiry, AggSig: []byte("does not check signature"), }, @@ -998,7 +1015,10 @@ func TestMsgVotePollAggRequest(t *testing.T) { "sender required": { src: MsgVotePollAgg{ PollId: 1, - Votes: []Options{Options{Titles: []string{"alice", "bob"}}, Options{Titles: []string{"alice"}}}, + Votes: []Options{ + {Titles: []string{"alice", "bob"}}, + {Titles: []string{"alice"}}, + }, Expiry: *expiry, AggSig: []byte("does not check signature"), }, @@ -1008,7 +1028,10 @@ func TestMsgVotePollAggRequest(t *testing.T) { src: MsgVotePollAgg{ Sender: "invalid sender address", PollId: 1, - Votes: []Options{Options{Titles: []string{"alice", "bob"}}, Options{Titles: []string{"alice"}}}, + Votes: []Options{ + {Titles: []string{"alice", "bob"}}, + {Titles: []string{"alice"}}, + }, Expiry: *expiry, AggSig: []byte("does not check signature"), }, @@ -1018,16 +1041,22 @@ func TestMsgVotePollAggRequest(t *testing.T) { src: MsgVotePollAgg{ Sender: memberAddr, PollId: 1, - Votes: []Options{Options{Titles: []string{"alice", "bob"}}, Options{Titles: []string{"alice"}}}, + Votes: []Options{ + {Titles: []string{"alice", "bob"}}, + {Titles: []string{"alice"}}, + }, Expiry: *expiry, }, expErr: true, }, "metadata too long": { src: MsgVotePollAgg{ - Sender: memberAddr, - PollId: 1, - Votes: []Options{Options{Titles: []string{"alice", "bob"}}, Options{Titles: []string{"alice"}}}, + Sender: memberAddr, + PollId: 1, + Votes: []Options{ + {Titles: []string{"alice", "bob"}}, + {Titles: []string{"alice"}}, + }, Expiry: *expiry, AggSig: []byte("does not check signature"), Metadata: bytes.Repeat([]byte{1}, 256), @@ -1036,6 +1065,7 @@ func TestMsgVotePollAggRequest(t *testing.T) { }, } for msg, spec := range specs { + spec := spec t.Run(msg, func(t *testing.T) { err := spec.src.ValidateBasic() if spec.expErr { diff --git a/x/group/server/msg_server.go b/x/group/server/msg_server.go index e1152ada..93b865d0 100644 --- a/x/group/server/msg_server.go +++ b/x/group/server/msg_server.go @@ -6,6 +6,7 @@ import ( "encoding/binary" "fmt" "reflect" + "sort" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -69,6 +70,10 @@ func (s serverImpl) CreateGroup(goCtx context.Context, req *group.MsgCreateGroup } } + if len(metadata) > group.MaxMetadataLength { + return nil, sdkerrors.Wrap(group.ErrMaxLimit, "group metadata") + } + totalWeight := math.NewDecFromInt64(0) for i := range members.Members { m := members.Members[i] @@ -907,14 +912,14 @@ func (s serverImpl) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgE func (s serverImpl) CreatePoll(goCtx context.Context, req *group.MsgCreatePoll) (*group.MsgCreatePollResponse, error) { ctx := types.UnwrapSDKContext(goCtx) creator := req.Creator - groupId := req.GroupId + groupID := req.GroupId endTime := req.Timeout metadata := req.Metadata title := req.Title options := req.Options limit := req.VoteLimit - g, err := s.getGroupInfo(ctx, groupId) + g, err := s.getGroupInfo(ctx, groupID) if err != nil { return nil, sdkerrors.Wrap(err, "get group by account") } @@ -933,9 +938,11 @@ func (s serverImpl) CreatePoll(goCtx context.Context, req *group.MsgCreatePoll) return nil, sdkerrors.Wrap(group.ErrExpired, "poll already expired") } + sort.Strings(options.Titles) + m := &group.Poll{ PollId: s.pollTable.Sequence().PeekNextVal(ctx), - GroupId: groupId, + GroupId: groupID, Title: title, Options: options, Creator: creator, @@ -1010,6 +1017,8 @@ func (s serverImpl) VotePoll(goCtx context.Context, req *group.MsgVotePoll) (*gr return nil, sdkerrors.Wrapf(err, "address: %s", voterAddr) } + sort.Strings(options.Titles) + newVote := group.VotePoll{ PollId: id, Voter: voterAddr, @@ -1017,10 +1026,6 @@ func (s serverImpl) VotePoll(goCtx context.Context, req *group.MsgVotePoll) (*gr Metadata: metadata, SubmittedAt: *blockTime, } - if len(poll.VoteState.Counts) == 0 { - poll.VoteState.Counts = make(map[string]string) - } - if err := poll.VoteState.Add(newVote, voter.Member.Weight); err != nil { return nil, sdkerrors.Wrap(err, "add new vote") } @@ -1031,6 +1036,10 @@ func (s serverImpl) VotePoll(goCtx context.Context, req *group.MsgVotePoll) (*gr return nil, sdkerrors.Wrap(err, "store vote") } + sort.SliceStable(poll.VoteState.Entries, func(i, j int) bool { + return poll.VoteState.Entries[i].OptionTitle < poll.VoteState.Entries[j].OptionTitle + }) + if err = s.pollTable.Set(ctx, id, &poll); err != nil { return nil, err } @@ -1183,11 +1192,6 @@ func (s serverImpl) VotePollAgg(goCtx context.Context, req *group.MsgVotePollAgg return nil, err } - // Count and store votes. - if len(poll.VoteState.Counts) == 0 { - poll.VoteState.Counts = make(map[string]string, len(votesStore)) - } - for i := range votesStore { // skip the vote if error err := poll.VoteState.Add(votesStore[i], weights[i]) @@ -1206,6 +1210,9 @@ func (s serverImpl) VotePollAgg(goCtx context.Context, req *group.MsgVotePollAgg } } + sort.SliceStable(poll.VoteState.Entries, func(i, j int) bool { + return poll.VoteState.Entries[i].OptionTitle < poll.VoteState.Entries[j].OptionTitle + }) if err = s.pollTable.Set(ctx, id, &poll); err != nil { return nil, err } diff --git a/x/group/server/server.go b/x/group/server/server.go index 864ba7bb..8f2baa8d 100644 --- a/x/group/server/server.go +++ b/x/group/server/server.go @@ -254,6 +254,9 @@ func newServer(storeKey servermodule.RootModuleKey, accKeeper exported.AccountKe s.votePollByPollIndex, err = orm.NewIndex(votePollTableBuilder, VotePollByPollIndexPrefix, func(value interface{}) ([]interface{}, error) { return []interface{}{value.(*group.VotePoll).PollId}, nil }, group.VotePoll{}.PollId) + if err != nil { + panic(err.Error()) + } s.votePollByVoterIndex, err = orm.NewIndex(votePollTableBuilder, VotePollByVoterIndexPrefix, func(value interface{}) ([]interface{}, error) { addr, err := sdk.AccAddressFromBech32(value.(*group.VotePoll).Voter) if err != nil { diff --git a/x/group/server/testsuite/suite.go b/x/group/server/testsuite/suite.go index ffc89f9a..c18eb8c4 100644 --- a/x/group/server/testsuite/suite.go +++ b/x/group/server/testsuite/suite.go @@ -2765,9 +2765,9 @@ func (s *IntegrationTestSuite) TestVotePoll() { Options: group.Options{Titles: []string{"alice", "bob"}}, }, expVoteState: group.TallyPoll{ - Counts: map[string]string{ - "alice": "1", - "bob": "1", + Entries: []*group.TallyPollEntry{ + {OptionTitle: "alice", Weight: "1"}, + {OptionTitle: "bob", Weight: "1"}, }, }, expPollStatus: group.PollStatusSubmitted, @@ -2843,9 +2843,9 @@ func (s *IntegrationTestSuite) TestVotePoll() { s.Require().NoError(err) }, expVoteState: group.TallyPoll{ - Counts: map[string]string{ - "alice": "2", - "bob": "3", + Entries: []*group.TallyPollEntry{ + {OptionTitle: "alice", Weight: "2"}, + {OptionTitle: "bob", Weight: "3"}, }, }, expPollStatus: group.PollStatusSubmitted, @@ -3239,9 +3239,9 @@ func (s *IntegrationTestSuite) TestVotePollAgg() { }, votes: validVotes, expVoteState: group.TallyPoll{ - Counts: map[string]string{ - "alice": "4", - "bob": "1", + Entries: []*group.TallyPollEntry{ + {OptionTitle: "alice", Weight: "4"}, + {OptionTitle: "bob", Weight: "1"}, }, }, expPollStatus: group.PollStatusSubmitted, @@ -3265,10 +3265,10 @@ func (s *IntegrationTestSuite) TestVotePollAgg() { s.Require().NoError(err) }, expVoteState: group.TallyPoll{ - Counts: map[string]string{ - "alice": "3", - "bob": "0", - "charlie": "1", + Entries: []*group.TallyPollEntry{ + {OptionTitle: "alice", Weight: "3"}, + {OptionTitle: "bob", Weight: "0"}, + {OptionTitle: "charlie", Weight: "1"}, }, }, expPollStatus: group.PollStatusSubmitted, diff --git a/x/group/types.go b/x/group/types.go index 047d0006..c4e1b8a3 100644 --- a/x/group/types.go +++ b/x/group/types.go @@ -582,27 +582,43 @@ func (t *TallyPoll) operation(vote VotePoll, weight string, op operation) error } for _, option := range vote.Options.Titles { - res, err := math.NewNonNegativeDecFromString("0") + res, err := t.getOptionWeight(option) if err != nil { - return err - } - if x, ok := t.Counts[option]; ok { - res, err = math.NewNonNegativeDecFromString(x) - if err != nil { - return err - } + return sdkerrors.Wrap(err, "getOptionWeight") } res, err = op(res, weightDec) if err != nil { return sdkerrors.Wrap(err, "count") } - - t.Counts[option] = res.String() + t.setOptionWeight(option, res) } return nil } +func (t *TallyPoll) getOptionWeight(title string) (math.Dec, error) { + for _, entry := range t.Entries { + if entry.OptionTitle == title { + return math.NewNonNegativeDecFromString(entry.Weight) + } + } + return math.NewDecFromInt64(0), nil +} + +func (t *TallyPoll) setOptionWeight(title string, weight math.Dec) { + for i, entry := range t.Entries { + if entry.OptionTitle == title { + t.Entries[i].Weight = weight.String() + return + } + } + t.Entries = append(t.Entries, &TallyPollEntry{ + OptionTitle: title, + Weight: weight.String(), + }) + return +} + // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces func (q QueryGroupAccountsByGroupResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { return unpackGroupAccounts(unpacker, q.GroupAccounts) diff --git a/x/group/types.pb.go b/x/group/types.pb.go index b904f61d..16bd82d7 100644 --- a/x/group/types.pb.go +++ b/x/group/types.pb.go @@ -208,7 +208,7 @@ func (x Poll_Status) String() string { } func (Poll_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_35b2f87fd83fcfeb, []int{11, 0} + return fileDescriptor_35b2f87fd83fcfeb, []int{12, 0} } // Member represents a group member with an account address, @@ -778,9 +778,8 @@ func (m *Vote) GetSubmittedAt() types.Timestamp { return types.Timestamp{} } -// TallyPoll represents the sum of weighted votes for a poll. type TallyPoll struct { - Counts map[string]string `protobuf:"bytes,1,rep,name=counts,proto3" json:"counts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Entries []*TallyPollEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` } func (m *TallyPoll) Reset() { *m = TallyPoll{} } @@ -816,6 +815,44 @@ func (m *TallyPoll) XXX_DiscardUnknown() { var xxx_messageInfo_TallyPoll proto.InternalMessageInfo +type TallyPollEntry struct { + OptionTitle string `protobuf:"bytes,1,opt,name=option_title,json=optionTitle,proto3" json:"option_title,omitempty"` + Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` +} + +func (m *TallyPollEntry) Reset() { *m = TallyPollEntry{} } +func (m *TallyPollEntry) String() string { return proto.CompactTextString(m) } +func (*TallyPollEntry) ProtoMessage() {} +func (*TallyPollEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_35b2f87fd83fcfeb, []int{10} +} +func (m *TallyPollEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyPollEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyPollEntry.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TallyPollEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyPollEntry.Merge(m, src) +} +func (m *TallyPollEntry) XXX_Size() int { + return m.Size() +} +func (m *TallyPollEntry) XXX_DiscardUnknown() { + xxx_messageInfo_TallyPollEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyPollEntry proto.InternalMessageInfo + // Options represents the choices voters can vote for a poll. type Options struct { Titles []string `protobuf:"bytes,1,rep,name=titles,proto3" json:"titles,omitempty"` @@ -825,7 +862,7 @@ func (m *Options) Reset() { *m = Options{} } func (m *Options) String() string { return proto.CompactTextString(m) } func (*Options) ProtoMessage() {} func (*Options) Descriptor() ([]byte, []int) { - return fileDescriptor_35b2f87fd83fcfeb, []int{10} + return fileDescriptor_35b2f87fd83fcfeb, []int{11} } func (m *Options) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -890,7 +927,7 @@ func (m *Poll) Reset() { *m = Poll{} } func (m *Poll) String() string { return proto.CompactTextString(m) } func (*Poll) ProtoMessage() {} func (*Poll) Descriptor() ([]byte, []int) { - return fileDescriptor_35b2f87fd83fcfeb, []int{11} + return fileDescriptor_35b2f87fd83fcfeb, []int{12} } func (m *Poll) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -937,7 +974,7 @@ func (m *VotePoll) Reset() { *m = VotePoll{} } func (m *VotePoll) String() string { return proto.CompactTextString(m) } func (*VotePoll) ProtoMessage() {} func (*VotePoll) Descriptor() ([]byte, []int) { - return fileDescriptor_35b2f87fd83fcfeb, []int{12} + return fileDescriptor_35b2f87fd83fcfeb, []int{13} } func (m *VotePoll) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1017,7 +1054,7 @@ func init() { proto.RegisterType((*Tally)(nil), "fetchai.group.v1alpha1.Tally") proto.RegisterType((*Vote)(nil), "fetchai.group.v1alpha1.Vote") proto.RegisterType((*TallyPoll)(nil), "fetchai.group.v1alpha1.TallyPoll") - proto.RegisterMapType((map[string]string)(nil), "fetchai.group.v1alpha1.TallyPoll.CountsEntry") + proto.RegisterType((*TallyPollEntry)(nil), "fetchai.group.v1alpha1.TallyPollEntry") proto.RegisterType((*Options)(nil), "fetchai.group.v1alpha1.Options") proto.RegisterType((*Poll)(nil), "fetchai.group.v1alpha1.Poll") proto.RegisterType((*VotePoll)(nil), "fetchai.group.v1alpha1.VotePoll") @@ -1028,107 +1065,106 @@ func init() { } var fileDescriptor_35b2f87fd83fcfeb = []byte{ - // 1585 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x5f, 0x6f, 0x1b, 0x4b, - 0x15, 0xcf, 0xda, 0x8e, 0xff, 0x1c, 0x27, 0x8e, 0x99, 0xa6, 0x89, 0xe3, 0x36, 0xce, 0xc6, 0x15, - 0x6a, 0x00, 0xc5, 0x56, 0x82, 0x40, 0x34, 0x15, 0xad, 0x6c, 0x67, 0x03, 0x86, 0x34, 0x0e, 0x6b, - 0x3b, 0x94, 0xbe, 0x98, 0xf5, 0xee, 0xc4, 0x59, 0x58, 0xef, 0x58, 0xbb, 0xe3, 0x50, 0xf3, 0x01, - 0x50, 0xf1, 0x13, 0x12, 0x0f, 0x88, 0x07, 0x4b, 0x95, 0xf8, 0x02, 0x3c, 0xf0, 0x01, 0x78, 0xac, - 0x78, 0xaa, 0x78, 0x40, 0xa8, 0x48, 0xe8, 0xaa, 0x7d, 0xb9, 0x5f, 0xe0, 0xbe, 0x5f, 0xed, 0xcc, - 0x6c, 0xec, 0x4d, 0x6c, 0xa7, 0xf7, 0xaa, 0xf7, 0x29, 0x7b, 0x66, 0xce, 0xef, 0xcc, 0x99, 0xdf, - 0x39, 0x3e, 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, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x75, 0x90, 0xf3, 0x52, 0x26, 0x10, 0x00, - 0x00, + // 1578 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0x5b, + 0x15, 0xcf, 0xd8, 0x8e, 0xff, 0x1c, 0x27, 0x8e, 0xb9, 0x4d, 0x13, 0xc7, 0x6d, 0x9c, 0x89, 0x2b, + 0x68, 0x00, 0xc5, 0x56, 0x82, 0x40, 0x22, 0x15, 0x2d, 0xb6, 0x33, 0x01, 0x43, 0x1a, 0xa7, 0x63, + 0x3b, 0x94, 0x6e, 0xcc, 0x78, 0xe6, 0xc6, 0x19, 0x18, 0xcf, 0xb5, 0x66, 0xae, 0x43, 0xcd, 0x07, + 0x40, 0xc5, 0x2b, 0x76, 0x88, 0x85, 0xa5, 0x4a, 0x7c, 0x01, 0x16, 0x7c, 0x00, 0x96, 0x15, 0xab, + 0x8a, 0x05, 0x42, 0x45, 0x42, 0x4f, 0xed, 0xe6, 0x7d, 0x81, 0xb7, 0x7f, 0x9a, 0x7b, 0xef, 0xc4, + 0x9e, 0xc4, 0x76, 0xfa, 0x9e, 0xfa, 0x56, 0xf1, 0xb9, 0xf7, 0xfc, 0xce, 0x3d, 0xe7, 0x77, 0xce, + 0x9c, 0x73, 0x14, 0xc8, 0x9f, 0x63, 0xaa, 0x5f, 0x68, 0x66, 0xb1, 0xe3, 0x90, 0x7e, 0xaf, 0x78, + 0xb9, 0xa7, 0x59, 0xbd, 0x0b, 0x6d, 0xaf, 0x48, 0x07, 0x3d, 0xec, 0x16, 0x7a, 0x0e, 0xa1, 0x04, + 0xad, 0x09, 0x9d, 0x02, 0xd3, 0x29, 0xf8, 0x3a, 0xd9, 0xd5, 0x0e, 0xe9, 0x10, 0xa6, 0x52, 0xf4, + 0x7e, 0x71, 0xed, 0x6c, 0xae, 0x43, 0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0xe1, 0x0c, 0x30, 0x76, 0x36, + 0x67, 0x19, 0x69, 0x68, 0x96, 0x35, 0x10, 0x04, 0x25, 0x3c, 0x98, 0xe7, 0x0d, 0x46, 0x07, 0xe3, + 0x1e, 0x93, 0xfc, 0x48, 0x7a, 0x7d, 0x00, 0x7a, 0x0e, 0x2b, 0xf8, 0x25, 0xd6, 0xfb, 0x94, 0x38, + 0x2d, 0x11, 0xc9, 0x12, 0x8b, 0xa4, 0x78, 0x6b, 0x24, 0x8a, 0xc0, 0x89, 0x88, 0x52, 0x38, 0x20, + 0xa3, 0x1d, 0x88, 0x74, 0xdd, 0x8e, 0x9b, 0x59, 0x66, 0x0d, 0x77, 0x6a, 0xd1, 0xab, 0x4c, 0x23, + 0xff, 0x56, 0x82, 0x28, 0xe7, 0x15, 0xed, 0x01, 0xaa, 0x37, 0x4a, 0x8d, 0x66, 0xbd, 0xd5, 0x3c, + 0xa9, 0x9f, 0x2a, 0x95, 0xea, 0x51, 0x55, 0x39, 0x4c, 0x2f, 0x64, 0x37, 0x86, 0x23, 0xf9, 0xae, + 0xff, 0x32, 0xd7, 0xad, 0xda, 0x97, 0x9a, 0x65, 0x1a, 0x68, 0x0f, 0xd2, 0x02, 0x52, 0x6f, 0x96, + 0x9f, 0x56, 0x1b, 0x0d, 0xe5, 0x30, 0x2d, 0x65, 0xef, 0x0d, 0x47, 0xf2, 0x7a, 0x10, 0x50, 0xf7, + 0x2b, 0x0a, 0x7d, 0x1f, 0x96, 0x05, 0xa4, 0x72, 0x5c, 0xab, 0x2b, 0x87, 0xe9, 0x50, 0x36, 0x33, + 0x1c, 0xc9, 0xab, 0x41, 0xfd, 0x8a, 0x45, 0x5c, 0x6c, 0xa0, 0x5d, 0x48, 0x09, 0xe5, 0x52, 0xb9, + 0xa6, 0x7a, 0xd6, 0xc3, 0xd3, 0xdc, 0x29, 0xb5, 0x89, 0x43, 0xb1, 0x91, 0x8d, 0xbc, 0xfa, 0x5b, + 0x6e, 0x21, 0xff, 0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0x9f, 0x24, 0x58, 0x64, 0x1f, 0x2b, 0xba, + 0x07, 0x89, 0x01, 0x76, 0x5b, 0xac, 0xeb, 0x88, 0x41, 0x14, 0x1f, 0x60, 0xb7, 0xe2, 0xc9, 0xde, + 0x24, 0xb2, 0x89, 0xb8, 0x13, 0x1d, 0xd7, 0x26, 0xfc, 0xea, 0x01, 0x2c, 0x6b, 0x6d, 0x97, 0x6a, + 0xa6, 0x2d, 0xee, 0xf9, 0x44, 0x5a, 0x12, 0x87, 0x5c, 0x69, 0x13, 0xe0, 0x12, 0x53, 0xdf, 0x42, + 0x84, 0xef, 0x1e, 0xde, 0x09, 0xbb, 0x16, 0xbe, 0xfc, 0x47, 0x82, 0xc8, 0x19, 0xa1, 0xf8, 0xf6, + 0xfe, 0xbf, 0x0a, 0x8b, 0x5e, 0x53, 0x71, 0xfc, 0x9d, 0x81, 0x09, 0xde, 0x54, 0xd6, 0x2f, 0x88, + 0xa9, 0x63, 0xe6, 0x42, 0x6a, 0xf6, 0x54, 0xae, 0x30, 0x2d, 0x55, 0x68, 0xcf, 0x9d, 0x9a, 0x9f, + 0x62, 0x2a, 0xe4, 0xeb, 0x90, 0x60, 0x1c, 0x9f, 0x12, 0xcb, 0x42, 0x3f, 0x85, 0x18, 0xb6, 0xa9, + 0x63, 0x62, 0x7f, 0xc3, 0xfb, 0xce, 0xdc, 0x26, 0xea, 0x61, 0x14, 0x9b, 0x3a, 0x03, 0xd5, 0x87, + 0x09, 0xb6, 0x9e, 0x41, 0x2a, 0xa8, 0xe0, 0x6d, 0x3f, 0xa4, 0xc7, 0x06, 0x2e, 0x35, 0xa9, 0x85, + 0x45, 0x12, 0x93, 0xfc, 0xac, 0xe1, 0x1d, 0xcd, 0xda, 0x4e, 0x85, 0xc9, 0x87, 0x10, 0xab, 0x31, + 0x65, 0xb6, 0xc6, 0x32, 0x23, 0xdc, 0xc9, 0x84, 0x2a, 0x24, 0xa1, 0xf8, 0x6e, 0x11, 0x22, 0x2c, + 0x98,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, 0xc3, 0x5f, 0xab, 0x8a, 0xbf, 0xe9, 0x5e, 0xf4, + 0x3d, 0x03, 0xa2, 0xbc, 0xfd, 0xa1, 0x35, 0x40, 0x95, 0x9f, 0xd7, 0xaa, 0x15, 0x25, 0x98, 0x25, + 0xb4, 0x0c, 0x09, 0x71, 0x7e, 0x52, 0x4b, 0x4b, 0x28, 0x05, 0x20, 0xc4, 0x5f, 0x2b, 0xf5, 0x74, + 0x08, 0x21, 0x48, 0x09, 0xb9, 0x54, 0xae, 0x37, 0x4a, 0xd5, 0x93, 0x74, 0x18, 0xad, 0x40, 0x52, + 0x9c, 0x9d, 0x29, 0x8d, 0x5a, 0x3a, 0x52, 0x7e, 0xf4, 0xe6, 0x7d, 0x4e, 0x7a, 0xfb, 0x3e, 0x27, + 0x7d, 0xf6, 0x3e, 0x27, 0xfd, 0xf9, 0x43, 0x6e, 0xe1, 0xed, 0x87, 0xdc, 0xc2, 0x7f, 0x3f, 0xe4, + 0x16, 0x5e, 0x6c, 0x77, 0x4c, 0x7a, 0xd1, 0x6f, 0x17, 0x74, 0xd2, 0x2d, 0xfa, 0xff, 0x17, 0x60, + 0x7f, 0x8d, 0xe2, 0x4b, 0xfe, 0x0f, 0x82, 0x76, 0x94, 0x45, 0xf2, 0x83, 0x2f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0x10, 0x66, 0x0f, 0x2e, 0x38, 0x10, 0x00, 0x00, } func (this *GroupAccountInfo) Equal(that interface{}) bool { @@ -1719,21 +1755,16 @@ func (m *TallyPoll) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Counts) > 0 { - for k := range m.Counts { - v := m.Counts[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintTypes(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintTypes(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintTypes(dAtA, i, uint64(baseI-i)) + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -1741,6 +1772,43 @@ func (m *TallyPoll) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TallyPollEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TallyPollEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyPollEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Weight) > 0 { + i -= len(m.Weight) + copy(dAtA[i:], m.Weight) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Weight))) + i-- + dAtA[i] = 0x12 + } + if len(m.OptionTitle) > 0 { + i -= len(m.OptionTitle) + copy(dAtA[i:], m.OptionTitle) + i = encodeVarintTypes(dAtA, i, uint64(len(m.OptionTitle))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Options) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2196,17 +2264,32 @@ func (m *TallyPoll) Size() (n int) { } var l int _ = l - if len(m.Counts) > 0 { - for k, v := range m.Counts { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovTypes(uint64(len(k))) + 1 + len(v) + sovTypes(uint64(len(v))) - n += mapEntrySize + 1 + sovTypes(uint64(mapEntrySize)) + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) } } return n } +func (m *TallyPollEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OptionTitle) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Weight) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func (m *Options) Size() (n int) { if m == nil { return 0 @@ -4001,7 +4084,7 @@ func (m *TallyPoll) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Counts", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4028,103 +4111,124 @@ func (m *TallyPoll) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Counts == nil { - m.Counts = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthTypes - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthTypes - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthTypes - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthTypes - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Counts[mapkey] = mapvalue + m.Entries = append(m.Entries, &TallyPollEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyPollEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TallyPollEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyPollEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OptionTitle", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OptionTitle = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Weight = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex