IIP-59: era-based distribution amendment (v2)#75
Draft
envestcc wants to merge 1 commit into
Draft
Conversation
Adds §8 amendment superseding per-epoch distribution cadence with a per-day (24-epoch) era model. Motivated by mainnet-scale measurement (27,020 distinct voter addresses vs. the v1 assumption of ~40k credits spread across delegates) — the v1 per-epoch drain projects to ~3.4s trie-backed wall clock at the epoch-close block, exceeding the 2.5s post-Dardanelles block interval. §8 covers: 8.1 motivation with measured cost 8.2 three-phase decomposition (accrue / credit / compound) 8.3 per-era distribution cadence + EpochsPerRewardEra genesis param 8.4 per-era VoterWeightSnapshot cadence (no drift window) 8.5 state model additions (VoterRewardEraCursor + sentinel) 8.6 chunked Phase 2 credit path (VoterBudgetPerBlock cap) 8.7 EraVoterCredited log replacing DelegateDistributed 8.8 Phase 3 hybrid compound (background sweep + lazy on Claim) 8.9 first-era boundary handling 8.10 genesis parameters table 8.11 explicit list of superseded items in §3 8.12 new test cases 17-22 8.13 amended migration steps Also adds a Rationale block "Why Per-Era (Not Per-Epoch) Distribution" comparing three alternatives and a Backwards Compatibility note on the new state and genesis fields. Mechanism-preserving amendment: opt-in gate (§3.7), rate source (§3.5), compound routing (§3.6), pending pool (§3.1), and orphan drain (§3.3) are unchanged. Only the firing cadence and log format change.
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds §8 amendment to IIP-59 superseding the per-epoch voter reward distribution cadence with a per-day (24-epoch) era model. Motivated by mainnet-scale measurement.
ReadStakingDataMethod_BUCKETSenumeration): 27,020 distinct voter addresses across 39,950 live bucketsSlotBucketReader+ ~40 μsAddDepositForCompound+ trie overhead)The v1 spec is mechanism-correct but its per-epoch fan-out concentrates too much work into the epoch-close block. Chunking the drain (prototyped in iotex-core PR #4936) spreads the cost but does not reduce it and introduces snapshot-drift questions across the chunk window. This amendment adopts a per-era model instead:
unclaimedBalanceacross⌈voters / VoterBudgetPerBlock⌉blocksClaim): deferred compound ofunclaimedBalance, no time constraintEvery other §3 mechanism — opt-in gate (§3.7),
DelegateProfilerate source (§3.5),AutoDepositcompound routing (§3.6), pending pool (§3.1), orphan drain (§3.3) — is preserved. Only the firing cadence and log format change.What's in the diff
Single-file amendment to
iip-59.md, +223 / −2 lines:EpochsPerRewardEragenesis paramSnapshotForEpochRewardcadenceVoterRewardEraCursor+ sentinel)VoterBudgetPerBlockcap)EraVoterCreditedlog replacingDelegateDistributedClaim)VoterRewardEraCursor) and the new genesis fields (EpochsPerRewardEra/VoterBudgetPerBlock/CompoundBatchSize)Key design invariants preserved
!fCtx.NoVoterRewardDistributiongate from PR IIP-59: contract-backed rates, native compound, batched log, opt-in migration #74.EpochsPerRewardEra = 1reproduces v1 per-epoch behavior for testnet debug.unclaimedBalanceis monotonic between Phase 2 credit and Phase 3 compound (or userClaim), so Phase 3 can pause arbitrarily without correctness impact.EraVoterCreditedcarrieschunk_seq+is_final+snapshotHashso off-chain aggregators can sum by(era_start_epoch, delegate)and independently verify against the frozen snapshot.Trade-offs (called out in §8 + Rationale)
VoterRewardOnchainOptInat era boundaries, not epoch boundaries — otherwise a voter is double-paid for up to 24 epochs. Guaranteed if the filter runs at every epoch (superset).References
docs/iip-59-distribution-architecture.mdin iotexproject/iotex-core (upstream, in progress)Test plan
EraVoterCreditedlog payload (§8.7) is reconstructible by the off-chain verifier tool tracked in iotex-core task #45 once implementediotexproject/iotex-coreper the sequence in the design doc (PRs A–F)