Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/gov: gRPC query Service #6491

Merged
merged 100 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
483d2c4
WIP: adding gRPC for gov
atheeshp Jun 22, 2020
e6a82f6
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/52…
atheeshp Jun 22, 2020
48dccf7
removed passing new store
atheeshp Jun 23, 2020
cd1ff33
fixed error
atheeshp Jun 23, 2020
5fc80d6
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/52…
atheeshp Jun 23, 2020
d48b22c
added register query service in module
atheeshp Jun 23, 2020
8c97327
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/52…
atheeshp Jun 23, 2020
3c08159
order of imports changed
atheeshp Jun 23, 2020
cc03051
order of imports changed
atheeshp Jun 23, 2020
56dc7df
Fix proto file
sahith-narahari Jun 23, 2020
c6a67b5
added get all proposals grpc
atheeshp Jun 23, 2020
b42f53b
added more tests
atheeshp Jun 23, 2020
3bb64ee
added doc in tests
atheeshp Jun 23, 2020
1991b24
added grpc for votes
atheeshp Jun 23, 2020
85811e1
Added grpc for Deposits
atheeshp Jun 23, 2020
d86453f
updated protos
atheeshp Jun 24, 2020
a440df0
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jun 24, 2020
902ce25
added grpc for proposal, vote, deposit, tally
atheeshp Jun 24, 2020
e34baf5
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jun 24, 2020
6cc66f8
WIP: adding params grpc
atheeshp Jun 24, 2020
34acb6f
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jun 24, 2020
ee49038
added params in gRPC
atheeshp Jun 25, 2020
2e9f8a0
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jun 25, 2020
bea8cd8
updated error messages
atheeshp Jun 25, 2020
56a54af
fixed error check
atheeshp Jun 25, 2020
8496497
added more tests
atheeshp Jun 26, 2020
99f4a1c
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jun 26, 2020
88ed518
updated tests
atheeshp Jun 26, 2020
aea2b1e
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jun 29, 2020
f5b5543
added yaml types
atheeshp Jun 29, 2020
1691d14
review changes and lint issues
atheeshp Jun 29, 2020
a071ff9
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jun 29, 2020
b2ba29d
updated tests
atheeshp Jun 29, 2020
ee53887
code cleanup
sahith-narahari Jul 1, 2020
d05d272
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 2, 2020
b422756
removed cosmos.gov prefixes
atheeshp Jul 2, 2020
c1c60d2
Merge branch 'atheesh/5921-grpc-x-gov' of github.com:cosmos/cosmos-sd…
atheeshp Jul 2, 2020
08df270
added more checks
atheeshp Jul 2, 2020
940f008
added more test checks
atheeshp Jul 2, 2020
406ec2e
added filtered pagination
atheeshp Jul 2, 2020
091bf6a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 2, 2020
21013ec
removed test check
atheeshp Jul 2, 2020
c95ac10
added tests for filtered pagination
atheeshp Jul 2, 2020
b176733
Fix Proposals
sahith-narahari Jul 3, 2020
2db581e
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 3, 2020
d256ef2
lint
atheeshp Jul 3, 2020
1ff7524
fixed error in tests
atheeshp Jul 3, 2020
6cc0224
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 3, 2020
b112263
lint issues
atheeshp Jul 3, 2020
f525912
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 3, 2020
c05154e
Add nil check for params
sahith-narahari Jul 3, 2020
7cd8efb
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 4, 2020
eec0293
Merge branch 'atheesh/5921-grpc-x-gov' of github.com:cosmos/cosmos-sd…
atheeshp Jul 4, 2020
e266bd9
Added unpacker
atheeshp Jul 4, 2020
0f4660e
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 5, 2020
c66b5ea
removed casttypes
atheeshp Jul 5, 2020
f2aeef5
review changes
atheeshp Jul 5, 2020
a629f41
Merge branch 'master' into atheesh/5921-grpc-x-gov
sahith-narahari Jul 6, 2020
44184ff
Merge branch 'master' into atheesh/5921-grpc-x-gov
anilcse Jul 7, 2020
c19eccd
use suite in grpc query tests
sahith-narahari Jul 7, 2020
3226715
migrated tests to use suite
atheeshp Jul 7, 2020
1aa5e2a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 7, 2020
34c24cd
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 8, 2020
3321818
Merge branch 'atheesh/5921-grpc-x-gov' of github.com:cosmos/cosmos-sd…
sahith-narahari Jul 8, 2020
bf8847d
fix non-determinism
sahith-narahari Jul 9, 2020
ae380a0
Merge branch 'master' into atheesh/5921-grpc-x-gov
sahith-narahari Jul 9, 2020
f4060b6
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 9, 2020
261327f
Merge branch 'atheesh/5921-grpc-x-gov' of github.com:cosmos/cosmos-sd…
atheeshp Jul 9, 2020
416a66b
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 9, 2020
00407eb
tests migrated to table driven tests
atheeshp Jul 9, 2020
bb39caa
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 9, 2020
b4d4286
fixed doc typo
atheeshp Jul 10, 2020
bdd4ab1
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 10, 2020
6bdbda4
revert change
atheeshp Jul 13, 2020
1cbb799
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 13, 2020
3ddbb5c
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 13, 2020
321ce4c
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 13, 2020
29a4161
review changes
atheeshp Jul 13, 2020
1be2274
review changes
atheeshp Jul 13, 2020
4415769
review changes
atheeshp Jul 13, 2020
690446e
review change
atheeshp Jul 13, 2020
e64978a
review changes
atheeshp Jul 13, 2020
7d28b8d
docs updated
atheeshp Jul 13, 2020
97c276a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 14, 2020
3cb526d
review change
atheeshp Jul 14, 2020
0edada2
review changes
atheeshp Jul 14, 2020
7e162d2
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 15, 2020
34d3b35
review changes
atheeshp Jul 15, 2020
042e9e7
review changes
atheeshp Jul 15, 2020
a902cb3
Update x/gov/keeper/keeper_test.go
fedekunze Jul 15, 2020
248284a
Merge branch 'master' into atheesh/5921-grpc-x-gov
fedekunze Jul 15, 2020
4a7f3a0
Merge branch 'master' into atheesh/5921-grpc-x-gov
fedekunze Jul 15, 2020
89937aa
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp Jul 16, 2020
3684239
Merge branch 'atheesh/5921-grpc-x-gov' of github.com:cosmos/cosmos-sd…
atheeshp Jul 16, 2020
89f2777
Merge branch 'master' into atheesh/5921-grpc-x-gov
mergify[bot] Jul 16, 2020
c56d2bb
Merge branch 'master' into atheesh/5921-grpc-x-gov
mergify[bot] Jul 16, 2020
77701b3
Merge branch 'master' into atheesh/5921-grpc-x-gov
mergify[bot] Jul 16, 2020
50de9f2
Merge branch 'master' into atheesh/5921-grpc-x-gov
mergify[bot] Jul 16, 2020
efe17b8
Merge branch 'master' into atheesh/5921-grpc-x-gov
mergify[bot] Jul 16, 2020
1e7dde4
Merge branch 'master' into atheesh/5921-grpc-x-gov
mergify[bot] Jul 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions proto/cosmos/gov/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
option (gogoproto.goproto_stringer_all) = false;
Expand Down Expand Up @@ -160,3 +161,57 @@ message Vote {
bytes voter = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
VoteOption option = 3;
}

