Skip to content

Validator activation queue off by one#50

Merged
JamesEjembi merged 2 commits into
VeriNode-Labs:mainfrom
clintjeff2:Validator-Activation-Queue-Off-by-One
Jun 27, 2026
Merged

Validator activation queue off by one#50
JamesEjembi merged 2 commits into
VeriNode-Labs:mainfrom
clintjeff2:Validator-Activation-Queue-Off-by-One

Conversation

@clintjeff2

Copy link
Copy Markdown
Contributor

Motivation

  • Fix an off-by-one in validator activation scheduling where a pending validator with activation_epoch == current_epoch could be skipped and never activated.

Description

  • Add a new deterministic activation queue in src/validator/activation_queue.rs with MAX_PENDING_VALIDATORS, compute_activation_epoch(), capacity/duplicate checks and an inclusive drain (activation_epoch <= current_epoch).
  • Wire the activation queue into the validator API by exposing the module in src/validator/mod.rs and extending ValidatorSet in src/validator/validator_set.rs with a Pending status, an activation_queue field, add_pending_validator(), activate_validator(), queued_activations() and process_activation_queue() that activates drained validators exactly once.
  • Add regression tests in tests/activation_queue_test.rs that verify boundary-epoch activation, multiple validators sharing the boundary, future delayed activation using compute_activation_epoch(), and duplicate/capacity rejection.

Testing

  • Ran cargo test --test activation_queue_test and all activation-queue tests passed.
  • Ran cargo test --test exit_queue_ordering_test and the existing exit-queue ordering tests passed.
  • Ran the full test suite with cargo test and the repository tests completed successfully with no failures.

Closes #16

@JamesEjembi JamesEjembi merged commit 12916bb into VeriNode-Labs:main Jun 27, 2026
1 check passed
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.

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

2 participants