Skip to content
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

feat: modexp precompile 384 bits #1513

Merged
merged 20 commits into from
Nov 12, 2024

Conversation

tekkac
Copy link
Contributor

@tekkac tekkac commented Oct 19, 2024

Time spent on this PR:

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Running 8 test(s) from src/
[PASS] evm::precompiles::modexp::tests::test_modexp_berlin_empty_input (gas: ~133)
[PASS] evm::precompiles::modexp::tests::test_modexp_eip198_example_1 (gas: ~635)
[PASS] evm::precompiles::modexp::tests::test_modexp_circuit (gas: ~544)
[PASS] evm::precompiles::modexp::tests::test_modexp_edge_case_circuit (gas: ~9)
[PASS] evm::precompiles::modexp::tests::test_modexp_eip198_example_2 (gas: ~312)
[PASS] evm::precompiles::modexp::tests::test_modexp_precompile_input_output_worst (gas: ~953)
[PASS] evm::precompiles::modexp::tests::test_modexp_circuit_worst_case (gas: ~953)
[PASS] evm::precompiles::modexp::tests::test_modexp_precompile_input_output_all_sizes (gas: ~22497)

Resolves #1496

What is the new behavior?

  • modexp precompiled implemented with circuit up to 384 bits (48 bytes)
  • passes basic tests and some EIP test vectors
  • Custom input output needed because of non-standard integer types from circuits.

This change is Reviewable

Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

great :)

cairo/kakarot-ssj/crates/evm/src/precompiles/modexp.cairo Outdated Show resolved Hide resolved
cairo/kakarot-ssj/crates/evm/src/precompiles/modexp.cairo Outdated Show resolved Hide resolved
cairo/kakarot-ssj/crates/evm/src/precompiles/modexp.cairo Outdated Show resolved Hide resolved
@Eikix
Copy link
Member

Eikix commented Oct 28, 2024

Why are ef-tests failing?

@tekkac
Copy link
Contributor Author

tekkac commented Oct 30, 2024

Why are ef-tests failing?

passing now after updating branch

@enitrat
Copy link
Collaborator

enitrat commented Oct 31, 2024

thanks, will do a second pass soon

@enitrat enitrat requested a review from obatirou November 5, 2024 17:24
enitrat
enitrat previously approved these changes Nov 9, 2024
Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

perfect now 💯

matthieuauger pushed a commit to matthieuauger/kakarot that referenced this pull request Nov 9, 2024
Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.5%. Comparing base (474951c) to head (4572dc5).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1513     +/-   ##
=======================================
- Coverage   63.6%   63.5%   -0.1%     
=======================================
  Files         44      44             
  Lines       8332    8332             
=======================================
- Hits        5301    5298      -3     
- Misses      3031    3034      +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

Choose a reason for hiding this comment

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

can do a follow up PR, but in a second thought we said that we could move these tests to end to end to make direct call to the precompile, instead of unit with generated data.

Copy link
Member

@ClementWalter ClementWalter left a comment

Choose a reason for hiding this comment

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

I'm fine with merging as is if it's all ✅ and do follow up PRs for

@ClementWalter ClementWalter merged commit 5b174f4 into kkrt-labs:main Nov 12, 2024
14 of 15 checks passed
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.

dev: modexp
5 participants