IIP-59: v3 rewrite matching shipped era-based implementation#76
Open
envestcc wants to merge 1 commit into
Open
IIP-59: v3 rewrite matching shipped era-based implementation#76envestcc wants to merge 1 commit into
envestcc wants to merge 1 commit into
Conversation
Rewrite the specification to match the era-based drain design that actually shipped in iotex-core PR #4953. The v2 amendment (merged as PR #75) described the direction; this v3 revision captures the final protocol surface exposed to delegates, voters, and off-chain verifiers. Key changes vs. v2: - Voter distribution moves from per-epoch to per-*reward era* (default 24 epochs), with an epoch-boundary Phase A that freezes the work list into a persistent cursor and a per-block Phase B system action GrantVoterRewardChunk that drains it. - Two per-block caps parameterize Phase B: VoterBudgetPerBlock (default 2000) and CompoundBatchSize (default 500). - Add SetVoterRewardOptIn action envelope (two-field: candidate identifier + opt-in flag) as the sole delegate-facing mutation for VoterRewardOnchainOptIn. - Add EPOCH_DRAIN_OVERRUN and CURSOR_PROGRESS receipt log types for per-item graceful degrade at Phase A entry and off-chain cursor-progress monitoring. - Commission rates are read from DelegateProfile at each era boundary and frozen into the snapshot for the duration of the drain. No new on-chain rate storage. - Feature gate stays a single flag (NoVoterRewardDistribution). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Rewrite the IIP-59 specification to match the era-based drain design that actually shipped in iotex-core#4953. The v2 amendment (merged as #75) sketched the direction; this v3 revision captures the final protocol surface exposed to delegates, voters, and off-chain verifiers.
What changed vs. v2
EpochsPerRewardEra(default 24) epochs. Era boundary = Phase A (freeze work list into a persistent cursor + immediate commission); every non-boundary block = Phase B (GrantVoterRewardChunksystem action drains the cursor).VoterBudgetPerBlock(default 2000 payouts/block) andCompoundBatchSize(default 500 compounds/block). Both live in genesis config.SetVoterRewardOptInaction envelope — the sole delegate-facing mutation for theVoterRewardOnchainOptInflag. Two-field payload:bytes candidate_identifier,bool opt_in. Commission rates continue to come fromDelegateProfile, so no rate fields on this action.EPOCH_DRAIN_OVERRUN(per-item graceful degrade if a stale cursor is present at Phase A entry — residue rolls into the next era) andCURSOR_PROGRESS(per-chunk observability for off-chain cursor pile-up monitoring).DelegateProfileat each era boundary and frozen into the poll snapshot for the entire drain. No new on-chain rate storage.NoVoterRewardDistribution); no sub-flag decomposition.Why v3, not another amendment to
iip-59-era-distributionThe v2 amendment is already merged onto master (PR #75). This is a full rewrite of the spec text — headers reorganized, edge cases documented, receipt-log catalog added — not an incremental delta. A fresh PR onto master is clearer than layering another amendment on top of a merged one.
Alignment with shipped code
Cross-checked against the shipped commits on iotex-core#4953:
blockchain/genesis/genesis.go.action/protocol/rewarding/reward.goandvoter_reward_chunk.go.SetVoterRewardOptInhandler + validation live inaction/protocol/staking/handler_set_voter_reward_opt_in.goandvalidations.go.protocol.FeatureCtx.NoVoterRewardDistribution.Test plan
blockchain/genesis/genesis.go.action/protocol/rewarding/rewardingpb/rewarding.proto.Supersedes:header captures the correct prior-revision lineage.🤖 Generated with Claude Code