Proof aggregation#58
Conversation
52d5ea3 to
50ba31a
Compare
|
@XuyangSong @vveiln the PR is now ready for review. |
XuyangSong
left a comment
There was a problem hiding this comment.
It looks good overall. I've left some feedback.
Could you rebase onto the develop branch and resolve the conflicts? We updated some basic structs.
I've reviewed the circuit implementation—it looks nice. I'll run the tests and benchmarks after the rebase.
129aba1 to
d0949e2
Compare
a9ef646 to
0db91a0
Compare
There was a problem hiding this comment.
Thank you for the work. Left a few comments.
Could you fix cargo clippy --workspace --all-targets -- -D warnings warnings, as the current CI does not automatically cover the aggregation feature.
In most cases, using Result instead of Option is better for proper error handling. I'm also handling errors in arm concurrently. Maybe you can wait until the error handling in arm is done.
Do you have a comparison of the two strategies? When should we use batch versus sequential?
Could you add a brief description in the README about proof types, including inner and aggregated proof types, and how to specify them?
| #[cfg(feature = "fast_aggregation")] | ||
| let prover_opts = ProverOpts::fast(); | ||
|
|
||
| #[cfg(all(not(feature = "fast_aggregation"), feature = "groth16_aggregation"))] |
There was a problem hiding this comment.
Does the inner proof type affect the aggregation proof type?
Default succinct proofs are used in tests. Can other proof types be aggregated?
There was a problem hiding this comment.
By inner proof type do you mean the InnerReceipt of the compliance/logic proofs? If so, I would say it does not affect it. RISC0 allows to add a Receipt as an assumption without differentiation.
Aggregation should be agnostic to what is aggregating. This can be empirically confirmed when running benches. (I can't from my machine.)
There was a problem hiding this comment.
What inner proof types should we use in practice, and what are the differences between them? Do they vary in performance? I don't fully understand the agnosticism of the inner types—does it mean the outer (aggregation) circuit can verify different inner proof types dynamically?
There was a problem hiding this comment.
does it mean the outer (aggregation) circuit can verify different inner proof types dynamically
That's my understanding, yes. Boils down to proving a computational trace for a stark/groth16 verifier(s). Aggregating succinct proofs (single stark) should yield the fastest aggregation.
There was a problem hiding this comment.
Added note in the README about this
| if agg_proof.is_some() { | ||
| self.aggregation_proof = bincode::serialize(&agg_proof.unwrap()).ok(); | ||
| } | ||
|
|
||
| if self.aggregation_proof.is_some() { | ||
| self.erase_base_proofs(); | ||
| Some(()) | ||
| } else { | ||
| // Do nothing. | ||
| None | ||
| } |
There was a problem hiding this comment.
| if agg_proof.is_some() { | |
| self.aggregation_proof = bincode::serialize(&agg_proof.unwrap()).ok(); | |
| } | |
| if self.aggregation_proof.is_some() { | |
| self.erase_base_proofs(); | |
| Some(()) | |
| } else { | |
| // Do nothing. | |
| None | |
| } | |
| if agg_proof.is_some() { | |
| self.aggregation_proof = bincode::serialize(&agg_proof.unwrap()).ok(); | |
| self.erase_base_proofs(); | |
| Some(()) | |
| } else { | |
| None | |
| } |
There was a problem hiding this comment.
I only want to remove the base proofs if the serialized aggregation actually contains some bytes after L133. (There maybe simpler ways of checking self.aggregation_proof is Some after line 133, but I chose clarity)
This PR was created before error handling exist in the library. The use of |
The README explains how to specify the different aggregation proof types in the Features table. Is that what you mean? Re inner proof types, not sure what you mean, but this comment might be relevant. |
In the README (proof aggregation section) the difference between batch and sequential is mentioned. When to use each, I guess aggregation (proving) performance is the most relevant metric -- we should wait for benches i guess... :_) Let me know otherwise. |
59749af to
3fb5b15
Compare
|
This PR also closes #116 (error handling for proof aggregation) |
b418214 to
1379cba
Compare
XuyangSong
left a comment
There was a problem hiding this comment.
lgtm
We can merge after PA testing.
| )) | ||
| .map_err(|_| ArmError::InstanceSerializationFailed)?; | ||
|
|
||
| println!("[DEBUG:] batch instance: {:?}", batch_instance); |
There was a problem hiding this comment.
Do we need the print here? We can consider adding it to the log in the future.
There was a problem hiding this comment.
my bad! thanks for catching it
|
Works as checked in anoma/pa-evm#336 Feel free to merge |
| # If you want to try (experimental) std support, add `features = [ "std" ]` to risc0-zkvm | ||
| risc0-zkvm = { version = "3.0.3", features = ["std", "unstable"], default-features = false } | ||
| serde = { version = "1.0.197", default-features = false } | ||
| serde_with = "3.14.1" |
There was a problem hiding this comment.
Is it necessary to introduce this as a dependency if it is only used once? We should minimize dependencies and be wary of supply chain attacks.
There was a problem hiding this comment.
Compliance instances are too large to be serialized with serde. What do you suggest instead?
b4810fa to
e58093c
Compare
1d0eaf2 to
cbe9b7a
Compare
Not in this PR - to be done: