nil Foundation的Placeholder证明系统(1)

1. 引言

=nil; Foundation团队2022年11月论文《Placeholder证明系统》。[2022年11月29日版本]

ZKP证明系统的发展为简短描述 所执行计算 提供了各种方法,这些方法在证明时间、证明大小、验证复杂性、是否存在零知识属性、递归友好性之间进行了不同的权衡,以不同的方式将所有相同的组件组合在一起。

nil Foundation的Placeholder证明系统,通过:

  • 1)对arithmetization方法进行调整
  • 2)对承诺方案方案进行调整
  • 3)对承诺处理的验证流程进行调整
  • 4)递归层证明子系统组件本身的切换

实现了:

  • 1)最紧凑的电路表示
  • 2)在不同环境下(基于寄存器的执行器、特定的基于栈的执行器),具有最便宜的验证开销。

本文要点:


在这里插入图片描述

Placeholder是对RedShift的改进:

  • 1)将RedShift中的第4、5、6、8步抽象为Permutation Argument(见本文Algorithm 1),同时,将RedShift的Permutation Argument中的 P , Q P,Q P,Q两个多项式,优化为,仅需要一个多项式 V P V_P VP,在插值点,二者关系为: V P = P / Q V_P=P/Q VP=P/Q。【实际就是采用的ZCash Halo2 Permutation argument算法。】
  • 2)引入了lookup argument。【实际就是采用的ZCash Halo2 Lookup argument算法。】
  • 3)以selector为粒度,分类Gate,将所有 gate i ( X ) \text{gate}_i(X) gatei(X)合并为一个多项式 F 8 ( X ) F_8(X) F8(X)
  • 4)为实现zero-knowledge属性,借鉴了Mina和Halo中的方法,在PLONK-trace table的最后 t t t行,引入了随机值。同时额外引入了2个selector:【 N u s a b l e = N r o w s − t − 1 N_{usable}=N_{rows}-t-1 Nusable=Nrowst1 0 ∼ N u s a b l e − 1 0\sim N_{usable}-1 0Nusable1为实际计算数据,第 N u s a b l e N_{usable} Nusable行对应为分隔行(以 q l a s t = 1 q_{last}=1 qlast=1来表示), N u s a b l e + 1 ∼ N r o w s N_{usable}+1\sim N_{rows} Nusable+1Nrows为随机值。】
    • q b l i n d q_{blind} qblind:若 N u s a b l e < i ≤ N r o w s N_{usable}<i\leq N_{rows} Nusable<iNrows,有 q b l i n d ( w i ) = 1 q_{blind}(w^i)=1 qblind(wi)=1;否则, q b l i n d ( w i ) = 0 q_{blind}(w^i)=0 qblind(wi)=0
    • q l a s t q_{last} qlast:表示分隔行(区分实际计算数据 与 随机值),有 q l a s t ( w N u s a b l e ) = 1 q_{last}(w^{N_{usable}})=1 qlast(wNusable)=1,其它行 q l a s t q_{last} qlast值均为0,

Placeholder证明系统为:

  • PLONK Arithmetization + Custom Gates

待证明的computation sequence(计算序列)称为Circuit。
Circuit由:

  • 1)Table
  • 2)Basic Constraints
  • 3)Copy Constraints
  • 4)Lookup Constraints

定义。
注意:Circuit中并不包含witnesses、public input、以及intermediate values。

1.1 Table

Table为矩阵,代表了a structure of the computations。Table中的Rows、Columns、Cells与矩阵中的传统定义一致。
Table中有4种类型的Columns:

  • 1)Witness Columns:包含了witness input和intermediate calculations。Witness Columns对Verifier是未知的。
    不同的proof instances,Witness Columns会不相同(因其取决于input)。
  • 2)Public Columns:包含了public input。Public Columns对Verifier是已知的。
    不同的proof instances,Public Columns会不相同(因其取决于input)。
  • 3)Fixed Columns:包含了circuit-depended data。Fixed Columns对Verifier是已知的。
    不同的proof instances,Fixed Columns是相同的。
  • 4)Selectors:为特殊的Fixed Columns。Selectors定义了在Table中的哪些行使用Basic Constraints。Selectors对Verifier是已知的。
    Selectors中的value仅能为0或1。

在这里插入图片描述

1.2 Table values约束

在computation过程中,Table会依次存储values。Constraints定义了这些values之间的关系。
Table中的value有以下3种约束:

  • 1)Basic Constraints:约束Table中各value之间的关系。Basic Constraints为基于Cells的(多变量多项式)表达。
  • 2)Copy Constraints:表示Cells之间的equality约束。
  • 3)Lookup Constraints:表示所选中的Cells tuples 等于 Lookup Table中的某(些)行。
    注意,Lookup Constraints并不会定义tuple在Lookup Table中的准确位置,这是Lookup Constraints与Copy Constraints的主要区别。

在这里插入图片描述

  • Basic Constraints和Lookup Constraints可包含不同Rows的Cells。若Constraint references的values源自相邻的Rows,则称该reference为Offset Reference,Constraint Row与referenced Row之间的差值称为Offset。
  • 在Copy Constraints中还可使用Absolute References。Absolute References指向具体的Row number,而不是Row之间的差值。
  • Selectors可用于指定是否向特定Row应用某Basic Constraint check(设置相应Selector Column的特定Row为1表示“是”,为0表示“否”)。使用相同Selector的Basic Constraints set称为Gate。
    一个Gate中可包含一个或多个Constraints。
  • Each Row需satisfy Circuit中的所有Gates。

1.3 Public Input

注意:Circuit中并不包含witnesses、public input、以及intermediate values。
Public Input会占用Table中额外的一列或多列(比较罕见)。Public Input可通过Copy Constraints enforced到 Witness Columns中。

2. Placeholder协议

Placeholder协议中各标识基本含义为:

标识含义
N r o w s N_{rows} NrowsRows的数量
N w i t n e s s N_{witness} NwitnessWitness Columns的数量
N p e r m N_{perm} Nperm包含在Permutation Argument中的Witness Columns数量
N s e l N_{sel} NselCircuit中所使用的Selectors数量
N l o o k u p N_{lookup} NlookupLookup Constraints数量
N c N_c NcConstraints Polynomials数量【根据RedShift论文,Constraint Polynomials:由Selector Polynomials q L , q R , q O , q M , q C \mathbf{q_L},\mathbf{q_R},\mathbf{q_O},\mathbf{q_M},\mathbf{q_C} qL,qR,qO,qM,qC 和 Permutation Polynomials { S i d i ( X ) } i = 1 3 , { S σ j ( X ) } j = 1 3 \{S_{id_i}(X)\}_{i=1}^3, \{S_{\sigma_j}(X)\}_{j=1}^3 {Sidi(X)}i=13,{Sσj(X)}j=13组成】
N P I N_{PI} NPIPublic input Columns数量
w i w_i wiWitness Polynomials,其中 0 ≤ i < N w i t n e s s 0\leq i < N_{witness} 0i<Nwitness
c j ( i ) c_j^{(i)} cj(i)Constraints Polynomials,其中 0 ≤ i < N s e l 0\leq i < N_{sel} 0i<Nsel
g a t e i gate_i gateiGate Polynomials for Selector q i ( X ) q_i(X) qi(X) and Constraints { c j ( i ) } j = 0 n i ′ − 1 \{c_j^{(i)}\}_{j=0}^{n_i'-1} {cj(i)}j=0ni1
P I i PI_i PIiPublic input Polynomials,其中 0 ≤ i < N P I 0\leq i < N_{PI} 0i<NPI
σ ( c o l :   i , r o w :   j ) = ( c o l :   i ′ , r o w :   j ′ ) \sigma(col:\ i, row:\ j)=(col:\ i', row:\ j') σ(col: i,row: j)=(col: i,row: j)Permutation over the Table
o \mathbf{o} oSet of all Offsets。

2.1 多项式承诺和多项式evluation方案

Placeholder中采用了RedShift论文多项式承诺(PCS)和多项式evaluation方案(PES),详情参看:

2.2 根据Constraints构建Gates

Gate中包含的为一组具有相同Selector的Constraints。

每个Constraint可包含不同的Columns和Offsets。
令Constraint Polynomial c j c_j cj中包含的Columns为 w j , 0 , ⋯   , w j , k − 1 w_{j,0},\cdots,w_{j,k-1} wj,0,,wj,k1,其中 k ∈ N k\in\mathbb{N} kN,相应的Offsets为 d j , 0 , ⋯   , d j , k − 1 d_{j,0},\cdots,d_{j,k-1} dj,0,,dj,k1,Constraint Polynomial c j c_j cj的形式为:
c j = a j , 0 ⋅ w j , 0 ( w d j , 0 X ) + ⋯ + a j , k − 1 ⋅ w j , k − 1 ( w d j , k − 1 X ) , a j , i ∈ F c_j=a_{j,0}\cdot w_{j,0}(w^{d_{j,0}}X)+\cdots + a_{j,k-1}\cdot w_{j,k-1}(w^{d_{j,k-1}}X), a_{j,i}\in\mathbb{F} cj=aj,0wj,0(wdj,0X)++aj,k1wj,k1(wdj,k1X),aj,iF 【如为某Basic Constraint: 2 ⋅ T i , j + T i + 1 , j = 0 2\cdot T_{i,j}+T_{i+1,j}=0 2Ti,j+Ti+1,j=0,对应的Constraint Polynomial c j c_j cj表示为 c j = 2 ⋅ T j ( X ) + T j ( w ⋅ X ) c_j=2\cdot T_j(X)+T_{j}(w\cdot X) cj=2Tj(X)+Tj(wX)。】

令第 i i i个Gate的Constraints数量为 k i k_i ki v i v_i vi为第 i i i个Gate的random challenge τ \tau τ 的initial degree ,有:
v i + 1 = v i + k i v_{i+1}=v_i+k_i vi+1=vi+ki
v 0 = 0 v_0=0 v0=0

则第 i i i-th gate表示为:【其中 q l i q_{l_i} qli为对应第 i i i-th gate的selector。】
gate i ( X ) = q l i ( X ) ⋅ ( τ k i − 1 + v i c 0 i ( X ) + ⋯ + τ v i c k i − 1 ( X ) ) \text{gate}_i(X)=q_{l_i}(X)\cdot (\tau^{k_i-1+v_i}c_{0_i}(X)+\cdots +\tau^{v_i}c_{k_i-1}(X)) gatei(X)=qli(X)(τki1+vic0i(X)++τvicki1(X))

总结为:

  • 1)每个Gate只对应一个selector。
  • 2)每个包含 k k k个Constraints c j , j ∈ [ 0 , k − 1 ] c_j,j\in [0,k-1] cj,j[0,k1] k k k值可大于1。
  • 3)每个Constraint可包含 k i k_i ki个Constraints, i i i表示第 i i i个Gate, k i k_i ki值可大于1。
  • 4)总的Gate数由Selectors数量 N s e l N_{sel} Nsel决定。
  • 5)所有的Gate,借助相同的random challenge τ \tau τ,利用linear combination,合并为同一多项式。

2.3 预处理

根据Table,对Polynomials进行预处理:

  • 1)令 L ′ = ( q 0 , ⋯   , q N s e l ) \mathcal{L}'=(q_0,\cdots,q_{N_{sel}}) L=(q0,,qNsel),对应所有的Selector Columns。
  • 2)令 w w w 2 k = N r o w s 2^k=N_{rows} 2k=Nrows-th root of unity。
  • 3)令 δ \delta δ T T T-th root of unity,其中 T ⋅ 2 S + 1 = p , k ≤ S T\cdot 2^S+1=p,k\leq S T2S+1=pkS T T T为奇数,且 p p p为field size。
  • 4)计算 N p e r m N_{perm} Nperm Permutation Polynomials: S σ i ( X ) S_{\sigma_i}(X) Sσi(X),使得 S σ i ( w j ) = δ i ′ ⋅ w j ′ S_{\sigma_i}(w^j)=\delta^{i'}\cdot w^{j'} Sσi(wj)=δiwj。【 i i i的取值为 0 ∼ ( N p e r m − 1 ) 0\sim (N_{perm}-1) 0(Nperm1),对于fan-in two电路来说,有 N p e r m = 3 N_{perm}=3 Nperm=3 j j j表示第 j j j个gate。】
  • 5)计算 N p e r m N_{perm} Nperm Identity Permutation Polynomials: S i d i ( X ) S_{id_i}(X) Sidi(X),使得 S i d i ( w j ) = δ i ⋅ w j S_{id_i}(w^j)=\delta^{i}\cdot w^{j} Sidi(wj)=δiwj。【 i i i的取值为 0 ∼ ( N p e r m − 1 ) 0\sim (N_{perm}-1) 0(Nperm1),对于fan-in two电路来说,有 N p e r m = 3 N_{perm}=3 Nperm=3 j j j表示第 j j j个gate。】
  • 6)令 H = { w 0 , ⋯   , w N r o w s − 1 } H=\{w^0,\cdots,w^{N_{rows}-1}\} H={w0,,wNrows1}为cyclic subgroup of F ∗ \mathbb{F}^* F
  • 7)令 A i A_i Ai为用于Lookup中的某单个Witness Column, S i S_i Si为用于Lookup中的某一组Columns,其中 i = 0 , ⋯   , m i=0,\cdots,m i=0,,m
  • 8)有 Z ( X ) = ∏ a ∈ H ( X − a ) = X N r o w s − 1 Z(X)=\prod_{a\in H}(X-a)=X^{N_{rows}}-1 Z(X)=aH(Xa)=XNrows1

注,在RedShift论文中:

  • 定义 { S i d i ( X ) } i = 1 3 , { S σ j ( X ) } j = 1 3 \{S_{id_i}(X)\}_{i=1}^3, \{S_{\sigma_j}(X)\}_{j=1}^3 {Sidi(X)}i=13,{Sσj(X)}j=13为degree不超过 n n n的Permutation Polynomials:【将fan-in two arithmetic circuits of unlimited fan-out with n n n gates and m m m wires 以constraint system的形式来表达。有 n ≤ m ≤ 2 n n\leq m\leq 2n nm2n。在Placeholder中,对应有 N p e r m = 3 N_{perm}=3 Nperm=3。】
    • S i d j ( X ) = k j X , j ∈ [ 3 ] S_{id_j}(X)=k_jX, j\in[3] Sidj(X)=kjX,j[3]:【本质为:分别对所有gate的左侧输入wire、右侧输入wire和output wire 进行编号。如每个gate的左侧输入wire依次编号为 ( k 1 , 2 ⋅ k 1 , ⋯   , n ⋅ k 1 ) (k_1,2\cdot k_1,\cdots,n\cdot k_1) (k1,2k1,,nk1),每个gate的右侧输入wire依次编号为 ( k 2 , 2 ⋅ k 2 , ⋯   , n ⋅ k 2 ) (k_2,2\cdot k_2,\cdots,n\cdot k_2) (k2,2k2,,nk2),每个gate的output wire依次编号为 ( k 3 , 2 ⋅ k 3 , ⋯   , n ⋅ k 3 ) (k_3,2\cdot k_3,\cdots,n\cdot k_3) (k3,2k3,,nk3)。】
    • S σ j ( g i ) = σ ′ ( k j g i ) , i ∈ [ n ] , j ∈ [ 3 ] S_{\sigma_j}(g^i)=\sigma'(k_jg^i),i\in[n],j\in[3] Sσj(gi)=σ(kjgi),i[n],j[3] i i i的取值为0~n-1,对应为gate, j j j的取值对应为左、右、output wire。【本质为:表示的是gate之间的输入、输出连接关系,如某gate的output wire为另一gate的left input wire等。】

2.4 Placeholder协议中Prover端

将多项式承诺生成函数表示为 C o m m i t ( ⋅ ) Commit(\cdot) Commit()。详细的多项式承诺方案和优化策略见第3和第8节。

Placeholder协议中Prover端的详细流程为:

  • 1) transcript.append(circuit_params) \text{transcript.append(circuit\_params)} transcript.append(circuit_params)
  • 2) transcript.append ( C o m m i t ( w i ( X ) ) ) \text{transcript.append}(Commit(w_i(X))) transcript.append(Commit(wi(X))),其中 0 ≤ i < N w i t n e s s 0\leq i < N_{witness} 0i<Nwitness
  • 3)将Permutation Argument中的Witness Polynomials和Public Input Polynomials定义为:
    f 0 = w 0 , f 1 = w 1 , ⋯   , f N p e r m + N P I − 1 = P I N P I − 1 f_0=w_0,f_1=w_1,\cdots,f_{N_{perm}+N_{PI}-1}=PI_{N_{PI}-1} f0=w0,f1=w1,,fNperm+NPI1=PINPI1
  • 4)有: F 0 ( X ) , F 1 ( X ) , F 2 ( X ) = permutation_argument ( transcript , f 0 , ⋯   , f N p e r m + N P I − 1 , circuit_params ) F_0(X),F_1(X),F_2(X)=\text{permutation\_argument}(\text{transcript}, f_0,\cdots, f_{N_{perm}+N_{PI}-1},\text{circuit\_params}) F0(X),F1(X),F2(X)=permutation_argument(transcript,f0,,fNperm+NPI1,circuit_params)
  • 5)将Lookup Argument中的Witness Polynomials定义为:
    a 0 = A 0 , a 1 = A 1 , ⋯   , a m − 1 = A m − 1 a_0=A_0,a_1=A_1,\cdots,a_{m-1}=A_{m-1} a0=A0,a1=A1,,am1=Am1
  • 6)有: F 3 ( X ) , F 4 ( X ) , F 5 ( X ) , F 6 ( X ) , F 7 ( X ) = lookup_argument ( transcript , a 0 , ⋯   , a m − 1 , circuit_params ) F_3(X),F_4(X),F_5(X),F_6(X),F_7(X)=\text{lookup\_argument}(\text{transcript}, a_0,\cdots, a_{m-1},\text{circuit\_params}) F3(X),F4(X),F5(X),F6(X),F7(X)=lookup_argument(transcript,a0,,am1,circuit_params)
  • 7)Constraint-satisfiability处理流程为:
    • 7.1) τ = transcript.get_challenge() \tau=\text{transcript.get\_challenge()} τ=transcript.get_challenge()
    • 7.2)对于 i = 0 , ⋯   , N s e l − 1 i=0,\cdots, N_{sel}-1 i=0,,Nsel1,有:
      gate i ( X ) = q l i ( X ) ⋅ ( τ k i − 1 + v i c 0 i ( X ) + ⋯ + τ v i c k i − 1 ( X ) ) \text{gate}_i(X)=q_{l_i}(X)\cdot (\tau^{k_i-1+v_i}c_{0_i}(X)+\cdots +\tau^{v_i}c_{k_i-1}(X)) gatei(X)=qli(X)(τki1+vic0i(X)++τvicki1(X))
    • 7.3)Quotient Polynomial的constraints-related分子多项式为:
      F 8 ( X ) = ∑ 0 ≤ i < N s e l ( gate i ( X ) ) F_8(X)=\sum_{0\leq i<N_{sel}}(\text{gate}_i(X)) F8(X)=0i<Nsel(gatei(X))
  • 8)Quotient Polynomial计算流程为:
    • 8.1) α 0 , ⋯   , α 8 = transcript.get_challenge() \alpha_0,\cdots,\alpha_8=\text{transcript.get\_challenge()} α0,,α8=transcript.get_challenge()
    • 8.2)计算Quotient Polynomial T ( X ) T(X) T(X)
      F ( X ) = ∑ i = 0 8 α i F i ( X ) F(X)=\sum_{i=0}^{8}\alpha_iF_i(X) F(X)=i=08αiFi(X)
      T ( X ) = F ( X ) Z ( X ) T(X)=\frac{F(X)}{Z(X)} T(X)=Z(X)F(X)
    • 8.3) N T = max ⁡ ( N p e r m + N P I , deg ⁡ g a t e s − 1 ) N_T=\max(N_{perm}+N_{PI}, \deg_{gates}-1) NT=max(Nperm+NPI,deggates1),其中 deg ⁡ g a t e s \deg_{gates} deggates为Gate Polynomials中的最高degree值。【RedShift中,默认 N T = 3 N_T=3 NT=3。】
    • 8.4)将 T ( X ) T(X) T(X)切分为不同的多项式 T 0 ( X ) , ⋯   , T N T − 1 ( X ) T_0(X),\cdots, T_{N_{T}-1}(X) T0(X),,TNT1(X),以满足多项式承诺中degree ≤ n \leq n n的要求。
    • 8.5)对于 0 ≤ i < N T − 1 0\leq i <N_T-1 0i<NT1,有: transcript.append ( C o m m i t ( T i ( X ) ) ) \text{transcript.append}(Commit(T_i(X))) transcript.append(Commit(Ti(X)))
  • 9)运行evaluation proof:
    • 9.1) y = transcript.get_challenge_from ( F / H ) , y ∈ F / H y=\text{transcript.get\_challenge\_from}(\mathbb{F}/H), y\in \mathbb{F}/H y=transcript.get_challenge_from(F/H),yF/H
    • 9.2)对committed多项式运行evaluation scheme,相应的points源自 { y , y w − 1 , y w , y w d } \{y,yw^{-1},yw,yw^d\} {y,yw1,yw,ywd},其中 d ∈ o d\in\mathbf{o} do,即 d d d o \mathbf{o} o中所有值。【为 w i ( y ) , w i ( y w d ) , V P ( y ) , V P ( y w ) , T 0 ( y ) , ⋯   , T N T − 1 ( y ) , A p e r m ( y ) , A p e r m ( y w − 1 ) , S p e r m ( y ) , V L ( y ) , V L ( y w ) w_i(y),w_i(yw^d),V_P(y),V_P(yw),T_0(y),\cdots,T_{N_T-1}(y),A_{perm}(y),A_{perm}(yw^{-1}),S_{perm}(y),V_L(y),V_L(yw) wi(y),wi(ywd),VP(y),VP(yw),T0(y),,TNT1(y),Aperm(y),Aperm(yw1),Sperm(y),VL(y),VL(yw)生成evaluation proof π e v a l \pi_{eval} πeval,其中 d d d o \mathbf{o} o中所有值。】
    • 9.3)最终proof为 ( π c o m m , π e v a l ) (\pi_{comm}, \pi_{eval}) (πcomm,πeval),其中:
      • π c o m m = { w 0 , c o m m , ⋯   , w N w i t n e s s − 1 , c o m m , V P , c o m m , T 0 , c o m m , ⋯   , T N T − 1 , c o m m , A p e r m , c o m m , S p e r m , c o m m , V L , c o m m } \pi_{comm}=\{w_{0,comm},\cdots,w_{N_{witness}-1, comm},V_{P,comm},T_{0,comm},\cdots,T_{N_T-1,comm}, A_{perm,comm},S_{perm,comm},V_{L,comm}\} πcomm={w0,comm,,wNwitness1,comm,VP,comm,T0,comm,,TNT1,comm,Aperm,comm,Sperm,comm,VL,comm}
      • π e v a l \pi_{eval} πeval为evaluation proofs for w i ( y ) , w i ( y w d ) , V P ( y ) , V P ( y w ) , T 0 ( y ) , ⋯   , T N T − 1 ( y ) , A p e r m ( y ) , A p e r m ( y w − 1 ) , S p e r m ( y ) , V L ( y ) , V L ( y w ) w_i(y),w_i(yw^d),V_P(y),V_P(yw),T_0(y),\cdots,T_{N_T-1}(y),A_{perm}(y),A_{perm}(yw^{-1}),S_{perm}(y),V_L(y),V_L(yw) wi(y),wi(ywd),VP(y),VP(yw),T0(y),,TNT1(y),Aperm(y),Aperm(yw1),Sperm(y),VL(y),VL(yw),其中 d d d o \mathbf{o} o中所有值。

2.4.1 Prover端Permutation Argument

此处的Permutation Argument对应的是电路中的Copy Constraints,详细见本文第6节“将Copy Constraints转换为Permutation Argument”。

