Skip to content

feat: add math cairo tests under vm/src/tests/cairo_test_suite#2379

Open
naor-starkware wants to merge 14 commits intonaor/refactor/Makefile-include-test_cairo_suite_targetfrom
naor/feat/add_math_cairo_test
Open

feat: add math cairo tests under vm/src/tests/cairo_test_suite#2379
naor-starkware wants to merge 14 commits intonaor/refactor/Makefile-include-test_cairo_suite_targetfrom
naor/feat/add_math_cairo_test

Conversation

@naor-starkware
Copy link
Copy Markdown
Collaborator

@naor-starkware naor-starkware commented Mar 29, 2026

TITLE

Description

Description of the pull request changes and motivation.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

This change is Reviewable

Copy link
Copy Markdown
Collaborator Author

naor-starkware commented Mar 29, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.096 ± 0.017 2.080 2.128 1.00 ± 0.02
head big_factorial 2.095 ± 0.030 2.075 2.168 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.020 ± 0.011 2.012 2.049 1.00 ± 0.01
head big_fibonacci 2.017 ± 0.006 2.010 2.028 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.404 ± 0.133 7.297 7.729 1.01 ± 0.02
head blake2s_integration_benchmark 7.358 ± 0.085 7.291 7.579 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.151 ± 0.019 2.137 2.198 1.01 ± 0.01
head compare_arrays_200000 2.140 ± 0.014 2.115 2.162 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.404 ± 0.006 1.397 1.415 1.00
head dict_integration_benchmark 1.413 ± 0.010 1.402 1.437 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.214 ± 0.004 1.208 1.220 1.00
head field_arithmetic_get_square_benchmark 1.215 ± 0.004 1.207 1.219 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.475 ± 0.086 7.414 7.703 1.00 ± 0.01
head integration_builtins 7.438 ± 0.051 7.392 7.565 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.561 ± 0.134 7.491 7.937 1.01 ± 0.02
head keccak_integration_benchmark 7.518 ± 0.016 7.479 7.535 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.123 ± 0.015 2.112 2.160 1.00
head linear_search 2.123 ± 0.020 2.108 2.170 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.465 ± 0.008 1.459 1.488 1.00 ± 0.01
head math_cmp_and_pow_integration_benchmark 1.465 ± 0.012 1.452 1.496 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.441 ± 0.013 1.431 1.471 1.00
head math_integration_benchmark 1.462 ± 0.080 1.432 1.689 1.01 ± 0.06
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.192 ± 0.003 1.187 1.196 1.00
head memory_integration_benchmark 1.195 ± 0.010 1.188 1.221 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.519 ± 0.004 1.514 1.527 1.00
head operations_with_data_structures_benchmarks 1.522 ± 0.008 1.514 1.538 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 527.5 ± 1.0 526.0 529.0 1.00
head pedersen 528.9 ± 2.5 526.6 534.6 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 601.5 ± 2.8 599.2 609.1 1.00 ± 0.01
head poseidon_integration_benchmark 600.9 ± 2.6 598.6 607.5 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.796 ± 0.007 1.788 1.813 1.00
head secp_integration_benchmark 1.797 ± 0.008 1.786 1.810 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 654.7 ± 1.4 652.2 656.0 1.00
head set_integration_benchmark 655.9 ± 2.4 653.4 661.5 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.193 ± 0.023 4.173 4.249 1.00
head uint256_integration_benchmark 4.194 ± 0.021 4.162 4.247 1.00 ± 0.01

@naor-starkware naor-starkware changed the base branch from naor/feat/add_test_helpers to graphite-base/2379 March 29, 2026 13:00
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from 421425b to 981fce6 Compare March 29, 2026 13:01
@naor-starkware naor-starkware changed the base branch from graphite-base/2379 to naor/refactor/Makefile-include-test_cairo_suite_target March 29, 2026 13:01
@naor-starkware naor-starkware force-pushed the naor/refactor/Makefile-include-test_cairo_suite_target branch from 646dd9e to 2bc600b Compare March 29, 2026 13:13
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from 981fce6 to 4e1af25 Compare March 29, 2026 13:13
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.07%. Comparing base (f0bb2d0) to head (d6a6c58).

Additional details and impacted files
@@                                   Coverage Diff                                   @@
##           naor/refactor/Makefile-include-test_cairo_suite_target    #2379   +/-   ##
=======================================================================================
  Coverage                                                   96.07%   96.07%           
=======================================================================================
  Files                                                         107      107           
  Lines                                                       37852    37852           
=======================================================================================
  Hits                                                        36366    36366           
  Misses                                                       1486     1486           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

naor-starkware added a commit that referenced this pull request Mar 29, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from 4e1af25 to fa0fe77 Compare March 29, 2026 14:19
@naor-starkware naor-starkware force-pushed the naor/refactor/Makefile-include-test_cairo_suite_target branch from 2bc600b to 6fd8964 Compare March 29, 2026 14:19
naor-starkware added a commit that referenced this pull request Mar 29, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from fa0fe77 to fd27b62 Compare March 29, 2026 16:11
@naor-starkware naor-starkware force-pushed the naor/refactor/Makefile-include-test_cairo_suite_target branch 2 times, most recently from c106a57 to 106cbb4 Compare March 30, 2026 08:43
naor-starkware added a commit that referenced this pull request Mar 30, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/refactor/Makefile-include-test_cairo_suite_target branch from 106cbb4 to ff56720 Compare March 30, 2026 09:32
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from fd27b62 to 1e0b48e Compare March 30, 2026 09:32
@naor-starkware naor-starkware marked this pull request as ready for review March 30, 2026 10:35
naor-starkware added a commit that referenced this pull request Apr 6, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
naor-starkware added a commit that referenced this pull request Apr 6, 2026
…test_suite

Also fix duplicate and stale CHANGELOG entries for PRs #2377-#2379.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from 1e0b48e to fd5cce6 Compare April 6, 2026 09:53
@naor-starkware naor-starkware force-pushed the naor/refactor/Makefile-include-test_cairo_suite_target branch from ff56720 to 6c03214 Compare April 6, 2026 09:53
naor-starkware added a commit that referenced this pull request Apr 6, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/refactor/Makefile-include-test_cairo_suite_target branch from 6c03214 to d11f204 Compare April 6, 2026 20:35
naor-starkware added a commit that referenced this pull request Apr 6, 2026
…test_suite

Also fix duplicate and stale CHANGELOG entries for PRs #2377-#2379.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from fd5cce6 to 985c1fe Compare April 6, 2026 20:35
@naor-starkware naor-starkware changed the base branch from naor/refactor/Makefile-include-test_cairo_suite_target to graphite-base/2379 April 6, 2026 20:49
naor-starkware added a commit that referenced this pull request Apr 7, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
naor-starkware added a commit that referenced this pull request Apr 7, 2026
…test_suite

Also fix duplicate and stale CHANGELOG entries for PRs #2377-#2379.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from 985c1fe to f0f279f Compare April 7, 2026 07:11
@naor-starkware naor-starkware changed the base branch from graphite-base/2379 to naor/refactor/Makefile-include-test_cairo_suite_target April 7, 2026 07:11
naor-starkware and others added 14 commits April 9, 2026 12:43
- Create cairo_test_suite module skeleton (mod.rs, test_math/mod.rs)
- Add main_math_test.cairo stub (imports all math.cairo functions)
- Add math_test_utils.rs (RC_BOUND, MAX_DIV, is_quad_residue_mod_prime)
- Move test_math_cairo.rs from cairo_test_suite/, update all imports
  - cairo_vm:: → crate:: for all internal paths
  - crate::error_utils → crate::test_helpers::error_utils
  - cairo_function_runner → function_runner module path
  - Fix 5x runner.runner.vm → runner.vm (old struct design remnant)
- Register cairo_test_suite mod behind function_runner feature

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- new() → new_for_testing() (type alias has no 1-arg constructor)
- runner.get_return_values() → runner.vm.get_return_values() (method is on VirtualMachine)
- Add missing macro imports: assert_mr_eq! and load_cairo_program!

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rename main_math_test.cairo → math_test.cairo for clarity.
Add `from starkware.cairo.common.math_utils import horner_eval` so the
compiled JSON includes horner_eval (used in test_horner_eval).
Update the load_cairo_program! call to reference math_test.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add missing assert_not_nullptr, safe_div, safe_mult.
Move horner_eval and assert_is_power_of_2 into the math.cairo import
block (both are defined there, not in math_utils).
Match declaration order to match math.cairo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove isize from MaybeRelocatable tuple literals (inferred from From impl)
- Remove usize from add_usize() calls (inferred from param type)
- Remove _i64 suffixes in split_int cases (inferred from param types)
- Remove usize from shift/bit operations
- Use type annotation on variable instead of inline i64 suffixes on literals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…test_suite

Also fix duplicate and stale CHANGELOG entries for PRs #2377-#2379.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CairoFunctionRunner type alias was removed, use CairoRunner directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@naor-starkware naor-starkware force-pushed the naor/feat/add_math_cairo_test branch from f0f279f to d6a6c58 Compare April 9, 2026 09:46
@naor-starkware naor-starkware force-pushed the naor/refactor/Makefile-include-test_cairo_suite_target branch from b2799c2 to f0bb2d0 Compare April 9, 2026 09:46
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