Skip to content

Commit

Permalink
Update docs, cairo-lang-runner references (#1854)
Browse files Browse the repository at this point in the history
* Update docs

* Fix typo

* update

* update dict docs

---------

Co-authored-by: pefontana <[email protected]>
  • Loading branch information
pefontana and pefontana authored Oct 23, 2024
1 parent d2257d6 commit 159f67d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cairo1-run/src/cairo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<Instruction> {
casm! {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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<CoreType, CoreLibfunc>,
ty: &'a cairo_lang_sierra::ids::ConcreteTypeId,
Expand Down
3 changes: 3 additions & 0 deletions vm/src/hint_processor/cairo_1_hint_processor/dict_manager.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,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,
Expand Down

0 comments on commit 159f67d

Please sign in to comment.