Skip to content

crypto: Trivial reuse of computed values in pairing helpers#1542

Merged
chfast merged 1 commit into
masterfrom
crypto/pairng_resuse
May 26, 2026
Merged

crypto: Trivial reuse of computed values in pairing helpers#1542
chfast merged 1 commit into
masterfrom
crypto/pairng_resuse

Conversation

@chfast
Copy link
Copy Markdown
Member

@chfast chfast commented May 25, 2026

This reuses already computed terms in trivial cases in pairing helpers.

91.4 → 92.2 (+0.83%) Mgas/s

This reuses already computed terms in trivial cases in pairing helpers.

91.4 → 92.2 (+0.83%) Mgas/s
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 optimizes BN254 pairing helper routines by reusing already-computed intermediate values to reduce redundant field arithmetic, improving precompile throughput.

Changes:

  • Reuse V = x0 * H_squared when computing Y3 in lin_func_and_add().
  • Avoid recomputing z0 * z0_squared for line coefficients by using z0_cubed directly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +409 to +410
t[0] = z0_cubed * x0 - U2 * z0_cubed;
t[1] = S2 * z0_squared - y0 * z0_squared;
Comment on lines +435 to +436
t[0] = z0_cubed * x0 - U2 * z0_cubed;
t[1] = S2 * z0_squared - y0 * z0_squared;
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.97%. Comparing base (61163aa) to head (fc20656).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1542   +/-   ##
=======================================
  Coverage   96.97%   96.97%           
=======================================
  Files         163      163           
  Lines       14455    14455           
  Branches     3385     3385           
=======================================
  Hits        14018    14018           
  Misses        307      307           
  Partials      130      130           
Flag Coverage Δ
eest-develop 91.94% <100.00%> (ø)
eest-develop-gmp 26.53% <100.00%> (ø)
eest-legacy 17.55% <0.00%> (ø)
eest-libsecp256k1 28.17% <100.00%> (ø)
eest-stable 91.85% <100.00%> (ø)
evmone-unittests 92.64% <100.00%> (ø)

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

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

@chfast chfast merged commit 8a68f96 into master May 26, 2026
24 checks passed
@chfast chfast deleted the crypto/pairng_resuse branch May 26, 2026 06:40
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