feat(IIP-59): PR A — era-based genesis params + IsEraBoundary helper#4939
Draft
envestcc wants to merge 1 commit into
Draft
feat(IIP-59): PR A — era-based genesis params + IsEraBoundary helper#4939envestcc wants to merge 1 commit into
envestcc wants to merge 1 commit into
Conversation
Additive scaffolding for the era-based voter reward distribution
described in the design doc (IIP-59 §8):
- blockchain/genesis: three new Rewarding fields
- EpochsPerRewardEra (default 24): epochs per voter-reward era
- VoterBudgetPerBlock (default 2000): max voters credited per block
during the era-boundary chunked credit path
- CompoundBatchSize (default 500): max voters swept per block by the
background compound sweep
Not part of the genesis Hash proto — no consensus impact until a
subsequent PR wires them into a fork-gated code path.
- action/protocol: IsEraBoundary(epochNum, epochsPerEra) helper.
Epoch 0 is never a boundary; epochsPerEra=0 disables the cadence
entirely so existing tests are undisturbed.
Follow-up PRs (B/C/D) consume these; no behavioral change here.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
envestcc
force-pushed
the
iip-59/era-genesis-params
branch
from
July 16, 2026 03:35
84c6271 to
069ae87
Compare
|
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
First PR in the IIP-59 v2 (era-based) implementation sequence — pure additive scaffolding, no behavior change. Follow-ups (PR B/C/D/F) will consume the fields and helper introduced here.
blockchain/genesis.Rewardinggains three fields with mainnet-target defaults:EpochsPerRewardEra(24) — voter reward era length in epochsVoterBudgetPerBlock(2000) — max voters credited per block during the era-boundary chunked credit path (Phase 2)CompoundBatchSize(500) — max voters swept per block by the deferred compound sweep (Phase 3)These are NOT added to the
iotextypes.GenesisRewardingproto used byGenesis.Hash(), so this PR does not change the genesis hash. Consensus impact only arrives when a subsequent PR gates behavior on them behind the existing IIP-59 fork.action/protocol.IsEraBoundary(epochNum, epochsPerEra) bool— small predicate the PR B/C sites will use to decide whether a given epoch is an era boundary. Epoch 0 is intentionally never a boundary;epochsPerEra == 0disables the cadence entirely so existing tests are undisturbed.docs/iip-59-distribution-architecture.md— design doc that scopes the era-based rework and enumerates the follow-up PRs. Included in this PR so reviewers of PR B/C/D can reference it.Motivation, three-phase decomposition, and per-era rationale live in the amended IIP-59 §8.
Test plan
go build ./...go vet ./blockchain/genesis/ ./action/protocol/go test ./blockchain/genesis/... ./action/protocol/...(828 tests, all passing)TestHashstill matches the previously-frozen hash — confirms the new fields are outside the consensus-relevant proto.TestIIP59EraDefaults— asserts default field values load through the yaml parser unchanged.TestIsEraBoundary— 11 subtests covering epoch 0,epochsPerEra == 0,epochsPerEra == 1, exact multiples, off-by-one on either side, and large multiples.Follow-ups (not in this PR)
SnapshotForEpochRewardwrites onIsEraBoundary.🤖 Generated with Claude Code