Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Cairo 1 Hint Processor crate #384

Merged
merged 2 commits into from
Apr 24, 2023
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
9 changes: 9 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ assert_matches = "1.5.0"
rusty-hook = "0.11"

[workspace]
members = ["crates/starknet-rs-py"]
members = ["crates/starknet-rs-py", "crates/cairo-1-hint-processor"]

[[bench]]
path = "bench/internals.rs"
Expand Down
9 changes: 9 additions & 0 deletions crates/cairo-1-hint-processor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "cairo-1-hint-processor"
version = "0.1.0"
edition = "2021"

[dependencies]
cairo-rs = { git = "https://github.com/lambdaclass/cairo-rs", package = "cairo-vm", rev = "725c17e6b4c50ecf9fbb0113ecf172d858372954" }
felt = { git = "https://github.com/lambdaclass/cairo-rs", package = "cairo-felt", rev = "725c17e6b4c50ecf9fbb0113ecf172d858372954" }
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo" }
29 changes: 29 additions & 0 deletions crates/cairo-1-hint-processor/src/hint_processor.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use std::collections::HashMap;

use cairo_rs::{
hint_processor::hint_processor_definition::HintProcessor,
types::exec_scope::ExecutionScopes,
vm::{errors::hint_errors::HintError, vm_core::VirtualMachine},
};
use felt::Felt252;

/// HintProcessor for Cairo 1 compiler hints.
struct Cairo1HintProcessor {}

impl HintProcessor for Cairo1HintProcessor {
fn execute_hint(
&mut self,
//Proxy to VM, contains references to necessary data
//+ MemoryProxy, which provides the necessary methods to manipulate memory
_vm: &mut VirtualMachine,
//Proxy to ExecutionScopes, provides the necessary methods to manipulate the scopes and
//access current scope variables
_exec_scopes: &mut ExecutionScopes,
//Data structure that can be downcasted to the structure generated by compile_hint
_hint_data: &Box<dyn std::any::Any>,
//Constant values extracted from the program specification.
_constants: &HashMap<String, Felt252>,
) -> Result<(), HintError> {
todo!();
}
}
1 change: 1 addition & 0 deletions crates/cairo-1-hint-processor/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod hint_processor;