From 0a3645dedfda07a53dda483457d55fe53279bf3d Mon Sep 17 00:00:00 2001 From: pefontana Date: Wed, 16 Oct 2024 16:58:20 -0300 Subject: [PATCH 1/4] Update docs --- cairo1-run/src/cairo_run.rs | 8 ++++++++ .../cairo_1_hint_processor/hint_processor.rs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/cairo1-run/src/cairo_run.rs b/cairo1-run/src/cairo_run.rs index bf654e9724..f22a6edd9a 100644 --- a/cairo1-run/src/cairo_run.rs +++ b/cairo1-run/src/cairo_run.rs @@ -366,6 +366,8 @@ fn build_hints_vec<'b>( (hints, program_hints) } +// Function derived from the cairo-lang-runner crate. +// https://github.com/starkware-libs/cairo/blob/40a7b60687682238f7f71ef7c59c986cc5733915/crates/cairo-lang-runner/src/lib.rs#L551-L552 /// Finds first function ending with `name_suffix`. fn find_function<'a>( sierra_program: &'a SierraProgram, @@ -384,6 +386,8 @@ fn find_function<'a>( .ok_or_else(|| RunnerError::MissingMain) } +// Function derived from the cairo-lang-runner crate. +// https://github.com/starkware-libs/cairo/blob/40a7b60687682238f7f71ef7c59c986cc5733915/crates/cairo-lang-runner/src/lib.rs#L750 /// Creates a list of instructions that will be appended to the program's bytecode. fn create_code_footer() -> Vec { casm! { @@ -527,6 +531,8 @@ fn load_arguments( Ok(()) } +// Function derived from the cairo-lang-runner crate. +// https://github.com/starkware-libs/cairo/blob/40a7b60687682238f7f71ef7c59c986cc5733915/crates/cairo-lang-runner/src/lib.rs#L703 /// Returns the instructions to add to the beginning of the code to successfully call the main /// function, as well as the builtins required to execute the program. fn create_entry_code( @@ -869,6 +875,8 @@ fn create_entry_code( )) } +// Function derived from the cairo-lang-runner crate. +// https://github.com/starkware-libs/cairo/blob/40a7b60687682238f7f71ef7c59c986cc5733915/crates/cairo-lang-runner/src/lib.rs#L577 fn get_info<'a>( sierra_program_registry: &'a ProgramRegistry, ty: &'a cairo_lang_sierra::ids::ConcreteTypeId, diff --git a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs index 98bb0a1547..45e6c58781 100644 --- a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs +++ b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs @@ -1,3 +1,6 @@ +// Most of the `HintCore` implementation is derived from the cairo-lang-runner crate. +// https://github.com/starkware-libs/cairo/blob/main/crates/cairo-lang-runner/src/casm_run/mod.rs + use super::dict_manager::DictManagerExecScope; use super::hint_processor_utils::*; use crate::any_box; From 6bcaaf69cf34aea5382f1e76b05cd194bcaed771 Mon Sep 17 00:00:00 2001 From: pefontana Date: Wed, 16 Oct 2024 17:09:57 -0300 Subject: [PATCH 2/4] Fix typo --- vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs index 45e6c58781..ff31d05b22 100644 --- a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs +++ b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs @@ -1,4 +1,4 @@ -// Most of the `HintCore` implementation is derived from the cairo-lang-runner crate. +// The majority of the `CoreHint` implementations are derived from the `cairo-lang-runner` crate. // https://github.com/starkware-libs/cairo/blob/main/crates/cairo-lang-runner/src/casm_run/mod.rs use super::dict_manager::DictManagerExecScope; From 2b98e9a070881f8bb4c6f5772ed6ca8426c80370 Mon Sep 17 00:00:00 2001 From: pefontana Date: Wed, 16 Oct 2024 17:16:32 -0300 Subject: [PATCH 3/4] update --- .../cairo_1_hint_processor/hint_processor.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs index ff31d05b22..0caf9c4e9c 100644 --- a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs +++ b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs @@ -1,6 +1,3 @@ -// The majority of the `CoreHint` implementations are derived from the `cairo-lang-runner` crate. -// https://github.com/starkware-libs/cairo/blob/main/crates/cairo-lang-runner/src/casm_run/mod.rs - use super::dict_manager::DictManagerExecScope; use super::hint_processor_utils::*; use crate::any_box; @@ -74,7 +71,9 @@ impl Cairo1HintProcessor { segment_arena_validations, } } - // Runs a single Hint + // Most of the Hints implementations are derived from the `cairo-lang-runner` crate. + // https://github.com/starkware-libs/cairo/blob/40a7b60687682238f7f71ef7c59c986cc5733915/crates/cairo-lang-runner/src/casm_run/mod.rs#L1681 + /// Runs a single Hint pub fn execute( &self, vm: &mut VirtualMachine, From 89178e818932f2fbf33a8511f3bc24c5dece6b3e Mon Sep 17 00:00:00 2001 From: pefontana Date: Wed, 16 Oct 2024 18:05:28 -0300 Subject: [PATCH 4/4] update dict docs --- vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs b/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs index b95c0b5232..a82a4fa2db 100644 --- a/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs +++ b/vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs @@ -1,3 +1,6 @@ +// Most of the structs and implementations of these Dictionaries are based on the `cairo-lang-runner` crate. +// Reference: https://github.com/starkware-libs/cairo/blob/main/crates/cairo-lang-runner/src/casm_run/dict_manager.rs + use num_traits::One; use crate::stdlib::collections::HashMap;