-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clap-utils: Forbid multiple values for --signer
#34482
Conversation
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 |
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? |
Sorry, can I get one last approval here? I got scooped on the changelog again |
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