Skip to content

Commit

Permalink
Renamed entrypoint kind names. (starkware-libs#6821)
Browse files Browse the repository at this point in the history
  • Loading branch information
orizi authored Dec 5, 2024
1 parent abaa1c5 commit 6671cec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions crates/bin/cairo-execute/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ fn main() -> anyhow::Result<()> {
let entrypoint = executable
.entrypoints
.iter()
.find(|e| matches!(e.kind, EntryPointKind::NonReturning))
.with_context(|| "No function entrypoint found.")?;
.find(|e| matches!(e.kind, EntryPointKind::Standalone))
.with_context(|| "No `Standalone` entrypoint found.")?;
Program::new_for_proof(
entrypoint.builtins.clone(),
data,
Expand All @@ -152,8 +152,8 @@ fn main() -> anyhow::Result<()> {
let entrypoint = executable
.entrypoints
.iter()
.find(|e| matches!(e.kind, EntryPointKind::Function))
.with_context(|| "No function entrypoint found.")?;
.find(|e| matches!(e.kind, EntryPointKind::Bootloader))
.with_context(|| "No `Bootloader` entrypoint found.")?;
Program::new(
entrypoint.builtins.clone(),
data,
Expand Down
12 changes: 8 additions & 4 deletions crates/cairo-lang-executable/src/executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ impl Executable {
ExecutableEntryPoint {
builtins: compiled.wrapper.builtins.clone(),
offset: 0,
kind: EntryPointKind::NonReturning,
kind: EntryPointKind::Standalone,
},
ExecutableEntryPoint {
builtins: compiled.wrapper.builtins,
offset: non_returning_header.current_code_offset,
kind: EntryPointKind::Function,
kind: EntryPointKind::Bootloader,
},
],
}
Expand All @@ -58,9 +58,13 @@ pub struct ExecutableEntryPoint {
/// The kind of an entrypoint.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum EntryPointKind {
/// Entrypoint is for running it using a bootloader.
///
/// The entrypoint is a function, ending with a `ret`, expecting the builtins as its parameters.
Function,
Bootloader,
/// Entrypoint is for running this executable as a standalone program.
///
/// The entrypoint starts with `ap += <builtins.len()>` and expected the builtins to be injected
/// there, and ends with an infinite loop.
NonReturning,
Standalone,
}

0 comments on commit 6671cec

Please sign in to comment.