plonkathon_728x364

I finally got a chance to try out the exercises from Plonkathon by 0xPARC, an educational implementation of PLONK. The exercises closely follow the paper, which is what makes them such a good resource for reinforcing one’s learning (or starting to learn) on PLONK.

I’ve made some notes in the relevant sections in the repo. Here are some notes I’ve taken.

Variables Structure & Examples

## Round 1
 
Program(["e public", "c <== a * b", "e <== c * d"], 8)
 
witness: {None: 0, 'a': 3, 'b': 4, 'c': 12, 'd': 5, 'e': 60}
 
self.group_order = 8
 
program.constraints = 3
program.wires(): [Wire(L='e', R=None, O=None),
                  Wire(L='a', R='b', O='c'),
                  Wire(L='c', R='d', O='e')]
 
A_values: [60, 3, 12]
B_values: [None, 4, 5]
C_values: [None, 12, 60]
 
self.pk.QL = [1, 0, 0, 0, 0, 0, 0, 0]
self.pk.QR = [0, 0, 0, 0, 0, 0, 0, 0]
self.pk.QM = [0, 21888242871839275222246405745257275088548364400416034343698204186575808495616, 21888242871839275222246405745257275088548364400416034343698204186575808495616, 0, 0, 0, 0, 0]
self.pk.QO = [0, 1, 1, 0, 0, 0, 0, 0]
self.PI = [21888242871839275222246405745257275088548364400416034343698204186575808495557, 0, 0, 0, 0, 0, 0, 0]
self.pk.QC = [0, 0, 0, 0, 0, 0, 0, 0]

Variables Mapping

Notations

: commitment to Group 1

PaperCodebaseIn Proof / Round OutputsFunctionAppearsDescription
group_orderPR1
program.constraintsPR1
list_aA_values + paddingPR1Scalar values of witness wire LEFT values
list_bB_values + paddingPR1Scalar values of witness wire RIGHT values
list_cC_values + paddingPR1Scalar values of witness wire OUTPUT values
self.APolynomial(list_a, Basis.LAGRANGE)PR1LEFT wire polynomials in Lagrange Basis
self.BPolynomial(list_b, Basis.LAGRANGE)PR1RIGHT wire polynomials in Lagrange Basis
self.CPolynomial(list_c, Basis.LAGRANGE)PR1OUTPUT wire polynomials in Lagrange Basis
a_1Ysetup.commit(self.A)PR1Commitment of
b_1Ysetup.commit(self.A)PR1Commitment of
c_1Ysetup.commit(self.A)PR1Commitment of
QMPR1, PR3multiplication selector polynomial
QLPR1, PR3left selector polynomial
QRPR1, PR3right selector polynomial
QOPR1, PR3output selector polynomial
QCPR1, PR3constants selector polynomial
S1PR1, PR31st permutation polynomial
S2PR1, PR32nd permutation polynomial
S3PR1, PR33rd permutation polynomial
z_1Ysetup.commit(self.Z)PR2Commitment of
self.ZPolynomial(Z_values, Basis.LAGRANGE)PR2Permutation Grand Product polynomial in Lagrange Basis
roots_of_unityScalar.roots_of_unity(group_order)PR2
2 * roots_of_unityPR2
3 * roots_of_unityPR2
roots_of_unity_by_4Scalar.roots_of_unity(4 * group_order)PR3
Xroots_of_unity_by_4_poly * self.fft_cofactorPR3
two_Xroots_of_unity_by_4_poly * self.fft_cofactor * 2PR3
three_Xroots_of_unity_by_4_poly * self.fft_cofactor * 3PR3
A_bigself.fft_expand(self.A)PR3A in coset extended Lagrange basis
B_bigself.fft_expand(self.B)PR3B in coset extended Lagrange basis
C_bigself.fft_expand(self.C)PR3C in coset extended Lagrange basis
PI_bigself.fft_expand(self.PI)PR3Public Inputs in coset extended Lagrange basis
QL_bigself.fft_expand(self.pk.QL)PR3Selector polynomials QL, QR, QM, QO, QC in coset extended Lagrange basis
Z_bigself.fft_expand(self.Z)PR3Permutation Grand Product polynomial in coset extended Lagrange basis
Z_shifted_bigZ_big.shift(4)PR3Shifted Permutation Grand Product polynomial in coset extended Lagrange basis
S1_bigself.fft_expand(self.pk.S1)PR31st permutation polynomial in coset extended Lagrange Basis
S2_bigself.fft_expand(self.pk.S2)PR32nd permutation polynomial in coset extended Lagrange Basis
S3_bigself.fft_expand(self.pk.S3)PR33rd permutation polynomial in coset extended Lagrange Basis
Z_HPolynomial(
[((self.fft_cofactor * x) ** group_order - 1)
for x in roots_of_unity_by_4],
Basis.LAGRANGE)
PR3 in evaluation form in coset extended Lagrange basis
L0Polynomial([1] + [0] * (group_order - 1), Basis.LAGRANGE)PR3Lagrange basis polynomial:
for
for any other
QUOT_big_coeffsself.expanded_evals_to_coeffs(QUOT_big)PR3
self.T1Polynomial(QUOT_big_coeffs.values[:group_order], Basis.MONOMIAL).fft()PR3 where: degree < n
self.T2Polynomial(QUOT_big_coeffs.values[group_order : 2 * group_order], Basis.MONOMIAL).fft()PR3 where: n degree < 2n
self.T3Polynomial(QUOT_big_coeffs.values[2 * group_order : 3 * group_order], Basis.MONOMIAL).fft()PR3 where: 2n degree < 3n
t_lo_1Ysetup.commit(self.T1)PR3Commitment of
t_mid_1Ysetup.commit(self.T2)PR3Commitment of
t_hi_1Ysetup.commit(self.T3)PR3Commitment of
a_evalYself.A.barycentric_eval(self.zeta)PR4A evaluated at
b_evalYself.B.barycentric_eval(self.zeta)PR4B evaluated at
c_evalYself.C.barycentric_eval(self.zeta)PR4C evaluated at
s1_evalYself.S1.barycentric_eval(self.zeta)PR4S1 evaluated at
s2_evalYself.S2.barycentric_eval(self.zeta)PR4S2 evaluated at
root_of_unityScalar.root_of_unity(self.group_order)PR41st root of unity
z_shifted_evalYself.Z.barycentric_eval(self.zeta * root_of_unity)PR4S2 evaluated at
Z_H_evalzeta ** group_order - 1PR5Zero polynomial evaluation at Zeta
L_1_evalZ_H_eval / (group_order * (zeta - 1))PR5Lagrange polynomial evaluation at Zeta
W_zPolynomial(W_z_coeffs[:group_order], Basis.MONOMIAL).fft()PR5
W_zwPolynomial(W_zw_coeffs[:group_order], Basis.MONOMIAL).fft()PR5Proof of
W_z_1Ysetup.commit(W_z)PR5Commitment of
W_zw_1Ysetup.commit(W_zw)PR5Commitment of