-
Notifications
You must be signed in to change notification settings - Fork 378
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
agave-validator: add args tests for repair-shred-from-peer #4990
base: master
Are you sure you want to change the base?
agave-validator: add args tests for repair-shred-from-peer #4990
Conversation
ff93c2c
to
31c39f8
Compare
let shred_index = value_t_or_exit!(matches, "shred", u64); | ||
let repair_shred_from_peer_args = RepairShredFromPeerArgs::from_clap_arg_match(matches); | ||
if repair_shred_from_peer_args.slot.is_none() { | ||
eprintln!("slot is required"); |
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.
if these are required, why are they specified as optional in struct itself? seems like we should make invalid argument combinations unrepresentable, this way all the validation can be delegated to clap once we upgrade to v4.
|
||
#[derive(Debug, PartialEq, Eq)] | ||
pub struct RepairShredFromPeerArgs { | ||
pub pubkey: Option<Pubkey>, |
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.
these should not be options since theyvare required args
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.
i think if arg is required, atruct holding those args should not be constructable if required args are not supplied. "make invalid states unrepresentable"
Problem
#4082
Summary of Changes
value_t_or_exit !
with other functions and moved the exit logic to thefn execute