This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
clap-utils: Forbid multiple values for --signer
#34482
Merged
Merged
Conversation
This file contains 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
t-nelson
reviewed
Dec 15, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #34482 +/- ##
=======================================
Coverage 81.8% 81.8%
=======================================
Files 824 824
Lines 222486 222486
=======================================
+ Hits 182090 182104 +14
+ Misses 40396 40382 -14 |
t-nelson
previously approved these changes
Dec 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh thought i approved with the other review... now
Sorry, had a merge conflict to resolve, can you approve again please? |
t-nelson
previously approved these changes
Dec 22, 2023
Sorry, can I get one last approval here? I got scooped on the changelog again |
t-nelson
approved these changes
Jan 5, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
The
--signer
arg doesn't exactly work as expected because it allows for multiple values. This means clap allows for someone to specify:--signer <PUBKEY>=<SIG> <PUBKEY>=<SIG>
This can be useful in some situations, but it's inconsistent with the documentation.
For example, https://docs.solana.com/offline-signing#submitting-offline-signed-transactions-to-the-network mentions to specify "--signer BASE58_PUBKEY=BASE58_SIGNATURE, one for each offline signer.", and the examples use multiple occurrences of
--signer
.Also, the example command of:
Does not work currently because
--signer
tries to parse multiple values. This means it tries to also parserecipient-keypair.json
and1
. Practically, this means that--signer
must always come last in the command, which contradicts the docs.Side note: for your reading pleasure here are the docs for
multiple_values
https://docs.rs/clap/3.2.23/clap/builder/struct.Arg.html#method.multiple_values in clap v3 and formultiple
in clap v2 https://docs.rs/clap/2.34.0/clap/struct.Arg.html#method.multipleSummary of Changes
Cap the number of values to 1 (clap v2) and do not allow multiple values per occurrence (clap v3). I'm not sure if this breaks any existing users, so I've put in a changelog entry.
Fixes #34453