From 90d7acadcefa207d4e95fa108ca67e917e37fbb7 Mon Sep 17 00:00:00 2001 From: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> Date: Thu, 2 May 2024 23:50:13 +0900 Subject: [PATCH] add gRPC for RBAC --- client/docs/config.json | 4 +- client/docs/swagger-ui/swagger.yaml | 444 +++++++--- docs/core/proto-docs.md | 74 +- proto/lbm/fbridge/v1/query.proto | 48 +- x/fbridge/keeper/auth.go | 15 +- x/fbridge/keeper/genesis.go | 4 +- x/fbridge/keeper/grpc_query.go | 124 ++- x/fbridge/module/abci.go | 6 +- x/fbridge/types/query.pb.go | 1164 +++++++++++++++++++++++---- x/fbridge/types/query.pb.gw.go | 226 +++++- 10 files changed, 1821 insertions(+), 288 deletions(-) diff --git a/client/docs/config.json b/client/docs/config.json index 4a1968c6ee..10c1f955fa 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -175,7 +175,9 @@ "Operators": "FBridgeOperators", "Judges": "FBridgeJudges", "Proposals": "FBridgeProposals", - "Proposal": "FBridgeProposal" + "Proposal": "FBridgeProposal", + "Votes": "FBridgeVotes", + "Vote": "FBridgeVote" } } } diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index c56e21d150..1fc1847f2b 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -30313,90 +30313,7 @@ paths: format: byte tags: - Query - '/lbm/fbridge/v1/provision/{seq}': - get: - summary: ConfirmedProvision queries a particular sequence of confirmed provisions - operationId: ConfirmedProvision - responses: - '200': - description: A successful response. - schema: - type: object - properties: - data: - type: object - properties: - seq: - type: string - format: uint64 - title: the sequence number of the bridge request - amount: - type: string - title: the amount of token to be claimed - sender: - type: string - title: the sender address on the source chain - receiver: - type: string - title: the recipient address on the destination chain - description: Provision is a struct that represents a provision internally. - status: - type: object - properties: - timelock_end: - type: string - format: uint64 - title: >- - the unix timestamp the provision will be able to be - claimed (unix timestamp) - confirm_counts: - type: integer - format: int32 - title: >- - a value that tells how many operators have submitted this - provision - is_claimed: - type: boolean - format: boolean - title: whether the provision has been claimed - description: >- - ProvisionStatus is a struct that represents the status of a - provision. - - To optimize computational cost, we have collected frequently - changing values from provision. - default: - description: An unexpected error response - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: seq - description: the sequence number of the bridge request - in: path - required: true - type: string - format: uint64 - tags: - - Query - /lbm/fbridge/v1/role/proposals: + /lbm/fbridge/v1/proposals: get: summary: Proposals queries a list of SuggestRole Proposals operationId: FBridgeProposals @@ -30444,10 +30361,28 @@ paths: judge. expired_at: type: string - format: uint64 + format: date-time title: >- the unix timestamp the proposal will be expired (unix timestamp) + pagination: + description: pagination defines an pagination for the response. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise default: description: An unexpected error response schema: @@ -30531,7 +30466,7 @@ paths: format: boolean tags: - Query - '/lbm/fbridge/v1/role/proposals/{proposal_id}': + '/lbm/fbridge/v1/proposals/{proposal_id}': get: summary: Proposal queries a SuggestRole Proposal operationId: FBridgeProposal @@ -30572,7 +30507,7 @@ paths: judge. expired_at: type: string - format: uint64 + format: date-time title: >- the unix timestamp the proposal will be expired (unix timestamp) @@ -30604,6 +30539,226 @@ paths: in: path required: true type: string + format: uint64 + tags: + - Query + '/lbm/fbridge/v1/proposals/{proposal_id}/votes': + get: + summary: Votes queries votes of a given proposal. + operationId: FBridgeVotes + responses: + '200': + description: A successful response. + schema: + type: object + properties: + votes: + type: array + items: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given + role proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + description: votes defined the queried votes. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: proposal_id + description: proposal_id defines the unique id of the proposal. + in: path + required: true + type: string + format: uint64 + tags: + - Query + '/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}': + get: + summary: 'Vote queries voted information based on proposalID, voterAddr.' + operationId: FBridgeVote + responses: + '200': + description: A successful response. + schema: + type: object + properties: + vote: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given + role proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: proposal_id + description: proposal_id defines the unique id of the proposal. + in: path + required: true + type: string + format: uint64 + - name: voter + description: voter defines the oter address for the proposals. + in: path + required: true + type: string + tags: + - Query + '/lbm/fbridge/v1/provision/{seq}': + get: + summary: ConfirmedProvision queries a particular sequence of confirmed provisions + operationId: ConfirmedProvision + responses: + '200': + description: A successful response. + schema: + type: object + properties: + data: + type: object + properties: + seq: + type: string + format: uint64 + title: the sequence number of the bridge request + amount: + type: string + title: the amount of token to be claimed + sender: + type: string + title: the sender address on the source chain + receiver: + type: string + title: the recipient address on the destination chain + description: Provision is a struct that represents a provision internally. + status: + type: object + properties: + timelock_end: + type: string + format: uint64 + title: >- + the unix timestamp the provision will be able to be + claimed (unix timestamp) + confirm_counts: + type: integer + format: int32 + title: >- + a value that tells how many operators have submitted this + provision + is_claimed: + type: boolean + format: boolean + title: whether the provision has been claimed + description: >- + ProvisionStatus is a struct that represents the status of a + provision. + + To optimize computational cost, we have collected frequently + changing values from provision. + default: + description: An unexpected error response + schema: + type: object + properties: + error: + type: string + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + type_url: + type: string + value: + type: string + format: byte + parameters: + - name: seq + description: the sequence number of the bridge request + in: path + required: true + type: string + format: uint64 tags: - Query definitions: @@ -50417,7 +50572,7 @@ definitions: description: 'Role defines the role of the operator, guardian, and judge.' expired_at: type: string - format: uint64 + format: date-time title: the unix timestamp the proposal will be expired (unix timestamp) lbm.fbridge.v1.QueryProposalsResponse: type: object @@ -50453,8 +50608,26 @@ definitions: description: 'Role defines the role of the operator, guardian, and judge.' expired_at: type: string - format: uint64 + format: date-time title: the unix timestamp the proposal will be expired (unix timestamp) + pagination: + description: pagination defines an pagination for the response. + type: object + properties: + next_key: + type: string + format: byte + title: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently + total: + type: string + format: uint64 + title: >- + total is total number of results available if + PageRequest.count_total + + was set, its value is undefined otherwise lbm.fbridge.v1.QuerySubmittedProvisionResponse: type: object properties: @@ -50499,6 +50672,61 @@ definitions: To optimize computational cost, we have collected frequently changing values from provision. + lbm.fbridge.v1.QueryVoteResponse: + type: object + properties: + vote: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given role + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + lbm.fbridge.v1.QueryVotesResponse: + type: object + properties: + votes: + type: array + items: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given role + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + description: votes defined the queried votes. lbm.fbridge.v1.Role: type: string enum: @@ -50537,5 +50765,41 @@ definitions: description: 'Role defines the role of the operator, guardian, and judge.' expired_at: type: string - format: uint64 + format: date-time title: the unix timestamp the proposal will be expired (unix timestamp) + lbm.fbridge.v1.Vote: + type: object + properties: + proposal_id: + type: string + format: uint64 + voter: + type: string + option: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: >- + VoteOption enumerates the valid vote options for a given role + proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. + description: Vote defines a vote on a role proposal. + lbm.fbridge.v1.VoteOption: + type: string + enum: + - VOTE_OPTION_UNSPECIFIED + - VOTE_OPTION_YES + - VOTE_OPTION_NO + default: VOTE_OPTION_UNSPECIFIED + description: |- + VoteOption enumerates the valid vote options for a given role proposal. + + - VOTE_OPTION_UNSPECIFIED: VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + - VOTE_OPTION_YES: VOTE_OPTION_YES defines a yes vote option. + - VOTE_OPTION_NO: VOTE_OPTION_NO defines a no vote option. diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 209143f2b6..9f6e4cca14 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -812,6 +812,10 @@ - [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) - [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest) - [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse) + - [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) + - [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) + - [QueryVotesRequest](#lbm.fbridge.v1.QueryVotesRequest) + - [QueryVotesResponse](#lbm.fbridge.v1.QueryVotesResponse) - [Query](#lbm.fbridge.v1.Query) @@ -12133,7 +12137,7 @@ GenesisState defines the fbridge module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [string](#string) | | the proposal id | +| `proposal_id` | [uint64](#uint64) | | the proposal id | @@ -12179,6 +12183,7 @@ GenesisState defines the fbridge module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines an pagination for the response. | @@ -12216,6 +12221,67 @@ GenesisState defines the fbridge module's genesis state. + + + +### QueryVoteRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id defines the unique id of the proposal. | +| `voter` | [string](#string) | | voter defines the oter address for the proposals. | + + + + + + + + +### QueryVoteResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `vote` | [Vote](#lbm.fbridge.v1.Vote) | | vote defined the queried vote. | + + + + + + + + +### QueryVotesRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id defines the unique id of the proposal. | + + + + + + + + +### QueryVotesResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `votes` | [Vote](#lbm.fbridge.v1.Vote) | repeated | votes defined the queried votes. | + + + + + @@ -12241,8 +12307,10 @@ GenesisState defines the fbridge module's genesis state. | `Guardians` | [QueryGuardiansRequest](#lbm.fbridge.v1.QueryGuardiansRequest) | [QueryGuardiansResponse](#lbm.fbridge.v1.QueryGuardiansResponse) | Guardians queries a list of Guardians registered on the bridge | GET|/lbm/fbridge/v1/guardians| | `Operators` | [QueryOperatorsRequest](#lbm.fbridge.v1.QueryOperatorsRequest) | [QueryOperatorsResponse](#lbm.fbridge.v1.QueryOperatorsResponse) | Operators queries a list of Operators registered on the bridge | GET|/lbm/fbridge/v1/operators| | `Judges` | [QueryJudgesRequest](#lbm.fbridge.v1.QueryJudgesRequest) | [QueryJudgesResponse](#lbm.fbridge.v1.QueryJudgesResponse) | Judges queries a list of Judges registered on the bridge | GET|/lbm/fbridge/v1/judges| -| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/role/proposals| -| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/role/proposals/{proposal_id}| +| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/proposals| +| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/proposals/{proposal_id}| +| `Vote` | [QueryVoteRequest](#lbm.fbridge.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.fbridge.v1.QueryVoteResponse) | Vote queries voted information based on proposalID, voterAddr. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}| +| `Votes` | [QueryVotesRequest](#lbm.fbridge.v1.QueryVotesRequest) | [QueryVotesResponse](#lbm.fbridge.v1.QueryVotesResponse) | Votes queries votes of a given proposal. | GET|/lbm/fbridge/v1/proposals/{proposal_id}/votes| diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto index 900aac4e8b..3114994e0f 100644 --- a/proto/lbm/fbridge/v1/query.proto +++ b/proto/lbm/fbridge/v1/query.proto @@ -70,12 +70,22 @@ service Query { // Proposals queries a list of SuggestRole Proposals rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/role/proposals"; + option (google.api.http).get = "/lbm/fbridge/v1/proposals"; } // Proposal queries a SuggestRole Proposal rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { - option (google.api.http).get = "/lbm/fbridge/v1/role/proposals/{proposal_id}"; + option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}"; + } + + // Vote queries voted information based on proposalID, voterAddr. + rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}/votes/{voter}"; + } + + // Votes queries votes of a given proposal. + rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/proposals/{proposal_id}/votes"; } } @@ -172,14 +182,40 @@ message QueryProposalsRequest { } message QueryProposalsResponse { - repeated RoleProposal proposals = 1; + repeated RoleProposal proposals = 1 [(gogoproto.nullable) = false]; + + // pagination defines an pagination for the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QueryProposalRequest { // the proposal id - string proposal_id = 1; + uint64 proposal_id = 1; } message QueryProposalResponse { - RoleProposal proposal = 1; -} \ No newline at end of file + RoleProposal proposal = 1 [(gogoproto.nullable) = false]; +} + +message QueryVoteRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + + // voter defines the oter address for the proposals. + string voter = 2; +} + +message QueryVoteResponse { + // vote defined the queried vote. + Vote vote = 1 [(gogoproto.nullable) = false]; +} + +message QueryVotesRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} + +message QueryVotesResponse { + // votes defined the queried votes. + repeated Vote votes = 1 [(gogoproto.nullable) = false]; +} diff --git a/x/fbridge/keeper/auth.go b/x/fbridge/keeper/auth.go index bd10693c2b..b5df808532 100644 --- a/x/fbridge/keeper/auth.go +++ b/x/fbridge/keeper/auth.go @@ -131,8 +131,8 @@ func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.RolePro } } -// GetProposals returns all the role proposals from store -func (k Keeper) GetProposals(ctx sdk.Context) (proposals []types.RoleProposal) { +// GetRoleProposals returns all the role proposals from store +func (k Keeper) GetRoleProposals(ctx sdk.Context) (proposals []types.RoleProposal) { k.IterateProposals(ctx, func(proposal types.RoleProposal) bool { proposals = append(proposals, proposal) return false @@ -157,14 +157,19 @@ func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress return types.VoteOption(binary.BigEndian.Uint32(bz)), nil } -func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) []types.VoteOption { +func (k Keeper) GetProposalVotes(ctx sdk.Context, proposalID uint64) []types.Vote { store := ctx.KVStore(k.storeKey) - votes := make([]types.VoteOption, 0) + votes := make([]types.Vote, 0) iterator := sdk.KVStorePrefixIterator(store, types.VotesKey(proposalID)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - v := types.VoteOption(binary.BigEndian.Uint32(iterator.Value())) + _, voter := types.SplitVoterVoteKey(iterator.Key()) + v := types.Vote{ + ProposalId: proposalID, + Voter: voter.String(), + Option: types.VoteOption(binary.BigEndian.Uint32(iterator.Value())), + } votes = append(votes, v) } diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go index 5f31056776..fa3b71f1a5 100644 --- a/x/fbridge/keeper/genesis.go +++ b/x/fbridge/keeper/genesis.go @@ -36,7 +36,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { NextSeq: k.GetNextSequence(ctx), }, NextRoleProposalId: k.GetNextProposalID(ctx), - RoleProposals: k.GetProposals(ctx), + RoleProposals: k.GetRoleProposals(ctx), Votes: k.GetAllVotes(ctx), RoleMetadata: k.GetRoleMetadata(ctx), Roles: k.GetRolePairs(ctx), @@ -47,7 +47,7 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { func (k Keeper) IterateVotes(ctx sdk.Context, cb func(proposal types.Vote) (stop bool)) { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalPrefix) + iterator := sdk.KVStorePrefixIterator(store, types.KeyProposalVotePrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { id, voter := types.SplitVoterVoteKey(iterator.Key()) diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go index 4953a0a5ef..34a8952668 100644 --- a/x/fbridge/keeper/grpc_query.go +++ b/x/fbridge/keeper/grpc_query.go @@ -2,18 +2,28 @@ package keeper import ( "context" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/Finschia/finschia-sdk/store/prefix" sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/query" "github.com/Finschia/finschia-sdk/x/fbridge/types" ) var _ types.QueryServer = Keeper{} -func (k Keeper) Params(ctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - panic("implement me") +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil } func (k Keeper) NextSeqSend(goCtx context.Context, req *types.QueryNextSeqSendRequest) (*types.QueryNextSeqSendResponse, error) { @@ -51,22 +61,112 @@ func (k Keeper) Commitments(ctx context.Context, request *types.QueryCommitments panic("implement me") } -func (k Keeper) Guardians(ctx context.Context, request *types.QueryGuardiansRequest) (*types.QueryGuardiansResponse, error) { - panic("implement me") +func (k Keeper) Guardians(goCtx context.Context, req *types.QueryGuardiansRequest) (*types.QueryGuardiansResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + guardians := make([]string, 0) + roles := k.GetRolePairs(ctx) + for _, pair := range roles { + if pair.Role == types.RoleGuardian { + guardians = append(guardians, pair.Address) + } + } + + return &types.QueryGuardiansResponse{Guardians: guardians}, nil } -func (k Keeper) Operators(ctx context.Context, request *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error) { - panic("implement me") +func (k Keeper) Operators(goCtx context.Context, req *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + operators := make([]string, 0) + roles := k.GetRolePairs(ctx) + for _, pair := range roles { + if pair.Role == types.RoleOperator { + operators = append(operators, pair.Address) + } + } + + return &types.QueryOperatorsResponse{Operators: operators}, nil } -func (k Keeper) Judges(ctx context.Context, request *types.QueryJudgesRequest) (*types.QueryJudgesResponse, error) { - panic("implement me") +func (k Keeper) Judges(goCtx context.Context, req *types.QueryJudgesRequest) (*types.QueryJudgesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + judges := make([]string, 0) + roles := k.GetRolePairs(ctx) + for _, pair := range roles { + if pair.Role == types.RoleJudge { + judges = append(judges, pair.Address) + } + } + + return &types.QueryJudgesResponse{Judges: judges}, nil } -func (k Keeper) Proposals(ctx context.Context, request *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) { - panic("implement me") +func (k Keeper) Proposals(goCtx context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyProposalPrefix) + proposals := make([]types.RoleProposal, 0) + pageRes, err := query.Paginate(store, req.Pagination, func(_, value []byte) error { + var proposal types.RoleProposal + k.cdc.MustUnmarshal(value, &proposal) + proposals = append(proposals, proposal) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryProposalsResponse{Proposals: proposals, Pagination: pageRes}, nil } -func (k Keeper) Proposal(ctx context.Context, request *types.QueryProposalRequest) (*types.QueryProposalResponse, error) { - panic("implement me") +func (k Keeper) Proposal(goCtx context.Context, req *types.QueryProposalRequest) (*types.QueryProposalResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + proposal, found := k.GetRoleProposal(ctx, req.ProposalId) + if !found { + return nil, status.Error(codes.NotFound, fmt.Sprintf("role proposal %d", req.ProposalId)) + } + + return &types.QueryProposalResponse{Proposal: proposal}, nil +} + +func (k Keeper) Votes(goCtx context.Context, req *types.QueryVotesRequest) (*types.QueryVotesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + votes := k.GetProposalVotes(ctx, req.ProposalId) + return &types.QueryVotesResponse{Votes: votes}, nil +} + +func (k Keeper) Vote(goCtx context.Context, req *types.QueryVoteRequest) (*types.QueryVoteResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + opt, err := k.GetVote(ctx, req.ProposalId, sdk.MustAccAddressFromBech32(req.Voter)) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } + + return &types.QueryVoteResponse{Vote: types.Vote{ProposalId: req.ProposalId, Voter: req.Voter, Option: opt}}, nil } diff --git a/x/fbridge/module/abci.go b/x/fbridge/module/abci.go index acb8d7874e..0eb1368348 100644 --- a/x/fbridge/module/abci.go +++ b/x/fbridge/module/abci.go @@ -9,18 +9,18 @@ import ( func EndBlocker(ctx sdk.Context, k keeper.Keeper) { guardianTrustLevel := k.GetParams(ctx).GuardianTrustLevel - proposals := k.GetProposals(ctx) + proposals := k.GetRoleProposals(ctx) for _, proposal := range proposals { if ctx.BlockTime().After(proposal.ExpiredAt) { k.DeleteRoleProposal(ctx, proposal.Id) continue } - votes := k.GetVotes(ctx, proposal.Id) + votes := k.GetProposalVotes(ctx, proposal.Id) voteYes := 0 for _, vote := range votes { - if vote == types.OptionYes { + if vote.Option == types.OptionYes { voteYes++ } } diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go index d43ba5168b..eace142a0c 100644 --- a/x/fbridge/types/query.pb.go +++ b/x/fbridge/types/query.pb.go @@ -1043,7 +1043,9 @@ func (m *QueryProposalsRequest) GetPagination() *query.PageRequest { } type QueryProposalsResponse struct { - Proposals []*RoleProposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"` + Proposals []RoleProposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals"` + // pagination defines an pagination for the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} } @@ -1079,16 +1081,23 @@ func (m *QueryProposalsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo -func (m *QueryProposalsResponse) GetProposals() []*RoleProposal { +func (m *QueryProposalsResponse) GetProposals() []RoleProposal { if m != nil { return m.Proposals } return nil } +func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + type QueryProposalRequest struct { // the proposal id - ProposalId string `protobuf:"bytes,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` } func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } @@ -1124,15 +1133,15 @@ func (m *QueryProposalRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo -func (m *QueryProposalRequest) GetProposalId() string { +func (m *QueryProposalRequest) GetProposalId() uint64 { if m != nil { return m.ProposalId } - return "" + return 0 } type QueryProposalResponse struct { - Proposal *RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"` + Proposal RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` } func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } @@ -1168,10 +1177,199 @@ func (m *QueryProposalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo -func (m *QueryProposalResponse) GetProposal() *RoleProposal { +func (m *QueryProposalResponse) GetProposal() RoleProposal { if m != nil { return m.Proposal } + return RoleProposal{} +} + +type QueryVoteRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // voter defines the oter address for the proposals. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` +} + +func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} } +func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVoteRequest) ProtoMessage() {} +func (*QueryVoteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{26} +} +func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteRequest.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 *QueryVoteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteRequest.Merge(m, src) +} +func (m *QueryVoteRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo + +func (m *QueryVoteRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryVoteRequest) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +type QueryVoteResponse struct { + // vote defined the queried vote. + Vote Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` +} + +func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } +func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVoteResponse) ProtoMessage() {} +func (*QueryVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{27} +} +func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteResponse.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 *QueryVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteResponse.Merge(m, src) +} +func (m *QueryVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo + +func (m *QueryVoteResponse) GetVote() Vote { + if m != nil { + return m.Vote + } + return Vote{} +} + +type QueryVotesRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} } +func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVotesRequest) ProtoMessage() {} +func (*QueryVotesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{28} +} +func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesRequest.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 *QueryVotesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesRequest.Merge(m, src) +} +func (m *QueryVotesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesRequest proto.InternalMessageInfo + +func (m *QueryVotesRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +type QueryVotesResponse struct { + // votes defined the queried votes. + Votes []Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"` +} + +func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} } +func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVotesResponse) ProtoMessage() {} +func (*QueryVotesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{29} +} +func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesResponse.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 *QueryVotesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesResponse.Merge(m, src) +} +func (m *QueryVotesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo + +func (m *QueryVotesResponse) GetVotes() []Vote { + if m != nil { + return m.Votes + } return nil } @@ -1202,84 +1400,97 @@ func init() { proto.RegisterType((*QueryProposalsResponse)(nil), "lbm.fbridge.v1.QueryProposalsResponse") proto.RegisterType((*QueryProposalRequest)(nil), "lbm.fbridge.v1.QueryProposalRequest") proto.RegisterType((*QueryProposalResponse)(nil), "lbm.fbridge.v1.QueryProposalResponse") + proto.RegisterType((*QueryVoteRequest)(nil), "lbm.fbridge.v1.QueryVoteRequest") + proto.RegisterType((*QueryVoteResponse)(nil), "lbm.fbridge.v1.QueryVoteResponse") + proto.RegisterType((*QueryVotesRequest)(nil), "lbm.fbridge.v1.QueryVotesRequest") + proto.RegisterType((*QueryVotesResponse)(nil), "lbm.fbridge.v1.QueryVotesResponse") } func init() { proto.RegisterFile("lbm/fbridge/v1/query.proto", fileDescriptor_5e7780f9db9d346e) } var fileDescriptor_5e7780f9db9d346e = []byte{ - // 1152 bytes of a gzipped FileDescriptorPro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 0x3c, 0xf5, 0xe7, 0x45, 0x79, 0xea, 0xeb, 0x0d, 0xcf, 0x8f, - 0x9f, 0xf7, 0x9a, 0x56, 0x8b, 0x75, 0xec, 0x47, 0x7e, 0xc0, 0x5b, 0xcf, 0x7d, 0xc7, 0x3e, 0xc4, - 0xc1, 0x3a, 0x77, 0xbf, 0xb5, 0x8f, 0x55, 0x95, 0xf8, 0xa4, 0x4b, 0x79, 0x73, 0x46, 0xfc, 0xfd, - 0xfc, 0xf0, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x46, 0xe7, 0x3d, 0x95, 0x2a, 0x0f, 0x00, 0x00, + // 1292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcd, 0x6f, 0x1b, 0xc5, + 0x1b, 0xce, 0xb6, 0x6e, 0x54, 0xbf, 0x96, 0x7e, 0x6a, 0xe7, 0xe7, 0xa6, 0xed, 0x12, 0xec, 0x64, + 0xfb, 0x91, 0xf4, 0x23, 0xbb, 0xb1, 0x69, 0x9b, 0x43, 0x13, 0xa8, 0x12, 0x94, 0xaa, 0x45, 0x2a, + 0xc1, 0x41, 0x20, 0x71, 0xb1, 0xd6, 0xde, 0xc9, 0x76, 0x21, 0xde, 0xb1, 0x77, 0xd6, 0x56, 0xa2, + 0xc8, 0x17, 0x24, 0x10, 0x82, 0x0b, 0x12, 0x27, 0x2e, 0x5c, 0xf8, 0x07, 0x90, 0x38, 0x23, 0x71, + 0xec, 0x81, 0x43, 0x25, 0x2e, 0x9c, 0x10, 0x4a, 0xf8, 0x43, 0xd0, 0xce, 0xbe, 0xb3, 0xb6, 0x77, + 0x3d, 0x8e, 0xc3, 0x85, 0xdb, 0x7a, 0xe6, 0x7d, 0x9f, 0xe7, 0x79, 0xdf, 0xf9, 0x7a, 0x64, 0xd0, + 0xf7, 0x1b, 0x2d, 0x6b, 0xaf, 0x11, 0x78, 0x8e,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 0xc8, 0xca, 0x99, 0xf4, 0x6c, 0x3e, + 0x7f, 0x75, 0x5c, 0xd2, 0x5e, 0x1f, 0x97, 0xb4, 0xbf, 0x8e, 0x4b, 0xda, 0xb7, 0x27, 0xa5, 0x99, + 0xd7, 0x27, 0xa5, 0x99, 0x3f, 0x4e, 0x4a, 0x33, 0x9f, 0xac, 0xba, 0x5e, 0xf8, 0xb2, 0xdb, 0x30, + 0x9b, 0xac, 0x65, 0x6d, 0x7b, 0x3e, 0x6f, 0xbe, 0xf4, 0x6c, 0x6b, 0x0f, 0x3f, 0x56, 0xb8, 0xf3, + 0x99, 0x75, 0x90, 0xd0, 0x84, 0x87, 0x6d, 0xca, 0x1b, 0xb3, 0xe2, 0xcf, 0x8e, 0xb7, 0xfe, 0x09, + 0x00, 0x00, 0xff, 0xff, 0x2a, 0x3b, 0xaf, 0xda, 0x98, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1323,6 +1534,10 @@ type QueryClient interface { Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) // Proposal queries a SuggestRole Proposal Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) } type queryClient struct { @@ -1450,6 +1665,24 @@ func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, op return out, nil } +func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { + out := new(QueryVoteResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { + out := new(QueryVotesResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Votes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Params queries the parameters of x/fbridge module. @@ -1481,6 +1714,10 @@ type QueryServer interface { Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) // Proposal queries a SuggestRole Proposal Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1526,6 +1763,12 @@ func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryPropos func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") } +func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1765,6 +2008,42 @@ func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Votes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Votes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "lbm.fbridge.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1821,6 +2100,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Proposal", Handler: _Query_Proposal_Handler, }, + { + MethodName: "Vote", + Handler: _Query_Vote_Handler, + }, + { + MethodName: "Votes", + Handler: _Query_Votes_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "lbm/fbridge/v1/query.proto", @@ -2547,6 +2834,18 @@ func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.Proposals) > 0 { for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { { @@ -2584,12 +2883,10 @@ func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ProposalId) > 0 { - i -= len(m.ProposalId) - copy(dAtA[i:], m.ProposalId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ProposalId))) + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -2614,76 +2911,207 @@ func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Proposal != nil { - { - size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryVoteRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n + +func (m *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } -func (m *QueryNextSeqSendRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryVoteResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryNextSeqSendResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Seq != 0 { - n += 1 + sovQuery(uint64(m.Seq)) - } - return n +func (m *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGreatestSeqByOperatorRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Vote.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryVotesRequest) 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 *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryVotesResponse) 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 *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryNextSeqSendRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryNextSeqSendResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovQuery(uint64(m.Seq)) + } + return n +} + +func (m *QueryGreatestSeqByOperatorRequest) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -2937,6 +3365,10 @@ func (m *QueryProposalsResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -2946,9 +3378,8 @@ func (m *QueryProposalRequest) Size() (n int) { } var l int _ = l - l = len(m.ProposalId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) } return n } @@ -2959,13 +3390,65 @@ func (m *QueryProposalResponse) Size() (n int) { } var l int _ = l - if m.Proposal != nil { - l = m.Proposal.Size() + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryVoteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } +func (m *QueryVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Vote.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryVotesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryVotesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4814,11 +5297,47 @@ func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposals = append(m.Proposals, &RoleProposal{}) + m.Proposals = append(m.Proposals, RoleProposal{}) if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4870,10 +5389,10 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) } - var stringLen uint64 + m.ProposalId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4883,24 +5402,11 @@ func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ProposalId |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProposalId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4980,9 +5486,6 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Proposal == nil { - m.Proposal = &RoleProposal{} - } if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5008,6 +5511,343 @@ func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryVoteRequest) 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 ErrIntOverflowQuery + } + 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: QueryVoteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVoteResponse) 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 ErrIntOverflowQuery + } + 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: QueryVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Vote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotesRequest) 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 ErrIntOverflowQuery + } + 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: QueryVotesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVotesResponse) 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 ErrIntOverflowQuery + } + 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: QueryVotesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Votes = append(m.Votes, Vote{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go index 8de3ab8ffe..470bb7bc34 100644 --- a/x/fbridge/types/query.pb.gw.go +++ b/x/fbridge/types/query.pb.gw.go @@ -501,7 +501,7 @@ func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") } - protoReq.ProposalId, err = runtime.String(val) + protoReq.ProposalId, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) @@ -528,7 +528,7 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") } - protoReq.ProposalId, err = runtime.String(val) + protoReq.ProposalId, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) @@ -539,6 +539,136 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh } +func request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["voter"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") + } + + protoReq.Voter, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) + } + + msg, err := client.Vote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Vote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVoteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + val, ok = pathParams["voter"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "voter") + } + + protoReq.Voter, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "voter", err) + } + + msg, err := server.Vote(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := client.Votes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Votes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVotesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := server.Votes(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -805,6 +935,46 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Vote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Vote_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Votes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Votes_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1106,6 +1276,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Vote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Vote_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Vote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Votes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Votes_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Votes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1132,9 +1342,13 @@ var ( pattern_Query_Judges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "judges"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "role", "proposals"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "proposals"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"lbm", "fbridge", "v1", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Vote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"lbm", "fbridge", "v1", "proposals", "proposal_id", "votes", "voter"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"lbm", "fbridge", "v1", "role", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Votes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"lbm", "fbridge", "v1", "proposals", "proposal_id", "votes"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1163,4 +1377,8 @@ var ( forward_Query_Proposals_0 = runtime.ForwardResponseMessage forward_Query_Proposal_0 = runtime.ForwardResponseMessage + + forward_Query_Vote_0 = runtime.ForwardResponseMessage + + forward_Query_Votes_0 = runtime.ForwardResponseMessage )