// DepositParams defines the params around deposits for governance
message DepositParams {
// Minimum deposit for a proposal to enter voting period.
repeated cosmos.Coin min_deposit = 1 [
atheeshp marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"min_deposit\"",
(gogoproto.jsontag) = "min_deposit,omitempty"
];

// Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months.
google.protobuf.Duration max_deposit_period = 2 [
atheeshp marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "max_deposit_period,omitempty",
(gogoproto.moretags) = "yaml:\"max_deposit_period\""
];
}

// VotingParams defines the params around Voting in governance
message VotingParams {
// Length of the voting period.
google.protobuf.Duration voting_period = 1 [
atheeshp marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "voting_period,omitempty",
(gogoproto.moretags) = "yaml:\"voting_period\""
];
}

// TallyParams defines the params around Tallying votes in governance
message TallyParams {
// Minimum percentage of total stake needed to vote for a result to be considered valid.
bytes quorum = 1 [
atheeshp marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "quorum,omitempty"
];

// Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5.
bytes threshold = 2 [
atheeshp marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "threshold,omitempty"
];

// Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3.
bytes veto = 3 [
atheeshp marked this conversation as resolved.
Show resolved Hide resolved
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "veto,omitempty"
];
}
148 changes: 148 additions & 0 deletions proto/cosmos/gov/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
syntax = "proto3";
package cosmos.gov;

import "cosmos/query/pagination.proto";
import "gogoproto/gogo.proto";
import "cosmos/gov/gov.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";

// Query defines the gRPC querier service for gov module
service Query {
// Proposal queries proposal details based on ProposalID
rpc Proposal (QueryProposalRequest) returns (QueryProposalResponse) {}

// Proposals queries all proposals based on given status
rpc Proposals (QueryProposalsRequest) returns (QueryProposalsResponse) {}

// Vote queries Voted information based on proposalID, voterAddr
rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) {}

// Votes queries votes of a given proposal
rpc Votes (QueryVotesRequest) returns (QueryVotesResponse) {}

// Params queries all params
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {}

// Deposit queries single deposit information based proposalID, depositAddr
rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) {}

// Deposits queries all deposits of a single proposal
rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) {}

// TallyResult queries the tally of a proposal vote
rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) {}
}

// QueryProposalRequest is the request type for the Query/Proposal RPC method
message QueryProposalRequest {
// unique id of the proposal
uint64 proposal_id = 1;
}

// QueryProposalResponse is the response type for the Query/Proposal RPC method
message QueryProposalResponse {
Proposal proposal = 1 [(gogoproto.nullable) = false];
}

// QueryProposalsRequest is the request type for the Query/Proposals RPC method
message QueryProposalsRequest {
// status of the proposals.
ProposalStatus proposal_status = 1 ;

// Voter address for the proposals.
bytes voter = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];

// Deposit addresses from the proposals.
bytes depositor = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];

cosmos.query.PageRequest req = 4;
}

// QueryProposalsResponse is the response type for the Query/Proposals RPC method
message QueryProposalsResponse {
repeated Proposal proposals = 1 [(gogoproto.nullable) = false];

cosmos.query.PageResponse res = 2;
}

// QueryVoteRequest is the request type for the Query/Vote RPC method
message QueryVoteRequest {
// unique id of the proposal
uint64 proposal_id = 1;

// Voter address for the proposals.
bytes voter = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// QueryVoteResponse is the response type for the Query/Vote RPC method
message QueryVoteResponse {
Vote vote = 1 [(gogoproto.nullable) = false];
}

// QueryVotesRequest is the request type for the Query/Votes RPC method
message QueryVotesRequest {
// unique id of the proposal
uint64 proposal_id = 1;

cosmos.query.PageRequest req = 2;
}

// QueryVotesResponse is the response type for the Query/Votes RPC method
message QueryVotesResponse {
repeated Vote votes = 1 [(gogoproto.nullable) = false];

cosmos.query.PageResponse res = 2;
}

// QueryParamsRequest is the request type for the Query/Params RPC method
message QueryParamsRequest {
string params_type = 1;
}

// QueryParamsResponse is the response type for the Query/Params RPC method
message QueryParamsResponse {
VotingParams voting_params = 1 [(gogoproto.nullable) = false];
DepositParams deposit_params = 2 [(gogoproto.nullable) = false];
TallyParams tally_params = 3 [(gogoproto.nullable) = false];
}

// QueryDepositRequest is the request type for the Query/Deposit RPC method
message QueryDepositRequest {
// unique id of the proposal
uint64 proposal_id = 1;

// Deposit addresses from the proposals.
bytes depositor = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"];
}

// QueryDepositResponse is the response type for the Query/Deposit RPC method
message QueryDepositResponse {
Deposit deposit = 1 [(gogoproto.nullable) = false];
}

// QueryDepositsRequest is the request type for the Query/Deposits RPC method
message QueryDepositsRequest {
// unique id of the proposal
uint64 proposal_id = 1;

cosmos.query.PageRequest req = 2;
}

// QueryDepositsResponse is the response type for the Query/Deposits RPC method
message QueryDepositsResponse {
repeated Deposit deposits = 1 [(gogoproto.nullable) = false];

cosmos.query.PageResponse res = 2;
}

// QueryTallyResultRequest is the request type for the Query/Tally RPC method
message QueryTallyResultRequest {
// unique id of the proposal
uint64 proposal_id = 1;
}

// QueryTallyResultResponse is the response type for the Query/Tally RPC method
message QueryTallyResultResponse {
TallyResult tally = 1 [(gogoproto.nullable) = false];
}
Loading