Skip to content

Commit

Permalink
Unpin cairo-vm version for cairo1-run crate (#1455)
Browse files Browse the repository at this point in the history
* Add basic example for running Cairo 1 programs

* FileWriter

* Fix issue

* Fix cargo lock

* Fix typo

* CLI for cairo1 run

* CLI

* Test for the cli

* Clone corelib, add it to ignore

* Delete pub, set bincode to workspace

* Delete corelib

* New line

* Remove corelib, download it

* .Phony

* Add readme documentation

* change place of doc in readme

* Run with release

* Try running all files

* Fix makefile to compile everything

* add workflow

* Endlines

* test workflow

* change on in workflow

* yaml fix

* change on in workflow

* change on in workflow

* Fix typo

* Fix cairo vm dependecy

* Modify changelog

* Modify workflow

* Clone with https

* use cairo1 run makefile

* Add cairo 1 programs

* Pin cairo version to 2.2.0

* Update documentation

* Update workflow

* Add cairo 1 program

* Update dependencies

* Update test workflow

* Extract entrypoint from function name

* Extract return values from main func and distinguish panics (First darft, needs cleaning)

* Improve return values output

* Show panick data

* Parse panic data

* Remove TODO & some unwraps

* Add newline at end of file

* Use own Cairo1HintProcessor instead or importing the one on cairo_lang_runner

* Remove RunFunctionContext

* Remove more imports

* Use fixed entrypoint

* Use fixed entrypoint

* Miror find_function

* Mirror create_code_footer

* Miror create_entry_code

* Remove cairo_lang_runner imports

* unpin cairo-vm dependency

* Add layout flag to make run

* Remove dependency

* Remove comment

* fmt + clippy

* Add changelog + update lock

* Validate values in tests 7 fix return values

* Fix test

* fmt

* clippy

* Remove unwraps

* Bump cairo imports version

* Bump dep version

* fmt

* Remove unwrap

* Create only the builtins used by the program when running cairo 1 programs (#1457)

* Add features to cairo1-run

* Add cairo1-run to default members

* Add mimalloc dependency

* Try stuff

* Revert "Try stuff"

This reverts commit 5fb206c.

* Free up space in ubuntu runner

* Also partition test-no-std

* Revert "Free up space in ubuntu runner"

This reverts commit 076ac69.

---------

Co-authored-by: Mariano Nicolini <[email protected]>
Co-authored-by: Milton <[email protected]>
Co-authored-by: mmsc2 <[email protected]>
Co-authored-by: Pedro Fontana <[email protected]>
  • Loading branch information
5 people authored Oct 23, 2023
1 parent f434823 commit 01a5773
Show file tree
Hide file tree
Showing 10 changed files with 449 additions and 197 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ jobs:
fail-fast: false
matrix:
special_features: ["", "lambdaworks-felt"]
target: [ test#1, test#2, test#3, test#4, test-no_std, test-wasm ]
target: [ test#1, test#2, test#3, test#4, test-no_std#1, test-no_std#2, test-no_std#3, test-no_std#4, test-wasm ]
name: Run tests
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -260,6 +260,7 @@ jobs:
;;
'test-no_std')
cargo llvm-cov nextest --lcov --output-path lcov-${{ matrix.target }}-${{ matrix.special_features }}.info \
--partition count:${PARTITION}/4 \
--workspace --no-default-features --features "${{ matrix.special_features }}"
;;
'test-wasm')
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

#### Upcoming Changes

* feat: Implement a CLI to run cairo programs [#1370](https://github.com/lambdaclass/cairo-vm/pull/1370)
* feat: Use only program builtins when running cairo 1 programs [#1457](https://github.com/lambdaclass/cairo-vm/pull/1457)

* feat: Use latest cairo-vm version in cairo1-run crate [#1455](https://github.com/lambdaclass/cairo-vm/pull/1455)

* feat: Implement a CLI to run cairo 1 programs [#1370](https://github.com/lambdaclass/cairo-vm/pull/1370)

* fix: Fix string code of `BLAKE2S_ADD_UINT256` hint [#1454](https://github.com/lambdaclass/cairo-vm/pull/1454)

Expand Down
153 changes: 8 additions & 145 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ default-members = [
"cairo-vm-cli",
"felt",
"vm",
"cairo1-run",
]
exclude = ["ensure-no_std"]

Expand Down
15 changes: 11 additions & 4 deletions cairo1-run/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@ keywords.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# To match the cairo-vm version used by cairo-lang-runner crate
cairo-vm = {version = "0.8.2", features = ["std"]}
cairo-vm = {workspace = true, features = ["std", "cairo-1-hints"]}

cairo-lang-sierra-type-size = { version = "2.2.0", default-features = false }
cairo-lang-sierra-type-size = { version = "2.2.0", default-features = false }
cairo-lang-sierra-ap-change = { version = "2.2.0", default-features = false }
cairo-lang-sierra-gas = { version = "2.2.0", default-features = false }
cairo-lang-sierra-to-casm.workspace = true
cairo-lang-compiler.workspace = true
cairo-lang-sierra.workspace = true
cairo-lang-runner.workspace = true
cairo-lang-utils.workspace = true
cairo-lang-casm.workspace = true
itertools = "0.11.0"
clap = { version = "4.3.10", features = ["derive"] }
thiserror = { version = "1.0.40" }
bincode.workspace = true
assert_matches = "1.5.0"
rstest = "0.17.0"
mimalloc = { version = "0.1.37", default-features = false, optional = true }

[features]
default = ["with_mimalloc"]
with_mimalloc = ["cairo-vm/with_mimalloc", "mimalloc"]
lambdaworks-felt = ["cairo-vm/lambdaworks-felt"]
4 changes: 2 additions & 2 deletions cairo1-run/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
CAIRO_1_FOLDER=../cairo_programs/cairo-1-programs

$(CAIRO_1_FOLDER)/%.trace: $(CAIRO_1_FOLDER)/%.cairo
cargo run --release $< --trace_file $@
cargo run --release $< --trace_file $@ --layout all_cairo

$(CAIRO_1_FOLDER)/%.memory: $(CAIRO_1_FOLDER)/%.cairo
cargo run --release $< --memory_file $@
cargo run --release $< --memory_file $@ --layout all_cairo

CAIRO_1_PROGRAMS=$(wildcard ../cairo_programs/cairo-1-programs/*.cairo)
TRACES:=$(patsubst $(CAIRO_1_FOLDER)/%.cairo, $(CAIRO_1_FOLDER)/%.trace, $(CAIRO_1_PROGRAMS))
Expand Down
Loading

1 comment on commit 01a5773

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 01a5773 Previous: f434823 Ratio
add_u64_with_felt/1 4 ns/iter (± 0) 2 ns/iter (± 0) 2
add_u64_with_felt/2 4 ns/iter (± 0) 2 ns/iter (± 0) 2
add_u64_with_felt/3 2 ns/iter (± 0) 1 ns/iter (± 0) 2
add_u64_with_felt/4 2 ns/iter (± 0) 1 ns/iter (± 0) 2
add_u64_with_felt/5 2 ns/iter (± 0) 1 ns/iter (± 0) 2
add_u64_with_felt/6 4 ns/iter (± 0) 2 ns/iter (± 0) 2
add_u64_with_felt/7 4 ns/iter (± 0) 2 ns/iter (± 0) 2
add_u64_with_felt/8 3 ns/iter (± 0) 2 ns/iter (± 0) 1.50

This comment was automatically generated by workflow using github-action-benchmark.

CC: @unbalancedparentheses

Please sign in to comment.