-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add lib.rs * Add changelog entry * Add FuncArg docs * Add Cairo1RunConfig docs * fix * fmt * fmt
- Loading branch information
Showing
5 changed files
with
109 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use cairo_lang_sierra::{ids::ConcreteTypeId, program_registry::ProgramRegistryError}; | ||
use cairo_lang_sierra_to_casm::{compiler::CompilationError, metadata::MetadataError}; | ||
use cairo_vm::{ | ||
air_public_input::PublicInputError, | ||
cairo_run::EncodeTraceError, | ||
types::errors::program_errors::ProgramError, | ||
vm::errors::{ | ||
memory_errors::MemoryError, runner_errors::RunnerError, trace_errors::TraceError, | ||
vm_errors::VirtualMachineError, | ||
}, | ||
Felt252, | ||
}; | ||
use thiserror::Error; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum Error { | ||
#[error("Invalid arguments")] | ||
Cli(#[from] clap::Error), | ||
#[error("Failed to interact with the file system")] | ||
IO(#[from] std::io::Error), | ||
#[error(transparent)] | ||
EncodeTrace(#[from] EncodeTraceError), | ||
#[error(transparent)] | ||
VirtualMachine(#[from] VirtualMachineError), | ||
#[error(transparent)] | ||
Trace(#[from] TraceError), | ||
#[error(transparent)] | ||
PublicInput(#[from] PublicInputError), | ||
#[error(transparent)] | ||
Runner(#[from] RunnerError), | ||
#[error(transparent)] | ||
ProgramRegistry(#[from] Box<ProgramRegistryError>), | ||
#[error(transparent)] | ||
Compilation(#[from] Box<CompilationError>), | ||
#[error("Failed to compile to sierra:\n {0}")] | ||
SierraCompilation(String), | ||
#[error(transparent)] | ||
Metadata(#[from] MetadataError), | ||
#[error(transparent)] | ||
Program(#[from] ProgramError), | ||
#[error(transparent)] | ||
Memory(#[from] MemoryError), | ||
#[error("Program panicked with {0:?}")] | ||
RunPanic(Vec<Felt252>), | ||
#[error("Function signature has no return types")] | ||
NoRetTypesInSignature, | ||
#[error("No size for concrete type id: {0}")] | ||
NoTypeSizeForId(ConcreteTypeId), | ||
#[error("Concrete type id has no debug name: {0}")] | ||
TypeIdNoDebugName(ConcreteTypeId), | ||
#[error("No info in sierra program registry for concrete type id: {0}")] | ||
NoInfoForType(ConcreteTypeId), | ||
#[error("Failed to extract return values from VM")] | ||
FailedToExtractReturnValues, | ||
#[error("Function expects arguments of size {expected} and received {actual} instead.")] | ||
ArgumentsSizeMismatch { expected: i16, actual: i16 }, | ||
#[error("Function param {param_index} only partially contains argument {arg_index}.")] | ||
ArgumentUnaligned { | ||
param_index: usize, | ||
arg_index: usize, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
pub mod cairo_run; | ||
pub mod error; | ||
// Re-export main struct and functions from crate for convenience | ||
pub use crate::cairo_run::{cairo_run_program, Cairo1RunConfig, FuncArg}; | ||
// Re-export cairo_vm structs returned by this crate for ease of use | ||
pub use cairo_vm::{ | ||
types::relocatable::{MaybeRelocatable, Relocatable}, | ||
vm::{runners::cairo_runner::CairoRunner, vm_core::VirtualMachine}, | ||
Felt252, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters