Remove set_validator_weight admin override#504
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
set_validator_weightwas 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), withadd_validator(key, weight)setting the initial value at whitelist time. Decision (user, 2026-06-29): delete the override.What's removed
instructions/admin.rs: theset_validator_weighthandler.lib.rs: its#[program]dispatch entry.tests/test_validator_weight.rs; theonchain_set_validator_weightintegration case + itsset_validator_weight_ixbuilder intests/integration_onchain.rs).No event or error was defined solely for it — the handler reused
ErrorCode::ValidatorNotFound(shared withremove_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.weightfield + the Phase-9 lottery draw that consumes it — unchanged.Notes
Configschema is unchanged (no field added/removed), soCONFIG_VERSIONis not bumped — it tracks the Config account layout, not the instruction surface.grep -rn set_validator_weightreturns nothing (contract + off-chain python/ts/json). No off-chain builder/layout referenced this instruction.anchor buildclean; full LiteSVM unit suite green (test_validator_weightnow 6 tests: add-with-weight + 5vote_set_weightscases).CONTRACT CHANGE — please run a smart-contract-security review before merge.