Skip to content

Remove set_validator_weight admin override#504

Merged
LandynDev merged 1 commit into
m3from
m3-d9-remove-set-validator-weight
Jul 1, 2026
Merged

Remove set_validator_weight admin override#504
LandynDev merged 1 commit into
m3from
m3-d9-remove-set-validator-weight

Conversation

@LandynDev

Copy link
Copy Markdown
Collaborator

Why

set_validator_weight was an admin-only instruction that let the admin unilaterally rewrite any validator's lottery draw weight. That is an unnecessary centralization / skew vector on the reservation lottery. The legitimate weight surface is the consensus path (vote_set_weights), with add_validator(key, weight) setting the initial value at whitelist time. Decision (user, 2026-06-29): delete the override.

What's removed

  • instructions/admin.rs: the set_validator_weight handler.
  • lib.rs: its #[program] dispatch entry.
  • Its test coverage (the two set-weight LiteSVM cases in tests/test_validator_weight.rs; the onchain_set_validator_weight integration case + its set_validator_weight_ix builder in tests/integration_onchain.rs).

No event or error was defined solely for it — the handler reused ErrorCode::ValidatorNotFound (shared with remove_validator), which stays.

What's kept (the legitimate weight surface)

  • add_validator(key, weight) — sets a validator's initial draw weight.
  • vote_set_weights — consensus-governed weight vector (the normal path); full coverage retained.
  • ValidatorInfo.weight field + the Phase-9 lottery draw that consumes it — unchanged.

Notes

  • Pure instruction-surface removal. Anchor discriminators are per-instruction name-hashes, so removing one does not shift the others; all kept instructions' discriminators/layouts are unchanged.
  • Config schema is unchanged (no field added/removed), so CONFIG_VERSION is not bumped — it tracks the Config account layout, not the instruction surface.
  • Repo-wide grep -rn set_validator_weight returns nothing (contract + off-chain python/ts/json). No off-chain builder/layout referenced this instruction.
  • anchor build clean; full LiteSVM unit suite green (test_validator_weight now 6 tests: add-with-weight + 5 vote_set_weights cases).

CONTRACT CHANGE — please run a smart-contract-security review before merge.

@LandynDev LandynDev merged commit 0d85696 into m3 Jul 1, 2026
@LandynDev LandynDev deleted the m3-d9-remove-set-validator-weight branch July 1, 2026 03:58
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