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

feat: prove through a Multiframe trait #709

Merged
merged 4 commits into from
Sep 28, 2023

Conversation

huitseeker
Copy link
Contributor

@huitseeker huitseeker commented Sep 27, 2023

  • introduces a Multiframe trait generalizing over the circuit machinery produced by LEM & Lurk,
  • implements it for the Lurk Circuit,
  • converts the nova proof file to work with this MultiFrame trait, making proving generic.

Nest steps :

@huitseeker huitseeker requested review from porcuquine and a team as code owners September 27, 2023 21:11
Mutability leftovers (see lurk-lab#680)

- Updated benchmarking scripts to no longer mutate the `store` variable during evaluation frames retrieval.
- Reformed `get_evaluation_frames` method across several files to use immutable references to `store` instead of mutable references.

Multiframe definition

- Introduced several new traits - `CEKState`, `FrameLike`, `EvaluationStore` and `MultiFrameTrait` to manage complex evaluation and circuit proof operations in the `proof/mod.rs` file.
- Detailed implementations of the above traits introduced in `circuit/circuit_frame.rs`, providing methods for handling evaluation frames, synthesizing data from multiple frames and more.
@huitseeker huitseeker requested a review from a team as a code owner September 27, 2023 21:12
@huitseeker huitseeker force-pushed the multiframe_trait branch 5 times, most recently from 223a363 to 90e1dfd Compare September 27, 2023 21:36
- uses the generic MultiFrame trait introduced in the prior commit to generically prove using nova,
- For references on the latest work defining this trait, see lurk-lab#629 (and its history, incl. lurk-lab#642, lurk-lab#707) and lurk-lab#677.

- make the benches use the generic trait, so LEM can bench similarly,
- make the examples use the generic trait, so LEM can example similarly,
- make Supernova use the generic trait, so LEM can NIVC similarly,
@arthurpaulino
Copy link
Contributor

!benchmark

arthurpaulino
arthurpaulino previously approved these changes Sep 27, 2023
Copy link
Contributor

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

✨ 🎉
Let's just see the benchmarks to make sure that nothing weird happened.

@@ -866,7 +928,7 @@ pub mod tests {
let s = &mut Store::<Fr>::default();
let expected = s.num(3);
let terminal = s.get_cont_terminal();
test_aux::<Coproc<Fr>>(
test_aux::<_, _, C1<'_, _, Coproc<_>>>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we abbreviate this type with a local type definition? It will probably avoid a bunch of line additions.

It would also setup an organized pattern for when we introduce the LEM tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not quite sure what local type definition you have in mind, but I'm of course in favor of the PR re-organizing the proof tests to put LEM & Lurk side-by-side doing some heavy refactoring to do so.

The line changes made here are such that those generic methods that need annotation now bear the exact same annotation on each line, syntactically - this makes them ripe for mechanized refactoring. So I'm not too worried about that.

Copy link
Contributor

Choose a reason for hiding this comment

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

huitseeker#8 for a -800 lines diff

@arthurpaulino
Copy link
Contributor

I ran the benchmarks locally and everything is okay

end2end_benchmark/end2end_go_base_nova/_10_0                                                                          
                        time:   [1.3718 s 1.3738 s 1.3756 s]
                        change: [-0.1598% +0.1216% +0.4690%] (p = 0.54 > 0.05)
                        No change in performance detected.

store_benchmark/store_go_base_bls12/_10_16                                                                           
                        time:   [152.84 µs 152.90 µs 152.96 µs]
                        change: [+2.0234% +2.1403% +2.2462%] (p = 0.00 < 0.05)
                        Performance has regressed.
store_benchmark/store_go_base_pallas/_10_16                                                                           
                        time:   [149.14 µs 149.20 µs 149.25 µs]
                        change: [+0.6970% +0.9125% +1.0992%] (p = 0.00 < 0.05)
                        Change within noise threshold.
store_benchmark/store_go_base_bls12/_10_160                                                                           
                        time:   [150.55 µs 150.58 µs 150.62 µs]
                        change: [+0.9360% +1.0404% +1.1608%] (p = 0.00 < 0.05)
                        Change within noise threshold.
store_benchmark/store_go_base_pallas/_10_160                                                                           
                        time:   [150.52 µs 150.58 µs 150.64 µs]
                        change: [+1.5555% +1.6116% +1.6773%] (p = 0.00 < 0.05)
                        Performance has regressed.

hydration_benchmark/hydration_go_base_bls12/_10_16                                                                           
                        time:   [226.64 ns 226.67 ns 226.72 ns]
                        change: [+0.1890% +0.2361% +0.2820%] (p = 0.00 < 0.05)
                        Change within noise threshold.
hydration_benchmark/hydration_go_base_pallas/_10_16                                                                           
                        time:   [227.11 ns 227.14 ns 227.17 ns]
                        change: [+0.4104% +0.4546% +0.4982%] (p = 0.00 < 0.05)
                        Change within noise threshold.
hydration_benchmark/hydration_go_base_bls12/_10_160                                                                           
                        time:   [227.14 ns 227.19 ns 227.24 ns]
                        change: [+0.4554% +0.4891% +0.5220%] (p = 0.00 < 0.05)
                        Change within noise threshold.
hydration_benchmark/hydration_go_base_pallas/_10_160                                                                           
                        time:   [226.43 ns 226.63 ns 226.99 ns]
                        change: [+0.1814% +0.2476% +0.3242%] (p = 0.00 < 0.05)
                        Change within noise threshold.

eval_benchmark/eval_go_base_bls12/_10_16                                                                           
                        time:   [474.64 µs 474.77 µs 474.90 µs]
                        change: [+0.5484% +0.6288% +0.7118%] (p = 0.00 < 0.05)
                        Change within noise threshold.
eval_benchmark/eval_go_base_pallas/_10_16                                                                           
                        time:   [475.62 µs 475.78 µs 475.97 µs]
                        change: [+0.8392% +0.9057% +0.9782%] (p = 0.00 < 0.05)
                        Change within noise threshold.

eval_benchmark/eval_go_base_bls12/_10_160                                                                            
                        time:   [4.5522 ms 4.5547 ms 4.5575 ms]
                        change: [+0.1824% +0.8828% +2.0558%] (p = 0.08 > 0.05)
                        No change in performance detected.

eval_benchmark/eval_go_base_pallas/_10_160                                                                            
                        time:   [4.5658 ms 4.5680 ms 4.5703 ms]
                        change: [+0.8843% +0.9426% +0.9984%] (p = 0.00 < 0.05)
                        Change within noise threshold.

prove_benchmark/prove_go_base_nova/_10_0                                                                           
                        time:   [1.3575 s 1.3643 s 1.3683 s]
                        change: [-0.8152% -0.0892% +0.7712%] (p = 0.85 > 0.05)
                        No change in performance detected.

prove_compressed_benchmark/prove_compressed_go_base_nova/_10_0                                                                          
                        time:   [5.3678 s 5.3903 s 5.4138 s]
                        change: [-0.2555% +0.1745% +0.6378%] (p = 0.48 > 0.05)
                        No change in performance detected.

verify_benchmark/verify_go_base_nova/_10_0                                                                          
                        time:   [184.19 ms 185.63 ms 187.87 ms]
                        change: [+1.3051% +2.5493% +4.2089%] (p = 0.00 < 0.05)
                        Performance has regressed.

verify_compressed_benchmark/verify_compressed_go_base_nova/_10_0                                                                          
                        time:   [186.25 ms 187.16 ms 188.40 ms]
                        change: [-0.4886% +0.2702% +0.9845%] (p = 0.50 > 0.05)
                        No change in performance detected.

@huitseeker
Copy link
Contributor Author

This will be blocked on @porcuquine 's review because of the removal of the &mut modifier on generate_frames (which was actually permitted since #680 => bypassing to unblock.

@huitseeker huitseeker merged commit aa27d0f into lurk-lab:master Sep 28, 2023
6 checks passed
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