Skip to content

Conversation

JulianGCalderon
Copy link
Contributor

@JulianGCalderon JulianGCalderon commented Sep 2, 2025

In some situations, we have a top-level Cairo program that itself executes other Cairo programs.

The Cairo Runner is being initialized with the top-level program. This means that, when executing hint, the constants passed to the hint belong to the top-level program. If the inner programs has hints that depends on constants defined only in the inner program, then the execution would fail as the constants are being searched in the top-level program's constants, and not in the inner program's constants.

This PR fixes this by having the constants specified on compile_hint, rather than on execute_hint. When compiling a hint for the inner program, we can specify the constants of that inner program.

Breaking Changes

This PR introduces breaking changes:

  • The signature of the HintProcessor methods changed. We now specify constants on compile_hint, rather than on execute_hint.
  • The CairoRunner::step_hint method no longer receives the program constants, as they no longer require it.
  • The CairoRunner::step method only receives constants when the test-utils features is enabled, as its used for the pre/post step hooks.

Copy link

github-actions bot commented Sep 2, 2025

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.112 ± 0.021 2.092 2.168 1.00 ± 0.01
head big_factorial 2.112 ± 0.011 2.100 2.134 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.040 ± 0.004 2.032 2.047 1.00
head big_fibonacci 2.045 ± 0.022 2.030 2.105 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.697 ± 0.038 7.619 7.740 1.01 ± 0.02
head blake2s_integration_benchmark 7.658 ± 0.150 7.587 8.082 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.163 ± 0.010 2.141 2.175 1.00
head compare_arrays_200000 2.174 ± 0.022 2.152 2.226 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.416 ± 0.009 1.402 1.435 1.00
head dict_integration_benchmark 1.420 ± 0.008 1.411 1.437 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.219 ± 0.006 1.210 1.231 1.00
head field_arithmetic_get_square_benchmark 1.221 ± 0.006 1.212 1.231 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.779 ± 0.068 7.719 7.930 1.01 ± 0.01
head integration_builtins 7.731 ± 0.019 7.701 7.750 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.018 ± 0.144 7.903 8.278 1.01 ± 0.02
head keccak_integration_benchmark 7.920 ± 0.024 7.878 7.970 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.152 ± 0.012 2.131 2.179 1.00 ± 0.01
head linear_search 2.151 ± 0.006 2.140 2.162 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.494 ± 0.016 1.476 1.534 1.00
head math_cmp_and_pow_integration_benchmark 1.495 ± 0.008 1.483 1.515 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.450 ± 0.003 1.446 1.456 1.00 ± 0.00
head math_integration_benchmark 1.448 ± 0.005 1.442 1.453 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.209 ± 0.015 1.199 1.251 1.00 ± 0.01
head memory_integration_benchmark 1.206 ± 0.004 1.198 1.210 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.562 ± 0.011 1.549 1.588 1.00 ± 0.01
head operations_with_data_structures_benchmarks 1.556 ± 0.006 1.548 1.572 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 528.3 ± 1.3 525.7 530.2 1.00 ± 0.00
head pedersen 528.1 ± 1.3 525.0 529.6 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 606.9 ± 4.1 603.4 616.0 1.00
head poseidon_integration_benchmark 609.6 ± 4.9 604.7 616.1 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.822 ± 0.006 1.813 1.833 1.00
head secp_integration_benchmark 1.829 ± 0.009 1.816 1.852 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 625.8 ± 1.3 623.8 627.8 1.00
head set_integration_benchmark 669.0 ± 6.7 655.6 676.7 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.262 ± 0.033 4.233 4.323 1.01 ± 0.01
head uint256_integration_benchmark 4.233 ± 0.010 4.209 4.246 1.00

Copy link

codecov bot commented Sep 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.66%. Comparing base (d2f7b09) to head (e8978b6).
⚠️ Report is 1 commits behind head on 2.x.y.

Additional details and impacted files
@@           Coverage Diff           @@
##            2.x.y    #2191   +/-   ##
=======================================
  Coverage   96.66%   96.66%           
=======================================
  Files         103      103           
  Lines       43645    43646    +1     
=======================================
+ Hits        42190    42191    +1     
  Misses       1455     1455           

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

@JulianGCalderon JulianGCalderon changed the title Store identifiers in Hint Data Store constants in Hint Data Sep 2, 2025
@JulianGCalderon JulianGCalderon marked this pull request as ready for review September 9, 2025 16:09
@gabrielbosio gabrielbosio added this to the 2.5.0 milestone Sep 9, 2025
@gabrielbosio gabrielbosio moved this to In Review in Starknet Sep 9, 2025
Copy link
Contributor

@DiegoCivi DiegoCivi left a comment

Choose a reason for hiding this comment

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

Looks good!

@gabrielbosio gabrielbosio added this pull request to the merge queue Sep 10, 2025
Merged via the queue into 2.x.y with commit fec5af0 Sep 10, 2025
93 checks passed
@gabrielbosio gabrielbosio deleted the store-idents-in-hints branch September 10, 2025 21:36
@github-project-automation github-project-automation bot moved this from In Review to Done in Starknet Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants