diff --git a/Cargo.lock b/Cargo.lock index 40677b4bd..586a22c92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -582,6 +582,15 @@ dependencies = [ "bytes", ] +[[package]] +name = "cairo-1-hint-processor" +version = "0.1.0" +dependencies = [ + "cairo-felt 0.3.0-rc1 (git+https://github.com/lambdaclass/cairo-rs?rev=725c17e6b4c50ecf9fbb0113ecf172d858372954)", + "cairo-lang-casm", + "cairo-vm", +] + [[package]] name = "cairo-felt" version = "0.3.0-rc1" diff --git a/Cargo.toml b/Cargo.toml index be10cc431..53f88698e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/crates/cairo-1-hint-processor/Cargo.toml b/crates/cairo-1-hint-processor/Cargo.toml new file mode 100644 index 000000000..8e4169d80 --- /dev/null +++ b/crates/cairo-1-hint-processor/Cargo.toml @@ -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" } diff --git a/crates/cairo-1-hint-processor/src/hint_processor.rs b/crates/cairo-1-hint-processor/src/hint_processor.rs new file mode 100644 index 000000000..c20a30c6c --- /dev/null +++ b/crates/cairo-1-hint-processor/src/hint_processor.rs @@ -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, + //Constant values extracted from the program specification. + _constants: &HashMap, + ) -> Result<(), HintError> { + todo!(); + } +} diff --git a/crates/cairo-1-hint-processor/src/lib.rs b/crates/cairo-1-hint-processor/src/lib.rs new file mode 100644 index 000000000..93c7ec76e --- /dev/null +++ b/crates/cairo-1-hint-processor/src/lib.rs @@ -0,0 +1 @@ +pub mod hint_processor;