Generating the final proof (decider), to be able to verify it in Ethereum's EVM:
#![allow(unused)]fnmain() {
typeDECIDER = Decider<
Projective,
Projective2,
CubicFCircuit<Fr>,
KZG<'static, Bn254>,
Pedersen<Projective2>,
Groth16<Bn254>, // here we define the Snark to use in the decider
NOVA, // here we define the FoldingScheme to use
>;
letmut rng = rand::rngs::OsRng;
// prepare the Decider prover & verifier params for the given nova_params and nova instance. This involves generating the Groth16 and KZG10 setuplet (decider_pp, decider_vp) = DECIDER::preprocess(&mut rng, &nova_params, nova.clone()).unwrap();
// decider proof generationlet proof = DECIDER::prove(rng, decider_pp, nova.clone()).unwrap();
}
As in the previous sections, you can find a full examples with all the code at sonobe/examples.
#![allow(unused)]fnmain() {
// this is the same that we defined for the provertypeDECIDER = Decider<
Projective,
Projective2,
CubicFCircuit<Fr>,
KZG<'static, Bn254>,
Pedersen<Projective2>,
Groth16<Bn254>,
NOVA,
>;
let verified = DECIDER::verify(
decider_vp, nova.i, nova.z_0, nova.z_i, &nova.U_i, &nova.u_i, proof,
)
.unwrap();
assert!(verified);
}
In the Ethereum Decider case, we can generate a Solidity smart contract that verifies the proofs onchain. More details in the next section.