Skip to content

Conversation

@einat-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

einat-starkware commented Dec 18, 2025

@einat-starkware einat-starkware marked this pull request as ready for review December 18, 2025 09:16
@einat-starkware einat-starkware force-pushed the einat/proof_manager/read_write_proof branch from 5b39100 to 72c429f Compare December 18, 2025 09:25
@einat-starkware einat-starkware force-pushed the einat/proof_manager/read_write_proof branch 2 times, most recently from 58f0c28 to c0ca05c Compare December 18, 2025 12:30
Copy link
Collaborator

@noaov1 noaov1 left a 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())

@einat-starkware einat-starkware changed the base branch from einat/proof_manager/create_directory_methods to graphite-base/10899 December 21, 2025 07:37
@einat-starkware einat-starkware force-pushed the einat/proof_manager/read_write_proof branch from c0ca05c to 4be5b48 Compare December 21, 2025 08:17
@einat-starkware einat-starkware changed the base branch from graphite-base/10899 to einat/proof_manager/create_directory_methods December 21, 2025 08:17
Copy link
Contributor Author

@einat-starkware einat-starkware left a 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 add let 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.

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

:lgtm:

@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.

@einat-starkware einat-starkware force-pushed the einat/proof_manager/read_write_proof branch 2 times, most recently from 94630c2 to bb3378c Compare December 21, 2025 14:47
@einat-starkware einat-starkware force-pushed the einat/proof_manager/create_directory_methods branch from 4ab3e73 to fd66ca7 Compare December 21, 2025 14:47
Copy link
Collaborator

@noaov1 noaov1 left a 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).

@graphite-app graphite-app bot changed the base branch from einat/proof_manager/create_directory_methods to graphite-base/10899 December 22, 2025 08:20
@einat-starkware einat-starkware force-pushed the einat/proof_manager/read_write_proof branch from bb3378c to 4aa1eff Compare December 22, 2025 08:25
@einat-starkware einat-starkware changed the base branch from graphite-base/10899 to einat/proof_manager/create_directory_methods December 22, 2025 08:25
Copy link
Contributor Author

@einat-starkware einat-starkware left a 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.

@einat-starkware einat-starkware changed the base branch from einat/proof_manager/create_directory_methods to main December 22, 2025 08:53
@einat-starkware einat-starkware force-pushed the einat/proof_manager/read_write_proof branch from 4aa1eff to 82dfdbf Compare December 22, 2025 08:53
@graphite-app
Copy link

graphite-app bot commented Dec 22, 2025

Merge activity

  • Dec 22, 8:54 AM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

@einat-starkware einat-starkware force-pushed the einat/proof_manager/read_write_proof branch from 2b6f1f1 to ec840fa Compare December 28, 2025 11:08
Copy link
Collaborator

@noaov1 noaov1 left a 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AvivYossef-starkware).

@einat-starkware einat-starkware added this pull request to the merge queue Dec 28, 2025
Merged via the queue into main with commit cea14c3 Dec 28, 2025
13 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants