WHIR

Presentation: https://youtu.be/JdHqAIMihxg

Introduction

WHIR is a follow-up paper to STIR, and it has advanced in 2 key aspects: verification speed and use of multilinear polynomials over univariate polynomials. WHIR can replace existing protocols such as FRI, STIR, and Basefold.

Background

Please refer to Basefold and STIR in advance.

Constrained RS (CRS) Code

An RS (Reed-Solomon) code with field F\mathbb{F}, evaluation domain LF\mathcal{L} \subseteq \mathbb{F}, and degree dd can be interpreted as evaluations over either a univariate polynomial or a multilinear polynomial as follows:

RS[F,L,m]:={f:LF:g^F2m[X] s.t. xL,f(x)=g^(x)}={f:LF:f^F2[X1,,Xm] s.t. xL,f(x)=f^(pow(x,m))}\begin{align*} \mathsf{RS}[\mathbb{F}, \mathcal{L}, m] :&= \{ f:\mathcal{L} \rightarrow \mathbb{F} : \exist \hat{g} \in \mathbb{F}^{2^m}[X] \text{ s.t. }\forall x \in \mathcal{L}, f(x) = \hat{g}(x) \} \\ &= \{ f:\mathcal{L} \rightarrow \mathbb{F} : \exist \hat{f} \in \mathbb{F}^{2}[X_1, \dots, X_m] \text{ s.t. }\forall x \in \mathcal{L}, f(x) = \hat{f}(\mathsf{pow}(x, m)) \} \end{align*}

where pow\mathsf{pow} is defined as:

pow(x,m)=(x20, , x2m1)\mathsf{pow}(x, m) = ({x}^{2^0}, \space \dots, \space {x}^{2^{m - 1}})

A CRS (Constrained Reed-Solomon) code extends the traditional RS code by introducing additional evaluation constraint f^(z)=σ\hat{f}(\bm{z})=\sigma.

Recall that f^\hat{f} is defined as:

f^(X)=b{0,1}mf^(b)eq(b,X)\hat{f}(\bm{X}) = \sum_{\bm{b}\in \{0, 1\}^m} \hat{f}(\bm{b}) \cdot \mathsf{eq}(\bm{b}, \bm{X})

To incorporate the additional constraint f^(z)=σ\hat{f}(\bm{z})=\sigma,

f^(z)=b{0,1}mf^(b)eq(b,z)=b{0,1}mw^(f^(b),b)=σ\hat{f}(\bm{z}) = \sum_{\bm{b} \in \{0, 1\} ^m } \hat{f}(\bm{b}) \cdot \mathsf{eq}(\bm{b}, \bm{z}) = \sum_{\bm{b} \in \{0, 1\}^m} \hat{w}(\hat{f}(\bm{b}), \bm{b}) = \sigma

where w^\hat{w} is defined as: (and we call this weight polynomial, which we'll explain later).

w^(Z,X)=Zeq(X,z)\hat{w}(Z, \bm{X}) = Z \cdot \mathsf{eq}(\bm{X}, \bm{z})

Hence, CRS (Constrained Reed-Solomon) code code can be written as:

CRS[F,L,m,w^,σ]:={fRS[F,L,m]:b{0,1}mw^z(f^(b),b)=σ}\mathsf{CRS}[\mathbb{F}, \mathcal{L}, m, \hat{w}, \sigma] := \left\{ f \in \mathsf{RS}[\mathbb{F}, \mathcal{L}, m] : \sum_{\bm{b} \in \{0, 1\}^m} \hat{w}_z(\hat{f}(\bm{b}), \bm{b}) = \sigma \right\}

Protocol Explanation

Brief Overview

Fig 1. Simple Diagram of the Query Phase in the STIR (left) and WHIR (right) Protocols

The query complexity in WHIR remains the same as in STIR because the same idea of reducing the rate is applied. WHIR also uses Out-Of-Domain Sampling, which is employed in STIR. However, WHIR does not use Quotienting, or Degree Correction. Instead, it introduces two new methods, described below:

Sumcheck

For each round in the Sumcheck protocol, the verifier provides a random value, and the prover reduces the number of variables by one. With each variable reduction, the degree is also reduced by one. After kk rounds of sumcheck, kk variables can be eliminated, reducing the degree by kk. This is the folding method used in WHIR, differing from the kk-fold approach in STIR.

For example, when k=2k = 2, the process operates as follows. First, let us assume that the evaluation constraint claimed by the CRS in the previous round is as follows:

b{0,1}mw^(f^(b),b)=σ\sum_{\bm{b} \in \{0, 1\}^m} \hat{w}(\hat{f}(\bm{b}), \bm{b}) = \sigma
  1. The prover provides the verifier with a univariate polynomial h^0\hat{h}_0 defined as follows to prove the constraint:

h^0(X)=b{0,1}m1w^(f^(X,b),X,b)\hat{h}_{0}(X) = \sum_{\bm{b} \in \{0, 1\}^{m-1}} \hat{w}(\hat{f}(X, \bm{b}), X, \bm{b})
  1. The verifier then checks the following condition and rejects if the two sides are not equal:

h^0(0)+h^0(1)=?σ\hat{h}_0(0) + \hat{h}_0(1) \stackrel{?}= \sigma
  1. The verifier samples a random α0\alpha_0​ and sends it to the prover.

  2. The prover, using the random value α0\alpha_0, provides the verifier with another univariate polynomial h^1\hat{h}_1₁ defined as follows:

h^1(X)=b{0,1}m2w^(f^(α0,X,b),α0,X,b)\hat{h}_1(X) = \sum_{\bm{b} \in \{0, 1\}^{m-2}} \hat{w}(\hat{f}(\alpha_0, X, \bm{b}), \alpha_0, X, \bm{b})
  1. The verifier checks the following condition and rejects if the two sides are not equal:

h^1(0)+h^1(1)=?h^0(α0)\hat{h}_1(0) + \hat{h}_1(1) \stackrel{?}= \hat{h}_0(\alpha_0)
  1. The verifier samples a random value α1\alpha_1​ and sends it to the prover.

  2. The folded polynomial g^\hat{g} can then be constructed as follows:

g^(X)=f^(α0,α1,X)\hat{g}(\bm{X}) = \hat{f}(\alpha_0, \alpha_1, \bm{X})

Weight Polynomial

Out-Of-Domain Sampling

  1. The verifier samples random value z0$Fz_0 \stackrel{\$}\leftarrow \mathbb{F}.

  2. The prover sends y0=g^(pow(z0,mk))y_0 = \hat{g}(\mathsf{pow}(z_0, m - k)).

Shift queries

  1. The verifier samples random values z1,,zti$Liz_1, \dots, z_{t_i} \stackrel{\$}\leftarrow \mathcal{L}_i. The Li\mathcal{L}_i is the evaluation domain in each round ii, and the value tt represents the number of queries required in each round ii, determined by the security parameter λ\lambda.

  2. For each i[t]i \in [t], the verifier obtains yiy_i by querying ff:

yi=Fold(f,α0,α1)(zi)y_i = \mathsf{Fold}(f, \alpha_0, \alpha_1 )(z_i)

and Fold\mathsf{Fold} is defined as:

Fold(f,αi,,αj)(y)={Fold(Fold(f,αi),αi+1,,αj)(y2) if i<jf(x)+f(x)2+αif(x)f(x)2x if i=j\mathsf{Fold}(f, \alpha_i, \dots, \alpha_{j})(y) = \begin{cases} \mathsf{Fold}(\mathsf{Fold}(f, \alpha_i), \alpha_{i + 1}, \dots, \alpha_{j})(y^2) &\text{ if } i < j \\ \frac{f(x) + f(-x)}{2} +\alpha_i \cdot \frac{f(x) - f(-x)}{2 \cdot x} & \text { if } i = j \end{cases}

where y=x2=(x)2y = x^2 = (-x)^2.

Recursive Claims

  1. The verifier samples random value γ$F\gamma \stackrel{\$}\leftarrow \mathbb{F}.

  2. Using the random values and the computed results, the prover and the verifier constructs w^\hat{w}' and σ\sigma', which will be used in the new CRS[F,L,mk,w^,σ]\mathsf{CRS}[\mathbb{F}, \mathcal{L}, m - k, \hat{w}', \sigma'].

w^(Z,X):=w^(Z,α0,,αk1,X)+Zi=0tγi+1eq(X,zi)σ:=h^k1(αk1)+i=0tγi+1yi\hat{w}'(Z, \bm{X}) := \hat{w}(Z, \alpha_0, \dots, \alpha_{k-1}, \bm{X}) + Z \cdot \sum_{i = 0}^t \gamma^{i+1}\cdot \mathsf{eq}(\bm{X}, \bm{z_i}) \\ \sigma' := \hat{h}_{k-1}(\alpha_{k-1}) + \sum_{i = 0}^t \gamma^{i+1} \cdot y_i

The Full WHIR Protocol

Parameters

  • a constrained Reed-Solomon code CRS[F,L0,m0,w^0,σ0]\mathsf{CRS}[\mathbb{F}, \mathcal{L}_0, m_0, \hat{w}_0, \sigma_0];

  • an iteration count MNM \in \mathbb{N};

  • folding parameter k0,,kM1k_0, \dots, k_{M-1} such that i=0M1kim\sum_{i=0}^{M-1}k_i \le m;

  • evaluation domain L1,,LM1F\mathcal{L}_1, \dots, \mathcal{L}_{M-1} \sube \mathbb{F} where Li\mathcal{L}_i is a smooth coset of F\mathbb{F}^* with order Li2mi|\mathcal{L}_i| \ge 2^{m_i};

  • repetition parameters t0,,tM1t_0, \dots, t_{M-1} with tiLit_i \le |\mathcal{L}_i|;

  • define m0:=mm_0 := m and mi:=mj<ikjm_i := m - \sum_{j<i}k_j;

  • define d:=1+degZ(w^0)+maxi[m0]degXi(w^0)d^* := 1 + \deg_Z(\hat{w}_0) + \max_{i \in [m_0]} \deg_{X_i}(\hat{w}_0) and d:=max{d,3}d := \max \{ d^*, 3\}.

Inputs

The verifier has oracle access to f0:L0Ff_0: \mathcal{L}_0 \rightarrow \mathbb{F}. In the honest case, f0CRS[F,L0,m0,w^0,σ0]f_0 \in \mathsf{CRS}[\mathbb{F}, \mathcal{L}_0, m_0, \hat{w}_0, \sigma_0] and the prover receives f^0F<2[X1,,Xm]\hat{f}_0 \in \mathbb{F}^{< 2} [X_1, \dots, X_m] such that f0=f^0(L0)f_0 = \hat{f}_0(\mathcal{L}_0) and b{0,1}m0w^0(f^0(b),b)=σ0\sum_{\bm{b} \in \{0,1\}^{m_0}} \hat{w}_0(\hat{f}_0(\bm{b}), \bm{b} ) = \sigma_0.

Query(Prover side)

  1. Initial sumcheck: Set α0:=\pmb{\alpha}_0 := \emptyset. For =1,,k0\ell = 1, \dots, k_0:

    1. The prover sends h^0,F<d[X]\hat{h}_{0, \ell} \in \mathbb{F}^{< d^*}[X]. In the honest case, h^0,:=b{0,1}m01w^0(f^0(α0,X,b),α0,X,b)\hat{h}_{0, \ell} := \sum_{\bm{b} \in \{0, 1\}^{m_0 - \ell - 1}} \hat{w}_0(\hat{f}_0(\alpha_0, X, \bm{b}), \bm{\alpha}_0, X, \bm{b}).

    2. The verifier samples α0,F\alpha_{0, \ell} \leftarrow \mathbb{F}. Append α0,\alpha_{0, \ell} to set α0\bm{\alpha}_0.

  2. Main loop: For i=1,,M1i = 1, \dots, M - 1:

    1. Send folded function: The prover sends fi:LiFf_i: \mathcal{L}_i \rightarrow \mathbb{F}. In the honest case, fif_i is the evaluation of f^i:=f^i1(αi1,)\hat{f}_i := \hat{f}_{i-1}(\bm{\alpha}_{i-1}, \cdot) over Li\mathcal{L}_i.

    2. Out-of-domain sample: The verifier sends zi,0$Fz_{i, 0} \stackrel{\$}\leftarrow \mathbb{F}. Set zi,0:=pow(zi,0,mi)\bm{z}_{i, 0} := \mathsf{pow}(z_{i, 0}, m_i).

    3. Out-of-domain reply: The prover sends yi,0Fy_{i, 0} \in \mathbb{F}. In the honest case, yi,0:=f^i(zi,0)y_{i, 0} := \hat{f}_i(\mathbb{z}_{i, 0}).

    4. Shift message: The verifier samples zi,1,,zi,ti1$Li1(2ki1)z_{i, 1}, \dots, z_{i, t_ {i- 1}} \stackrel{\$}\leftarrow \mathcal{L}_{i-1}^{(2^{k_{i - 1}})} and γi$F\gamma_i \stackrel{\$}\leftarrow \mathbb{F}. Set zi,j:=pow(zi,j,mi)\bm{z}_{i, j} := \mathsf{pow}(z_{i, j}, m_i).

    5. Sumcheck rounds: Set α0:=\pmb{\alpha}_0 := \emptyset. For =1,,ki\ell = 1, \dots, k_i:

      1. The prover sends h^i,F<d[X]\hat{h}_{i, \ell} \in \mathbb{F}^{< d}[X]. In the honest case, h^i,(X):=b{0,1}mi1w^i(f^i(αi,X,b),αi,X,b)\hat{h}_{i, \ell}(X) := \sum_{\bm{b} \in \{0, 1\}^{m_i - \ell - 1}} \hat{w}_i(\hat{f}_i(\alpha_i, X, \bm{b}), \bm{\alpha}_i, X, \bm{b}) where w^i(Z,X1,,Xmi):=w^i1(Z,αi1,X1,,Xmi)+Zj=0ti1eq(zi,j,(X1,,Xmi))\hat{w}_i(Z, X_1, \dots, X_{m_i}) := \hat{w}_{i -1}(Z, \bm{\alpha}_{i-1}, X_1, \dots, X_{m_i}) + Z \cdot \sum_{j = 0}^{t_{i-1}}\cdot \mathsf{eq}(\bm{z}_{i, j} , (X_1, \dots, X_{m_i})).

      2. The verifier samples αi,F\alpha_{i, \ell} \leftarrow \mathbb{F}. Append αi,\alpha_{i, \ell} to set αi\bm{\alpha}_i.

  3. Send final polynomial: The prover sends f^MF<2[X1,,XmM]\hat{f}_M \in \mathbb{F}^{<2}[X_1, \dots, X_{m_M}]. In the honest case f^M:=f^M1(αM1,)\hat{f}_M := \hat{f}_{M-1}(\bm{\alpha}_{M-1}, \cdot).

  4. Sample final randomness: The verifier samples r1fin,,rtM1fin$LM1(2kM1)r_1^{\mathsf{fin}}, \dots, r_{t_{M-1}}^{\mathsf{fin}} \stackrel{\$}{\leftarrow} \mathcal{L}_{M - 1}^{(2^{k _{M - 1}})}.

Query(Verifier side)

  1. Check initial sumcheck:

    1. Check that b{0,1}h^0,1(b)=σ0\sum_{b \in \{0, 1\}} \hat{h}_{0,1}(b) = \sigma_0.

    2. Check that b{0,1}h^0,(b)=h^0,1(α0,1)\sum_{b \in \{0, 1\}} \hat{h}_{0, \ell}(b) = \hat{h}_{0, \ell-1}(\alpha_{0, \ell-1}) for {2,,k0}\ell \in \{2, \dots, k_0\}.

  2. Check main loop: For i=1,,M1i = 1, \dots, M - 1:

    1. Let gi1:=Fold(fi1,αi1)g_{i-1} := \mathsf{Fold}(f_{i-1}, \bm{\alpha}_{i-1}).

    2. Compute the points {gi1(zi,j)}j[ti1]\{g_{i-1}(z_{i, j})\}_{j \in [t_{i-1}]} by querying fi1f_{i-1} at the appropriate locations.

    3. Check that b{0,1}h^i,1(b)=h^i1,ki1(αi1,ki1)+γiyi,0+j=1ti1gi1(zi,j)\sum_{b \in \{0, 1\}} \hat{h}_{i,1}(b) = \hat{h}_{i-1, k_{i-1}}(\alpha_{i-1, k_{i - 1}}) + \gamma_i \cdot y_{i, 0} + \sum_{j=1}^{t_{i-1}} \cdot g_{i-1}(z_{i, j}).

    4. Check that b{0,1}h^i,(b)=h^i,1(αi,1)\sum_{b \in \{0, 1\}} \hat{h}_{i, \ell}(b) = \hat{h}_{i, \ell -1}(\alpha_{i, \ell - 1}) for every {2,,ki}\ell \in \{2, \dots, k_i\}.

  3. Check final polynomial:

    1. Check that, for every [tM1]\ell \in [t_{M-1}], f^M(rfin)=gM1(rfin)\hat{f}_M(\bm{r}^{\mathsf{fin}}_\ell) = g_{M-1}(r^{\mathsf{fin}}_\ell) where rfin:=pow(rfin,mM)\bm{r}_\ell^{\mathsf{fin}} := \mathsf{pow}(r^\mathsf{fin}_\ell, m_M).

    2. For i=1,,M1i = 1, \dots, M - 1 set w^i(Z,X1,,Xmi):=w^i1(Z,αi1,X1,,Xmi)+Zj=0ti1γij+1eq(zi,j,X1,,Xmi)\hat{w}_i(Z, X_1, \dots, X_{m_i}) := \hat{w}_{i-1}(Z, \bm{\alpha}_{i-1}, X_1, \dots, X_{m_i}) + Z \cdot \sum_{j=0}^{t_{i-1}} \gamma_i^{j+1} \cdot \mathsf{eq}(\bm{z}_{i,j}, X_1, \dots, X_{m_i})

    3. Check that b{0,1}mMw^M1(f^M(b),αM1,b)=h^M1,kM1(αM1,kM1)\sum_{\bm{b} \in \{0, 1\}^{m_M}} \hat{w}_{M-1}(\hat{f}_M(\bm{b}), \bm{\alpha}_{M-1}, \bm{b}) = \hat{h}_{M-1, k_{M-1}}(\alpha_{M-1, k_{M-1}}).

Conclusion

Fig 2. Comparison Table among BaseFold, FRI, STIR and WHIR

The figure above is a table comparing BaseFold, FRI, STIR, and WHIR. It shows that WHIR, like STIR, has the lowest query complexity. Additionally, WHIR also achieves the lowest verifier time complexity. (For details on how WHIR's verifier time complexity is calculated, refer to Section 2.1.4, "Verifier Efficiency," in the paper.)

Fig 3. Benchmark Result among FRI, STIR and WHIR

The benchmarking results, as derived from the table above, show a similar trend. In the ZK Summit 12 presentation, Eylon Yogev highlighted that WHIR has lower on-chain gas costs than Groth16. Given that Groth16 is widely recognized for its low on-chain gas costs, this suggests an exciting possibility: we may not need to combine STARK-based proof generation with Groth16 verification in the future. This could mark the beginning of a more efficient era, though significant progress is still needed to make it a reality. For now, Groth16 verification remains the most cost-effective option. For more details, see this discussion.

References

Written by ryan Kim from A41

Last updated