Prover端生成证明时,会调用 F 0 ( X ) , F 1 ( X ) , F 2 ( X ) = permutation_argument ( transcript , f 0 , ⋯   , f N p e r m + N P I − 1 , circuit_params ) F_0(X),F_1(X),F_2(X)=\text{permutation\_argument}(\text{transcript}, f_0,\cdots, f_{N_{perm}+N_{PI}-1},\text{circuit\_params}) F0(X),F1(X),F2(X)=permutation_argument(transcript,f0,,fNperm+NPI1,circuit_params),其中 f 0 = w 0 , f 1 = w 1 , ⋯   , f N p e r m + N P I − 1 = P I N P I − 1 f_0=w_0,f_1=w_1,\cdots,f_{N_{perm}+N_{PI}-1}=PI_{N_{PI}-1} f0=w0,f1=w1,,fNperm+NPI1=PINPI1

本文的Permutation Argument与 ZCash Halo2 Permutation argument算法完全一致:
在这里插入图片描述

2.4.2 Prover端Lookup Argument

Prover端生成证明时,会调用 F 3 ( X ) , F 4 ( X ) , F 5 ( X ) , F 6 ( X ) , F 7 ( X ) = lookup_argument ( transcript , a 0 , ⋯   , a m − 1 , circuit_params ) F_3(X),F_4(X),F_5(X),F_6(X),F_7(X)=\text{lookup\_argument}(\text{transcript}, a_0,\cdots, a_{m-1},\text{circuit\_params}) F3(X),F4(X),F5(X),F6(X),F7(X)=lookup_argument(transcript,a0,,am1,circuit_params)。其中将Lookup Argument中的Witness Polynomials定义为:
a 0 = A 0 , a 1 = A 1 , ⋯   , a m − 1 = A m − 1 a_0=A_0,a_1=A_1,\cdots,a_{m-1}=A_{m-1} a0=A0,a1=A1,,am1=Am1

本文的Lookup Argument与ZCash Halo2 Lookup argument算法完全一致:【根据"Algorithm 4 Lookup Argument Verification"来看,“9”应该在“6”之前,若不是在“6”之后】
在这里插入图片描述

2.5 Placeholder协议中Verifier端

Placeholder协议中Verifier端的详细流程为:

  • 1)将proof π \pi π解析为 ( π c o m m , π e v a l ) (\pi_{comm}, \pi_{eval}) (πcomm,πeval),其中:
    * π c o m m = { w 0 , c o m m , ⋯   , w N w i t n e s s − 1 , c o m m , V P , c o m m , T 0 , c o m m , ⋯   , T N T − 1 , c o m m , A p e r m , c o m m , S p e r m , c o m m , V L , c o m m } \pi_{comm}=\{w_{0,comm},\cdots,w_{N_{witness}-1, comm},V_{P,comm},T_{0,comm},\cdots,T_{N_T-1,comm}, A_{perm,comm},S_{perm,comm},V_{L,comm}\} πcomm={w0,comm,,wNwitness1,comm,VP,comm,T0,comm,,TNT1,comm,Aperm,comm,Sperm,comm,VL,comm}
    * π e v a l \pi_{eval} πeval为evaluation proofs for w i ( y ) , w i ( y w d ) , V P ( y ) , V P ( y w ) , T 0 ( y ) , ⋯   , T N T − 1 ( y ) , A p e r m ( y ) , A p e r m ( y w − 1 ) , S p e r m ( y ) , V L ( y ) , V L ( y w ) w_i(y),w_i(yw^d),V_P(y),V_P(yw),T_0(y),\cdots,T_{N_T-1}(y),A_{perm}(y),A_{perm}(yw^{-1}),S_{perm}(y),V_L(y),V_L(yw) wi(y),wi(ywd),VP(y),VP(yw),T0(y),,TNT1(y),Aperm(y),Aperm(yw1),Sperm(y),VL(y),VL(yw),其中 d d d o \mathbf{o} o中所有值。
  • 2) transcript.append(circuit_params) \text{transcript.append(circuit\_params)} transcript.append(circuit_params)
  • 3) transcript.append ( w i , c o m m ) \text{transcript.append}(w_{i,comm}) transcript.append(wi,comm),其中 0 ≤ i < N w i t n e s s 0\leq i < N_{witness} 0i<Nwitness

2.5.1 Verifier端Permutation Argument

其中 f 0 = w 0 , f 1 = w 1 , ⋯   , f N p e r m + N P I − 1 = P I N P I − 1 f_0=w_0,f_1=w_1,\cdots,f_{N_{perm}+N_{PI}-1}=PI_{N_{PI}-1} f0=w0,f1=w1,,fNperm+NPI1=PINPI1
在这里插入图片描述

2.5.2 Verifier端Lookup Argument

其中将Lookup Argument中的Witness Polynomials定义为:
a 0 = A 0 , a 1 = A 1 , ⋯   , a m − 1 = A m − 1 a_0=A_0,a_1=A_1,\cdots,a_{m-1}=A_{m-1} a0=A0,a1=A1,,am1=Am1

在这里插入图片描述

3. Placeholder的Commit Scheme和Evaluation Scheme

本节将定义proofs和params等数据的不同结构体。这些结构体仅定义了proof中的数据(commit scheme parameters)。

3.1 Witness Polynomials

Setup相关参数:
在这里插入图片描述
FRI commit为对 D D D域内所有点进行evaluation,基于该域所有evaluation值构建Merkle-tree,相应的root为承诺值:
在这里插入图片描述
FRI参数 fri_params \text{fri\_params} fri_params有:

  • r r r:表示total number of FRI-rounds in constructing FRI-proof。
  • Domains D 0 , ⋯   , D r − 1 D_0,\cdots,D_{r-1} D0,,Dr1
  • λ \lambda λ:表示number of calls FRI-protocol are necessary for constructing LPC-proof
  • m m m:表示localization factor,默认值为 m = 2 m=2 m=2
  • q ( X ) q(X) q(X):表示folding map, q ( X ) = X 2 q(X)=X^2 q(X)=X2
  • k k k:表示number of points to open。

3.1.1 LPC proof P \mathcal{P} P 证明生成算法

