Skip to content

Conversation

@chfast
Copy link
Member

@chfast chfast commented Jan 15, 2026

Add test vectors for:

  • Small even modulus: 12, 20, 24 (single-byte results)
  • Power-of-two modulus larger than 64 bits
  • Large even modulus: (2^320-1)*2^64 and (2^768-1)*2^320
  • Large base (48 bytes) with small even modulus (16 bytes)

These cases exercise:

  • Even modulus handling via Chinese Remainder Theorem
  • modinv_pow2 Newton-Raphson iteration
  • Montgomery multiplication with base >= mod

Add test vectors for:
- Small even modulus: 12, 20, 24 (single-byte results)
- Power-of-two modulus larger than 64 bits
- Large even modulus: (2^320-1)*2^64 and (2^768-1)*2^320
- Large base (48 bytes) with small even modulus (16 bytes)

These cases exercise:
- Even modulus handling via Chinese Remainder Theorem
- modinv_pow2 Newton-Raphson iteration
- Montgomery multiplication with base >= mod
Copilot AI review requested due to automatic review settings January 15, 2026 08:46
Copy link

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 adds comprehensive test vectors for modular exponentiation (modexp) to validate edge cases involving even moduli. The tests exercise the Chinese Remainder Theorem implementation, Newton-Raphson iteration for modular inverse with power-of-two moduli, and Montgomery multiplication with large bases.

Changes:

  • Added test vectors for small even moduli (12, 20, 24) with single-byte results
  • Added test for power-of-two modulus larger than 64 bits (2^96)
  • Added tests for large even moduli: (2^320-1)*2^64 and (2^768-1)*2^320
  • Added test for large base (48 bytes) with small even modulus (16 bytes)

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

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.68%. Comparing base (67adeb2) to head (961809e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1421      +/-   ##
==========================================
+ Coverage   81.64%   81.68%   +0.03%     
==========================================
  Files         152      152              
  Lines       13550    13578      +28     
  Branches     3217     3217              
==========================================
+ Hits        11063    11091      +28     
  Misses        343      343              
  Partials     2144     2144              
Flag Coverage Δ
eest-develop 91.10% <ø> (ø)
eest-develop-gmp 29.02% <0.00%> (-0.07%) ⬇️
eest-legacy 15.34% <0.00%> (-0.04%) ⬇️
eest-legacy-silkpre 24.37% <0.00%> (-0.06%) ⬇️
evmone-unittests 76.25% <100.00%> (+0.06%) ⬆️

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

Components Coverage Δ
core 94.38% <ø> (ø)
tooling 83.63% <ø> (ø)
tests 73.62% <100.00%> (+0.09%) ⬆️
Files with missing lines Coverage Δ
test/unittests/precompiles_expmod_test.cpp 96.21% <100.00%> (+0.67%) ⬆️
🚀 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