crypto: Declare the pairing arithmetic noexcept - #1642
Merged
Conversation
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.
There was a problem hiding this comment.
Pull request overview
Declares BN254 field and curve helpers as non-throwing, aligning them with existing caller contracts.
Changes:
- Adds
noexceptto six pairing utilities. - Adds
noexceptto 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Thirteen definitions in the bn254 field and curve helpers omitted
noexceptwhiletheir 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 sevenmultiply/sqr/inverseoverloads in
pairing/bn254/fields.hpp.None of them can throw, and the boundary above them already asserted as much:
ExtFieldElem::operator*andExtFieldElem::inv()arenoexceptand callmultiply(),sqr()andinverse(), which were not. This removes that mismatch.The compiled binary is byte-identical to master (
cmpreports no difference), sothere is nothing to measure. 1172/1172 unit tests pass.
🤖 Generated with Claude Code