Skip to content

feat(IIP-59): PR A — era-based genesis params + IsEraBoundary helper#4939

Draft
envestcc wants to merge 1 commit into
masterfrom
iip-59/era-genesis-params
Draft

feat(IIP-59): PR A — era-based genesis params + IsEraBoundary helper#4939
envestcc wants to merge 1 commit into
masterfrom
iip-59/era-genesis-params

Conversation

@envestcc

Copy link
Copy Markdown
Member

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.Rewarding gains three fields with mainnet-target defaults:
    • EpochsPerRewardEra (24) — voter reward era length in epochs
    • VoterBudgetPerBlock (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.GenesisRewarding proto used by Genesis.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 == 0 disables 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)
  • TestHash still matches the previously-frozen hash — confirms the new fields are outside the consensus-relevant proto.
  • New TestIIP59EraDefaults — asserts default field values load through the yaml parser unchanged.
  • New 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)

  • PR B — gate SnapshotForEpochReward writes on IsEraBoundary.
  • PR C — Phase 2 chunked credit path (largest; may split C1/C2/C3).
  • PR D — Phase 3 hybrid compound sweep.
  • PR F — off-chain migration guide.

🤖 Generated with Claude Code

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
envestcc force-pushed the iip-59/era-genesis-params branch from 84c6271 to 069ae87 Compare July 16, 2026 03:35
@sonarqubecloud

Copy link
Copy Markdown

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