You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2fc6c1b
Browse filesBrowse the repository at this point in the historyBrowse files
Settle finished proposal deposits over multiple blocks (#4707)
On the incremental tally path, `EndBlocker` burns or refunds every
deposit record of a proposal in the block where the proposal expires or
finishes tallying, so the work in that block grows with the number of
deposit records. The rest of the per-block governance work, vote
tallying and tally cleanup, already runs within a fixed budget.
`EndBlocker` now records the outcome with `ScheduleDepositSettlement`
under the new `DepositSettlementKeyPrefix` (`0x46`). `SettleDeposits`
then burns or refunds at most `MaxDepositsSettledPerBlock` (1000)
records per block, lowest proposal ID first. A proposal without deposits
is not queued, and a queued proposal with no records left counts as one
record, so each block handles at most 1000 queue entries. It resumes
from a stored cursor, so records kept for depositors that cannot receive
funds are skipped rather than scanned again. It runs at the end of
`EndBlocker` on every return path, so tally work cannot starve it, and a
proposal with up to 1000 deposits still settles in the block it
finishes. Each record is burned or refunded and then deleted in one
step, so `ModuleAccountInvariant` holds after every block. Proposal
status, handler execution and expiry are unchanged. `DeleteDeposits` and
`RefundDeposits` behave as before on the legacy path and now share the
per-record helpers.
This breaks the app hash: it adds store state and changes the block in
which large deposit sets are burned or refunded. It only affects the
incremental tally path, which is enabled by the v6.8 upgrade, so no
migration is needed. The existing gov tests pass unchanged. New tests
cover the budget across proposals, resuming past a blocked depositor,
supply and balance accounting, an expiry with 1,001 deposits that
settles over two blocks, skipping proposals without deposits, and
counting queue entries with no records.
0 commit comments