Skip to content

Bump cairo-lang to 0.13.5 #1959

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

Merged
merged 13 commits into from
May 8, 2025
Merged

Bump cairo-lang to 0.13.5 #1959

merged 13 commits into from
May 8, 2025

Conversation

JulianGCalderon
Copy link
Contributor

@JulianGCalderon JulianGCalderon commented Feb 17, 2025

Bump cairo-lang to 0.13.5

Updates the hint definitions to match the updated versions. The only difference is that the hints now use PRIME instead of SECP256R1_P when packing.

I also modified the implementation to work for both PRIME and SECP256R1_P. Do do this, I created a new math utility: pack86_for_prime. It works just like pack86, but it receives the prime to use, rather than asume that we always use the Cairo prime.

Added tests for negative points, for all updated hints.

Hint Differences

SECP_R1_GET_POINT_FROM_X:

<     x=pack(ids.x, SECP256R1.prime),
>     x=pack(ids.x, PRIME),

SECP_DOUBLE_ASSIGN_NEW_X

< slope = pack(ids.slope, SECP256R1_P)
< x = pack(ids.point.x, SECP256R1_P)
< y = pack(ids.point.y, SECP256R1_P)
---
> slope = pack(ids.slope, PRIME)
> x = pack(ids.point.x, PRIME)
> y = pack(ids.point.y, PRIME)

EC_DOUBLE_SLOPE

< x = pack(ids.point.x, SECP256R1_P)
< y = pack(ids.point.y, SECP256R1_P)
---
> x = pack(ids.point.x, PRIME)
> y = pack(ids.point.y, PRIME)

Copy link

github-actions bot commented Feb 17, 2025

**Hyper Thereading Benchmark results**




hyperfine -r 2 -n "hyper_threading_main threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_main' -n "hyper_threading_pr threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 1
  Time (mean ± σ):     26.154 s ±  0.094 s    [User: 25.388 s, System: 0.762 s]
  Range (min … max):   26.088 s … 26.221 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     26.262 s ±  0.040 s    [User: 25.528 s, System: 0.730 s]
  Range (min … max):   26.233 s … 26.290 s    2 runs
 
Summary
  hyper_threading_main threads: 1 ran
    1.00 ± 0.00 times faster than hyper_threading_pr threads: 1




hyperfine -r 2 -n "hyper_threading_main threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_main' -n "hyper_threading_pr threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 2
  Time (mean ± σ):     14.515 s ±  0.024 s    [User: 25.381 s, System: 0.796 s]
  Range (min … max):   14.498 s … 14.532 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.526 s ±  0.012 s    [User: 25.579 s, System: 0.785 s]
  Range (min … max):   14.517 s … 14.534 s    2 runs
 
Summary
  hyper_threading_main threads: 2 ran
    1.00 ± 0.00 times faster than hyper_threading_pr threads: 2




hyperfine -r 2 -n "hyper_threading_main threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_main' -n "hyper_threading_pr threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 4
  Time (mean ± σ):     10.596 s ±  0.055 s    [User: 37.755 s, System: 0.947 s]
  Range (min … max):   10.558 s … 10.635 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.140 s ±  0.079 s    [User: 38.214 s, System: 0.978 s]
  Range (min … max):   10.084 s … 10.196 s    2 runs
 
Summary
  hyper_threading_pr threads: 4 ran
    1.04 ± 0.01 times faster than hyper_threading_main threads: 4




hyperfine -r 2 -n "hyper_threading_main threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_main' -n "hyper_threading_pr threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 6
  Time (mean ± σ):     10.428 s ±  0.226 s    [User: 37.756 s, System: 0.961 s]
  Range (min … max):   10.268 s … 10.588 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.561 s ±  0.254 s    [User: 37.893 s, System: 0.989 s]
  Range (min … max):   10.382 s … 10.740 s    2 runs
 
Summary
  hyper_threading_main threads: 6 ran
    1.01 ± 0.03 times faster than hyper_threading_pr threads: 6




hyperfine -r 2 -n "hyper_threading_main threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_main' -n "hyper_threading_pr threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 8
  Time (mean ± σ):     10.327 s ±  0.177 s    [User: 38.181 s, System: 1.005 s]
  Range (min … max):   10.202 s … 10.453 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.473 s ±  0.061 s    [User: 38.026 s, System: 0.967 s]
  Range (min … max):   10.430 s … 10.516 s    2 runs
 
Summary
  hyper_threading_main threads: 8 ran
    1.01 ± 0.02 times faster than hyper_threading_pr threads: 8




