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
488 stars 133 forks source link

Sort builtin segment info upon serialization for Cairo PIE #1654

Closed fmoletta closed 4 months ago

fmoletta commented 4 months ago

Adds custom serialization for builtin segment info. This fixes pie validation checks failing due to builtin segment info map keys not following the same order as the builtin list

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.68%. Comparing base (136296a) to head (5ce48f0).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1654 +/- ## ======================================= Coverage 97.68% 97.68% ======================================= Files 91 91 Lines 37654 37668 +14 ======================================= + Hits 36782 36796 +14 Misses 872 872 ```

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

github-actions[bot] commented 4 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.252 ± 0.021 2.227 2.286 1.00 ± 0.03
head big_factorial 2.252 ± 0.066 2.211 2.433 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.222 ± 0.015 2.207 2.242 1.00
head big_fibonacci 2.243 ± 0.037 2.209 2.342 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.409 ± 0.029 8.373 8.454 1.00 ± 0.02
head blake2s_integration_benchmark 8.394 ± 0.129 8.234 8.521 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.299 ± 0.016 2.272 2.316 1.00
head compare_arrays_200000 2.316 ± 0.038 2.269 2.398 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.433 ± 0.018 1.411 1.474 1.01 ± 0.01
head dict_integration_benchmark 1.420 ± 0.011 1.406 1.447 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.301 ± 0.019 1.288 1.353 1.00 ± 0.02
head field_arithmetic_get_square_benchmark 1.298 ± 0.018 1.278 1.330 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.464 ± 0.113 8.398 8.779 1.01 ± 0.02
head integration_builtins 8.421 ± 0.121 8.269 8.548 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.678 ± 0.057 8.623 8.793 1.00 ± 0.02
head keccak_integration_benchmark 8.662 ± 0.126 8.509 8.818 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.314 ± 0.015 2.290 2.341 1.00 ± 0.01
head linear_search 2.305 ± 0.026 2.279 2.366 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.564 ± 0.010 1.550 1.580 1.00 ± 0.01
head math_cmp_and_pow_integration_benchmark 1.559 ± 0.014 1.539 1.585 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.425 ± 0.012 1.407 1.442 1.01 ± 0.01
head math_integration_benchmark 1.415 ± 0.009 1.404 1.429 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.277 ± 0.034 1.252 1.370 1.01 ± 0.03
head memory_integration_benchmark 1.262 ± 0.014 1.247 1.291 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.593 ± 0.008 1.583 1.606 1.00
head operations_with_data_structures_benchmarks 1.598 ± 0.005 1.587 1.605 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 587.0 ± 1.7 583.6 590.5 1.00
head pedersen 590.9 ± 2.1 587.7 595.4 1.01 ± 0.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 971.3 ± 10.6 956.6 991.7 1.00
head poseidon_integration_benchmark 974.0 ± 5.8 965.0 983.8 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.867 ± 0.012 1.851 1.892 1.00
head secp_integration_benchmark 1.878 ± 0.016 1.861 1.900 1.01 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 694.3 ± 3.6 690.2 699.2 1.00
head set_integration_benchmark 718.8 ± 4.2 715.7 729.6 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.679 ± 0.102 4.623 4.966 1.01 ± 0.02
head uint256_integration_benchmark 4.619 ± 0.035 4.551 4.667 1.00