privacy-scaling-explorations / sonobe

Experimental folding schemes library
https://privacy-scaling-explorations.github.io/sonobe-docs/
MIT License
204 stars 53 forks source link

Onchain decider circuit for Protogalaxy #145

Closed winderica closed 2 weeks ago

winderica commented 3 months ago

Following #157 and #162, this PR implements generic on-chain and off-chain decider circuits GenericOnchainDeciderCircuit and GenericOffchainDeciderCircuit{1, 2} that can handle all folding schemes (Nova, HyperNova, and Protogalaxy, hopefully even Mova and Ova in the future).

The abstraction in #157 and #162 provide a unified yet flexible usage of these objects, leading to highly reuseable decider circuits. As an example, we can take a look at the definition and internal logic of GenericOnchainDeciderCircuit below: https://github.com/privacy-scaling-explorations/sonobe/blob/7add907762707d91d5579da3ee93c98b9618a810/folding-schemes/src/folding/circuits/decider/on_chain.rs#L64-L110 https://github.com/privacy-scaling-explorations/sonobe/blob/7add907762707d91d5579da3ee93c98b9618a810/folding-schemes/src/folding/circuits/decider/on_chain.rs#L232-L321

With GenericOnchainDeciderCircuit, creating the on-chain decider circuit for Protogalaxy is as simple as giving a type alias and implementing the TryFrom trait: https://github.com/privacy-scaling-explorations/sonobe/blob/7add907762707d91d5579da3ee93c98b9618a810/folding-schemes/src/folding/protogalaxy/decider_eth_circuit.rs#L74-L150

Below I list several additional modifications made in this PR:


P.S. ~While this PR should already be ready for review, please focus on what you are working on now (such as #133). I don't want to bother the other contributors with merge conflicts due to this huge PR and am happy to rebase at my end after the pending PRs get merged :)~ Conflicts resolved :)