Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAS Branch: Improve Documentation and Variable Naming #441

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

b-wagn
Copy link
Contributor

@b-wagn b-wagn commented Jun 19, 2024

This PR aims to improve readability and documentation of the code in the das branch (this one).

The following has been done:

  • Function verify_cell_kzg_proof_batch: A comment was wrong (powers of r start at r^0).
  • Function verify_cell_kzg_proof: Comments and function documentation improved
  • Function verify_kzg_proof_multi_impl: Comments, documentation, variable names improved + minor code reordering

Copy link
Contributor

@asn-d6 asn-d6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Added some opinionated review comments. Can merge when those are resolved.

src/c_kzg_4844.c Outdated
if (ret != C_KZG_OK) goto out;

///////////////////////////////////////////////////////////////////////////
// STEP 2: Compute the vanishing polynomial V(X) (as a commitment in G_2).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use Z(x) for the vanishing since that's what the specs are using.

src/c_kzg_4844.c Outdated
blst_fr_eucl_inverse(&h_pow, &inv_h_pow);
g2_mul(&h_pow_g2, blst_p2_generator(), &h_pow);

/* Compute [s^n - h^n] in G_2 */
g2_sub(&s_pow_minus_h_pow, &s->g2_values_monomial[n], &h_pow_g2);
/* Compute [V(tau)] = [tau^n - h^n] in G_2 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight preference for s over tau because that's what many Ethereum-related documents have been using. It also looks a bit better in code docs because it's a single letter. No strong opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not want to use s because the KZGSettings are called s everywhere. But I can call it s if you think it makes sense. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable point. Let's keep it as tau. We can change it later if we want.

src/c_kzg_4844.c Outdated
@@ -3788,15 +3810,19 @@ C_KZG_RET verify_cell_kzg_proof(
if (ret != C_KZG_OK) goto out;
}

/* Calculate the input value */
/* Calculate the value x that identifies the coset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you are wrapping the lines a bit too early here? I don't remember if we have precise rules, but we can certainly go up to 80 columns.

Copy link
Contributor

@asn-d6 asn-d6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! LGTM!

@asn-d6 asn-d6 merged commit 3f4a7a4 into ethereum:das Jun 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants