Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PolynomialEvalV3

Git Source

Functions

newEvalDomain

Create a new Radix2EvalDomain with domainSize which should be power of 2.

Will revert if domainSize is not among {2^5, 2^16, 2^20}

The hardcoded values are generated by the rust script eval-domain.

function newEvalDomain(uint256 domainSize) internal pure returns (EvalDomain memory);

evaluateVanishingPoly

function evaluateVanishingPoly(EvalDomain memory domain, uint256 zeta)
    internal
    pure
    returns (uint256 res);

evaluateLagrangeOne

Evaluate the lagrange polynomial at point zeta given the vanishing polynomial evaluation vanish_eval.

function evaluateLagrangeOne(
    EvalDomain memory domain,
    BN254.ScalarField zeta,
    BN254.ScalarField vanishEval
) internal view returns (BN254.ScalarField res);

evaluatePiPoly

Evaluate public input polynomial at point zeta.

function evaluatePiPoly(
    EvalDomain memory domain,
    uint256[5] memory pi,
    uint256 zeta,
    uint256 vanishingPolyEval
) internal view returns (uint256 res);

evalDataGen

compute the EvalData for a given domain and a challenge zeta

function evalDataGen(EvalDomain memory domain, uint256 zeta, uint256[5] memory publicInput)
    internal
    view
    returns (EvalData memory evalData);

Errors

UnsupportedDegree

Unsupported polynomial degree, currently size must in 2^{14~17}.

error UnsupportedDegree();

Structs

EvalDomain

a Radix 2 Evaluation Domain

struct EvalDomain {
    uint256 logSize; // log_2(domain.size)
    uint256 sizeInv; // Inverse of the size in the field
    uint256[5] elements; // 1, g, g^2, g^3, g^4
}

EvalData

stores vanishing poly, lagrange at 1, and Public input poly

struct EvalData {
    BN254.ScalarField vanishEval;
    BN254.ScalarField lagrangeOne;
    BN254.ScalarField piEval;
}