Skip to content

fix(gov): bound EndBlock vote tally work - #4000

Draft
codchen wants to merge 1 commit into
mainfrom
codex/bound-governance-tally-work
Draft

fix(gov): bound EndBlock vote tally work#4000
codchen wants to merge 1 commit into
mainfrom
codex/bound-governance-tally-work

Conversation

@codchen

@codchen codchen commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes and provide context

Governance proposal finalization previously iterated and deleted every stored vote in one EndBlock, allowing a proposal with many zero-power voters to concentrate unbounded work in its expiry block.

This change:

  • shares a 1,000 vote-record budget across tallying and archived-vote cleanup in each EndBlock
  • persists tally results, total voting power, tally parameters, a bonded-validator snapshot, and a vote cursor between blocks
  • moves processed votes into round-specific archives and cleans those archives incrementally
  • rejects new votes after incremental tallying begins
  • isolates expedited and converted regular tally rounds
  • includes both archived and pending votes when exporting an unfinished tally
  • documents the new governance state and adds multi-block regression coverage

Proposal execution, deposit handling, hooks, and final events remain deferred until every vote has been processed.

Testing performed to validate your change

  • go test ./sei-cosmos/x/gov/... -count=1
  • go test -race ./sei-cosmos/x/gov ./sei-cosmos/x/gov/keeper -count=1
  • go vet ./sei-cosmos/x/gov/...
  • make fmtcheck with golangci-lint v2.8.0 rebuilt for Go 1.25
  • golangci-lint v2.8.0 scoped to ./sei-cosmos/x/gov/... — 0 issues

@github-actions

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 25, 2026, 5:14 AM

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.18943% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.04%. Comparing base (0997c3b) to head (7c3f7c7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-cosmos/x/gov/keeper/tally.go 91.05% 10 Missing and 7 partials ⚠️
sei-cosmos/x/gov/simulation/decoder.go 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4000      +/-   ##
==========================================
- Coverage   59.10%   58.04%   -1.07%     
==========================================
  Files        2305     2206      -99     
  Lines      197038   185640   -11398     
==========================================
- Hits       116453   107746    -8707     
+ Misses      69815    68058    -1757     
+ Partials    10770     9836     -934     
Flag Coverage Δ
sei-chain-pr 60.00% <91.18%> (?)
sei-db 69.80% <ø> (-0.22%) ⬇️
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-cosmos/x/gov/abci.go 95.23% <100.00%> (+0.30%) ⬆️
sei-cosmos/x/gov/genesis.go 88.00% <100.00%> (+0.76%) ⬆️
sei-cosmos/x/gov/keeper/vote.go 92.85% <100.00%> (+0.85%) ⬆️
sei-cosmos/x/gov/types/keys.go 93.33% <100.00%> (+1.66%) ⬆️
sei-cosmos/x/gov/simulation/decoder.go 3.22% <0.00%> (-0.23%) ⬇️
sei-cosmos/x/gov/keeper/tally.go 91.13% <91.05%> (-5.65%) ⬇️

... and 101 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant