Functions

batchVerify

  function batchVerify(
    struct IPlonkVerifier.VerifyingKey[] verifyingKeys,
    uint256[][] publicInputs,
    struct IPlonkVerifier.PlonkProof[] proofs,
    bytes[] extraTranscriptInitMsgs
  ) external returns (bool)

Batch verify multiple TurboPlonk proofs.

Parameters

NameTypeDescription
verifyingKeysstruct IPlonkVerifier.VerifyingKey[]An array of verifier keys
publicInputsuint256[][]A two-dimensional array of public inputs.
proofsstruct IPlonkVerifier.PlonkProof[]An array of Plonk proofs
extraTranscriptInitMsgsbytes[]An array of bytes from
transcript initialization messages

_validateProof

  function _validateProof(
    struct IPlonkVerifier.PlonkProof proof
  ) internal

Validate all group points and scalar fields. Revert if any are invalid.

Parameters

NameTypeDescription
proofstruct IPlonkVerifier.PlonkProofA Plonk proof

_preparePcsInfo

  function _preparePcsInfo(
  ) internal returns (struct PlonkVerifier.PcsInfo res)

_computeChallenges

  function _computeChallenges(
  ) internal returns (struct PlonkVerifier.Challenges res)

_computeLinPolyConstantTerm

  function _computeLinPolyConstantTerm(
  ) internal returns (uint256 res)

Compute the constant term of the linearization polynomial.

r_plonk = PI - L1(x) * alpha^2 - alpha * \prod_i=1..m-1 (w_i + beta * sigma_i + gamma) * (w_m + gamma) * z(xw)

where m is the number of wire types.


_prepareOpeningProof

  function _prepareOpeningProof(
    struct IPlonkVerifier.VerifyingKey verifyingKey,
    struct PolynomialEval.EvalData evalData,
    struct IPlonkVerifier.PlonkProof proof,
    struct PlonkVerifier.Challenges chal,
    uint256[] commScalars,
    struct BN254.G1Point[] commBases
  ) internal returns (uint256 eval)

Compute components in [E]1 and [F]1 used for PolyComm opening verification equivalent of JF's https://github.com/EspressoSystems/jellyfish/blob/main/plonk/src/proof_system/verifier.rs#L154-L170 caller allocates the memory fr commScalars and commBases requires Arrays of size 30.

Parameters

NameTypeDescription
verifyingKeystruct IPlonkVerifier.VerifyingKeyA verifier key
evalDatastruct PolynomialEval.EvalDataA polynomial evaluation
proofstruct IPlonkVerifier.PlonkProofA Plonk proof
chalstruct PlonkVerifier.ChallengesA set of challenges
commScalarsuint256[]Common scalars
commBasesstruct BN254.G1Point[]Common bases

_preparePolyCommitments

  function _preparePolyCommitments(
  ) internal

Similar to aggregate_poly_commitments() in Jellyfish, but we are not aggregating multiple, but rather preparing for [F]1 from a single proof. The caller allocates the memory fr commScalars and commBases. Requires Arrays of size 30.


_prepareEvaluations

  function _prepareEvaluations(
    uint256 linPolyConstant,
    struct IPlonkVerifier.PlonkProof proof,
    uint256[] commScalars
  ) internal returns (uint256 eval)

aggregate_evaluations() in Jellyfish, but since we are not aggregating multiple, but rather preparing [E]1 from a single proof. caller allocates the memory fr commScalars requires Arrays of size 30.

Parameters

NameTypeDescription
linPolyConstantuint256A linear polynomial constant
proofstruct IPlonkVerifier.PlonkProofA Plonk proof
commScalarsuint256[]An array of common scalars
The returned value is the scalar in [E]1 described in Sec 8.4, step 11 of https://eprint.iacr.org/2019/953.pdf

_batchVerifyOpeningProofs

  function _batchVerifyOpeningProofs(
    struct PlonkVerifier.PcsInfo[] pcsInfos
  ) internal returns (bool)

Batchly verify multiple PCS opening proofs. open_key has been assembled from BN254.P1(), BN254.P2() and contract variable _betaH Returns true if the entire batch verifiies and false otherwise.

Parameters

NameTypeDescription
pcsInfosstruct PlonkVerifier.PcsInfo[]An array of PcsInfo

_linearizationScalarsAndBases

  function _linearizationScalarsAndBases(
    struct IPlonkVerifier.VerifyingKey verifyingKey,
    struct PlonkVerifier.Challenges challenge,
    struct PolynomialEval.EvalData evalData,
    struct IPlonkVerifier.PlonkProof proof,
    struct BN254.G1Point[] bases,
    uint256[] scalars
  ) internal

Compute the linearization of the scalars and bases. The caller allocates the memory from commScalars and commBases. Requires arrays of size 30.

Parameters

NameTypeDescription
verifyingKeystruct IPlonkVerifier.VerifyingKeyThe verifying key
challengestruct PlonkVerifier.ChallengesA set of challenges
evalDatastruct PolynomialEval.EvalDataPolynomial evaluation data
proofstruct IPlonkVerifier.PlonkProofA Plonk proof
basesstruct BN254.G1Point[]An array of BN254 G1 points
scalarsuint256[]An array of scalars