Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yihau
Copy link
Member

@yihau yihau commented Feb 14, 2025

Problem

#4082

Summary of Changes

@yihau yihau mentioned this pull request Feb 11, 2025
@yihau yihau force-pushed the add-args-test-for-repair-shred-from-peer branch from ff93c2c to 31c39f8 Compare February 14, 2025 17:52
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");

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>,

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

Copy link

@alexpyattaev alexpyattaev left a 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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants