Skip to content

Commit

Permalink
Add air_private_input flag to cairo1-run (lambdaclass#1559)
Browse files Browse the repository at this point in the history
* Add proof_mode flag to cairo1-run

* Add Changelog entry

* Clippy

* clippy

* Add `air_public_input` flag

* Progress

* Update builtins stop ptrs when running cairo 1

* Change visibility

* Change visibility

* Fix

* Fix trace not enables

* Build execution public memory

* Handle EcOp case

* Fix typo

* Use cleaner solution

* Fix

* Improve comments

* Add changelog entry

* Add args flag

* Handle arguments

* Handle arg size & add tests

* Parse array arguments

* Fix language

* reorder

* Add changelog entry

* Move programs with args to an inner folder

* Implement get_air_private_input for RangeCheck;

* Implement air_private_input for Bitwise;

* Implement air_private_input for Hash

* Update proof_programs symlinks

* Add EcOp priv input variant

* Implement air_private_input for EcOp

* Implement air_private_input for Poseidon & Signature

* Implement air_private_input for Keccak

* Add AirPrivateInput serialization

* Remove unwrap

* Add targets to compare private inputs against python vm

* Add separate script to compare private inputs

* Ignore & Clean output files

* Fix target

* Fix README example

* Fix + fmt

* Fetch absolute paths in cli and remove feature-gate

* Fix ecdsa private input

* Add no-std import

* Add Chaneglog entry

* Update README

* Add cli tests

* Add case to cli test

* Fix conditional

* Add no-std import

* fmt

* fix

* Add air_private_input flag

* Remove unwraps

* fix

* Add new flag to tests

* Add Cli argument list to README

* Add Chaneglog entry

* Fix changelog

* Add tests so coverage doesnt sink

* Fix test

* Fix test

* Fix test

* Add tests so coverage doesnt sink

* Fix test

* Fix test

* Fix test

* Fix symlink

* Remove broken file

* Add air_private_input check to CI

* Fix changelog

* Fix changelog

* Fix changelog

* Fix changelog
  • Loading branch information
fmoletta committed Jan 17, 2024
1 parent 1a78237 commit 4ea224a
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 22 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ jobs:
cairo_programs/**/*.memory
cairo_programs/**/*.trace
cairo_programs/**/*.air_public_input
cairo_programs/**/*.air_private_input
key: ${{ matrix.program-target }}-reference-trace-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }}
restore-keys: ${{ matrix.program-target }}-reference-trace-cache-

Expand Down Expand Up @@ -360,7 +361,7 @@ jobs:
include:
- program-target: cairo_proof_programs
programs-dir: cairo_programs/proof_programs
extra-args: '--proof_mode --air_public_input {program}.rs.air_public_input '
extra-args: '--proof_mode --air_public_input {program}.rs.air_public_input --air_private_input {program}.rs.air_private_input '
- program-target: cairo_test_programs
programs-dir: cairo_programs
extra-args: ''
Expand Down Expand Up @@ -399,6 +400,7 @@ jobs:
cairo_programs/**/*.memory
cairo_programs/**/*.trace
cairo_programs/**/*.air_public_input
cairo_programs/**/*.air_private_input
key: ${{ matrix.program-target }}-release-trace-cache-${{ github.sha }}


Expand Down Expand Up @@ -498,6 +500,7 @@ jobs:
cairo_programs/**/*.memory
cairo_programs/**/*.trace
cairo_programs/**/*.air_public_input
cairo_programs/**/*.air_private_input
key: ${{ matrix.program-target }}-reference-trace-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }}
fail-on-cache-miss: true

Expand All @@ -508,6 +511,7 @@ jobs:
cairo_programs/**/*.memory
cairo_programs/**/*.trace
cairo_programs/**/*.air_public_input
cairo_programs/**/*.air_private_input
key: ${{ matrix.program-target }}-release-trace-cache-${{ github.sha }}
fail-on-cache-miss: true

Expand All @@ -516,8 +520,9 @@ jobs:
if [ ${{ matrix.program-target }} = cairo_proof_programs ]; then
PROOF=proof_mode
AIR_PUBLIC_INPUT=air_public_input
AIR_PRIVATE_INPUT=air_private_input
fi
./vm/src/tests/compare_vm_state.sh trace memory $PROOF $AIR_PUBLIC_INPUT
./vm/src/tests/compare_vm_state.sh trace memory $PROOF $AIR_PUBLIC_INPUT $AIR_PRIVATE_INPUT
./vm/src/tests/compare_vm_state.sh trace memory $PROOF
wasm-demo:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* feat: Add `air_private_input` flag to `cairo1-run` [#1559] (https://github.com/lambdaclass/cairo-vm/pull/1559)

* feat: Add `args` flag to `cairo1-run` [#15551] (https://github.com/lambdaclass/cairo-vm/pull/15551)

* feat: Add `air_public_input` flag to `cairo1-run` [#1539] (https://github.com/lambdaclass/cairo-vm/pull/1539)
Expand Down
18 changes: 18 additions & 0 deletions cairo1-run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,21 @@ To execute all the cairo 1 programs inside `../cairo_programs/cairo-1-programs/`
```bash
make run
```

## CLI argument list

The cairo1-run cli supports the following optional arguments:

* `--layout <LAYOUT>`: Sets the layout for the cairo_run. This will limit the available builtins. The deafult layout is `plain`, which has no builtins. For general purpose, the `all_cairo` layout contains all currently available builtins.

* `--args <ARGUMENTS>`: Receives the arguments to be passed to the program's main function. Receives whitespace-separated values which can be numbers or arrays, with arrays consisting of whitespace-separated numbers wrapped between brackets

* `--trace_file <TRACE_FILE>`: Receives the name of a file and outputs the relocated trace into it

* `--memory_file <MEMORY_FILE>`: Receives the name of a file and outputs the relocated memory into it

* `--proof_mode`: Runs the program in proof_mode

* `--air_public_input <AIR_PUBLIC_INPUT>`: Receives the name of a file and outputs the AIR public inputs into it. Can only be used if proof_mode is also enabled.

* `--air_private_input <AIR_PRIVATE_INPUT>`: Receives the name of a file and outputs the AIR private inputs into it. Can only be used if proof_mode, trace_file & memory_file are also enabled.
Loading

0 comments on commit 4ea224a

Please sign in to comment.