dusk-network / plonk

Pure Rust implementation of the PLONK ZKProof System done by the Dusk team
https://dusk-network.github.io/plonk
Mozilla Public License 2.0
535 stars 148 forks source link

Improve API for circuit (de-)compression #804

Closed moCello closed 8 months ago

moCello commented 8 months ago

Summary

When decompressing a circuit, we immediately compile the circuit and return the prover and verifier, and because of this we require the label and publicparameter at decompression time which is counter intuitive. At the same time we compress the circuit as part of the compile module which is also counter intuitive. We can improve the API as follows: Current API:

let compressed = Compiler::compress::<DummyCircuit>().unwrap();

let (decompressed_prover, decompressed_verifier) =
    Compiler::decompress(&pp, label, &compressed).unwrap();

Proposed new API:

let compressed = DummyCircuit::compress().unwrap();

let (decompressed_prover, decompressed_verifier) =
    Compiler::compile_with_compressed(&pp, label, &compressed).unwrap();