Skip to content

precompiles: Implement expmod with GMP #1198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chfast
Copy link
Member

@chfast chfast commented Apr 14, 2025

No description provided.

@chfast chfast added precompiles Related to EVM precompiles has_dependencies PR depends on not merged yet PR labels Apr 14, 2025
@chfast chfast force-pushed the precompiles/expmod_gmp branch from 592d65b to 9e8c99a Compare April 14, 2025 16:53
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.79%. Comparing base (48c2d63) to head (b134080).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1198      +/-   ##
==========================================
- Coverage   94.84%   94.79%   -0.05%     
==========================================
  Files         171      172       +1     
  Lines       19501    19515      +14     
==========================================
+ Hits        18496    18500       +4     
- Misses       1005     1015      +10     
Flag Coverage Δ
eest_gmp 15.41% <100.00%> (?)
eof_execution_spec_tests 2.56% <0.00%> (ø)
ethereum_tests 21.07% <100.00%> (ø)
ethereum_tests_silkpre 18.23% <100.00%> (+0.08%) ⬆️
execution_spec_tests 18.24% <100.00%> (ø)
unittests 92.52% <100.00%> (ø)

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

Files with missing lines Coverage Δ
test/state/precompiles.cpp 99.05% <100.00%> (ø)
test/state/precompiles_gmp.cpp 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chfast chfast force-pushed the precompiles/expmod_input branch 2 times, most recently from e015ea5 to 36e817f Compare April 15, 2025 10:32
Base automatically changed from precompiles/expmod_input to master April 15, 2025 10:50
@chfast chfast force-pushed the precompiles/expmod_gmp branch from 9e8c99a to 647213b Compare April 15, 2025 12:01
@chfast chfast removed the has_dependencies PR depends on not merged yet PR label Apr 15, 2025
@chfast chfast requested a review from rodiazet April 15, 2025 12:02
@@ -72,3 +72,16 @@ if(EVMONE_PRECOMPILES_SILKPRE)
precompiles_silkpre.cpp
)
endif()

# This is done after Silkpre because it also tries to find GMP.
option(EVMONE_PRECOMPILES_GMP "Enable precompiles implementations via the GMP/MPIR library" ON)
Copy link
Member Author

Choose a reason for hiding this comment

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

On by default seems to cause a lot of build issues. Maybe use the same strategy as with SILKPRE (OFF by default).

@@ -72,3 +72,16 @@ if(EVMONE_PRECOMPILES_SILKPRE)
precompiles_silkpre.cpp
)
endif()

# This is done after Silkpre because it also tries to find GMP.
Copy link
Member Author

Choose a reason for hiding this comment

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

SILKPRE option stays for benchmarking purposes only.

mpz_import(b, base.size(), 1, 1, 0, 0, base.data());
mpz_import(e, exp.size(), 1, 1, 0, 0, exp.data());
mpz_import(m, mod.size(), 1, 1, 0, 0, mod.data());
assert(mpz_sgn(m) != 0);
Copy link
Member Author

Choose a reason for hiding this comment

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

I should document in the expmod_xxx interface that the mod is expected non-zero.

@chfast chfast force-pushed the precompiles/expmod_gmp branch from 647213b to b134080 Compare April 16, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
precompiles Related to EVM precompiles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants