Conversation
There was a problem hiding this comment.
🟡 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
left a comment
There was a problem hiding this comment.
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.
2a8acf6 to
54f532c
Compare
Resolves: #4186
Summary of Changes
shreds validator-client-rewards set-proportiongains 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.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.ValidatorClientRewardsaccount 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 withinvalid account data, and a vault that was not the manager would have produced a payload nothing could execute, consuming an approval round.validate_managermoves fromclaiminto thevalidator_client_rewardsmodule, now that it has two callers. The direct path ofset-proportionsends the same transaction as before.Diff Breakdown
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)
offchain/crates/solana-cli/src/command/shreds/validator_client_rewards/set_proportion.rs— actor selection (wallet or vault), theValidatorClientRewardsfetch and manager check, the direct transaction, and the vault payload outputoffchain/crates/solana-cli/src/command/shreds/validator_client_rewards/mod.rs— receivesvalidate_managerand its testsoffchain/crates/solana-cli/src/command/shreds/validator_client_rewards/claim.rs— calls the hoistedvalidate_managerTesting Verification
--multisigwith--vault-index,--vault-indexrequiring--multisig, and the default with neither.percentage_to_bpsrounding and bounds are now tested.--multisigpointed at the system program fails with the "not the Squads v4 program" message before any fetch, and a real Squads multisig gets through to theValidatorClientRewardslookup and is refused withmanager mismatch: vault is <vault>, validator client rewards manager is <manager>. The direct path with a wallet that is not the manager is refused withmanager mismatch: wallet is <wallet>, ...before signing. No live client is managed by a Squads vault, so no payload was produced against a real manager.