|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <poseidon2_internal_relation.hpp>
Public Types | |
| using | FF = FF_ |
Static Public Member Functions | |
| template<typename AllEntities > | |
| static bool | skip (const AllEntities &in) |
| Returns true if the contribution from all subrelations for the provided inputs is identically zero. | |
| template<typename ContainerOverSubrelations , typename AllEntities , typename Parameters > | |
| static void | accumulate (ContainerOverSubrelations &evals, const AllEntities &in, const Parameters &, const FF &scaling_factor) |
| Expression for the Poseidon2 internal round relation, based on I_i in Section 6 of https://eprint.iacr.org/2023/323.pdf. | |
Static Public Attributes | |
| static constexpr std::array< size_t, 4 > | SUBRELATION_PARTIAL_LENGTHS |
| static constexpr fr | D1 = crypto::Poseidon2Bn254ScalarFieldParams::internal_matrix_diagonal[0] |
| static constexpr fr | D2 = crypto::Poseidon2Bn254ScalarFieldParams::internal_matrix_diagonal[1] |
| static constexpr fr | D3 = crypto::Poseidon2Bn254ScalarFieldParams::internal_matrix_diagonal[2] |
| static constexpr fr | D4 = crypto::Poseidon2Bn254ScalarFieldParams::internal_matrix_diagonal[3] |
| static constexpr fr | D1_plus_1 = fr{ 1 } + D1 |
Definition at line 13 of file poseidon2_internal_relation.hpp.
| using bb::Poseidon2InternalRelationImpl< FF_ >::FF = FF_ |
Definition at line 15 of file poseidon2_internal_relation.hpp.
|
inlinestatic |
Expression for the Poseidon2 internal round relation, based on I_i in Section 6 of https://eprint.iacr.org/2023/323.pdf.
Let the internal round matrix M_I be the 4×4 matrix
\[ M_I = \begin{bmatrix} D_1 + 1 & 1 & 1 & 1 \\ 1 & D_2 + 1 & 1 & 1 \\ 1 & 1 & D_3 + 1 & 1 \\ 1 & 1 & 1 & D_4 + 1 \end{bmatrix}, \quad \text{where } D_i \text{ are the diagonal entries of } M_I. \]
Define the state
\[ u_1 = \big(w_1 + \hat{c}_0^{(i)}\big)^{5},\qquad u_2 = w_2,\quad u_3 = w_3,\quad u_4 = w_4,\qquad \mathbf{u} = (u_1,u_2,u_3,u_4). \]
The internal round computes \( \mathbf{v} = M_I \cdot \mathbf{u}^{\top} \) and the relation enforces \( v_k = w_{k,\mathrm{shift}} \) for \( k \in \{1,2,3,4\} \):
\begin{align*} v_1 &= D_1\,u_1 + u_2 + u_3 + u_4,\\ v_2 &= u_1 + D_2\,u_2 + u_3 + u_4,\\ v_3 &= u_1 + u_2 + D_3\,u_3 + u_4,\\ v_4 &= u_1 + u_2 + u_3 + D_4\,u_4, \end{align*}
where \( \hat{c}_0^{(i)} \) is the internal round constant (provided via the \( q_l \) selector).
Concretely, the relation is encoded as four independent constraints multiplied by the \(\text{q_poseidon2_external}\) selector and the scaling factor \(\hat{g}\) arising from the GateSeparatorPolynomial. These contributions are added to the corresponding univariate accumulators \( A_k \) (one per subrelation):
\begin{align*} A_1 &\;\mathrel{+}= q_{\mathrm{poseidon2\_internal}}\cdot\big(v_1 - w_{1,\mathrm{shift}}\big)\cdot \hat{g},\\ A_2 &\;\mathrel{+}= q_{\mathrm{poseidon2\_internal}}\cdot\big(v_2 - w_{2,\mathrm{shift}}\big)\cdot \hat{g},\\ A_3 &\;\mathrel{+}= q_{\mathrm{poseidon2\_internal}}\cdot\big(v_3 - w_{3,\mathrm{shift}}\big)\cdot \hat{g},\\ A_4 &\;\mathrel{+}= q_{\mathrm{poseidon2\_internal}}\cdot\big(v_4 - w_{4,\mathrm{shift}}\big)\cdot \hat{g}. \end{align*}
At the end of each Sumcheck round, the subrelation accumulators are aggregated with independent challenges \( \alpha_i = \alpha_{i,\mathrm{Poseidon2Int}} \) (from the SubrelationSeparators)
\[ \alpha_{0}A_1 + \alpha_{1}A_2 + \alpha_{2}A_3 + \alpha_{3}A_4 \]
and multiplied by the linear factor of the GateSeparatorPolynomial.
| evals | A tuple of tuples of univariate accumulators; the subtuple for this relation is \([A_1,A_2,A_3,A_4]\), with \( \deg(A_k) = \text{SUBRELATION_PARTIAL_LENGTHS}[k] - 1 \). |
| in | In round \( k \) of Sumcheck at the point \( i_{>k} = (i_{k+1},\ldots,i_{d-1}) \) on the \( d-k-1 \) dimensional hypercube, an array of restrictions of the prover polynomials \( P_i(u_{<k}, X_k, i_{>k}) \). |
| parameters | Not used in this relation. |
| scaling_factor | Scaling term \( \hat{g} \) from the GateSeparatorPolynomial. |
Definition at line 98 of file poseidon2_internal_relation.hpp.
|
inlinestatic |
Returns true if the contribution from all subrelations for the provided inputs is identically zero.
Definition at line 33 of file poseidon2_internal_relation.hpp.
|
staticconstexpr |
Definition at line 24 of file poseidon2_internal_relation.hpp.
|
staticconstexpr |
Definition at line 28 of file poseidon2_internal_relation.hpp.
|
staticconstexpr |
Definition at line 25 of file poseidon2_internal_relation.hpp.
|
staticconstexpr |
Definition at line 26 of file poseidon2_internal_relation.hpp.
|
staticconstexpr |
Definition at line 27 of file poseidon2_internal_relation.hpp.
|
staticconstexpr |
Definition at line 17 of file poseidon2_internal_relation.hpp.