-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Currently, our QS impl accumulates all the triples from all vm
calls which leads to memory blowup.
E.g. proving 30KB of AES encrypted data requires ~12 mil triples or 12*48=~600MB of memory.
Additionally, the code initializes the memory often. The following hot path contributes to 0.8s of the runtime with 12 mil AND gates:
mpz/crates/zk-core/src/check.rs
Lines 41 to 46 in 16c2e7a
pub(crate) fn reserve(&mut self, n: usize) -> usize { | |
let idx = self.triples.len(); | |
self.triples.resize_with(idx + n, Default::default); | |
self.adjust.resize_with(idx + n, |_| Default::default()); | |
idx | |
} |
We can avoid the memory/compute overhead by treating each individual vm call as a separate circuit and using its adjust bits for its local transcript which gets hashed to derive chi
.
We would need to change the logic, so that upon executing the call, the prover/verifier immediately pre-compute the values for the consistency check and discard the triples.