Skip to content

Commit 31b4967

Browse files
feat: Loading setup for proving network (#100)
# What ❔ Proof compressor now provides convenient dyn trait setup interfaces, simple and sync, both for proving and generating keys and allows using in-memory cache for setup Potential weak async places causing sporadic errors are gone e.g. async init_context Improved performance. Before: 71s each proof; now: 71s first proof and 63s each following proof. <!-- What are the changes this PR brings about? --> <!-- Example: This PR adds a PR template to the repo. --> <!-- (For bigger PRs adding more context is appreciated) --> ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`.
1 parent 127798c commit 31b4967

File tree

16 files changed

+1244
-858
lines changed

16 files changed

+1244
-858
lines changed

crates/fflonk/src/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl<const N: usize> DeviceContext<N> {
156156

157157
pub fn init_from_preloaded_crs<A>(
158158
domain_size: usize,
159-
crs: Crs<CompactBn256, CrsForMonomialForm, A>,
159+
crs: &Crs<CompactBn256, CrsForMonomialForm, A>,
160160
) -> CudaResult<Self>
161161
where
162162
A: HostAllocator,
@@ -202,7 +202,7 @@ impl<const N: usize> DeviceContext<N> {
202202

203203
fn init_msm_on_static_memory<A>(
204204
domain_size: usize,
205-
crs: Option<Crs<CompactBn256, CrsForMonomialForm, A>>,
205+
crs: Option<&Crs<CompactBn256, CrsForMonomialForm, A>>,
206206
) -> CudaResult<()>
207207
where
208208
A: HostAllocator,
@@ -225,7 +225,7 @@ impl<const N: usize> DeviceContext<N> {
225225

226226
fn inner_init_msm<A>(
227227
domain_size: usize,
228-
crs: Option<Crs<CompactBn256, CrsForMonomialForm, A>>,
228+
crs: Option<&Crs<CompactBn256, CrsForMonomialForm, A>>,
229229
pool: Option<bc_mem_pool>,
230230
stream: Option<bc_stream>,
231231
) -> CudaResult<()>
@@ -241,7 +241,7 @@ impl<const N: usize> DeviceContext<N> {
241241
// multiple of the domain_size
242242
let crs = match crs {
243243
Some(preloaded_crs) => preloaded_crs,
244-
None => init_compact_crs::<A>(domain_size),
244+
None => &init_compact_crs::<A>(domain_size),
245245
};
246246
let num_bases = MAX_COMBINED_DEGREE_FACTOR * domain_size;
247247
assert!(crs.g1_bases.len() >= num_bases);

crates/proof-compression/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ serde_json = "1"
2121
bincode = "1.3"
2222
cfg-if = "1.0"
2323
byteorder = "1"
24+
anyhow = "1.0"
2425

2526
[features]
2627
default = ["gpu", "fflonk", "gpu-prover"]

0 commit comments

Comments
 (0)