-
Notifications
You must be signed in to change notification settings - Fork 12
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
Added file_utils to print not-found path in error #349
base: main
Are you sure you want to change the base?
Conversation
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.
Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @giladchase)
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)
stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs
line 36 at r1 (raw file):
public_input_json: &Path, private_input_json: &Path, dev_mode: bool,
Optional: will support both types via deref
Suggestion:
public_input_json: &PathBuf,
private_input_json: &PathBuf,
stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs
line 42 at r1 (raw file):
let public_input_string = read_to_string(public_input_json)?; let public_input: PublicInput<'_> = serde_json::from_str(&public_input_string)?; let private_input: PrivateInput = serde_json::from_str(&read_to_string(private_input_json)?)?;
Saves the tmp String
alloc
Suggestion:
let public_input: PublicInput<'_> = serde_json::from_reader(&open_file(public_input_string)?)?;
let private_input: PrivateInput = serde_json::from_reader(&open_file(private_input_json)?)?;
stwo_cairo_prover/crates/utils/src/file_utils.rs
line 10 at r1 (raw file):
path: PathBuf, } impl serde::de::StdError for IoErrorWithPath {
StdError
looks like a typedef to std::error? Does serde force us to this instead of impl std::Error
?
Code quote:
impl serde::de::StdError for IoErrorWithPath {
stwo_cairo_prover/crates/utils/src/file_utils.rs
line 27 at r1 (raw file):
/// A wrapper to `std::fs::read_to_string`, which, in case of failure, also logs the not-found path. pub fn read_to_string(path: &Path) -> Result<String, IoErrorWithPath> {
Will support both types via deref
Suggestion:
pub fn read_to_string(path: &PathBuf) -> Result<String, IoErrorWithPath> {
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)
stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs
line 42 at r1 (raw file):
Previously, giladchase wrote…
Saves the tmp
String
alloc
I meant this for the private_input:
let private_input: PrivateInput = serde_json::from_reader(&open_file(private_input_json)?)?;
srry
This change is