Skip to content

Conversation

@DiegoCivi
Copy link
Contributor

@DiegoCivi DiegoCivi commented Nov 14, 2025

Fix BoundedInt Constrain libfunc

We were not contemplating the case where the libfunc bounded_int_constrain() could receive a bounded int. Now, that case is handled by moving the boundary to the same range the bounded int is and using the same offset to represent it.

Co-authored-by: @JulianGCalderon
Co-authored-by: @FrancoGiachetta

Closes #NA

Introduces Breaking Changes?

Yes/No.

These PRs should be merged after this one right away, in that order.

Checklist

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

@DiegoCivi DiegoCivi changed the base branch from main to v0.6 November 14, 2025 21:13
@DiegoCivi DiegoCivi marked this pull request as ready for review November 14, 2025 21:16
Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions
Copy link

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 2.623 ± 0.022 2.589 2.656 1.04 ± 0.02
base dict_insert.cairo (AOT) 2.527 ± 0.031 2.487 2.575 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 2.667 ± 0.024 2.629 2.715 1.06 ± 0.01
head dict_insert.cairo (AOT) 2.516 ± 0.021 2.485 2.551 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 2.287 ± 0.017 2.267 2.319 1.05 ± 0.01
base dict_snapshot.cairo (AOT) 2.180 ± 0.019 2.155 2.223 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 2.312 ± 0.030 2.261 2.357 1.07 ± 0.02
head dict_snapshot.cairo (AOT) 2.170 ± 0.029 2.118 2.208 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 2.669 ± 0.025 2.632 2.715 1.02 ± 0.01
base factorial_2M.cairo (AOT) 2.623 ± 0.019 2.599 2.655 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 2.662 ± 0.026 2.613 2.707 1.02 ± 0.01
head factorial_2M.cairo (AOT) 2.614 ± 0.019 2.583 2.638 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 2.196 ± 0.027 2.168 2.246 1.02 ± 0.02
base fib_2M.cairo (AOT) 2.152 ± 0.018 2.127 2.182 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 2.208 ± 0.037 2.163 2.261 1.04 ± 0.02
head fib_2M.cairo (AOT) 2.125 ± 0.016 2.100 2.151 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 2.362 ± 0.014 2.343 2.391 1.06 ± 0.01
base linear_search.cairo (AOT) 2.236 ± 0.013 2.213 2.262 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 2.415 ± 0.031 2.371 2.465 1.07 ± 0.02
head linear_search.cairo (AOT) 2.251 ± 0.018 2.220 2.279 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 2.492 ± 0.019 2.474 2.532 1.08 ± 0.01
base logistic_map.cairo (AOT) 2.318 ± 0.020 2.281 2.352 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 2.517 ± 0.032 2.479 2.557 1.08 ± 0.02
head logistic_map.cairo (AOT) 2.341 ± 0.017 2.312 2.377 1.00

@github-actions
Copy link

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.881 ± 0.054 10.820 11.010 4.50 ± 0.03
cairo-native (embedded AOT) 2.416 ± 0.010 2.400 2.428 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.500 ± 0.012 2.481 2.521 1.03 ± 0.01

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 535.0 ± 7.5 523.6 551.6 1.00
cairo-native (embedded AOT) 2168.2 ± 24.5 2134.5 2207.2 4.05 ± 0.07
cairo-native (embedded JIT using LLVM's ORC Engine) 2314.5 ± 27.2 2268.1 2363.4 4.33 ± 0.08

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.751 ± 0.008 4.737 4.761 1.82 ± 0.02
cairo-native (embedded AOT) 2.609 ± 0.035 2.562 2.660 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.634 ± 0.014 2.612 2.656 1.01 ± 0.01

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.671 ± 0.010 4.655 4.689 2.25 ± 0.01
cairo-native (embedded AOT) 2.079 ± 0.010 2.066 2.096 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.116 ± 0.011 2.095 2.136 1.02 ± 0.01

Benchmark for program linear_search

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 569.9 ± 7.1 561.8 581.7 1.00
cairo-native (embedded AOT) 2251.1 ± 35.0 2209.6 2315.7 3.95 ± 0.08
cairo-native (embedded JIT using LLVM's ORC Engine) 2373.6 ± 25.4 2331.4 2408.1 4.16 ± 0.07

Benchmark for program logistic_map

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 376.2 ± 2.9 372.4 380.3 1.00
cairo-native (embedded AOT) 2269.5 ± 23.5 2236.4 2310.1 6.03 ± 0.08
cairo-native (embedded JIT using LLVM's ORC Engine) 2475.1 ± 45.7 2413.0 2532.3 6.58 ± 0.13

@gabrielbosio gabrielbosio added this pull request to the merge queue Nov 15, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 98.12500% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.86%. Comparing base (9c5a17d) to head (c6345cf).

Files with missing lines Patch % Lines
src/libfuncs/bounded_int.rs 98.12% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             v0.6    #1466      +/-   ##
==========================================
+ Coverage   76.22%   76.86%   +0.64%     
==========================================
  Files         111      111              
  Lines       26531    26689     +158     
==========================================
+ Hits        20223    20515     +292     
+ Misses       6308     6174     -134     

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

Merged via the queue into v0.6 with commit b2b4a96 Nov 15, 2025
41 of 43 checks passed
@gabrielbosio gabrielbosio deleted the fix-bi-constrain-0.6 branch November 15, 2025 14:47
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.

5 participants