LPC proof P \mathcal{P} P有:【即构建LPC proof时,会调用 λ \lambda λ次FRI协议。

  • 1)Evaluation values: z 0 , ⋯   , z k − 1 z_0,\cdots, z_{k-1} z0,,zk1
  • 2)Merkle proofs: p z 0 , ⋯   , p z k − 1 p_{z_0},\cdots,p_{z_{k-1}} pz0,,pzk1
  • 3)FRI proofs: fri_proof 0 , ⋯   , fri_proof fri_params . λ − 1 \text{fri\_proof}_0,\cdots,\text{fri\_proof}_{\text{fri\_params}.\lambda-1} fri_proof0,,fri_prooffri_params.λ1
    每个FRI proof fri_proof i \text{fri\_proof}_i fri_proofi(又名 π \pi π)中包含:
    • 3.1) round_proof i \text{round\_proof}_i round_proofi,其中 0 ≤ i < fri_params . r − 1 0\leq i <\text{fri\_params}.r-1 0i<fri_params.r1
      每个FRI round_proof i \text{round\_proof}_i round_proofi中包含:
      • 3.1.1)每个round对应的polynomial values: y 0 , ⋯   , y m y_0,\cdots,y_m y0,,ym
      • 3.1.2)每个round对应的Merkle tree root(Commitment): T T T
      • 3.1.3)每个round对应的 colinear_value,colinear_path \text{colinear\_value,colinear\_path} colinear_value,colinear_path
    • 3.2) final_polynomial = { c 0 , ⋯   , c s } \text{final\_polynomial}=\{c_0,\cdots,c_s\} final_polynomial={c0,,cs},其中 s = 2 log ⁡ d ′ − fri_params . r s=2^{\log d'-\text{fri\_params}.r} s=2logdfri_params.r d ′ d' d为quotient polynomial Q ( X ) Q(X) Q(X)的degree,详细可见下面的Proof Eval算法。】

LPC proof P \mathcal{P} P的“Proof Eval算法”中的输入有:

  • 多项式 g ( X ) g(X) g(X)的承诺值,实际即为Merkle tree T T T的root。
  • transcript
  • open的 k k k个点: { ξ j } j = 0 k − 1 \{\xi_j\}_{j=0}^{k-1} {ξj}j=0k1

详细的LPC proof P \mathcal{P} P的“Proof Eval算法”流程为:
在这里插入图片描述
其中的FRI.Eval为生成每个FRI proof fri_proof i \text{fri\_proof}_i fri_proofi(又名 π \pi π)的算法,具体为:
在这里插入图片描述

3.1.2 LPC proof P \mathcal{P} P 证明验证算法

LPC proof P \mathcal{P} P 证明验证算法“Verify Eval”为:
在这里插入图片描述
构建LPC proof时,会调用 λ \lambda λ次FRI协议。每次调用FRI协议生成的证明为 fri_proof i \text{fri\_proof}_i fri_proofi(又名 π \pi π),其中 0 ≤ i < fri_params . λ − 1 0\leq i <\text{fri\_params}.\lambda-1 0i<fri_params.λ1。对每个 fri_proof i \text{fri\_proof}_i fri_proofi(又名 π \pi π)证明的验证算法“FRI.Verify”为:
在这里插入图片描述

3.2 Circuit Polynomials

之前的commit/opening scheme for a polynomial f f f 描述了a δ \delta δ-list of functions f ′ f' f,使得:
Δ ( f , f ′ ) < δ \Delta(f,f')<\delta Δ(f,f)<δ
其中 Δ \Delta Δ为Hamming weight function。

根据RedShift论文可知:

  • Witness Polynomials不要求unique属性。可用 δ \delta δ-list LPC来表示。
  • Setup Polynomials(本文称为Circuit Polynomials)应具有unique属性,确保待证明问题不可验证。需约束 δ \delta δ-list LPC中的每个commit/opening对应为该list中的特定多项式(exactly one polynomial)。【 Setup Polynomials(本文称为Circuit Polynomials)定义了具体的circuit。】

为此,需引入Preprocessing setup:【所谓exactly one,是指Prover和Verifier需对list内能标识出特定多项式 g i ( X ) g_i(X) gi(X)的区分点 ( u i , v i ( = g i ( u i ) ) ) (u_i,v_i(=g_i(u_i))) (ui,vi(=gi(ui)))达成共识。】
在这里插入图片描述
此时,在对 g i ( X ) g_i(X) gi(X)进行“LPC proof生成证明 Proof Eval”算法 以及 “LPC proof验证证明 Verify Eval”算法 的过程中,在所evaluate的point list ( ξ j , z j ) (\xi_j,z_j) (ξj,zj)中 需额外引入 ( u i , v i ( = g i ( u i ) ) ) (u_i,v_i(=g_i(u_i))) (ui,vi(=gi(ui)))

4. 优化的Placeholder Commit Scheme和Evaluation Scheme

nil团队对其Placeholder中的Commit Scheme和Evaluation Scheme进行了优化,定义了针对proofs和params的不同的数据结构类型。

4.1 Placeholder的Setup算法

Placeholder的Setup算法与之前的“Algorithm 5 Setup”算法类似:
在这里插入图片描述

4.2 Placeholder的Merkle tree算法

采用Merkle trees来commit polynomial values,具体的Merkle tree算法有:

  • make_merkle_tree(leaves) \text{make\_merkle\_tree(leaves)} make_merkle_tree(leaves):each leaf of Merkle tree commits values of polynomial f f f on some coset S ⊂ D i S\subset D_i SDi。Coset结构为: S = ∀ s i , s j ∈ S : q r ( s i ) = q r ( s j ) S=\forall s_i,s_j\in S: q_r(s_i)=q_r(s_j) S=si,sjS:qr(si)=qr(sj) for some r r r
  • make_merkle_proof(tree, leaf) \text{make\_merkle\_proof(tree, leaf)} make_merkle_proof(tree, leaf):为 leaf \text{leaf} leaf生成Merkle proof。
  • validate(proof, leaf) \text{validate(proof, leaf)} validate(proof, leaf):检查 proof \text{proof} proof是否对应 leaf \text{leaf} leaf data。该函数应包含 f ( s j ) , ∀ s j ∈ S f(s_j),\forall s_j\in S f(sj),sjS

4.3 Placeholder数据结构

优化后的Placeholder,其FRI proof fri_proof i \text{fri\_proof}_i fri_proofi(又名 π \pi π)中不再包含所有 r r r个round proof round_proof i \text{round\_proof}_i round_proofi,其中 0 ≤ i < fri_params . r − 1 0\leq i <\text{fri\_params}.r-1 0i<fri_params.r1
优化后的Placeholder,其FRI proof fri_proof i \text{fri\_proof}_i fri_proofi(又名 π \pi π)中仅包含round proofs的 s t e p s steps steps,为此,需引入:

  • 算法A:执行 r i r_i ri FRI-rounds on i i i-th step来生成 round_proof i \text{round\_proof}_i round_proofi。FRI-rounds总数为 r r r
  • 算法B:之前版本中有:当前轮round_proof中的 y y y值包含了前一轮 colinear_value \text{colinear\_value} colinear_value值。这些值会存储在FRI proof π \pi π中的 values \text{values} values数据结构体内,有:
    在这里插入图片描述
    values i \text{values}_i valuesi中包含了polynomial values on coset S S S of one of the domains。 S S S结构体仍与之前相同,Coset结构为: S = ∀ s i , s j ∈ S : q r ( s i ) = q r ( s j ) S=\forall s_i,s_j\in S: q_r(s_i)=q_r(s_j) S=si,sjS:qr(si)=qr(sj) for some r r r
    基于相应的precommitment,调用 make_merkle_proof(tree, leaf) \text{make\_merkle\_proof(tree, leaf)} make_merkle_proof(tree, leaf)来为 values i \text{values}_i valuesi生成Merkle proof。

Placeholder的LPC参数 lpc_params \text{lpc\_params} lpc_params有:

  • r r r:表示total number of FRI-rounds in constructing FRI-proof。
  • λ \lambda λ:表示number of calls FRI-protocol are necessary for constructing LPC-proof。
  • m m m:表示localization factor,默认值为 m = 2 m=2 m=2
  • k k k:表示number of points to open。

Placeholder的FRI参数 fri_params \text{fri\_params} fri_params有:。

  • Domains D 0 , ⋯   , D r − 1 D_0,\cdots,D_{r-1} D0,,Dr1
  • m m m:表示localization factor,默认值为 m = 2 m=2 m=2
  • q ( X ) q(X) q(X):表示folding map, q ( X ) = X 2 q(X)=X^2 q(X)=X2
  • max_degree = d \text{max\_degree}=d max_degree=d
  • s t e p s steps steps:为FRI proof中的FRI round proofs数量。
  • r 0 , ⋯   , r s t e p s − 1 r_0,\cdots,r_{steps-1} r0,,rsteps1:表示每个step的rounds数,有 ∑ i = 0 s t e p s − 1 r i = r \sum_{i=0}^{steps-1}r_i=r i=0steps1ri=r

LPC proof P \mathcal{P} P有:【即构建LPC proof时,会调用 λ \lambda λ次FRI协议。

  • 1)Evaluation values: z 0 , ⋯   , z k − 1 z_0,\cdots, z_{k-1} z0,,zk1
  • 2)Merkle tree root: T_root \text{T\_root} T_root移除了Merkle proofs p z 0 , ⋯   , p z k − 1 p_{z_0},\cdots,p_{z_{k-1}} pz0,,pzk1
  • 3)FRI proofs: fri_proof 0 , ⋯   , fri_proof fri_params . λ − 1 \text{fri\_proof}_0,\cdots,\text{fri\_proof}_{\text{fri\_params}.\lambda-1} fri_proof0,,fri_prooffri_params.λ1
    每个FRI proof fri_proof i \text{fri\_proof}_i fri_proofi(又名 π \pi π)中包含:
    • 3.1) round_proof i \text{round\_proof}_i round_proofi,其中 0 ≤ i < fri_params . s t e p s 0\leq i <\text{fri\_params}.steps 0i<fri_params.steps。【引入 s t e p s steps steps,降低了round proof的总数。简化了round proof。
      每个FRI round_proof i \text{round\_proof}_i round_proofi中包含:
      • 3.1.1)每个round对应的Merkle tree path p p p
      • 3.1.2)每个round对应的Merkle tree root: T_root \text{T\_root} T_root
      • 3.1.3)每个round对应的Merkle tree paths: colinear_path \text{colinear\_path} colinear_path
    • 3.2) final_polynomial = { c 0 , ⋯   , c s } \text{final\_polynomial}=\{c_0,\cdots,c_s\} final_polynomial={c0,,cs},其中 s = 2 log ⁡ d ′ − fri_params . r s=2^{\log d'-\text{fri\_params}.r} s=2logdfri_params.r d ′ d' d为quotient polynomial Q ( X ) Q(X) Q(X)的degree,详细可见下面的Proof Eval算法。】
    • 3.3)一组polynomial values: values 0 , ⋯   , values fri_params . s t e p s \text{values}_0,\cdots,\text{values}_{\text{fri\_params}.steps} values0,,valuesfri_params.steps。【增加了一组值

