Skip to content

crypto: Share the seed addchain between the point and Fq12 powers - #1640

Draft
chfast wants to merge 1 commit into
masterfrom
crypto/share-seed-addchain
Draft

crypto: Share the seed addchain between the point and Fq12 powers#1640
chfast wants to merge 1 commit into
masterfrom
crypto/share-seed-addchain

Conversation

@chfast

@chfast chfast commented Aug 10, 2026

Copy link
Copy Markdown
Member

mul_by_X and cyclotomic_pow_to_X were the same 30-step addchain for the
curve seed X written twice, once over points and once over Fq12, with
identical temporaries and schedule. Express it once as pow_by_X,
parameterised by the squaring and the multiplication, with n_sqr replacing
the parallel n_dbl and n_cyclotomic_square.

The two chains agree step for step including operand order, and the shared
version was generated from mul_by_X's body so the steps could not drift.

Draft because it costs about 0.02%, the price of the indirection. The case
for taking it anyway is that an addchain is where a transcription slip is
invisible, and this code has already had one: #1636 fixed a term that #1542
had substituted in the sibling function and missed here. The case against
is trading concrete code for a generic template, where the names mul_by_X
and cyclotomic_pow_to_X document intent better than pow_by_X and lambdas.

🤖 Generated with Claude Code

mul_by_X and cyclotomic_pow_to_X were the same 30-step addchain for the curve seed
X written twice, once over points and once over Fq12, with identical temporaries and
schedule — checked to agree step for step including operand order. Express it once
as pow_by_X parameterised by the squaring and the multiplication, with n_sqr
replacing the parallel n_dbl and n_cyclotomic_square. Costs about 0.02% in
instructions, which is the price of the indirection.
@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 (87d8ade).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1640      +/-   ##
==========================================
- Coverage   97.71%   97.71%   -0.01%     
==========================================
  Files         171      171              
  Lines       15607    15578      -29     
  Branches     3610     3609       -1     
==========================================
- Hits        15251    15222      -29     
  Misses        269      269              
  Partials       87       87              
Flag Coverage Δ
eest-develop 88.57% <100.00%> (-0.06%) ⬇️
eest-develop-gmp 26.39% <100.00%> (-0.14%) ⬇️
eest-legacy 17.19% <0.00%> (+0.03%) ⬆️
eest-libsecp256k1 28.70% <100.00%> (-0.14%) ⬇️
eest-stable 88.57% <100.00%> (-0.06%) ⬇️
evmone-unittests 93.41% <100.00%> (-0.02%) ⬇️

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

Components Coverage Δ
core 96.08% <100.00%> (-0.03%) ⬇️
tooling 91.92% <ø> (ø)
tests 99.80% <ø> (ø)
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.

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.

1 participant