Skip to content

Commit

Permalink
feat!: fflonk (#38)
Browse files Browse the repository at this point in the history
This is a re-do of #28.

# What ❔

This PR implements all the functionality necessary to prove the fflonk
compression chain on a GPU, taking the scheduler proof as input and
producing a compression proof for the fflonk wrapper.
A new method for generating the `GpuSetup` and `VerificationKey`
structures using a GPU is also implemented.

The fflonk compression chain is made up of 5 circuit proofs, last proof
in the chain is the compression proof for the wrapper and uses poseidon
2 over BN254 scalar field for commitment.

Proving of the whole chain can be tested with the
`run_proof_compression_by_schedule` test.

Measurements of proving times on the L4 GPU:

compression circuit 1: 0.5 s
compression circuit 2: 2.2 s
compression circuit 3: 5.8 s
compression circuit 4: 22.7 s
compression for wrapper circuit: 192.1 s

End to end, including loading setup data from disk, producing witnesses
etc., the chain can be proven in ~230 seconds.
The highest GPU memory requirement is 14.2 GB.



**This PR changes shivini's proving API and the `GpuSetup` structure,
dependent code will need to be adjusted and serialized gpu setup files
will need to be recreated.
`GpuSetup::from_setup_and_hints` function was removed, the
`gpu_setup_and_vk_from_base_setup_vk_params_and_hints` function was
implemented as a replacement.**

## Why ❔

fflonk proofs are cheaper to verify on L1.

## Checklist

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `cargo fmt` and linted via `cargo
clippy`.
  • Loading branch information
robik75 authored Oct 31, 2024
1 parent aa58c7d commit 33ed62a
Show file tree
Hide file tree
Showing 96 changed files with 125,233 additions and 5,453 deletions.
12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ shivini = { version = "=0.151.1", path = "crates/shivini" }
wrapper-prover = { version = "=0.151.1", path = "crates/wrapper-prover", package = "zksync-wrapper-prover" }

# These dependencies should be shared by all the crates.
circuit_definitions = { version = "=0.150.7" }
zkevm_test_harness = { version = "=0.150.7" }
boojum = "=0.30.1"
franklin-crypto = "=0.30.1"
boojum = "=0.30.5"
circuit_definitions = "=0.150.10"
franklin-crypto = "=0.30.5"
snark_wrapper = "=0.30.5"
zkevm_test_harness = "=0.150.10"

[profile.release]
debug = "line-tables-only"
5 changes: 4 additions & 1 deletion crates/boojum-cuda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ description = "Boojum-CUDA is a library implementing GPU-accelerated cryptograph
[build-dependencies]
boojum.workspace = true
era_cudart_sys.workspace = true
snark_wrapper.workspace = true
cmake = "0.1"
itertools = "0.13"

[dependencies]
boojum.workspace = true
era_cudart.workspace = true
era_cudart_sys.workspace = true
snark_wrapper.workspace = true
itertools = "0.13"
lazy_static = "1.4"

Expand All @@ -31,6 +33,7 @@ criterion = "0.5"
criterion-macro = "0.4"
itertools = "0.13"
rand = "0.8"
rand_04 = { package = "rand", version = "0.4" }
rayon = "1.10"
serial_test = "3.1"

Expand All @@ -55,5 +58,5 @@ name = "ops_complex"
harness = false

[[bench]]
name = "poseidon"
name = "poseidon2"
harness = false
231 changes: 0 additions & 231 deletions crates/boojum-cuda/benches/poseidon.rs

This file was deleted.

Loading

0 comments on commit 33ed62a

Please sign in to comment.