crypto: Fix incorrect docstrings in BN254 and KZG pairing helpers#1548
Merged
Conversation
- pairing.cpp: the sparse Fq12 line value matrix had [1][1] = t[0], but the body of multiply_by_lin_func_value uses t[2]. Symbolic expansion (treating v = t[0]·y + t[1]·x·w + t[2]·v·w) confirms t[2] is correct. - kzg.cpp: blst_aggregated_in_g1 was claimed to use precomputed Miller-loop lines for the G2 generator. It does not: it calls miller_loop_n(ret, &BLS12_381_G2, sig, 1) on the fly. Reword the comment and add a TODO to precompute G2_GEN lines, matching the existing [s]₂ path.
6403e60 to
cfdd3cc
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1548 +/- ##
=======================================
Coverage 96.97% 96.97%
=======================================
Files 163 163
Lines 14444 14444
Branches 3382 3382
=======================================
Hits 14007 14007
Misses 307 307
Partials 130 130
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR corrects crypto-related documentation/comments so they accurately describe the underlying BN254 pairing helper math and the BLS12-381 KZG pairing helper implementation.
Changes:
- BN254: Fix the sparse Fq12 “line function value” docstring to match the implementation’s use of
t[2]. - KZG: Reword the
blst_aggregated_in_g1()comment to reflect that it runs against the G2 generator without using precomputed Miller-loop lines, and add a TODO to precompute those lines.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/evmone_precompiles/pairing/bn254/pairing.cpp | Updates the docstring for multiply_by_lin_func_value() to match actual coefficient usage (t[2]). |
| lib/evmone_precompiles/kzg.cpp | Updates pairing verification comments and adds a TODO regarding precomputing G2 generator Miller-loop lines. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pairing.cpp: the sparse Fq12 line value matrix had [1][1] = t[0], but the body of multiply_by_lin_func_value uses t[2]. Symbolic expansion (treating v = t[0]·y + t[1]·x·w + t[2]·v·w) confirms t[2] is correct.
kzg.cpp: blst_aggregated_in_g1 was claimed to use precomputed Miller-loop lines for the G2 generator. It does not: it calls miller_loop_n(ret, &BLS12_381_G2, sig, 1) on the fly. Reword the comment and add a TODO to precompute G2_GEN lines, matching the existing [s]₂ path.