Skip to content

Governance indexing: match the x/gov tally - #673

Merged
aopoltorzhicky merged 2 commits into
masterfrom
refactoring/gov
Oct 1, 2026
Merged

aopoltorzhicky merged 2 commits into
masterfrom
refactoring/gov

Conversation

@aopoltorzhicky

Copy link
Copy Markdown
Member

Tally

  • Weighted votes: a voter's power counts once toward the total, and each option gets power × weight. Results are truncated only at the end, as in x/gov.
  • Only delegations to bonded validators count. The validator set is taken at the block start, because gov's EndBlocker runs before staking's. Stakes are read after the block's txs. Validators jailed in the block are left out of the tally. One BondedValidators query at the block start is shared with x/signal.
  • total_voting_power is now the bonded stake in utia, the same unit and set as the votes. It was consensus power before.
  • Zero powers are written: the Tallied flag replaces the "only if positive" check.
  • Delegations are loaded in batches, not one query per vote row.

Votes

  • A new vote replaces all previous rows of the voter: one vote per (proposal, voter) in a block, and no validator_id filter.
  • votes_count counts voters. Option counters count voters who chose the option.
  • Fixed parsing of legacy weighted votes, where options are separated by \n.

Proposals

  • MsgCancelProposal / cancel_proposal → new cancelled status.
  • AddProposal no longer loses a final status when a vote or deposit for the same proposal comes earlier in the block. GreaterThan compared statuses the wrong way.

Migrations

  • Recount vote counters from the vote table.
  • New enum values: MsgCancelProposal, cancel_proposal, cancelled. message_types grows to bit(122).
  • total_voting_power → utia. Idempotent: only rows still in consensus power are converted.

Notes

  • ⚠️ API: total_voting_power is now ~10⁶× larger (utia). The frontend must drop any scaling.
  • Rollback of proposal state (status, counters, replaced votes) is still out of scope.

@aopoltorzhicky
aopoltorzhicky merged commit f6401c4 into master Oct 1, 2026
10 checks passed
@aopoltorzhicky
aopoltorzhicky deleted the refactoring/gov branch October 1, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants