caelum0x 9e2746707a feat(governance): complete governance module with veto votes, cancel, queries, and execution log
- Task 1.1/1.2: Add no_with_veto vote option with 33.4% veto threshold
  - New VoteOptionNoWithVeto constant and DefaultVetoThresholdBps (3340)
  - VetoVotes field on Proposal struct (proto field 15)
  - CastVote handles no_with_veto; TallyProposal rejects if veto > 33.4%

- Task 1.3: Add MsgCancelProposal
  - New ErrUnauthorizedCancel (1411) and ErrProposalNotCancellable (1412)
  - ProposalStatusCancelled constant
  - CancelProposal keeper method: checks proposer, voting status, refunds deposit

- Task 1.4: Add QueryTallyResult and QueryVoterVotes
  - QueryTallyResult returns counts, percentages (bps), pass/veto status
  - QueryVoterVotes walks Votes collection filtered by voter address

- Task 1.5: ParamExecutor coverage for marketplace, reputation, messaging, modelregistry
  - All 4 modules tested via mock executor registration + ExecuteProposal

- Task 1.6: Execution log fields
  - ExecutionHeight (proto field 16) and ExecutionError (proto field 17) on Proposal
  - ExecuteProposal sets these on both success and failure paths

All 24 tests pass (5 existing + 19 new), go build ./... clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 14:24:34 +03:00

62 lines
1.6 KiB
Protocol Buffer

syntax = "proto3";
package clawchain.governance.v1;
import "google/api/annotations.proto";
import "clawchain/governance/v1/types.proto";
import "clawchain/governance/v1/params.proto";
option go_package = "clawchain/x/governance/types";
// Query defines the governance gRPC query service.
service Query {
// Proposal returns a single proposal by ID.
rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) {
option (google.api.http).get = "/clawchain/governance/v1/proposal/{proposal_id}";
}
// Proposals returns all proposals, optionally filtered by status.
rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) {
option (google.api.http).get = "/clawchain/governance/v1/proposals";
}
// Votes returns all votes for a given proposal.
rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) {
option (google.api.http).get = "/clawchain/governance/v1/proposal/{proposal_id}/votes";
}
// Params returns the governance module parameters.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/clawchain/governance/v1/params";
}
}
message QueryProposalRequest {
uint64 proposal_id = 1;
}
message QueryProposalResponse {
Proposal proposal = 1;
}
message QueryProposalsRequest {
string status = 1;
}
message QueryProposalsResponse {
repeated Proposal proposals = 1;
}
message QueryVotesRequest {
uint64 proposal_id = 1;
}
message QueryVotesResponse {
repeated Vote votes = 1;
}
message QueryParamsRequest {}
message QueryParamsResponse {
GovParams params = 1;
}