arnaucube
arnaucube/sonobePublic Self-hosted repository
sonobe/folding-schemes-solidity/templates/kzg10_groth16_decider_verifier.askama.sol
folding-schemes-solidity/templates/kzg10_groth16_decider_verifier.askama.solRaw
 1pragma solidity ^0.8.4;
 2
 3{{ groth16_verifier }}
 4
 5{{ kzg10_verifier }}
 6
 7/**
 8 * @author  PSE & 0xPARC
 9 * @title   NovaDecider contract, for verifying zk-snarks Nova IVC proofs.
10 * @dev     This is an askama template. It will feature a snarkjs groth16 and a kzg10 verifier, from which this contract inherits.
11 */
12contract NovaDecider is Groth16Verifier, KZG10Verifier {
13    function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[{{ gamma_abc_len - 1 }}] calldata _pubSignals, uint256[2] calldata c, uint256[2] calldata pi, uint256 x, uint256 y) public view returns (bool) {
14        require(super.verifyProof(_pA, _pB, _pC, _pubSignals) == true, "Groth16 verification failed");
15        // for now, we do not relate the Groth16 and KZG10 proofs
16        // this will done in the future, by computing challenge points from the groth16 proof's data
17        require(super.check(c, pi, x, y) == true, "KZG10 verification failed");
18        return true;
19    }   
20}