4.4 Placeholder的commit

Merkle tree T T T的root值为commitment:
在这里插入图片描述

4.5 Placeholder中LPC proof生成算法

Placeholder中LPC proof生成算法为:
在这里插入图片描述
其中的FRI proof生成算法为:
在这里插入图片描述

4.6 Placeholder中LPC proof验证算法

Placeholder中LPC proof验证算法为:
在这里插入图片描述
其中的FRI proof验证算法为:
在这里插入图片描述

5. zero knowledge

5.1 Cosets

为实现zero-knowledge属性,RedShift论文中的策略之一是:

  • 引入了a cosets of the sub-domains D ( i ) D^{(i)} D(i)。令 h ∈ F ∗ / D h\in \mathbb{F}^*/D hF/D,定义新domains D ( 0 ) ′ = h D ( 0 ) , ⋯   , D ( r ) ′ = h D ( r ) D^{(0)'}=hD^{(0)},\cdots,D^{(r)'}=hD^{(r)} D(0)=hD(0),,D(r)=hD(r)。FRI协议基于这组新domains构建。

5.2 Hiding Commitments

本文采用了 Ben-Sasson等人2016年论文《Interactive Oracle Proofs》 的 添加了隐私跳转的Merkle tree commitments:

  • 每个Merkle tree leaf包含了:original leaf data + size为 2 λ 2\lambda 2λ的random value,其中此处 λ \lambda λ表示security parameter。

5.3 Random Rows

本文采用Mina和Halo相同的方法。在本文之前章节中已引入了zero-knowledge调整。在本节,将提供a PLONK-trace table preprocessing。
基本思想为:

  • 在table中的最后 t t t行填充uniformly distributed random values。此时,所构建的多项式值也是uniformly distributed random values。对于permutation polynomials和lookup polynomials的最后 t t t行也采取相同的方式,使得permutation argument和lookup argument也具有zero-knowledge属性。
    同时额外引入了2个selector:【 N u s a b l e = N r o w s − t − 1 N_{usable}=N_{rows}-t-1 Nusable=Nrowst1 0 ∼ N u s a b l e − 1 0\sim N_{usable}-1 0Nusable1为实际计算数据,第 N u s a b l e N_{usable} Nusable行对应为分隔行(以 q l a s t = 1 q_{last}=1 qlast=1来表示), N u s a b l e + 1 ∼ N r o w s N_{usable}+1\sim N_{rows} Nusable+1Nrows为随机值。】
    • q b l i n d q_{blind} qblind:若 N u s a b l e < i ≤ N r o w s N_{usable}<i\leq N_{rows} Nusable<iNrows,有 q b l i n d ( w i ) = 1 q_{blind}(w^i)=1 qblind(wi)=1;否则, q b l i n d ( w i ) = 0 q_{blind}(w^i)=0 qblind(wi)=0
    • q l a s t q_{last} qlast:表示分隔行(区分实际计算数据 与 随机值),有 q l a s t ( w N u s a b l e ) = 1 q_{last}(w^{N_{usable}})=1 qlast(wNusable)=1,其它行 q l a s t q_{last} qlast值均为0,

6. 将Copy Constraints转换为Permutation Argument

Prover端生成证明时,会调用 F 0 ( X ) , F 1 ( X ) , F 2 ( X ) = permutation_argument ( transcript , f 0 , ⋯   , f N p e r m + N P I − 1 , circuit_params ) F_0(X),F_1(X),F_2(X)=\text{permutation\_argument}(\text{transcript}, f_0,\cdots, f_{N_{perm}+N_{PI}-1},\text{circuit\_params}) F0(X),F1(X),F2(X)=permutation_argument(transcript,f0,,fNperm+NPI1,circuit_params),其中 f 0 = w 0 , f 1 = w 1 , ⋯   , f N p e r m + N P I − 1 = P I N P I − 1 f_0=w_0,f_1=w_1,\cdots,f_{N_{perm}+N_{PI}-1}=PI_{N_{PI}-1} f0=w0,f1=w1,,fNperm+NPI1=PINPI1

由于:

  • Public Input可通过Copy Constraints enforced到 Witness Columns中。
  • 电路内各wire之间的连接关系(即,PLONK-trace table中Cells之间的equality关系)也是以Copy Constraints表示。

接下来,需要将这些Copy Constraints转换为Permutation Argument。

6.1 Cells as Permutation Cycles

c i , j , c i ′ , j ′ c_{i,j},c_{i',j'} ci,j,ci,j为Plonk-trace table中的2个cell,在Plonk-trace table中,以 value ( c ) \text{value}(c) value(c)来表示cell c c c的值。
Copy constraint C p ( c i , j , c i ′ , j ′ ) \mathbf{Cp}(c_{i,j},c_{i',j'}) Cp(ci,j,ci,j)对应的断言为 value ( c i , j ) = value ( c i ′ , j ′ ) \text{value}(c_{i,j})=\text{value}(c_{i',j'}) value(ci,j)=value(ci,j)

使用Copy constraints,可定义table cells之间的permutation(组合)关系。与ZCash Halo2 Permutation argument中类似,可将permutation(组合)关系表示为a set of cycles。注意,不同的cycles之间是不相交的。对于每个equal cells set { c i , ⋯   , c k } \{c_i,\cdots,c_k\} {ci,,ck},定义cycle C = ( c i , ⋯   , c k ) C=(c_i,\cdots,c_k) C=(ci,,ck)
C C C具有‘sub-permutation’ δ C \delta_C δC,使得:

  • δ C ( c j ) = c j + 1 \delta_C(c_j)=c_{j+1} δC(cj)=cj+1,for i ≤ j < k i\leq j < k ij<k
  • δ C ( c k ) = c i \delta_C(c_k)=c_i δC(ck)=ci

这样,可将所有的Copy Constraints切分为一堆cycles,使得同一cycle中的所有cells具有相同的trace value。电路的Permutation定义为这些cycles的组合。

6.2 Permutation Construction Algorithm

采用与ZCash Halo2 Permutation argument中相同的算法,将state表示为:

  • 1)map m a p p i n g \mathbf{mapping} mapping:用于表示permutation自身。
  • 2)map a u x \mathbf{aux} aux:用于跟踪每个cycle的distinguished element。
  • 3)map s i z e s \mathbf{sizes} sizes:用于跟踪每个cycle的size。

x , y x,y x,y属于相同的cycle,则 a u x ( x ) = a u x ( y ) \mathbf{aux}(x)=\mathbf{aux}(y) aux(x)=aux(y)
s i z e s ( a u x ( x ) ) \mathbf{sizes}(\mathbf{aux}(x)) sizes(aux(x))表示包含 x x x的cycle size。【注意,此处为简化表示,使用一个label来表示permutation中的元素,实际此时, x = ( i , j ) x=(i,j) x=(i,j),其中 i i i表示cell column, j j j表示cell row。】

可将每个 x x x看成是one-element cycle,相应的Copy State初始化流程为:
在这里插入图片描述
Add Copy Constraint的流程为:
在这里插入图片描述

如有2个不相交cycle ( A , B , C , D ) (A,B,C,D) (A,B,C,D) ( E , F , G , H ) (E,F,G,H) (E,F,G,H)

A +---> B
^       +
|       |
+       v
D <---+ C       E +---> F
                ^       +
                |       |
                +       v
                H <---+ G

当 Add Copy Constraint B = E B=E B=E时,最终的cycle为:

A +---> B +-------------+
^                       |
|                       |
+                       v
D <---+ C <---+ E       F
                ^       +
                |       |
                +       v
                H <---+ G

6.3 Permutation Polynomial

以上Add Copy Constraint(Algorithm 19)输出的最终copy state为permutation σ \sigma σ,需要将该permutation转换为Permutation Polynomials。

