lambdaclass / cairo-vm

cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
https://lambdaclass.github.io/cairo-vm
Apache License 2.0
518 stars 148 forks source link

Add `HintProcessor::execute_hint_extensive` + refactor `hint_ranges` #1491

Closed fmoletta closed 11 months ago

fmoletta commented 11 months ago

This PR proposes a solution to the hint-relates problems faced when running the starknet os:

The proposed solution for each problem is:

Tests added for this new behaviour in #1494

codecov[bot] commented 11 months ago

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (7c1cfd9) 96.82% compared to head (480601c) 96.81%.

Files Patch % Lines
vm/src/vm/vm_core.rs 90.90% 4 Missing :warning:
vm/src/types/program.rs 94.11% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1491 +/- ## ========================================== - Coverage 96.82% 96.81% -0.01% ========================================== Files 96 96 Lines 39567 39574 +7 ========================================== + Hits 38311 38315 +4 - Misses 1256 1259 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 11 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.633 ± 0.018 2.605 2.661 1.00
head big_factorial 2.648 ± 0.036 2.598 2.726 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.249 ± 0.042 2.219 2.365 1.02 ± 0.02
head big_fibonacci 2.209 ± 0.017 2.186 2.241 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 6.212 ± 0.039 6.134 6.253 1.00
head blake2s_integration_benchmark 7.569 ± 0.063 7.503 7.704 1.22 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.330 ± 0.023 2.313 2.394 1.00
head compare_arrays_200000 2.611 ± 0.015 2.597 2.642 1.12 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.612 ± 0.007 1.600 1.620 1.00
head dict_integration_benchmark 1.761 ± 0.015 1.735 1.780 1.09 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.086 ± 0.008 1.079 1.103 1.00
head field_arithmetic_get_square_benchmark 1.265 ± 0.034 1.245 1.354 1.16 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 6.271 ± 0.057 6.180 6.358 1.01 ± 0.03
head integration_builtins 6.209 ± 0.153 6.126 6.572 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 6.280 ± 0.040 6.227 6.338 1.00
head keccak_integration_benchmark 7.641 ± 0.061 7.555 7.713 1.22 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.373 ± 0.017 2.348 2.395 1.00
head linear_search 2.666 ± 0.036 2.631 2.759 1.12 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.625 ± 0.010 1.611 1.643 1.00
head math_cmp_and_pow_integration_benchmark 1.772 ± 0.030 1.747 1.850 1.09 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.540 ± 0.038 1.505 1.643 1.00
head math_integration_benchmark 1.668 ± 0.020 1.653 1.722 1.08 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.339 ± 0.008 1.328 1.352 1.00
head memory_integration_benchmark 1.491 ± 0.032 1.467 1.580 1.11 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.464 ± 0.009 1.452 1.478 1.00
head operations_with_data_structures_benchmarks 1.611 ± 0.009 1.602 1.632 1.10 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 592.7 ± 2.1 590.3 597.0 1.01 ± 0.01
head pedersen 589.5 ± 3.0 585.6 595.5 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.165 ± 0.006 1.158 1.177 1.00
head poseidon_integration_benchmark 1.201 ± 0.006 1.191 1.210 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.035 ± 0.014 2.020 2.070 1.00
head secp_integration_benchmark 2.175 ± 0.008 2.163 2.193 1.07 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.155 ± 0.014 1.141 1.193 1.00
head set_integration_benchmark 1.179 ± 0.004 1.173 1.185 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 3.960 ± 0.024 3.930 4.008 1.00
head uint256_integration_benchmark 4.690 ± 0.227 4.586 5.333 1.18 ± 0.06