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
517 stars 148 forks source link

Implement air_private_input #1552

Closed fmoletta closed 9 months ago

fmoletta commented 10 months ago

Adds CairoRunner::get_air_public_input method which outputs a compact AirPrivateInput struct with all builtin's private inputs, which can be converted to an AirPrivateInputSerializable struct that also contains the memory and trace file paths, and matches the file output of the python vm when serialized. Adds air_private_input flag to cli

github-actions[bot] commented 10 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.171 ± 0.007 2.161 2.185 1.00
head big_factorial 2.268 ± 0.017 2.247 2.298 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.133 ± 0.020 2.101 2.161 1.00
head big_fibonacci 2.233 ± 0.023 2.213 2.267 1.05 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.818 ± 0.063 7.766 7.934 1.00
head blake2s_integration_benchmark 8.188 ± 0.090 8.096 8.310 1.05 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.194 ± 0.014 2.181 2.221 1.00
head compare_arrays_200000 2.279 ± 0.022 2.250 2.315 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.402 ± 0.011 1.391 1.422 1.00
head dict_integration_benchmark 1.439 ± 0.013 1.429 1.470 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.243 ± 0.008 1.230 1.255 1.00
head field_arithmetic_get_square_benchmark 1.289 ± 0.010 1.276 1.305 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.901 ± 0.085 7.821 8.112 1.00
head integration_builtins 8.274 ± 0.079 8.174 8.382 1.05 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.175 ± 0.047 8.111 8.215 1.00
head keccak_integration_benchmark 8.512 ± 0.075 8.415 8.627 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.231 ± 0.015 2.220 2.269 1.00
head linear_search 2.313 ± 0.026 2.292 2.373 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.520 ± 0.014 1.512 1.560 1.00
head math_cmp_and_pow_integration_benchmark 1.586 ± 0.013 1.572 1.613 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.388 ± 0.007 1.379 1.400 1.00
head math_integration_benchmark 1.447 ± 0.009 1.435 1.464 1.04 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.211 ± 0.002 1.207 1.213 1.00
head memory_integration_benchmark 1.252 ± 0.010 1.239 1.268 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.561 ± 0.006 1.551 1.573 1.00
head operations_with_data_structures_benchmarks 1.629 ± 0.011 1.620 1.652 1.04 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 596.3 ± 3.0 592.6 600.7 1.00
head pedersen 605.9 ± 2.2 602.9 610.0 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.065 ± 0.007 1.059 1.083 1.00
head poseidon_integration_benchmark 1.075 ± 0.003 1.072 1.082 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.891 ± 0.004 1.887 1.899 1.00
head secp_integration_benchmark 1.935 ± 0.006 1.928 1.945 1.02 ± 0.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 762.3 ± 1.2 760.5 764.5 1.00
head set_integration_benchmark 772.1 ± 3.1 767.8 777.4 1.01 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.381 ± 0.032 4.335 4.432 1.00
head uint256_integration_benchmark 4.523 ± 0.027 4.495 4.571 1.03 ± 0.01
codecov[bot] commented 10 months ago

Codecov Report

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

Comparison is base (8b9aabe) 97.21% compared to head (b20da7d) 97.21%. Report is 2 commits behind head on main.

Files Patch % Lines
vm/src/vm/runners/builtin_runner/bitwise.rs 96.72% 2 Missing :warning:
vm/src/vm/runners/builtin_runner/ec_op.rs 95.83% 2 Missing :warning:
vm/src/vm/runners/builtin_runner/keccak.rs 97.05% 2 Missing :warning:
vm/src/vm/runners/builtin_runner/poseidon.rs 96.42% 2 Missing :warning:
vm/src/vm/runners/builtin_runner/range_check.rs 93.75% 2 Missing :warning:
cairo1-run/src/main.rs 98.24% 1 Missing :warning:
vm/src/air_private_input.rs 97.82% 1 Missing :warning:
vm/src/types/relocatable.rs 80.00% 1 Missing :warning:
vm/src/vm/runners/builtin_runner/hash.rs 98.18% 1 Missing :warning:
vm/src/vm/runners/builtin_runner/signature.rs 96.29% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1552 +/- ## ======================================== Coverage 97.21% 97.21% ======================================== Files 90 91 +1 Lines 36452 36990 +538 ======================================== + Hits 35437 35961 +524 - Misses 1015 1029 +14 ```

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