Skip to content

crypto: Declare the pairing arithmetic noexcept - #1642

Merged
chfast merged 1 commit into
masterfrom
crypto/pairing-noexcept
Aug 10, 2026
Merged

crypto: Declare the pairing arithmetic noexcept#1642
chfast merged 1 commit into
masterfrom
crypto/pairing-noexcept

Conversation

@chfast

@chfast chfast commented Aug 10, 2026

Copy link
Copy Markdown
Member

Thirteen definitions in the bn254 field and curve helpers omitted noexcept while
their neighbours carried it — six in pairing/bn254/utils.hpp
(is_on_twisted_curve, g2_subgroup_check, fq4_square, cyclotomic_square,
n_cyclotomic_square, cyclotomic_pow_to_X) and all seven multiply/sqr/inverse
overloads in pairing/bn254/fields.hpp.

None of them can throw, and the boundary above them already asserted as much:
ExtFieldElem::operator* and ExtFieldElem::inv() are noexcept and call
multiply(), sqr() and inverse(), which were not. This removes that mismatch.

The compiled binary is byte-identical to master (cmp reports no difference), so
there is nothing to measure. 1172/1172 unit tests pass.

🤖 Generated with Claude Code

None of the pairing field or curve helpers can throw, yet thirteen definitions
omitted noexcept while their neighbours carried it. The operator boundary already
asserted it: ExtFieldElem::operator* and inv() are noexcept and call multiply(),
sqr() and inverse(), which were not. Declare it where it was missing. The compiled
binary is byte-identical.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Declares BN254 field and curve helpers as non-throwing, aligning them with existing caller contracts.

Changes:

  • Adds noexcept to six pairing utilities.
  • Adds noexcept to seven field arithmetic functions.

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/utils.hpp Marks curve and cyclotomic helpers non-throwing.
lib/evmone_precompiles/pairing/bn254/fields.hpp Marks multiplication, squaring, and inversion non-throwing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chfast
chfast merged commit 7693eee into master Aug 10, 2026
14 of 22 checks passed
@chfast
chfast deleted the crypto/pairing-noexcept branch August 10, 2026 22:34
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.71%. Comparing base (155eb66) to head (bd3a9c5).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1642   +/-   ##
=======================================
  Coverage   97.71%   97.71%           
=======================================
  Files         171      171           
  Lines       15607    15607           
  Branches     3610     3610           
=======================================
  Hits        15251    15251           
  Misses        269      269           
  Partials       87       87           
Flag Coverage Δ
eest-develop 88.62% <ø> (ø)
eest-develop-gmp 26.53% <ø> (ø)
eest-legacy 17.15% <ø> (ø)
eest-libsecp256k1 28.83% <ø> (ø)
eest-stable 88.62% <ø> (ø)
evmone-unittests 93.42% <ø> (ø)

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

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

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