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

refactor: Refactor proof handling for ownership and borrowing #1214

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

huitseeker
Copy link
Member

@huitseeker huitseeker commented Mar 16, 2024

On a long enough timeline, we'll want to generate compressed proofs without dropping the associated RecursiveProof. This is for the purpose of re-starting the proof using the prior RecursiveProof, which at the moment can only be obtained through cloning prior to compression (which itself would be impossible prior to the companion PR used here).

The current approach witnesses that compression only requires a reference to the current proof, and returns a Cow: the only situation in which this would result in a clone is if:

  • we create a CompressedProof,
  • we call compress() on it,
  • we further perform a modification of the resulting CompressedProof that requires an owned value.
    => this flow seems unlikely.

In detail:

  • Updated compress function across various files to take &self instead of self, avoiding the drop of the RecursiveProof;
  • Adjusted dependencies in chain-server's Cargo.toml to use workspace versions, streamlining dependency management and increasing project consistency.

Note

This depends on and requires the companion PR argumentcomputer/arecibo#364. CI is fully expected to fail on the cargo-deny job due to use of a fork (until companion PR is merged).

@arthurpaulino
Copy link
Member

This is for the purpose of re-starting the proof using the prior RecursiveProof, which at the moment can only be obtained through cloning prior to compression

How come? #1209 accomplishes the above without such clone

@huitseeker
Copy link
Member Author

huitseeker commented Mar 16, 2024

How come? #1209 accomplishes the above without such clone

That's because #1209 drops the recursive proofs as it calls compress on them (compress takes ownership of self, and does not return self in case of actual compression).

This is fine for #1209, since reusing the recursive proof after compression of that recursive proof is not exercised anywhere I could spot.

Copy link
Member

@arthurpaulino arthurpaulino left a comment

Choose a reason for hiding this comment

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

Indeed, we're going to need this in order to compress the recursive proof and still move on with it, without losing ownership. Thanks for unlocking this!

arthurpaulino
arthurpaulino previously approved these changes Mar 18, 2024
Copy link
Member

@arthurpaulino arthurpaulino left a comment

Choose a reason for hiding this comment

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

Now that #1209 was merged, this has become high priority to unlock the next steps of the proof server

On a long enough timeline, we'll want to generate compressed proofs without dropping the associated `RecursiveProof`. This is for the purpose of re-starting the proof using the prior
`RecursiveProof`, which at the moment can only be obtained through cloning prior to compression.

The current approach witnesses that compression only requires a reference to the current proof, and returns a `Cow`: the only situation in which this would result in a clone is if:
- we create a `CompressedProof`,
- we call `compress()` on it,
- we further perform a modificaiton of that `CompressedProof` that requires an owned value..

In detail:
- Updated `compress` function across various files to take `&self` instead of `self`, avoiding the drop of the `RecursiveProof`;
- Adjusted dependencies in chain-server's `Cargo.toml` to use workspace versions, streamlining dependency management and increasing project consistency.
@huitseeker huitseeker added this pull request to the merge queue Mar 19, 2024
Merged via the queue into argumentcomputer:main with commit 0d2ae13 Mar 19, 2024
11 checks passed
@huitseeker huitseeker deleted the iter_when_proving branch March 19, 2024 14:31
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