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

Merged
merged 9 commits into from
Nov 29, 2024

Conversation

varun-doshi
Copy link
Contributor

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.

miden/src/cli/verify.rs Outdated Show resolved Hide resolved
miden/src/cli/verify.rs Outdated Show resolved Hide resolved
miden/src/cli/verify.rs Outdated Show resolved Hide resolved
miden/src/cli/verify.rs Outdated Show resolved Hide resolved
@bobbinth
Copy link
Contributor

bobbinth commented Nov 4, 2024

Hi @varun-doshi - any interest in pushing this PR over the finish line?

@varun-doshi
Copy link
Contributor Author

Hi @varun-doshi - any interest in pushing this PR over the finish line?

Hi yes apologies for the delay
I'll push a commit as per the suggestions asap

@varun-doshi varun-doshi requested a review from bobbinth November 5, 2024 18:30
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.

Looks good! Thank you. I left a couple more comments inline.

miden/src/cli/verify.rs Outdated Show resolved Hide resolved
miden/src/cli/verify.rs Outdated Show resolved Hide resolved
@varun-doshi varun-doshi requested a review from bobbinth November 25, 2024 05:57
Comment on lines 79 to 88
let base_name = proof_file.file_stem().expect("Invalid proof file").to_str().unwrap();

let input_file = self.input_file.clone().unwrap_or_else(|| {
let mut input_path =
proof_file.parent().unwrap_or_else(|| Path::new(".")).to_path_buf();
input_path.push(base_name);
input_path.set_extension("inputs");
// input_path.push(format!("{}.inputs", base_name));
input_path
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to first to get the base name and then modify it. Would something like this not work?:

let input_file = self.input_file.unwrap_or_else(|| {
    let mut input_path = proof_file.clone();
    input_path.set_extension("inputs");
    input_path
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. This makes the code more compact.
Have made the necessary changes

@varun-doshi
Copy link
Contributor Author

After edits and discussions, the verify cmd works as such:

./target/optimized/miden verify -p <PATH_TO_PROOF_FILE> -x <PROGRAM_HASH>

@varun-doshi varun-doshi requested a review from bobbinth November 28, 2024 04:37
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.

Looks good! Thank you! Could you update the changelog and fix lint errors (to make the CI green), and then we can merge.

@varun-doshi varun-doshi requested a review from bobbinth November 28, 2024 14:32
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.

All looks good! Thank you!

@bobbinth bobbinth merged commit 18cb244 into 0xPolygonMiden:next Nov 29, 2024
9 checks passed
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