diff --git a/constantine/commitments/kzg_polynomial_commitments.nim b/constantine/commitments/kzg_polynomial_commitments.nim index 378a820f..ba0d12da 100644 --- a/constantine/commitments/kzg_polynomial_commitments.nim +++ b/constantine/commitments/kzg_polynomial_commitments.nim @@ -188,7 +188,7 @@ func kzg_prove*[N: static int, C: static Curve]( proof: var ECP_ShortW_Aff[Fp[C], G1], eval_at_challenge: var Fr[C], poly: PolynomialEval[N, Fr[C]], - domain: PolyDomainEval[N, Fr[C]], + domain: PolyRootsDomainEval[N, Fr[C]], challenge: Fr[C], powers_of_tau: PolynomialEval[N, G1aff[C]], isBitReversedDomain: static bool) {.tags:[Alloca, HeapAlloc, Vartime].} = diff --git a/constantine/commitments/kzg_polynomial_commitments_parallel.nim b/constantine/commitments/kzg_polynomial_commitments_parallel.nim index 05729b02..6842d896 100644 --- a/constantine/commitments/kzg_polynomial_commitments_parallel.nim +++ b/constantine/commitments/kzg_polynomial_commitments_parallel.nim @@ -45,7 +45,7 @@ proc kzg_prove_parallel*[N: static int, C: static Curve]( proof: var ECP_ShortW_Aff[Fp[C], G1], eval_at_challenge: var Fr[C], poly: ptr PolynomialEval[N, Fr[C]], - domain: ptr PolyDomainEval[N, Fr[C]], + domain: ptr PolyRootsDomainEval[N, Fr[C]], challenge: ptr Fr[C], powers_of_tau: PolynomialEval[N, G1aff[C]], isBitReversedDomain: static bool) = @@ -265,4 +265,4 @@ proc kzg_verify_batch_parallel*[bits: static int, F2; C: static Curve]( var gt {.noInit.}: C.getGT() gt.pairing(sums, [tauG2, negG2]) - return gt.isOne().bool() \ No newline at end of file + return gt.isOne().bool() diff --git a/constantine/math/polynomials/polynomials.nim b/constantine/math/polynomials/polynomials.nim index faab168b..235eed2d 100644 --- a/constantine/math/polynomials/polynomials.nim +++ b/constantine/math/polynomials/polynomials.nim @@ -38,8 +38,9 @@ type ## https://en.wikipedia.org/wiki/Lagrange_polynomial#Barycentric_form evals*{.align: 64.}: array[N, Group] - PolyDomainEval*[N: static int, Field] = object + PolyRootsDomainEval*[N: static int, Field] = object ## Metadata for polynomial in Lagrange basis (evaluation form) + ## with evaluation points at roots of unity. ## ## Note on inverses ## 1/ωⁱ (mod N) = ωⁿ⁻ⁱ (mod N) @@ -50,7 +51,7 @@ type func inverseRootsMinusZ_vartime*[N: static int, Field]( invRootsMinusZ: var array[N, Field], - domain: PolyDomainEval[N, Field], + domain: PolyRootsDomainEval[N, Field], z: Field, earlyReturnOnZero: static bool): int = ## Compute 1/(ωⁱ-z) for i in [0, N) @@ -111,7 +112,7 @@ func evalPolyAt*[N: static int, Field]( poly: PolynomialEval[N, Field], z: Field, invRootsMinusZ: array[N, Field], - domain: PolyDomainEval[N, Field]) = + domain: PolyRootsDomainEval[N, Field]) = ## Evaluate a polynomial in evaluation form ## at the point z ## z MUST NOT be one of the roots of unity @@ -159,7 +160,7 @@ func differenceQuotientEvalInDomain*[N: static int, Field]( poly: PolynomialEval[N, Field], zIndex: uint32, invRootsMinusZ: array[N, Field], - domain: PolyDomainEval[N, Field], + domain: PolyRootsDomainEval[N, Field], isBitReversedDomain: static bool) = ## Compute r(x) = (p(x) - p(z)) / (x - z) ## diff --git a/constantine/math/polynomials/polynomials_parallel.nim b/constantine/math/polynomials/polynomials_parallel.nim index 660f70d5..78e29785 100644 --- a/constantine/math/polynomials/polynomials_parallel.nim +++ b/constantine/math/polynomials/polynomials_parallel.nim @@ -28,7 +28,7 @@ proc evalPolyAt_parallel*[N: static int, Field]( poly: ptr PolynomialEval[N, Field], z: ptr Field, invRootsMinusZ: ptr array[N, Field], - domain: ptr PolyDomainEval[N, Field]) = + domain: ptr PolyRootsDomainEval[N, Field]) = ## Evaluate a polynomial in evaluation form ## at the point z ## z MUST NOT be one of the roots of unity @@ -100,7 +100,7 @@ proc differenceQuotientEvalInDomain_parallel*[N: static int, Field]( poly: ptr PolynomialEval[N, Field], zIndex: uint32, invRootsMinusZ: ptr array[N, Field], - domain: ptr PolyDomainEval[N, Field], + domain: ptr PolyRootsDomainEval[N, Field], isBitReversedDomain: static bool) = ## Compute r(x) = (p(x) - p(z)) / (x - z) ## @@ -153,4 +153,4 @@ proc differenceQuotientEvalInDomain_parallel*[N: static int, Field]( epilogue: return worker_ri - r.evals[zIndex] = sync(evalsZindex) \ No newline at end of file + r.evals[zIndex] = sync(evalsZindex) diff --git a/constantine/trusted_setups/ethereum_kzg_srs.nim b/constantine/trusted_setups/ethereum_kzg_srs.nim index dc8dcd94..6b0ff413 100644 --- a/constantine/trusted_setups/ethereum_kzg_srs.nim +++ b/constantine/trusted_setups/ethereum_kzg_srs.nim @@ -150,7 +150,7 @@ type # For most schemes (Marlin, Plonk, Sonic, Ethereum's Deneb), only [τ]H is needed # but Ethereum's sharding will need 64 (65 with the generator H) - domain*{.align: 64.}: PolyDomainEval[FIELD_ELEMENTS_PER_BLOB, Fr[BLS12_381]] + domain*{.align: 64.}: PolyRootsDomainEval[FIELD_ELEMENTS_PER_BLOB, Fr[BLS12_381]] TrustedSetupStatus* = enum tsSuccess