Skip to content

Conversation

@NDobrev
Copy link
Contributor

@NDobrev NDobrev commented Feb 7, 2025

No description provided.

Copy link

@smanilov smanilov left a comment

Choose a reason for hiding this comment

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

Preliminary review; interrupted by other tasks.

if args.input_file.is_empty() {
eprintln!("No file name provided after '--input-file'.");
std::process::exit(1);
}

Choose a reason for hiding this comment

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

This check will be triggered only if someone passes an empty string as the file name.

Clap has checks for missing flags included, so you could just remove this, unless you want exactly this behavior (to catch --input-file "").

# ./target/release/dvt_prover_host --input-file 
error: a value is required for '--input-file <INPUT_FILE>' but none was supplied

For more information, try '--help'.
# ./target/release/dvt_prover_host --input-file "" --type share
No file name provided after '--input-file'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reworked

src/main.rs Outdated

fn read_text_file(filename: &str) -> Result<String, Box<dyn Error>> {
fn read_text_file(filename: &str) -> Result<String, Box<dyn Error>> {
let mut file = File::open(filename).map_err(|e| format!("Error opening file: {}", e))?;

Choose a reason for hiding this comment

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

The error currently looks like this:

# ./target/release/dvt_prover_host --input-file examples/dvt_bad_share.json --type share --json-schema-file foo
Error opening file: No such file or directory (os error 2)

In my opinion, this is a shortcoming of std::io: the name of the file is not printed. I would add it in the error message manually:

let mut file = File::open(filename).map_err(|e| format!("Error opening file {filename}: {e}"))?;

Also, note that you can interpolate variables directly. (But not expressions; format!("{x}"); works, but format!("{call_me()}"); does not.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reworked

Choose a reason for hiding this comment

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

I don't see this change in the current code. Did you forget to add it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now should be there

Copy link

@smanilov smanilov left a comment

Choose a reason for hiding this comment

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

Finished review of the share_exchange_prove guest program.

Let me know if you would like me to review more of this code (the other guest programs).

@NDobrev NDobrev merged commit 57c553c into master Apr 2, 2025
1 check 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.

3 participants