feat(poll): gate IIP-59 poll snapshot on era boundary (IIP-59 PR B)#4940
Closed
envestcc wants to merge 1 commit into
Closed
feat(poll): gate IIP-59 poll snapshot on era boundary (IIP-59 PR B)#4940envestcc wants to merge 1 commit into
envestcc wants to merge 1 commit into
Conversation
Add IsEraBoundary(epochNum, EpochsPerRewardEra) check to freezeIIP59PollSnapshot so the snapshot writer only fires at era-cadence epochs (default 24) instead of every epoch. Ordering is fork-gate first, era-gate second — the pre-fork legacy path is unchanged; EpochsPerRewardEra=0 disables the write for every non-zero epoch, matching IsEraBoundary's own zero-cadence semantic. The call site in setCandidates now passes epochNum through. Tests cover the four gate states (non-boundary skip, boundary proceeds, zero-cadence disables, pre-fork gate still wins) with a strict mock so any unintended state write fails the test.
|
envestcc
added a commit
that referenced
this pull request
Jul 20, 2026
TestFreezeIIP59PollSnapshot_EraBoundaryProceeds's strict mock rejected
the ReadView("staking") call that 5.5a's FreezePollSnapshot issues via
voterWeightsFromSM. Return ErrStateNotExist so the freezer degrades to
Entries=nil — matches the "view not installed" branch already tested
directly in staking/poll_snapshot_test.go.
Compat fix for the interaction between #4940 (era-boundary gate) and
#4952 / 5.5a (VoterWeightView-populated snapshot). Both cherry-picks
apply cleanly in isolation.
Member
Author
|
Superseded by #4953 (consolidated IIP-59 stack). The era-boundary gate commit |
envestcc
added a commit
that referenced
this pull request
Jul 21, 2026
TestFreezeIIP59PollSnapshot_EraBoundaryProceeds's strict mock rejected
the ReadView("staking") call that 5.5a's FreezePollSnapshot issues via
voterWeightsFromSM. Return ErrStateNotExist so the freezer degrades to
Entries=nil — matches the "view not installed" branch already tested
directly in staking/poll_snapshot_test.go.
Compat fix for the interaction between #4940 (era-boundary gate) and
#4952 / 5.5a (VoterWeightView-populated snapshot). Both cherry-picks
apply cleanly in isolation.
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
Gates
freezeIIP59PollSnapshotonIsEraBoundary(epochNum, EpochsPerRewardEra)so the DelegateProfile commission-rate snapshot only fires at era-cadence epochs
(default 24 = one 24-hour era) instead of every epoch. This is step B of the
IIP-59 v2 era-based distribution rollout, stacked on top of #4915.
Ordering
Fork gate first, era gate second — pre-fork behavior is unchanged. When
EpochsPerRewardEra == 0, the write is skipped for every non-zero epoch,matching
IsEraBoundary's own zero-cadence semantic.Changes
action/protocol/poll/util.go— threadepochNumintofreezeIIP59PollSnapshotand add the era-boundary short-circuit after theexisting
!NoVoterRewardDistributiongate.action/protocol/poll/util_test.go— new tests covering the four gatestates (non-boundary skip / boundary proceeds / zero-cadence disables /
pre-fork gate still wins) with a strict mock so any unintended state write
fails the test.
Stack
IsEraBoundary)Test plan
go test ./action/protocol/poll/...— 56 passed / 3 packagesgo build ./...go vet ./action/protocol/poll/...🤖 Generated with Claude Code