Skip to content

solana-cli: add a Squads vault path to shreds validator-client-rewards set-proportion - #4332

Open
elitegreg wants to merge 2 commits into
mainfrom
gm/set-proportion-squads-vault
Open

elitegreg wants to merge 2 commits into
mainfrom
gm/set-proportion-squads-vault

Conversation

@elitegreg

@elitegreg elitegreg commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Resolves: #4186

Summary of Changes

  • shreds validator-client-rewards set-proportion gains a Squads vault path. With --multisig (and optional --vault-index), the vault stands in for the wallet as manager, no keypair is loaded, and the command prints a base58 payload for import into Squads instead of signing and sending. The output states the client id, proportion, manager vault and multisig before the payload, and says that nothing was signed or sent and which write options are inert.
  • The payload is the proportion instruction alone, encoded through the checked Squads encoder. It carries no CheckCliVersion, which would be evaluated at execute days after the payload is written, and no compute budget instructions, since Squads sets the budget on its own execute transaction. The output reports the compute units to budget there.
  • Both paths now read the ValidatorClientRewards account and refuse an actor that is not its manager before anything is built, naming the wallet or the vault and both keys. A wallet that was not the manager used to fail inside the program with invalid account data, and a vault that was not the manager would have produced a payload nothing could execute, consuming an approval round.
  • validate_manager moves from claim into the validator_client_rewards module, now that it has two callers. The direct path of set-proportion sends the same transaction as before.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 3 +170 / -32 +138
Tests 3 +144 / -24 +120
Docs 2 +4 / -0 +4
Total 5 +318 / -56 +262

Core and test lines are split by test module within each Rust file, so the per-category numbers are approximate. The change is roughly half command logic and half new tests.

Key files (click to expand)

Testing Verification

  • Unit tests run the exact vault payload through the checked Squads encoder, assert it carries no version check and no compute budget instruction, and pin that it leaves the import memo reserve free against the hard payload budget. A test pins the direct instruction list, with and without a compute unit price, so the direct path is verifiably unchanged.
  • Parse tests cover --multisig with --vault-index, --vault-index requiring --multisig, and the default with neither. percentage_to_bps rounding and bounds are now tested.
  • Manually against Solana mainnet-beta, read only: with no keypair available, --multisig pointed at the system program fails with the "not the Squads v4 program" message before any fetch, and a real Squads multisig gets through to the ValidatorClientRewards lookup and is refused with manager mismatch: vault is <vault>, validator client rewards manager is <manager>. The direct path with a wallet that is not the manager is refused with manager mismatch: wallet is <wallet>, ... before signing. No live client is managed by a Squads vault, so no payload was produced against a real manager.

@elitegreg
elitegreg requested review from a team and a lite review from Copilot September 14, 2026 20:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Strengthen parser and manager-mismatch tests to assert exact expected errors.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds Squads vault support to set-proportion while preserving direct wallet transactions.

Changes:

  • Adds vault selection, manager validation, and importable payload generation.
  • Centralizes manager validation.
  • Expands tests and updates changelogs.
File summaries
File Summary
offchain/crates/solana-cli/src/command/shreds/validator_client_rewards/set_proportion.rs Adds wallet/vault execution paths and payload tests.
offchain/crates/solana-cli/src/command/shreds/validator_client_rewards/mod.rs Centralizes manager validation and tests.
offchain/crates/solana-cli/src/command/shreds/validator_client_rewards/claim.rs Uses the shared manager validator.
offchain/crates/solana-cli/CHANGELOG.md Documents the CLI change.
CHANGELOG.md Adds the project changelog entry.
Review details

Suppressed comments (1)

offchain/crates/solana-cli/src/command/shreds/validator_client_rewards/set_proportion.rs:333

  • Issue
    These bounds tests only assert that an error exists and do not pin the user-facing error message.

Context
The tests remain green if the command reports the wrong range or value, which weakens the validation contract.

Proposed Fix
Compare each error's complete string with the expected proportion-range diagnostic.

        assert!(percentage_to_bps(100.1).is_err());
        assert!(percentage_to_bps(-0.1).is_err());
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nikw9944 nikw9944 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertions meant to pin the vault payload (no version check, no compute budget) run against an array the test builds itself, so that invariant has no regression coverage. Nothing blocking.

The tests meant to pin the set-proportion vault payload asserted against
an array the test built itself, so the invariants they named, no version
check and no compute budget instruction, had no regression coverage. The
payload the command sends was assembled inline and no test reached it.

Add a vault_instructions helper, the way claim already carries one, have
the command build its payload through it, and route both payload tests
through the same function.

Tighten three assertions alongside it: the manager mismatch message is
now compared whole rather than by fragment, the --vault-index parse
failure asserts the clap error kind, and the proportion bounds cases
assert the message. The vault index assertion goes into claim as well, so
the two sibling commands keep matching tests.
@elitegreg
elitegreg force-pushed the gm/set-proportion-squads-vault branch from 2a8acf6 to 54f532c Compare September 15, 2026 02:41
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.

solana-cli: add a Squads vault path to shreds validator-client-rewards set-proportion

3 participants