Skip to content

fix(genesis): require positive validator voting power - #346

Merged
ZhiyuCircle merged 1 commit into
circlefin:mainfrom
sanjeebdas1979:fix/genesis-require-positive-voting-power
Sep 8, 2026
Merged

fix(genesis): require positive validator voting power#346
ZhiyuCircle merged 1 commit into
circlefin:mainfrom
sanjeebdas1979:fix/genesis-require-positive-voting-power

Conversation

@sanjeebdas1979

@sanjeebdas1979 sanjeebdas1979 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Require genesis validator configurations to include at least one validator with positive voting power.

The previous schema accepted both an empty validator set and a set where every validator had zero voting power. Consensus-side decoding later rejects the resulting empty effective validator set, so this validation moves the failure earlier to genesis configuration time.

Changes

  • Add set-level validation requiring at least one validator with positive voting power.
  • Preserve support for zero-power validators when another validator has positive voting power.
  • Add regression tests covering:
    • empty validator set
    • all-zero voting power
    • positive-only validator set
    • mixed zero/positive validator set

Testing

ValidatorManager genesis validator-set validation
  ✔ rejects an empty validator set
  ✔ rejects a validator set with no positive voting power
  ✔ accepts a validator set with positive voting power
  ✔ accepts zero-power validators when another validator has positive power

4 passing

Fixes #344

@ZhiyuCircle

ZhiyuCircle commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for contribution, Zero voting power is our soft-delete/deactivation path: updateValidatorVotingPower(id, 0) leaves a validator Active and registered while removing it from the effective consensus set — see the doc comment at contracts/src/validator-manager/ValidatorRegistry.sol:169, removeValidator is the hard delete that prunes storage.

Check at least one validator must have positive voting power makes sense to me

@ZhiyuCircle ZhiyuCircle closed this Sep 8, 2026
@ZhiyuCircle ZhiyuCircle reopened this Sep 8, 2026
@ZhiyuCircle ZhiyuCircle added the pending-import Merged PR awaiting reverse-sync to upstream label Sep 8, 2026
@ZhiyuCircle
ZhiyuCircle merged commit 186d124 into circlefin:main Sep 8, 2026
37 checks passed
@sanjeebdas1979

Copy link
Copy Markdown
Contributor Author

Thanks for the review and clarification. The final approach preserves zero-power validators for deactivation while ensuring the genesis set always has effective voting power. Glad to see this merged.

@circle-github-action-bot circle-github-action-bot added imported and removed pending-import Merged PR awaiting reverse-sync to upstream labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(genesis): ValidatorManager accepts validator sets with no positive voting power

3 participants