hyperfine -r 2 -n "hyper_threading_main threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_main' -n "hyper_threading_pr threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 16
  Time (mean ± σ):     10.224 s ±  0.008 s    [User: 38.562 s, System: 1.101 s]
  Range (min … max):   10.218 s … 10.230 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.279 s ±  0.071 s    [User: 38.726 s, System: 1.072 s]
  Range (min … max):   10.229 s … 10.329 s    2 runs
 
Summary
  hyper_threading_main threads: 16 ran
    1.01 ± 0.01 times faster than hyper_threading_pr threads: 16


Copy link

github-actions bot commented Feb 17, 2025

Benchmark Results for modified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
head big_factorial 2.156 ± 0.028 2.127 2.215 1.00
Command Mean [s] Min [s] Max [s] Relative
head big_fibonacci 2.102 ± 0.025 2.082 2.166 1.00
Command Mean [s] Min [s] Max [s] Relative
head blake2s_integration_benchmark 7.896 ± 0.050 7.818 7.956 1.00
Command Mean [s] Min [s] Max [s] Relative
head compare_arrays_200000 2.227 ± 0.008 2.215 2.243 1.00
Command Mean [s] Min [s] Max [s] Relative
head dict_integration_benchmark 1.430 ± 0.003 1.426 1.435 1.00
Command Mean [s] Min [s] Max [s] Relative
head field_arithmetic_get_square_benchmark 1.248 ± 0.016 1.231 1.291 1.00
Command Mean [s] Min [s] Max [s] Relative
head integration_builtins 7.963 ± 0.109 7.864 8.256 1.00
Command Mean [s] Min [s] Max [s] Relative
head keccak_integration_benchmark 8.209 ± 0.073 8.145 8.395 1.00
Command Mean [s] Min [s] Max [s] Relative
head linear_search 2.214 ± 0.015 2.191 2.236 1.00
Command Mean [s] Min [s] Max [s] Relative
head math_cmp_and_pow_integration_benchmark 1.539 ± 0.017 1.525 1.574 1.00
Command Mean [s] Min [s] Max [s] Relative
head math_integration_benchmark 1.473 ± 0.007 1.463 1.489 1.00
Command Mean [s] Min [s] Max [s] Relative
head memory_integration_benchmark 1.230 ± 0.007 1.221 1.243 1.00
Command Mean [s] Min [s] Max [s] Relative
head operations_with_data_structures_benchmarks 1.593 ± 0.006 1.585 1.601 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
head pedersen 538.0 ± 2.1 535.4 542.4 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
head poseidon_integration_benchmark 630.3 ± 6.7 623.9 646.5 1.00
Command Mean [s] Min [s] Max [s] Relative
head secp_integration_benchmark 1.892 ± 0.008 1.881 1.906 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
head set_integration_benchmark 679.4 ± 1.8 676.3 683.5 1.00
Command Mean [s] Min [s] Max [s] Relative
head uint256_integration_benchmark 4.333 ± 0.022 4.304 4.372 1.00

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.65%. Comparing base (10b3dd9) to head (10db096).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1959      +/-   ##
==========================================
+ Coverage   96.58%   96.65%   +0.07%     
==========================================
  Files         102      103       +1     
  Lines       42924    43544     +620     
==========================================
+ Hits        41456    42089     +633     
+ Misses       1468     1455      -13     

☔ 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.

@gabrielbosio gabrielbosio mentioned this pull request Feb 21, 2025
6 tasks
@JulianGCalderon JulianGCalderon changed the title Bump cairo-lang to 0.13.4a1 Bump cairo-lang to 0.13.5 May 5, 2025
@JulianGCalderon JulianGCalderon force-pushed the fix-bug-in-os-hint branch 2 times, most recently from 7d43ddc to 55ccd7c Compare May 5, 2025 20:42
@JulianGCalderon JulianGCalderon marked this pull request as ready for review May 5, 2025 21:22
@JulianGCalderon JulianGCalderon marked this pull request as draft May 5, 2025 21:46
@JulianGCalderon JulianGCalderon marked this pull request as ready for review May 6, 2025 15:40
gabrielbosio
gabrielbosio previously approved these changes May 6, 2025
@gabrielbosio gabrielbosio dismissed their stale review May 6, 2025 21:49

The implementation of this function must change to match new versions of the hint.

@FrancoGiachetta FrancoGiachetta added this pull request to the merge queue May 8, 2025
Merged via the queue into main with commit b5f3a3a May 8, 2025
93 checks passed
@FrancoGiachetta FrancoGiachetta deleted the fix-bug-in-os-hint branch May 8, 2025 14:17
gabrielbosio pushed a commit that referenced this pull request May 21, 2025
* Update cairo-lang versin

* Update changelog

* Add new hints

* Specify prime in new hints

* Only apply mod floor if prime is not CAIRO_PRIME

* Properly implement pack for a different prime

