Rename poly_from_blob to match spec (#72)

This commit is contained in:
Justin Traglia 2023-01-18 15:46:28 -06:00 committed by GitHub
parent ac3c829727
commit 549054a5de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -996,7 +996,7 @@ static C_KZG_RET poly_to_kzg_commitment(g1_t *out, const Polynomial *p, const KZ
return g1_lincomb(out, s->g1_values, (const fr_t *)(&p->evals), FIELD_ELEMENTS_PER_BLOB); return g1_lincomb(out, s->g1_values, (const fr_t *)(&p->evals), FIELD_ELEMENTS_PER_BLOB);
} }
static C_KZG_RET poly_from_blob(Polynomial *p, const Blob *blob) { static C_KZG_RET blob_to_polynomial(Polynomial *p, const Blob *blob) {
C_KZG_RET ret; C_KZG_RET ret;
for (size_t i = 0; i < FIELD_ELEMENTS_PER_BLOB; i++) { for (size_t i = 0; i < FIELD_ELEMENTS_PER_BLOB; i++) {
ret = bytes_to_bls_field(&p->evals[i], &blob->bytes[i * BYTES_PER_FIELD_ELEMENT]); ret = bytes_to_bls_field(&p->evals[i], &blob->bytes[i * BYTES_PER_FIELD_ELEMENT]);
@ -1010,7 +1010,7 @@ C_KZG_RET blob_to_kzg_commitment(KZGCommitment *out, const Blob *blob, const KZG
Polynomial p; Polynomial p;
g1_t commitment; g1_t commitment;
ret = poly_from_blob(&p, blob); ret = blob_to_polynomial(&p, blob);
if (ret != C_KZG_OK) return ret; if (ret != C_KZG_OK) return ret;
ret = poly_to_kzg_commitment(&commitment, &p, s); ret = poly_to_kzg_commitment(&commitment, &p, s);
if (ret != C_KZG_OK) return ret; if (ret != C_KZG_OK) return ret;
@ -1301,7 +1301,7 @@ C_KZG_RET compute_aggregate_kzg_proof(KZGProof *out,
} }
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
ret = poly_from_blob(&polys[i], &blobs[i]); ret = blob_to_polynomial(&polys[i], &blobs[i]);
if (ret != C_KZG_OK) goto out; if (ret != C_KZG_OK) goto out;
ret = poly_to_kzg_commitment(&commitments[i], &polys[i], s); ret = poly_to_kzg_commitment(&commitments[i], &polys[i], s);
if (ret != C_KZG_OK) goto out; if (ret != C_KZG_OK) goto out;
@ -1353,7 +1353,7 @@ C_KZG_RET verify_aggregate_kzg_proof(bool *out,
for (size_t i = 0; i < n; i++) { for (size_t i = 0; i < n; i++) {
ret = bytes_to_g1(&commitments[i], (uint8_t *)(&expected_kzg_commitments[i])); ret = bytes_to_g1(&commitments[i], (uint8_t *)(&expected_kzg_commitments[i]));
if (ret != C_KZG_OK) goto out; if (ret != C_KZG_OK) goto out;
ret = poly_from_blob(&polys[i], &blobs[i]); ret = blob_to_polynomial(&polys[i], &blobs[i]);
if (ret != C_KZG_OK) goto out; if (ret != C_KZG_OK) goto out;
} }