-
Notifications
You must be signed in to change notification settings - Fork 65
apollo_proof_manager: read/write proof from file methods #10899
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
Conversation
5b39100 to
72c429f
Compare
58f0c28 to
c0ca05c
Compare
noaov1
left a comment
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.
@noaov1 reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @AvivYossef-starkware and @einat-starkware)
crates/apollo_proof_manager/src/proof_storage.rs line 91 at r1 (raw file):
/// Writes a proof to a file in binary format. /// The file is named `proof` inside the given directory.
Should the path contain a "proof" suffix?
Should we add let path = dir.join("proof");?
Code quote:
/// The file is named `proof` inside the given directory.crates/apollo_proof_manager/src/proof_storage.rs line 99 at r1 (raw file):
// Open a file for writing, deleting any existing content. let file = OpenOptions::new().create(true).write(true).truncate(true).open(path)?;
Can this fail?
Code quote:
let file = OpenOptions::new().create(true).write(true).truncate(true).open(path)?;crates/apollo_proof_manager/src/proof_storage.rs line 104 at r1 (raw file):
for &value in proof.iter() { writer.write_all(&value.to_le_bytes())?;
Same question
Code quote:
writer.write_all(&value.to_le_bytes())?;crates/apollo_proof_manager/src/proof_storage.rs line 107 at r1 (raw file):
} writer.flush()?;
BTW- Why little endian?
Suggestion:
// Pre-allocate exactly enough space: 4 bytes per u32.
let mut buf = Vec::with_capacity(proof.len() * std::mem::size_of::<u32>());
for &value in proof.iter() {
buf.extend_from_slice(&value.to_le_bytes());
}
// Single write instead of one per element.
writer.write_all(&buf)?;
writer.flush()?;crates/apollo_proof_manager/src/proof_storage.rs line 125 at r1 (raw file):
let proof_data = buffer.chunks_exact(4).map(|c| u32::from_le_bytes(c.try_into().unwrap())).collect();
Why should it always suceeded?
Please use expect
Code quote:
.unwrap())c0ca05c to
4be5b48
Compare
ac3f33c to
4ab3e73
Compare
einat-starkware
left a comment
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.
@einat-starkware made 4 comments.
Reviewable status: 0 of 1 files reviewed, 5 unresolved discussions (waiting on @AvivYossef-starkware and @noaov1).
crates/apollo_proof_manager/src/proof_storage.rs line 91 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Should the path contain a "proof" suffix?
Should we addlet path = dir.join("proof");?
I had it in the outer function, but moved it to here because I agree that it makes more sense
crates/apollo_proof_manager/src/proof_storage.rs line 99 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Can this fail?
No - changed to use expect :)
crates/apollo_proof_manager/src/proof_storage.rs line 107 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
BTW- Why little endian?
No particular reason, changes to big endian to be consistent with the directory methods
crates/apollo_proof_manager/src/proof_storage.rs line 125 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Why should it always suceeded?
Please use expect
Done.
noaov1
left a comment
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.
@noaov1 reviewed 1 file and all commit messages, made 2 comments, and resolved 4 discussions.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @AvivYossef-starkware and @einat-starkware).
crates/apollo_proof_manager/src/proof_storage.rs line 117 at r2 (raw file):
} // Single write instead of one per element.
Suggestion:
// Single write.94630c2 to
bb3378c
Compare
4ab3e73 to
fd66ca7
Compare
noaov1
left a comment
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.
@noaov1 reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @AvivYossef-starkware and @einat-starkware).
fd66ca7 to
b1a794c
Compare
bb3378c to
4aa1eff
Compare
einat-starkware
left a comment
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.
@einat-starkware made 1 comment and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @AvivYossef-starkware and @noaov1).
crates/apollo_proof_manager/src/proof_storage.rs line 104 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Same question
Done.
4aa1eff to
82dfdbf
Compare
Merge activity
|
82dfdbf to
c5a5a4c
Compare
c5a5a4c to
50d5465
Compare
50d5465 to
2b6f1f1
Compare
2b6f1f1 to
ec840fa
Compare
noaov1
left a comment
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.
@noaov1 resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @AvivYossef-starkware).

No description provided.