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

R1CS: Closure of challenge phase is Fn. #244

Closed
rubdos opened this issue Jan 17, 2019 · 6 comments
Closed

R1CS: Closure of challenge phase is Fn. #244

rubdos opened this issue Jan 17, 2019 · 6 comments
Labels
E-easy P-low T-api Change to the API T-r1cs Related to constraint system

Comments

@rubdos
Copy link
Contributor

rubdos commented Jan 17, 2019

Since #222, one writes the challenge phase using a closure. This closure gets stored in a Vec<Box<Fn(...)>>, and then gets called once at the start of the second phase.

Ideally, this closure should be FnOnce, such that it's able to consume some of its context (e.g. a set of variables could be consumed instead of borrowed).

Note that it is currently impossible to call a Box<FnOnce>, because it would call a method with unsized self. Cfr. rust-lang/rust#28796

Nightly does support FnBox(), which is a temporary workaround. The above issue is discussion deprecation of FnBox() in favour of the unsized_locals feature (which makes Box<FnOnce> callable).


Note that there does not seem to be a fix for stable Rust, but I thought this should be noted somewhere. I'm not sure whether you are in favour of keeping this issue open while waiting for unsized_locals stabilization.

@oleganza
Copy link
Collaborator

Thanks for opening this issue and explaining the context behind Box<Fn>. I think it makes total sense to keep it open until there is a fix for Box<FnOnce>.

@oleganza
Copy link
Collaborator

Since we have to use nightly for other reasons (non-lexical lifetimes in IPP nll), and that Box<FnOnce> is getting stabilized in Rust 1.35 (next release), we could probably change the API now and throw in a #![feature(unsized_locals)] until 1.35.

@cathieyun
Copy link
Member

That sounds good to me! As long as we remember to remove unsized_locals when 1.35 comes out so we have fewer nightly dependencies.

@hdevalence
Copy link
Contributor

+1 to all of the above. One thing we could do is to make the unsized_locals only enabled when the yoloproofs (which can be renamed to r1cs or something later if we decide it's not yolo), so that it's only pulled in for the r1cs code rather than for the rangeproof code. It might also be good to check on the NLL status.

@oleganza
Copy link
Collaborator

rubdos added a commit to rubdos/bulletproofs that referenced this issue May 28, 2019
It allows for the challenge phase to accept closures that take some more
context, e.g. moving non-Clone values in the challenge closure.

This works in stable since Rust 1.35; cfr.
rust-lang/rust#28796.

This closes issue dalek-cryptography#244.
rubdos added a commit to rubdos/bulletproofs that referenced this issue May 14, 2020
It allows for the challenge phase to accept closures that take some more
context, e.g. moving non-Clone values in the challenge closure.

This works in stable since Rust 1.35; cfr.
rust-lang/rust#28796.

This closes issue dalek-cryptography#244.
rubdos added a commit to rubdos/bulletproofs that referenced this issue May 20, 2020
It allows for the challenge phase to accept closures that take some more
context, e.g. moving non-Clone values in the challenge closure.

This works in stable since Rust 1.35; cfr.
rust-lang/rust#28796.

This closes issue dalek-cryptography#244.
rubdos added a commit to rubdos/bulletproofs that referenced this issue May 20, 2020
It allows for the challenge phase to accept closures that take some more
context, e.g. moving non-Clone values in the challenge closure.

This works in stable since Rust 1.35; cfr.
rust-lang/rust#28796.

This closes issue dalek-cryptography#244.
oleganza pushed a commit that referenced this issue May 26, 2020
It allows for the challenge phase to accept closures that take some more
context, e.g. moving non-Clone values in the challenge closure.

This works in stable since Rust 1.35; cfr.
rust-lang/rust#28796.

This closes issue #244.
@rubdos
Copy link
Contributor Author

rubdos commented May 28, 2020

Closed through #276

@rubdos rubdos closed this as completed May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy P-low T-api Change to the API T-r1cs Related to constraint system
Projects
None yet
Development

No branches or pull requests

4 participants