* Fix pack in compute_doubling_slope

* Add negative_points.cairo test

* Add try_get_point_from_x for negative points

* Add double_x test for negative points

* Allow to many arguments

* Add codecov to cairo-0-secp-hints feature
gabrielbosio added a commit that referenced this pull request Jun 4, 2025
* Remove duplicated `get_val` (#2065)

* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file

* CI: Make cache keys depend on Cairo version (#2056)

* Add Makefile and requirements.txt to cache key

* Don't fetch cairo stwo exclusive programs

* Remove empty file

* Restrict caching Cairo programs

Revert how the Rust workflow uses the Cairo program paths to
calculate the cache keys.
This change would imply the branch only adds Makefile and
requirements.txt to the cache key computation.

---------

Co-authored-by: gabrielbosio <[email protected]>
Co-authored-by: Gabriel Bosio <[email protected]>

* dev: make Memory::get `pub` (#2039)

* dev: make Memory::get `pub`

* edit changelog

* dev: expose get_maybe_relocatable instead

* add comment on borrowed variant

* add tests

* feat(breaking): add support for hint accessible scopes (#2042)

* feat: add support for hint accessible scopes

update changelog

* Update vm/src/hint_processor/hint_processor_definition.rs

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* feat: add support for alias identifiers destination in program serde (#2071)

* feat: add support for aliases destination in program serde

* add changelog

---------

Co-authored-by: Julián González Calderón <[email protected]>

* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils (#2062)

* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils

* Update secp_utils.rs

* Update CHANGELOG.md

* Update secp_utils.rs

* remove optimizations

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* empty commit to fix CI

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* docs: add --run_from_cairo_pie documentation for Cairo 0 and Cairo 1 (#2077)

* docs: add --run_from_cairo_pie flag usage documentation for Cairo 0

* docs: add --run_from_cairo_pie flag usage documentation for Cairo 1

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* Update README.md

* Update README.md

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Co-authored-by: Gabriel Bosio <[email protected]>

* Fix WRITE_DIVMOD_SEGMENT hint (#2078)

* Minor fixes - use CAIRO_PRIME

* Add error handling

* Update CHANGELOG.md

* Bump cairo-lang to 0.13.5 (#1959)

* Update cairo-lang versin

* Update changelog

* Add new hints

* Specify prime in new hints

* Only apply mod floor if prime is not CAIRO_PRIME

* Properly implement pack for a different prime

* Fix pack in compute_doubling_slope

* Add negative_points.cairo test

* Add try_get_point_from_x for negative points

* Add double_x test for negative points

* Allow to many arguments

* Add codecov to cairo-0-secp-hints feature

* Prepare for Release v3.0.0-rc.1 (#2092)

* Update version

* Update lock

* Update toolchain

* Update changelog

* Fix clippy

* Update toolchain in CI

* fix: correct cache keys for no-std test coverage in CI (#2093)

* Update rust.yml

* Update rust.yml

* Update rust toolchain to 1.87.0 (#2100)

* update rust toolchain to 1.87.0

* remove uneeded file

* update rust in workflows

* update changelog

* clippy

* clippy

* remove unneeded clippy allow

* fix Changelog link (#2104)

* Improve memory_segments coverage (#2110)

* Add tests for .gen_arg() and .write_arg()

* Add test for .is_valid_memory_value()

* Assert contents of memory segments

---------

Co-authored-by: Franco Giachetta <[email protected]>
Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Co-authored-by: Mathieu <[email protected]>
Co-authored-by: VolodymyrBg <[email protected]>
Co-authored-by: GarmashAlex <[email protected]>
Co-authored-by: crStiv <[email protected]>
Co-authored-by: DiegoC <[email protected]>
gabrielbosio pushed a commit that referenced this pull request Jun 5, 2025
* Update cairo-lang versin

* Update changelog

* Add new hints

* Specify prime in new hints

* Only apply mod floor if prime is not CAIRO_PRIME

* Properly implement pack for a different prime

* Fix pack in compute_doubling_slope

* Add negative_points.cairo test

* Add try_get_point_from_x for negative points

* Add double_x test for negative points

* Allow to many arguments

* Add codecov to cairo-0-secp-hints feature
gabrielbosio added a commit that referenced this pull request Jun 5, 2025
* Update cairo-lang versin

* Update changelog

* Add new hints

* Specify prime in new hints

* Only apply mod floor if prime is not CAIRO_PRIME

* Properly implement pack for a different prime

* Fix pack in compute_doubling_slope

* Add negative_points.cairo test

* Add try_get_point_from_x for negative points

* Add double_x test for negative points

* Allow to many arguments

* Add codecov to cairo-0-secp-hints feature

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
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.

3 participants