Skip to content

Validator Activation Queue Off-by-One in Epoch Scheduling at Boundary Condition #16

Description

@JamesEjembi

Problem Statement / Feature Objective

The validator activation queue processes pending validators in FIFO order by activation_epoch. When the queue is updated mid-epoch after a reorg, the epoch assignment computation uses a strict inequality (activation_epoch > current_epoch) instead of greater-than-or-equal, causing the validator at the boundary to be skipped entirely and never activated.

Technical Invariants & Bounds

  • MAX_PENDING_VALIDATORS = 8192 (queue depth).
  • Activation delay: 4 epochs (MIN_VALIDATOR_WITHDRAWABILITY_DELAY).
  • Queue processed once per epoch boundary.
  • Off-by-one causes exactly one validator per epoch boundary to be permanently stuck.
  • Affected validators can still submit attestations but never receive rewards.

Codebase Navigation Guide

  • src/validator/activation-queue.rs - process_activation_queue() and compute_activation_epoch().
  • src/validator/validator-set.rs - activate_validator() that mutates state.
  • src/state/epoch-transition.rs - epoch_transition() that triggers queue processing.
  • tests/validator/activation_queue_test.rs - unit and integration tests.

Implementation Blueprint

  1. In src/validator/activation-queue.rs, locate the condition if activation_epoch > current_epoch and change it to >= .
  2. Audit all other inequality comparisons in the same module for similar off-by-one patterns.
  3. Add a regression test that sets up a pending validator with activation_epoch exactly equal to current_epoch and asserts it is activated.
  4. Verify that the fix does not double-activate validators by adding a test where multiple validators share the boundary epoch.
  5. Run the full validator test suite to confirm no regressions in exit or withdrawal logic.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions