Skip to content

vrank: read epoch candidates from the header when state is gone - #1019

Open
hyunsooda wants to merge 1 commit into
kaiachain:devfrom
hyunsooda:fix/cfs-seed-from-epoch-start-header
Open

vrank: read epoch candidates from the header when state is gone#1019
hyunsooda wants to merge 1 commit into
kaiachain:devfrom
hyunsooda:fix/cfs-seed-from-epoch-start-header

Conversation

@hyunsooda

@hyunsooda hyunsooda commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

newCPMatrix seeded the CP matrix from GetCandTesting, which reads node states
one block below its argument — so an epoch block's transition needed the state two
blocks below it, which a node that synced the range without executing it does not
have. The epoch-start header carries the same candidate list and is now used when
the state read fails.

Types of changes

  • 🐛 Bug fix
  • ✨ Non-hardfork changes (node upgrade not required)
  • 💥 Hardfork / consensus-breaking changes
  • 🧪 Test improvements
  • 🧰 CI / build tool
  • ♻️ Chore / Refactor / Non-functional changes

Checklist

  • 📖 I have read the CONTRIBUTING GUIDELINES doc
  • 🟢 Lint and unit tests pass locally with my changes ($ make test)

Related issues

Further comments

newCPMatrix seeded the CP matrix from GetCandTesting, which resolves the node
states one block below its argument. Computing the transition for an epoch block
therefore needed the state two blocks below it, while a node that synced the
range without executing it holds only the pivot state. The read failed there and
the caller treated the missing scores as "no candidate failed". The epoch-start
header carries the same list, so it is used when the state read fails.

Constraint: GetCandTesting itself is unchanged - encodeEpochStartVRank builds the expected value for verifying an epoch-start header, and serving that from the header would compare it to itself
Constraint: CandTesting is set only in applyEpochTransition, so the header list and the state list cannot disagree within an epoch
Confidence: high
Scope-risk: narrow
Not-tested: a live node syncing across an epoch boundary at the pivot

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hyunsooda hyunsooda self-assigned this Aug 6, 2026
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