Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add args flag to cairo1-run #1551

Merged
merged 31 commits into from
Jan 15, 2024
Merged

Add args flag to cairo1-run #1551

merged 31 commits into from
Jan 15, 2024

Conversation

fmoletta
Copy link
Member

@fmoletta fmoletta commented Jan 9, 2024

Allows passing arguments to cairo 1 programs
As there isn't a set convention for arguments passed to cairo_run (and the current design doesn't allow using starknet's convention for arrays) the following convention was taken:

  • Values should be passed separated by whitespaces (akin to starknet commands)
  • Array values should be wrapped between brackets (New)
    Example:
cargo run ../cairo_programs/cairo-1-programs/with_input/array_input_sum.cairo --layout all_cairo --args '2 [1 2 3 4] 0 [9 8]'

@fmoletta fmoletta changed the base branch from main to cairo-1-run-air-pub-input-flag January 9, 2024 20:45
@fmoletta fmoletta changed the title Add args flag to cairo1-run Add args flag to cairo1-run Jan 9, 2024
@fmoletta fmoletta marked this pull request as ready for review January 9, 2024 20:51
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

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

Comparison is base (4568a40) 97.22% compared to head (ff482e7) 97.20%.

Files Patch % Lines
cairo1-run/src/main.rs 92.23% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1551      +/-   ##
==========================================
- Coverage   97.22%   97.20%   -0.02%     
==========================================
  Files          91       91              
  Lines       37048    37127      +79     
==========================================
+ Hits        36020    36091      +71     
- Misses       1028     1036       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fmoletta fmoletta linked an issue Jan 9, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Jan 9, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.262 ± 0.019 2.242 2.302 1.01 ± 0.01
head big_factorial 2.248 ± 0.020 2.221 2.284 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.231 ± 0.014 2.215 2.257 1.00 ± 0.01
head big_fibonacci 2.227 ± 0.017 2.204 2.250 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.155 ± 0.101 8.062 8.310 1.00
head blake2s_integration_benchmark 8.187 ± 0.072 8.069 8.259 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.295 ± 0.020 2.273 2.332 1.00 ± 0.01
head compare_arrays_200000 2.288 ± 0.025 2.264 2.341 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.444 ± 0.007 1.436 1.456 1.00 ± 0.02
head dict_integration_benchmark 1.439 ± 0.027 1.421 1.513 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.294 ± 0.009 1.283 1.308 1.00 ± 0.01
head field_arithmetic_get_square_benchmark 1.291 ± 0.013 1.275 1.315 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.219 ± 0.092 8.113 8.348 1.01 ± 0.01
head integration_builtins 8.135 ± 0.036 8.051 8.184 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.484 ± 0.181 8.355 8.941 1.00 ± 0.02
head keccak_integration_benchmark 8.448 ± 0.080 8.350 8.565 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.333 ± 0.011 2.325 2.361 1.01 ± 0.01
head linear_search 2.309 ± 0.015 2.292 2.335 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.601 ± 0.006 1.596 1.613 1.01 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.582 ± 0.033 1.566 1.673 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.451 ± 0.008 1.443 1.464 1.01 ± 0.01
head math_integration_benchmark 1.438 ± 0.007 1.429 1.448 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.268 ± 0.006 1.261 1.277 1.00 ± 0.01
head memory_integration_benchmark 1.262 ± 0.009 1.250 1.279 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.637 ± 0.036 1.613 1.737 1.03 ± 0.02
head operations_with_data_structures_benchmarks 1.596 ± 0.006 1.589 1.609 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 605.1 ± 3.1 601.7 610.1 1.00 ± 0.01
head pedersen 603.3 ± 3.8 598.8 609.8 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.054 ± 0.004 1.048 1.062 1.00 ± 0.01
head poseidon_integration_benchmark 1.051 ± 0.005 1.039 1.056 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.933 ± 0.011 1.924 1.959 1.01 ± 0.01
head secp_integration_benchmark 1.917 ± 0.006 1.910 1.928 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 772.5 ± 2.1 768.4 775.0 1.00 ± 0.01
head set_integration_benchmark 771.5 ± 7.4 764.8 791.5 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.590 ± 0.045 4.535 4.664 1.02 ± 0.01
head uint256_integration_benchmark 4.511 ± 0.025 4.486 4.573 1.00

Oppen
Oppen previously approved these changes Jan 11, 2024
juanbono
juanbono previously approved these changes Jan 15, 2024
Base automatically changed from cairo-1-run-air-pub-input-flag to main January 15, 2024 18:59
@Oppen Oppen dismissed stale reviews from juanbono and themself January 15, 2024 18:59

The base branch was changed.

Oppen
Oppen previously approved these changes Jan 15, 2024
@fmoletta fmoletta added this pull request to the merge queue Jan 15, 2024
Merged via the queue into main with commit 1a78237 Jan 15, 2024
49 of 50 checks passed
@fmoletta fmoletta deleted the cairo-1-input-args branch January 15, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable the vm to execute programs with inputs
3 participants