Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs, cairo-lang-runner references #1854

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
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
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
Loading