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

[fix]: VerifyCmd Flag Collision #1513

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

varun-doshi
Copy link

Describe your changes

Related #1421

This PR does the following:

  • Updates the symbol for program-hash to -x. No long form
  • Creates an infer_defaults function which checks the directory specified by the input file passed(with -i) to search for a .proof and .outputs file (only if these files are not already specified) . If these files are already specified by user, then it does not run this check.
    Hence the command can be called as such:
./target/optimized/miden verify -i PATH_TO_INPUT_FILE.inputs -x PROGRAM_HASH -o PATH_TO_OUTPUT_FILE.outputs -p PATH_TO_PROOF_FILE.proof

as well as such:

./target/optimized/miden verify -i PATH_TO_INPUT_FILE.inputs -x PROGRAM_HASH 

TODO:

  • Update docs

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! And sorry for such a delayed review. I left some comments inline. Also, some code formatting seems to be off. You can run make lint to fix this automatically.

Comment on lines +23 to 24
#[clap(short = 'x', long = "hash")]
program_hash: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably keep the long name as program-hash as it is more self-describing.

Comment on lines 20 to +21
#[clap(short = 'p', long = "proof", value_parser)]
proof_file: PathBuf,
proof_file: Option<PathBuf>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep proof_file as required and try to infer input/output files based on it (rather than using input file to infer proof/output file).

Comment on lines +28 to +33
pub fn execute(&mut self) -> Result<(), Report> {

let (proof_file,output_file)=self.infer_defaults();

self.proof_file=Some(proof_file);
self.output_file=Some(output_file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need to make self mutable here. Once we get the inferred files we can probably use them directly rather than reading them from self.

@@ -62,4 +69,26 @@ impl VerifyCmd {

Ok(())
}
}

pub fn infer_defaults(&self)->(PathBuf,PathBuf){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in another comment, I'd probably infer input/output files based on the proof file rather than the other way around.

Also, I don't think this function needs to be public, right?

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