Skip to content

Conversation

@DiegoCivi
Copy link
Contributor

@DiegoCivi DiegoCivi commented Oct 24, 2025

Implement GasReserve libfuncs

Implements the GasReserve libfuncs:

  • GasReserveConcreteLibfunc::Create
  • GasReserveConcreteLibfunc::Utilize

Closes #1426

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.

@github-actions
Copy link

github-actions bot commented Oct 24, 2025

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 2.775 ± 0.048 2.720 2.879 1.04 ± 0.02
base dict_insert.cairo (AOT) 2.673 ± 0.036 2.609 2.722 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 2.832 ± 0.024 2.778 2.866 1.00
head dict_insert.cairo (AOT) 2.858 ± 0.068 2.721 2.909 1.01 ± 0.03

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 2.429 ± 0.024 2.405 2.475 1.04 ± 0.01
base dict_snapshot.cairo (AOT) 2.345 ± 0.021 2.309 2.381 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 2.478 ± 0.048 2.400 2.564 1.05 ± 0.02
head dict_snapshot.cairo (AOT) 2.353 ± 0.020 2.321 2.386 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 2.837 ± 0.050 2.771 2.908 1.05 ± 0.02
base factorial_2M.cairo (AOT) 2.709 ± 0.038 2.634 2.773 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 2.858 ± 0.051 2.808 2.961 1.00
head factorial_2M.cairo (AOT) 2.975 ± 0.036 2.920 3.022 1.04 ± 0.02

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 2.283 ± 0.028 2.231 2.325 1.02 ± 0.02
base fib_2M.cairo (AOT) 2.247 ± 0.047 2.196 2.351 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 2.367 ± 0.027 2.324 2.409 1.03 ± 0.02
head fib_2M.cairo (AOT) 2.294 ± 0.034 2.251 2.379 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base heavy_circuit.cairo (JIT) 14.401 ± 0.090 14.252 14.549 1.03 ± 0.01
base heavy_circuit.cairo (AOT) 14.022 ± 0.086 13.880 14.119 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head heavy_circuit.cairo (JIT) 14.615 ± 0.219 14.319 15.016 1.00 ± 0.03
head heavy_circuit.cairo (AOT) 14.566 ± 0.455 13.921 15.106 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 2.487 ± 0.049 2.417 2.569 1.09 ± 0.03
base linear_search.cairo (AOT) 2.286 ± 0.028 2.255 2.348 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 2.536 ± 0.036 2.478 2.600 1.06 ± 0.02
head linear_search.cairo (AOT) 2.399 ± 0.033 2.329 2.447 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 2.549 ± 0.023 2.513 2.592 1.07 ± 0.01
base logistic_map.cairo (AOT) 2.393 ± 0.024 2.351 2.433 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 2.622 ± 0.052 2.557 2.700 1.06 ± 0.02
head logistic_map.cairo (AOT) 2.471 ± 0.027 2.415 2.506 1.00

@github-actions
Copy link

github-actions bot commented Oct 24, 2025

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 10.859 ± 0.032 10.797 10.917 4.46 ± 0.03
cairo-native (embedded AOT) 2.436 ± 0.015 2.410 2.463 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.548 ± 0.017 2.521 2.573 1.05 ± 0.01

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 513.5 ± 3.8 509.2 522.8 1.00
cairo-native (embedded AOT) 2134.7 ± 17.5 2119.9 2167.1 4.16 ± 0.05
cairo-native (embedded JIT using LLVM's ORC Engine) 2270.0 ± 19.3 2245.5 2298.9 4.42 ± 0.05

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.725 ± 0.015 4.703 4.751 1.84 ± 0.01
cairo-native (embedded AOT) 2.570 ± 0.013 2.554 2.593 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.633 ± 0.015 2.613 2.663 1.02 ± 0.01

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.691 ± 0.022 4.662 4.719 2.21 ± 0.03
cairo-native (embedded AOT) 2.125 ± 0.023 2.091 2.171 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.145 ± 0.018 2.119 2.177 1.01 ± 0.01

Benchmark for program heavy_circuit

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 9.602 ± 0.088 9.496 9.764 1.00
cairo-native (embedded AOT) 13.552 ± 0.089 13.403 13.713 1.41 ± 0.02
cairo-native (embedded JIT using LLVM's ORC Engine) 13.956 ± 0.059 13.890 14.036 1.45 ± 0.01

Benchmark for program linear_search

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 555.9 ± 5.5 548.8 564.9 1.00
cairo-native (embedded AOT) 2194.1 ± 17.2 2166.7 2222.5 3.95 ± 0.05
cairo-native (embedded JIT using LLVM's ORC Engine) 2319.9 ± 13.9 2301.9 2352.2 4.17 ± 0.05

Benchmark for program logistic_map

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 375.4 ± 4.7 369.7 384.1 1.00
cairo-native (embedded AOT) 2279.9 ± 14.8 2260.7 2309.0 6.07 ± 0.09
cairo-native (embedded JIT using LLVM's ORC Engine) 2438.9 ± 18.8 2409.9 2467.2 6.50 ± 0.10

@codecov-commenter
Copy link

codecov-commenter commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 95.65217% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.54%. Comparing base (ac3cb7f) to head (b460de7).

Files with missing lines Patch % Lines
src/libfuncs/gas_reserve.rs 97.14% 2 Missing ⚠️
src/types.rs 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1439      +/-   ##
==========================================
+ Coverage   81.45%   81.54%   +0.09%     
==========================================
  Files         105      107       +2     
  Lines       25862    25945      +83     
==========================================
+ Hits        21065    21156      +91     
+ Misses       4797     4789       -8     

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

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.

Left some nits, but looks good!

@github-actions
Copy link

github-actions bot commented Nov 10, 2025

✅ Code is now correctly formatted.

Copy link
Collaborator

@gabrielbosio gabrielbosio left a comment

Choose a reason for hiding this comment

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

I realized that changing the GasReserve tests to property tests increased execution time of the test job to ~100% (i.e. +20 min approx.) so we can revert that change in this context

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.

[2.12.0] Implement GasReserve related libfuncs

5 participants