argumentcomputer / lurk-beta

Lurk is a Turing-complete programming language for recursive zk-SNARKs. It is a statically scoped dialect of Lisp, influenced by Scheme and Common Lisp. (contact: @porcuquine)
https://lurk-lang.org/
Apache License 2.0
427 stars 54 forks source link

refactor: Refactor proof handling for ownership and borrowing #1214

Closed huitseeker closed 6 months ago

huitseeker commented 6 months ago

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:

In detail:

[!NOTE] This depends on and requires the companion PR https://github.com/lurk-lab/arecibo/pull/364. CI is fully expected to fail on the cargo-deny job due to use of a fork (until companion PR is merged).

arthurpaulino commented 6 months ago

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 commented 6 months ago

How come? https://github.com/lurk-lab/lurk-rs/pull/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.