Skip to main content

cairo_run_program

Function cairo_run_program 

Source
pub fn cairo_run_program(
    program: &Program,
    program_input: Option<ProgramInput>,
    cairo_run_config: CairoRunConfig<'_>,
    extra_hint_processor: Option<&mut dyn HintProcessor>,
) -> Result<CairoRunner, CairoRunError>
Expand description

Executes a Cairo program with the given configuration, optionally handling program input and proof mode.

§Arguments

  • program: A reference to a Program object that represents the compiled Cairo program to run.
  • program_input: An optional program input source. If Some, the input is injected into the execution scope under the key "program_input" and later decoded by hints into the concrete type the hints expect (e.g. SimpleProgramInput).
  • layout: A LayoutName specifying the Cairo layout to use in the VM (e.g., plain, all_cairo).
  • dynamic_layout_params: An optional CairoLayoutParams providing dynamic parameters for the layout. This is used only if the dynamic layout is selected.
  • proof_mode: A bool indicating whether to run the program in proof mode (true) or validation mode (false).

§Returns

  • Ok(CairoRunner): If the program runs successfully, returns the CairoRunner instance containing the execution state.
  • Err(CairoRunError): If an error occurs during execution, returns a CairoRunError describing the problem.