(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
_rng: Option<&mut dyn RngCore>,
)
| 226 | } |
| 227 | |
| 228 | fn commit<'a>( |
| 229 | ck: &Self::CommitterKey, |
| 230 | polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>, |
| 231 | _rng: Option<&mut dyn RngCore>, |
| 232 | ) -> Result< |
| 233 | ( |
| 234 | Vec<LabeledCommitment<Self::Commitment>>, |
| 235 | Vec<Self::CommitmentState>, |
| 236 | ), |
| 237 | Self::Error, |
| 238 | > |
| 239 | where |
| 240 | P: 'a, |
| 241 | { |
| 242 | let mut commitments = Vec::new(); |
| 243 | let mut states = Vec::new(); |
| 244 | |
| 245 | for labeled_polynomial in polynomials { |
| 246 | let polynomial = labeled_polynomial.polynomial(); |
| 247 | |
| 248 | // 1. Arrange the coefficients of the polynomial into a matrix, |
| 249 | // and apply encoding to get `ext_mat`. |
| 250 | let (mat, ext_mat) = L::compute_matrices(polynomial, ck); |
| 251 | let n_rows = mat.n; |
| 252 | let n_cols = mat.m; |
| 253 | let n_ext_cols = ext_mat.m; |
| 254 | |
| 255 | // 2. Create the Merkle tree from the hashes of each column. |
| 256 | let ext_mat_cols = ext_mat.cols(); |
| 257 | let leaves: Vec<H::Output> = cfg_into_iter!(ext_mat_cols) |
| 258 | .map(|col| { |
| 259 | H::evaluate(ck.col_hash_params(), col) |
| 260 | .map_err(|_| Error::HashingError) |
| 261 | .unwrap() |
| 262 | }) |
| 263 | .collect(); |
| 264 | let state = Self::CommitmentState { |
| 265 | mat, |
| 266 | ext_mat, |
| 267 | leaves, |
| 268 | }; |
| 269 | let mut leaves: Vec<C::Leaf> = |
| 270 | state.leaves.clone().into_iter().map(|h| h.into()).collect(); // TODO cfg_inter |
| 271 | let col_tree = create_merkle_tree::<C>( |
| 272 | &mut leaves, |
| 273 | ck.leaf_hash_param(), |
| 274 | ck.two_to_one_hash_param(), |
| 275 | )?; |
| 276 | |
| 277 | // 3. Obtain the MT root |
| 278 | let root = col_tree.root(); |
| 279 | |
| 280 | // 4. The commitment is just the root, but since each commitment could be to a differently-sized polynomial, we also add some metadata. |
| 281 | let commitment = LinCodePCCommitment { |
| 282 | metadata: Metadata { |
| 283 | n_rows, |
| 284 | n_cols, |
| 285 | n_ext_cols, |
nothing calls this directly
no test coverage detected