Skip to content

crypto: Fix incorrect docstrings in BN254 and KZG pairing helpers#1548

Merged
chfast merged 1 commit into
masterfrom
crypto/doc-cleanup
May 27, 2026
Merged

crypto: Fix incorrect docstrings in BN254 and KZG pairing helpers#1548
chfast merged 1 commit into
masterfrom
crypto/doc-cleanup

Conversation

@chfast
Copy link
Copy Markdown
Member

@chfast chfast commented May 26, 2026

  • 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.

- 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.
@chfast chfast force-pushed the crypto/doc-cleanup branch from 6403e60 to cfdd3cc Compare May 26, 2026 22:11
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.97%. Comparing base (47e5f9d) to head (cfdd3cc).

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           
Flag Coverage Δ
eest-develop 91.93% <ø> (ø)
eest-develop-gmp 26.50% <ø> (ø)
eest-legacy 17.57% <ø> (ø)
eest-libsecp256k1 28.15% <ø> (ø)
eest-stable 91.86% <ø> (ø)
evmone-unittests 92.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 96.01% <ø> (ø)
tooling 86.71% <ø> (ø)
tests 99.79% <ø> (ø)
Files with missing lines Coverage Δ
lib/evmone_precompiles/kzg.cpp 100.00% <ø> (ø)
lib/evmone_precompiles/pairing/bn254/pairing.cpp 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@chfast chfast merged commit ba23ad1 into master May 27, 2026
24 checks passed
@chfast chfast deleted the crypto/doc-cleanup branch May 27, 2026 06:11
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.

2 participants