Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

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

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[workspace]
members = [".", "felt"]
members = [".", "felt", "./deps/parse-hyperlinks"]

[package]
name = "cairo-rs"
version = "0.1.0"
name = "cairo-vm"
version = "0.1.1"
edition = "2021"
license = "MIT"
description = "Blazing fast Cairo interpreter"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -31,14 +33,14 @@ nom = "7"
sha2 = {version="0.10.2", features=["compress"]}
thiserror = "1.0.32"
generic-array = "0.14.6"
keccak = "0.1.2"
# This crate has only one function `take_until_unbalanced` that is
# very useful for our parsing purposes:
# https://stackoverflow.com/questions/70630556/parse-allowing-nested-parentheses-in-nom
# There is a proposal for extending nom::delimited to use this function:
# https://github.com/Geal/nom/issues/1253
keccak = "0.1.2"
parse-hyperlinks = { path = "./deps/parse-hyperlinks" }
felt = { path = "./felt" }
parse-hyperlinks = { path = "./deps/parse-hyperlinks", version = "0.23.4" }
felt = { package = "cairo-felt", path = "./felt", version = "0.1.0" }

[dev-dependencies]
iai = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion bench/criterion_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::Path;

use cairo_rs::{
use cairo_vm::{
cairo_run,
hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor,
};
Expand Down
2 changes: 1 addition & 1 deletion bench/iai_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::Path;

use cairo_rs::{
use cairo_vm::{
cairo_run::cairo_run,
hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor,
vm::errors::cairo_run_errors::CairoRunError, vm::runners::cairo_runner::CairoRunner,
Expand Down
14 changes: 7 additions & 7 deletions custom_hint_example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use cairo_rs::cairo_run::cairo_run;
use cairo_rs::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::{
use cairo_vm::cairo_run::cairo_run;
use cairo_vm::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::{
BuiltinHintProcessor, HintFunc,
};
use cairo_rs::hint_processor::builtin_hint_processor::hint_utils::get_integer_from_var_name;
use cairo_rs::hint_processor::hint_processor_definition::HintReference;
use cairo_rs::types::exec_scope::ExecutionScopes;
use cairo_rs::serde::deserialize_program::ApTracking;
use cairo_rs::vm::{errors::hint_errors::HintError, vm_core::VirtualMachine};
use cairo_vm::hint_processor::builtin_hint_processor::hint_utils::get_integer_from_var_name;
use cairo_vm::hint_processor::hint_processor_definition::HintReference;
use cairo_vm::types::exec_scope::ExecutionScopes;
use cairo_vm::serde::deserialize_program::ApTracking;
use cairo_vm::vm::{errors::hint_errors::HintError, vm_core::VirtualMachine};
use num_bigint::BigInt;
use std::collections::HashMap;
use std::path::Path;
Expand Down
4 changes: 2 additions & 2 deletions docs/hint_processor/builtin_hint_processor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let hint = HintFunc(Box::new(print_a_hint));
#### Step 3: Instantiate the BuiltinHintProcessor and add your custom hint implementation
Import the BuiltinHintProcessor from cairo-rs, instantiate it using the `new_empty()` method and the add your custom hint implementation using the method `add_hint`
```rust
use cairo_rs::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor
use cairo_vm::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor

let mut hint_processor = BuiltinHintProcessor::new_empty();
hint_processor.add_hint(String::from("print(ids.a)"), hint);
Expand All @@ -71,7 +71,7 @@ You can also create a dictionary of HintFunc and use the method `new()` to creat
Import the function cairo_run from cairo-rs, and run your compiled program

```rust
use cairo_rs::cairo_run::cairo_run;
use cairo_vm::cairo_run::cairo_run;
cairo_run(
Path::new("custom_hint.json"),
"main",
Expand Down
10 changes: 6 additions & 4 deletions felt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
[package]
name = "felt"
name = "cairo-felt"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Field elements representation for the Cairo VM"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
num-integer = "*"
num-integer = "0.1.45"
num-bigint = { version = "0.4", features = ["serde"] }
num-traits = "*"
lazy_static = "*"
num-traits = "0.2.15"
lazy_static = "1.4.0"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![deny(warnings)]
use cairo_rs::cairo_run;
use cairo_rs::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor;
use cairo_rs::vm::errors::cairo_run_errors::CairoRunError;
use cairo_rs::vm::errors::runner_errors::RunnerError;
use cairo_rs::vm::errors::trace_errors::TraceError;
use cairo_vm::cairo_run;
use cairo_vm::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor;
use cairo_vm::vm::errors::cairo_run_errors::CairoRunError;
use cairo_vm::vm::errors::runner_errors::RunnerError;
use cairo_vm::vm::errors::trace_errors::TraceError;
use clap::{Parser, ValueHint};
use std::path::PathBuf;

Expand Down
2 changes: 1 addition & 1 deletion tests/bitwise_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cairo_rs::{
use cairo_vm::{
hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor,
types::program::Program,
vm::{
Expand Down
4 changes: 2 additions & 2 deletions tests/cairo_run_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cairo_rs::cairo_run;
use cairo_rs::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor;
use cairo_vm::cairo_run;
use cairo_vm::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor;
use std::path::Path;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion tests/pedersen_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::Path;

use cairo_rs::{
use cairo_vm::{
hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor,
types::program::Program,
vm::trace::trace_entry::RelocatedTraceEntry,
Expand Down
4 changes: 2 additions & 2 deletions tests/struct_test.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use cairo_rs::{
use cairo_vm::{
hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor,
vm::vm_core::VirtualMachine,
};
use std::path::Path;

use cairo_rs::{
use cairo_vm::{
types::program::Program,
vm::{runners::cairo_runner::CairoRunner, trace::trace_entry::RelocatedTraceEntry},
};
Expand Down