σ ( col : i , row : j ) = ( col : i ′ , row : j ′ ) \sigma(\text{col}:i,\text{row}:j)=(\text{col}:i',\text{row}:j') σ(col:i,row:j)=(col:i,row:j),可使用 m a p p r i n g ( x = ( i , j ) ) = ( i ′ , j ′ ) \mathbf{mappring}(x=(i,j))=(i',j') mappring(x=(i,j))=(i,j)来表示。
w w w 2 k 2^k 2k-th root of unity, δ \delta δ T T T-th root of unity,其中 T ⋅ 2 S + 1 = p T\cdot 2^S+1=p T2S+1=p,有 k ≤ S k\leq S kS T T T为奇数, p p p为field size。
可将Permutation Polynomials插值表示为:

  • identity permutation polynomials: S i d i ( w j ) = δ i ⋅ w j S_{id_i}(w^j)=\delta^i\cdot w^j Sidi(wj)=δiwj,其中 i = 0 , ⋯   , N p e r m − 1 i=0,\cdots,N_{perm}-1 i=0,,Nperm1
  • permutation polynomials: S σ i ( w j ) = δ i ′ ⋅ w j ′ S_{\sigma_i}(w^j)=\delta^{i'}\cdot w^{j'} Sσi(wj)=δiwj,其中 i = 0 , ⋯   , N p e r m − 1 i=0,\cdots,N_{perm}-1 i=0,,Nperm1

6.4 Permutation Argument

ZCash Halo2 Permutation argument中思路一致:
在这里插入图片描述
添加Zero-Knowledge属性为:
在这里插入图片描述

7. 将Lookup Constraints转换为Lookup Argument

需要将Lookup Constraints转换为Lookup Argument,使用ZCash Halo2 Lookup argument算法。
T T T为Plonk-trace table。
S = S 0 , ⋯   , S m − 1 \mathbf{S}=S_0,\cdots,S_{m-1} S=S0,,Sm1为具有 m m m N r o w s N_{rows} Nrows行的table。注意, N r o w s N_{rows} Nrows等于 T T T中的usable rows数量。
对应lookup input cells ( T i 0 , j 0 , ⋯ T i m − 1 , j m − 1 ) (T_{i_0,j_0},\cdots T_{i_{m-1},j_{m-1}}) (Ti0,j0,Tim1,jm1)的Lookup Constraints,是指:

  • 断言 S \mathbf{S} S中存在某行lookup value等于lookup input cells中的值。

假设 T T T中参与Lookup Argument的列有 A = A 0 , ⋯   , A m − 1 \mathbf{A}=A_0,\cdots,A_{m-1} A=A0,,Am1
A i A_i Ai称为input columns, S i S_i Si为lookup columns。

A \mathbf{A} A S \mathbf{S} S中包含了相同的行数。 A \mathbf{A} A中的每个值均存在于 S \mathbf{S} S中。 A \mathbf{A} A S \mathbf{S} S可包含duplicate。若有需要,可扩展任一set,可扩展 S \mathbf{S} S with duplicates,可扩展 A \mathbf{A} A with dummy values know to be in S \mathbf{S} S

利用random linear combination,引入Verifier challenge θ ∈ F \theta\in\mathbb{F} θF,将 A i , B i A_i,B_i Ai,Bi压缩为2列:

  • A c o m p r = θ m − 1 A 0 + ⋯ + θ A m − 2 + A m − 1 A_{compr}=\theta^{m-1}A_0+\cdots +\theta A_{m-2}+A_{m-1} Acompr=θm1A0++θAm2+Am1
  • S c o m p r = θ m − 1 S 0 + ⋯ + θ S m − 2 + S m − 1 S_{compr}=\theta^{m-1}S_0+\cdots +\theta S_{m-2}+S_{m-1} Scompr=θm1S0++θSm2+Sm1

Lookup Argument中有2处与原始PLONK argument类似的地方:

  • 1)Permutation:Prover permutes A \mathbf{A} A S \mathbf{S} S,使得验证”inclusion lookup queries into S \mathbf{S} S“ 相对简单。然后Prover为permuted columns提供Permutation Argument,证明 permuted A \mathbf{A} A中的值 为 permuted S \mathbf{S} S的子集。
  • 2)Assertion Check:

7.1 Permutation

首先,Prover需计算额外的2列 A p e r m , S p e r m A_{perm},S_{perm} Aperm,Sperm,分别对应permutations of A c o m p r A_{compr} Acompr and S c o m p r S_{compr} Scompr。具体的permutation规则为:

  • 1) A p e r m A_{perm} Aperm column中所有cells的布局方式为:垂直相邻celles以like-valued方式布局,具体的order(顺序)没有关系。
  • 2)The first row in a sequence of like values in A p e r m A_{perm} Aperm为 the row that has the corresponding value in S p e r m S_{perm} Sperm S p e r m S_{perm} Sperm中其他值的顺序可随意。

与上面第6节的Permutation Argument类似,借助grand product argument,证明:

  • A p e r m , S p e r m A_{perm},S_{perm} Aperm,Sperm为permutations of A c o m p r , S c o m p r A_{compr},S_{compr} Acompr,Scompr

与上面6.4节“Permutation Argument”类似,引入random challenge β 2 , γ 2 \beta_2,\gamma_2 β2,γ2,对 A p e r m , S p e r m A_{perm},S_{perm} Aperm,Sperm A c o m p r , S c o m p r A_{compr},S_{compr} Acompr,Scompr构建grand product argument:

  • 1)计算 V L ( X ) V_L(X) VL(X),使得:
    V L ( 1 ) = V L ( w N r o w s ) = 1 V_L(1)=V_L(w^{N_{rows}})=1 VL(1)=VL(wNrows)=1
    V L ( w j ) = ∏ i = 0 j − 1 ( A c o m p r ( w i ) + β 2 ) ( S c o m p r ( w i ) + γ 2 ) ( A p e r m ( w i ) + β 2 ) ( S p e r m ( w i ) + γ 2 ) V_L(w^j)=\prod_{i=0}^{j-1}\frac{(A_{compr}(w^i)+\beta_2)(S_{compr}(w^i)+\gamma_2)}{(A_{perm}(w^i)+\beta_2)(S_{perm}(w^i)+\gamma_2)} VL(wj)=i=0j1(Aperm(wi)+β2)(Sperm(wi)+γ2)(Acompr(wi)+β2)(Scompr(wi)+γ2) for 0 < j < N r o w s 0<j<N_{rows} 0<j<Nrows
  • 2)计算 g L ( X ) , h L ( X ) g_L(X),h_L(X) gL(X),hL(X),使得:
    g L ( X ) = ( A c o m p r ( X ) + β 2 ) ( S c o m p r ( X ) + γ 2 ) g_L(X)=(A_{compr}(X)+\beta_2)(S_{compr}(X)+\gamma_2) gL(X)=(Acompr(X)+β2)(Scompr(X)+γ2)
    h L ( X ) = ( A p e r m ( X ) + β 2 ) ( S p e r m ( X ) + γ 2 ) h_L(X)=(A_{perm}(X)+\beta_2)(S_{perm}(X)+\gamma_2) hL(X)=(Aperm(X)+β2)(Sperm(X)+γ2)
  • 3)计算lookup-related numerators of the quotient polynomial:
    F 3 ( X ) = L 0 ( X ) ( 1 − V L ( X ) ) F_3(X)=L_0(X)(1-V_L(X)) F3(X)=L0(X)(1VL(X))
    F 4 ( X ) = ( 1 − ( q l a s t ( X ) + q b l i n d ( X ) ) ) ⋅ ( V L ( w X ) ⋅ h L ( X ) − V L ( X ) ⋅ g L ( X ) ) F_4(X)=(1-(q_{last}(X)+q_{blind}(X)))\cdot (V_L(wX)\cdot h_L(X)-V_L(X)\cdot g_L(X)) F4(X)=(1(qlast(X)+qblind(X)))(VL(wX)hL(X)VL(X)gL(X))
    F 5 ( X ) = q l a s t ( X ) ⋅ ( V L ( X ) 2 − V L ( X ) ) F_5(X)=q_{last}(X)\cdot (V_L(X)^2-V_L(X)) F5(X)=qlast(X)(VL(X)2VL(X))

7.2 Assertion Check

