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
508 stars 142 forks source link

[Cairo1] Append return values to the output segment when running in proof_mode #1597

Closed fmoletta closed 7 months ago

fmoletta commented 7 months ago

This involves:

Testing:

Also in this PR:

github-actions[bot] commented 7 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.285 ± 0.007 2.271 2.295 1.00 ± 0.00
head big_factorial 2.280 ± 0.009 2.269 2.295 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.266 ± 0.009 2.256 2.287 1.00
head big_fibonacci 2.275 ± 0.010 2.264 2.294 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.286 ± 0.044 8.208 8.356 1.00 ± 0.01
head blake2s_integration_benchmark 8.273 ± 0.044 8.235 8.370 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.336 ± 0.025 2.310 2.384 1.01 ± 0.01
head compare_arrays_200000 2.318 ± 0.014 2.297 2.343 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.458 ± 0.004 1.451 1.464 1.00
head dict_integration_benchmark 1.460 ± 0.010 1.452 1.486 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.300 ± 0.017 1.287 1.338 1.00 ± 0.01
head field_arithmetic_get_square_benchmark 1.294 ± 0.007 1.282 1.304 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.311 ± 0.038 8.267 8.392 1.00
head integration_builtins 8.344 ± 0.058 8.280 8.447 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.596 ± 0.131 8.504 8.952 1.01 ± 0.02
head keccak_integration_benchmark 8.546 ± 0.059 8.490 8.675 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.348 ± 0.014 2.335 2.384 1.00
head linear_search 2.356 ± 0.023 2.328 2.416 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.594 ± 0.013 1.585 1.630 1.01 ± 0.01
head math_cmp_and_pow_integration_benchmark 1.582 ± 0.005 1.575 1.591 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.454 ± 0.012 1.446 1.489 1.00 ± 0.01
head math_integration_benchmark 1.452 ± 0.014 1.439 1.490 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.273 ± 0.005 1.268 1.284 1.01 ± 0.01
head memory_integration_benchmark 1.266 ± 0.004 1.262 1.271 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.609 ± 0.010 1.597 1.629 1.00
head operations_with_data_structures_benchmarks 1.636 ± 0.019 1.609 1.662 1.02 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 611.1 ± 10.4 605.6 640.4 1.01 ± 0.02
head pedersen 606.7 ± 2.5 603.0 611.5 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.058 ± 0.005 1.054 1.070 1.00
head poseidon_integration_benchmark 1.064 ± 0.005 1.058 1.073 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.935 ± 0.011 1.925 1.964 1.00
head secp_integration_benchmark 1.941 ± 0.018 1.927 1.989 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 755.6 ± 5.0 752.0 768.9 1.00 ± 0.01
head set_integration_benchmark 754.4 ± 4.3 750.6 765.8 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.567 ± 0.032 4.528 4.629 1.00
head uint256_integration_benchmark 4.576 ± 0.036 4.536 4.632 1.00 ± 0.01
codecov[bot] commented 7 months ago

Codecov Report

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

Comparison is base (dea2723) 97.13% compared to head (982894d) 97.16%.

Files Patch % Lines
cairo1-run/src/main.rs 98.27% 1 Missing :warning:
vm/src/vm/vm_core.rs 87.50% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1597 +/- ## ========================================== + Coverage 97.13% 97.16% +0.02% ========================================== Files 91 91 Lines 37263 37324 +61 ========================================== + Hits 36196 36264 +68 + Misses 1067 1060 -7 ```

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

juanbono commented 7 months ago

We should work on adding the required changes to test this