-
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-v3-utils] Deprecate signer validation and update parsing for clap-v3 #33478
[clap-v3-utils] Deprecate signer validation and update parsing for clap-v3 #33478
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #33478 +/- ##
=========================================
- Coverage 81.8% 81.7% -0.1%
=========================================
Files 806 806
Lines 217850 218107 +257
=========================================
+ Hits 178269 178402 +133
- Misses 39581 39705 +124 |
…_of_multiple_signers`
this is a really huge change set. are there sane places to break it up? <500lns total changes per would be great |
Yeah, apologies. I've been dragging my feet on reviewing because I don't want to miss something. If there's any way to break it up, that would make me much more confident! |
Yes, sorry it is my fault. A lot of the line changes are (un)doing refactors, so I can divide that part up. |
Problem
In clap-v3, the
Arg::validator
is deprecated and replaced withArg::value_parser
. The idea is that when we validate an argument input, we generally parse the input, so dividing validation and parsing in separate steps forces you to parse input twice.A previous PR #33276 deprecated most of the validation functions in clap-v3-utils and replaced them with parsing functions. This PR is a follow-up that deprecates validation functions related to the signer.
Summary of Changes
Sorry this follow-up PR took such a long time. I actually had this PR open for a couple weeks, but I never asked for a review.
To make clap-v3-utils implement clap parsers idiomatically, I made some non-trivial amount of changes including making the
SignerSource
a public type. I am very open to the reviewers' opinions and am happy to revert any of the changes I made in this PR, so please let me know what you think.SignerSource
be a public type and let applications callmatches.get_one::<SignerSource>(...)
to validate and parse the signer source. To define a parser forSignerSource
(to callclap::builder::ValueParser::from(...)
on theSignerSource
type), theSignerSource
has to implementClone
. I thought addingClone
toSignerSource
was okay since sensitive information is not actually parsed withSignerSource
, but later when we callsigner_from_path
orkeypair_from_path
. Please let me know otherwise.SignerSource
parser, so I added it.parser::signer
from the previous PR. Since they are deprecated anyway, I moved them back to their original place (as suggested [clap-v3-utils] Deprecate input validators and add parsers to replace them #33276 (comment) previously). I should have put them back in the previous PR 🙏 ...SignerSource
intoparser::signer
and made it into a public type.SignerSource
. I also returned these deprecated functions back to its original place... sorry for the mess.#[allow(deprecated)]
insolana-keygen
andsolana-zk-keygen
. These two crates will be addressed on follow-up to remove deprecated functions. I also either removed deprecated functions inclap-v3-utils
or added#[allow(deprecated)]
to already deprecated functions for the CI.Fixes #