permuted columns的构建规则为:【 A p e r m A_{perm} Aperm中所有元素均存在于 S p e r m S_{perm} Sperm中】

  • 1) ( A p e r m ( X ) − S p e r m ( X ) ) ⋅ ( A p e r m ( X ) − A p e r m ( w − 1 X ) ) (A_{perm}(X)-S_{perm}(X))\cdot(A_{perm}(X)-A_{perm}(w^{-1}X)) (Aperm(X)Sperm(X))(Aperm(X)Aperm(w1X)),以确保:要么 A p e r m [ j ] = S p e r m [ j ] A_{perm}[j]=S_{perm}[j] Aperm[j]=Sperm[j],要么 A p e r m [ j ] = A p e r m [ j − 1 ] A_{perm}[j]=A_{perm}[j-1] Aperm[j]=Aperm[j1]
  • 2) L 0 ( X ) ⋅ ( A p e r m ( X ) − S p e r m ( X ) ) L_0(X)\cdot (A_{perm}(X)-S_{perm}(X)) L0(X)(Aperm(X)Sperm(X)):需要它是因为: ( A p e r m ( X ) − A p e r m ( w − 1 X ) (A_{perm}(X)-A_{perm}(w^{-1}X) (Aperm(X)Aperm(w1X) is not a valid check on the first row。

结合以上规则,并附加zero-knowledge属性,lookup-related numerators of the quotient polynomial为:

  • 1) F 3 ( X ) = L 0 ( X ) ( 1 − V L ( X ) ) F_3(X)=L_0(X)(1-V_L(X)) F3(X)=L0(X)(1VL(X))
  • 2) F 4 ( X ) = ( 1 − ( q l a s t ( X ) + q b l i n d ( X ) ) ) ⋅ ( V L ( w X ) ⋅ h L ( X ) − V L ( X ) ⋅ g L ( X ) ) F_4(X)=(1-(q_{last}(X)+q_{blind}(X)))\cdot (V_L(wX)\cdot h_L(X)-V_L(X)\cdot g_L(X)) F4(X)=(1(qlast(X)+qblind(X)))(VL(wX)hL(X)VL(X)gL(X))
  • 3) F 5 ( X ) = q l a s t ( X ) ⋅ ( V L ( X ) 2 − V L ( X ) ) F_5(X)=q_{last}(X)\cdot (V_L(X)^2-V_L(X)) F5(X)=qlast(X)(VL(X)2VL(X))
  • 4) F 6 ( X ) = L 0 ( X ) ⋅ ( A p e r m ( X ) − S p e r m ( X ) ) F_6(X)=L_0(X)\cdot (A_{perm}(X)-S_{perm}(X)) F6(X)=L0(X)(Aperm(X)Sperm(X))
  • 5) F 7 ( X ) = ( 1 − ( q l a s t ( X ) + q b l i n d ( X ) ) ) ⋅ ( A p e r m ( X ) − S p e r m ( X ) ) ⋅ ( A p e r m ( X ) − A p e r m ( w − 1 X ) ) F_7(X)=(1-(q_{last}(X)+q_{blind}(X)))\cdot(A_{perm}(X)-S_{perm}(X))\cdot(A_{perm}(X)-A_{perm}(w^{-1}X)) F7(X)=(1(qlast(X)+qblind(X)))(Aperm(X)Sperm(X))(Aperm(X)Aperm(w1X))

7.3 通用化——将多个lookup constraints转换为1个Lookup Argument

每个 lookup input cells 可为任意polynomial expression,并在lookup constraint中使用relative references。这会影响 A c o m p r A_{compr} Acompr的计算方式。
为将多个lookup constraints转换为1个Lookup Argument,需要额外再引入一个random challenge θ \theta θ

lookup中的相关约定有:

  • Lookup Table:为a table of values with columns S i S_i Si
  • Lookup Input:为a set of cells of the PLONK table of the form ( a 0 , ⋯   , a k ) (a_0,\cdots,a_k) (a0,,ak)
  • Compressed Lookup Table:为a column that represents jointed columns of all Lookup Tables。
  • Compressed Lookup Input:为a column that represents jointed column of all lookup inputs。
  • Lookup Constraint: ( a 0 , ⋯   , a k i − 1 ) ∈ S (a_0,\cdots,a_{k_i-1})\in S (a0,,aki1)S for some lookup table S S S
  • Lookup Expression:为Polynomial representation of the lookup constraint。

假设circuit C C C中包含了 N t a b l e s N_{tables} Ntables个lookup tables和 N l o o k u p N_{lookup} Nlookup个lookup constraints。
每个lookup constraint中所包含的input width可能不同。以 k i k_i ki来表示第 i i i-th个lookup constraint中lookup input的数量。
d j i d_{j_i} dji为lookup constraint中每个元素的rotation(即,shift by d j i d_{j_i} dji行)。
v i v_i vi为第 i i i-th个lookup constraint random challenge的初始degree,有:
v i + 1 = v i + k i v_{i+1}=v_i+k_i vi+1=vi+ki
v 0 = 0 v_0=0 v0=0

使得,lookup expression为:
lookup_gate i ( X ) = ( θ k i − 1 + v i A 0 i ( X ) + ⋯ + θ v i A k i − 1 ( X ) ) \text{lookup\_gate}_i(X)=(\theta^{k_i-1+v_i}A_{0_i}(X)+\cdots +\theta^{v_i}A_{k_i-1}(X)) lookup_gatei(X)=(θki1+viA0i(X)++θviAki1(X))

压缩的lookup input为:
A c o m p r ( w j ) = ∑ 0 ≤ i < N l o o k u p lookup_gate i ( w j ) A_{compr}(w^j)=\sum_{0\leq i<N_{lookup}}\text{lookup\_gate}_i(w^j) Acompr(wj)=0i<Nlookuplookup_gatei(wj)

注意,每个Column A i , j A_{i,j} Ai,j对应table T T T中的某一列,Column A i , j A_{i,j} Ai,j之间不要求是不同的,即可以是相同的。

与lookup inputs中定义类似,令 v i v_i vi为某table value。压缩的lookup table计算方式 与 压缩的lookup input 类似:
table_value i ( w j ) = ( θ k i − 1 + v i S 0 i ( w j ) + ⋯ + θ v i S k i − 1 ( w j ) ) \text{table\_value}_i(w^j)=(\theta^{k_i-1+v_i}S_{0_i}(w^j)+\cdots +\theta^{v_i}S_{k_i-1}(w^j)) table_valuei(wj)=(θki1+viS0i(wj)++θviSki1(wj))
S c o m p r ( w j ) = ∑ 0 ≤ i < N l o o k u p table_value i ( w j ) S_{compr}(w^j)=\sum_{0\leq i<N_{lookup}}\text{table\_value}_i(w^j) Scompr(wj)=0i<Nlookuptable_valuei(wj)

7.4 small lookup tables

借助tag column,可将多个table进行合并。
如, S 1 = S 1 0 , S 1 1 \mathbf{S}_1=S_{1_0},S_{1_1} S1=S10,S11 S 2 = S 2 0 , S 2 1 \mathbf{S}_2=S_{2_0},S_{2_1} S2=S20,S21为2个具有4行的lookup tables,对应 S 1 , S 2 \mathbf{S}_1,\mathbf{S}_2 S1,S2有2个lookup expression。可按如下方式合并:
在这里插入图片描述
但是,通常情况下, N r o w s > > 4 N_{rows}>>4 Nrows>>4,如按上述方式合并,prover需对所合并table列数之和的column进行commit,但借助tag column,可将多个table合并为:
在这里插入图片描述
这样,最多可节约 ( N c o n _ t a b l e s − 1 ) ⋅ max_columns − 1 (N_{con\_tables}-1)\cdot \text{max\_columns}-1 (Ncon_tables1)max_columns1列,其中 max_columns \text{max\_columns} max_columns N c o n _ t a b l e s N_{con\_tables} Ncon_tables个待合并table中的最大列数。

7.5 Non-Fixed Lookup Tables

table S \mathbf{S} S可为non-fixed, S \mathbf{S} S中的任何列都可看成是witness columns。总的证明过程仍保持不变。

附录 nil Foundation系列博客

参考资料

[1] ZCash Halo2 Lookup argument
[2] ZCash Halo2 Permutation argument

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值