-
Notifications
You must be signed in to change notification settings - Fork 377
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
[WIP] Integrate aggregation circuit #160
Conversation
5a373a7
to
fdf5832
Compare
ffi/src/prove.rs
Outdated
|
||
/// # Safety | ||
#[no_mangle] | ||
pub unsafe extern "C" fn add_agg_chunk_trace(trace_char: *const c_char) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not make a stateful API. You should just create a single API
fn create_agg_proof(chunk_trace: *const c_char) -> *const c_char;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. There is no this API for final FFI (have not finished updated FFI).
Will update as two FFI functions:
- one chunk-trace -> one two-layer-compression proof (as chunk-proof)
- Multiple two-layer-compression proofs -> one aggregation-proof (as batch-proof)
Is it right? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated (in-progress) functions gen_chunk_proof and gen_agg_proof in agg-funs/ffi-refactor
branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update FFI prove to gen_chunk_proof and gen_agg_proof in commit fc94edf.
ffi/src/prove.rs
Outdated
use std::cell::OnceCell; | ||
use types::eth::BlockTrace; | ||
|
||
static mut PROVER: OnceCell<zkevm::Prover> = OnceCell::new(); | ||
static mut CHUNK_PROVER: OnceCell<zkevm::Prover> = OnceCell::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static mut CHUNK_PROVER: OnceCell<zkevm::Prover> = OnceCell::new(); | |
static mut ZKEVM_PROVER: OnceCell<zkevm::Prover> = OnceCell::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, should we also need zkevm-prover (suppose to delete it when update)?
Since both two-layer-compression proof (inner-snark -> compression-wide -> compression-thin) and aggregation-proof are generated by aggregator-prover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or two-layer-compression proof
should be generated by zkevm-prover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to ZKEVM_PROVER in commit fc94edf.
ffi/src/prove.rs
Outdated
static mut PROVER: OnceCell<zkevm::Prover> = OnceCell::new(); | ||
static mut CHUNK_PROVER: OnceCell<zkevm::Prover> = OnceCell::new(); | ||
static mut AGG_PROVER: OnceCell<aggregator::Prover> = OnceCell::new(); | ||
static mut AGG_CHUNK_TRACES: OnceCell<Vec<Vec<BlockTrace>>> = OnceCell::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete it in commit fc94edf.
ffi/src/prove.rs
Outdated
@@ -1,27 +1,44 @@ | |||
use crate::utils::{c_char_to_str, c_char_to_vec, vec_to_c_char}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it's better to organize the files as zkevm.rs
and aggregator.rs
where each file contains both its prover and verifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-organize FFI to zkevm.rs
and aggregator.rs
in commit d23c3e7.
Awesome work! I want to test it, what is the minimum memory requirement? |
Sorry, this is WIP, tests cannot pass for now. |
@silathdiir Thanks for your response. I tested "test_agg_prove_verify" but it failed, I thought it was caused by low memory. Is it not finished yet? |
It is not finished. |
Summary
zkevm.rs
andaggregator.rs
for each prover and verifier.common
folder, and add zkevm-prover and aggregator-prover use this common-prover.MockProver
for all circuits.test_aggregation_circuit
zkevm-circuits#645.make test-agg-prove
will contain one real chunk and one "dummy chunk". Discuss with lispc for more details here.zkevm-circuits
branchintegrate-dynamic-proof-agg
(test aggregation) with develop after merging.halo2_proofs
branchfeat/disable_selector_compression
(fix vk deserialization) with develop after merging.TODO