repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/tar_x/src/tar_x_apply_fns.rs
items/tar_x/src/tar_x_apply_fns.rs
use std::marker::PhantomData; use peace::cfg::{ApplyCheck, FnCtx}; #[cfg(feature = "output_progress")] use peace::progress_model::ProgressLimit; use crate::{FileMetadatas, TarXData, TarXError, TarXParams, TarXStateDiff}; /// ApplyFns for the tar to extract. pub struct TarXApplyFns<Id>(PhantomData<Id>); impl<Id> Tar...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/tar_x/src/tar_x_state_goal_fn.rs
items/tar_x/src/tar_x_state_goal_fn.rs
use std::{io::Read, marker::PhantomData, path::Path}; use peace::{cfg::FnCtx, params::Params, rt_model::Storage}; use tar::Archive; use crate::{FileMetadata, FileMetadatas, TarXData, TarXError, TarXParams}; /// Reads the goal state of the tar to extract. #[derive(Debug)] pub struct TarXStateGoalFn<Id>(PhantomData<Id...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/tar_x/src/tar_x_state_current_fn.rs
items/tar_x/src/tar_x_state_current_fn.rs
use std::{marker::PhantomData, path::Path}; use peace::{cfg::FnCtx, params::Params}; use crate::{FileMetadata, FileMetadatas, TarXData, TarXError, TarXParams}; /// Reads the current state of the tar to extract. #[derive(Debug)] pub struct TarXStateCurrentFn<Id>(PhantomData<Id>); impl<Id> TarXStateCurrentFn<Id> wher...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/tar_x/src/native/dest_dir_entry.rs
items/tar_x/src/native/dest_dir_entry.rs
use std::path::PathBuf; use tokio::fs::DirEntry; /// Intermediary type while calculating `FileMetadata` for native targets. #[derive(Debug)] pub(crate) struct DestDirEntry { /// Path relative to the extraction directory. pub(crate) dest_dir_relative_path: PathBuf, /// `DirEntry` from `tokio`. pub(crat...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/tar_x/src/native/dir_unfold.rs
items/tar_x/src/native/dir_unfold.rs
use std::{ collections::VecDeque, path::{Path, PathBuf}, }; use tokio::fs::ReadDir; use crate::{native::DestDirEntry, TarXError}; pub(crate) struct DirUnfold; impl DirUnfold { /// Provides a function that recursively produces file entries within the /// original directory. pub(crate) fn unfold( ...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_apply_fns.rs
items/blank/src/blank_apply_fns.rs
use std::marker::PhantomData; use peace::cfg::{ApplyCheck, FnCtx}; #[cfg(feature = "output_progress")] use peace::progress_model::ProgressLimit; use crate::{BlankData, BlankError, BlankParams, BlankState, BlankStateDiff}; /// ApplyFns for the blank state. #[derive(Debug)] pub struct BlankApplyFns<Id>(PhantomData<Id>...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_item.rs
items/blank/src/blank_item.rs
use std::marker::PhantomData; use peace::{ cfg::{async_trait, ApplyCheck, FnCtx, Item}, item_model::ItemId, params::Params, resource_rt::{resources::ts::Empty, Resources}, }; use crate::{BlankApplyFns, BlankData, BlankError, BlankParams, BlankState, BlankStateDiff}; /// Item for copying a number. ///...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/lib.rs
items/blank/src/lib.rs
//! Copies a number from one resource to another. pub use crate::{ blank_apply_fns::BlankApplyFns, blank_data::BlankData, blank_dest::BlankDest, blank_error::BlankError, blank_item::BlankItem, blank_params::{BlankParams, BlankParamsFieldWise, BlankParamsPartial}, blank_src::BlankSrc, bl...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_state_diff.rs
items/blank/src/blank_state_diff.rs
use std::fmt; use serde::{Deserialize, Serialize}; /// Diff between current (dest) and goal (src) state. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] pub enum BlankStateDiff { /// Value was added. Added { /// The new value. value: u32, }, /// Value OutOfSync { ...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_dest.rs
items/blank/src/blank_dest.rs
use std::fmt; use peace::params::Params; use serde::{Deserialize, Serialize}; /// Destination for blank state. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Params)] pub struct BlankDest(pub Option<u32>); impl fmt::Display for BlankDest { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_state.rs
items/blank/src/blank_state.rs
use std::fmt; use serde::{Deserialize, Serialize}; #[cfg(feature = "output_progress")] use peace::item_interaction_model::ItemLocationState; /// Logical blank state. #[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct BlankState(pub Option<u32>); impl fmt::Display for BlankState { fn...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_data.rs
items/blank/src/blank_data.rs
use peace::data::{accessors::W, Data}; use crate::BlankParams; /// Data used to manage blank state. /// /// # Type Parameters /// /// * `Id`: A zero-sized type used to distinguish different blank parameters /// from each other. #[derive(Data, Debug)] pub struct BlankData<'exec, Id> where Id: Send + Sync + 'stat...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_error.rs
items/blank/src/blank_error.rs
#[cfg(feature = "error_reporting")] use peace::miette; /// Error while managing blank state. #[cfg_attr(feature = "error_reporting", derive(peace::miette::Diagnostic))] #[derive(Debug, thiserror::Error)] pub enum BlankError { /// A `peace` runtime error occurred. #[error("A `peace` runtime error occurred.")] ...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_params.rs
items/blank/src/blank_params.rs
use std::marker::PhantomData; use derivative::Derivative; use peace::params::Params; use serde::{Deserialize, Serialize}; use crate::{BlankDest, BlankSrc}; /// Blank item parameters. /// /// The `Id` type parameter is needed for each blank params to be a distinct /// type. /// /// # Type Parameters /// /// * `Id`: A...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/items/blank/src/blank_src.rs
items/blank/src/blank_src.rs
use peace::params::Params; use serde::{Deserialize, Serialize}; /// Source for blank state. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Params)] pub struct BlankSrc(pub u32); impl std::ops::Deref for BlankSrc { type Target = u32; fn deref(&self) -> &Self::Target { &self.0 } } i...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/doc/src/learning_material/why_rust/constraints/data_race_1.rs
doc/src/learning_material/why_rust/constraints/data_race_1.rs
use std::thread; #[derive(Debug)] struct Data { value: u32, } fn main() { let mut data = Data { value: 0 }; let data = &mut data; let work_0 = || (0..50000).for_each(|_| data.value += 1); let work_1 = || (0..50000).for_each(|_| data.value += 1); let thread_0 = thread::spawn(work_0); let ...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
azriel91/peace
https://github.com/azriel91/peace/blob/5e2c43f2c0b18672749d0902d2285c703e24de97/doc/src/learning_material/why_rust/constraints/data_race_2.rs
doc/src/learning_material/why_rust/constraints/data_race_2.rs
use std::{ sync::{Arc, Mutex}, thread, }; #[derive(Debug)] struct Data { value: u32, } fn main() -> thread::Result<()> { let data = Data { value: 0 }; let arc_mutex = Arc::new(Mutex::new(data)); let arc_mutex_0 = arc_mutex.clone(); let arc_mutex_1 = arc_mutex.clone(); let work_0 = mov...
rust
Apache-2.0
5e2c43f2c0b18672749d0902d2285c703e24de97
2026-01-04T20:22:52.922300Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/starknet_stub.rs
src/starknet_stub.rs
//! An usable implementation of the starknet syscall handler trait. //! //! Based of cairo-lang-runner syscall handler implementation. //! - https://github.com/starkware-libs/cairo/blob/v2.14.0/crates/cairo-lang-runner/src/casm_run/mod.rs use std::{ collections::{HashMap, VecDeque}, fmt, sync::Arc, }; use...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/lib.rs
src/lib.rs
#![allow(clippy::missing_safety_doc)] #![allow(rustdoc::bare_urls)] // The following line contains a markdown reference link. // This is necessary to override the link destination in the README.md file, so // that when the README.md is rendered standalone (e.g. on Github) it points to // the online version, and when re...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/module.rs
src/module.rs
use crate::metadata::MetadataStorage; use cairo_lang_sierra::{ extensions::core::{CoreLibfunc, CoreType}, program_registry::ProgramRegistry, }; use melior::ir::Module; use std::{any::Any, fmt::Debug}; /// A MLIR module in the context of Cairo Native. /// It is conformed by the MLIR module, the Sierra program r...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/values.rs
src/values.rs
//! # Params and return values de/serialization //! //! A Rusty interface to provide parameters to cairo-native entry point calls. use crate::{ error::{panic::ToNativeAssertError, CompilerError, Error}, native_assert, native_panic, runtime::FeltDict, starknet::{Secp256k1Point, Secp256r1Point}, type...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/execution_result.rs
src/execution_result.rs
use std::ops::{Add, AddAssign}; /// # Execution Result /// /// This module contains the structures used to interpret the program execution results, either /// normal programs or starknet contracts. use crate::{error::Error, native_panic, utils::decode_error_message, values::Value}; use starknet_types_core::felt::Felt;...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/error.rs
src/error.rs
//! Various error types used thorough the crate. use crate::metadata::gas::GasMetadataError; use cairo_lang_sierra::extensions::modules::utils::Range; use cairo_lang_sierra::{ edit_state::EditStateError, ids::ConcreteTypeId, program_registry::ProgramRegistryError, }; use num_bigint::BigInt; use panic::NativeAssertE...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/debug.rs
src/debug.rs
use cairo_lang_sierra::{ extensions::{ array::ArrayConcreteLibfunc, boolean::BoolConcreteLibfunc, bounded_int::BoundedIntConcreteLibfunc, boxing::BoxConcreteLibfunc, bytes31::Bytes31ConcreteLibfunc, casts::CastConcreteLibfunc, circuit::{CircuitConcreteLibfunc,...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types.rs
src/types.rs
//! # Compiler type infrastructure //! //! Contains type generation stuff (aka. conversion from Sierra to MLIR types). use crate::{ error::Error as CoreTypeBuilderError, libfuncs::LibfuncHelper, metadata::MetadataStorage, native_panic, utils::{get_integer_layout, layout_repeat, RangeExt, PRIME}, };...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/starknet.rs
src/starknet.rs
//! Starknet related code for `cairo_native` use serde::{Deserialize, Serialize}; use starknet_types_core::felt::Felt; pub type SyscallResult<T> = std::result::Result<T, Vec<Felt>>; #[repr(C)] #[derive(Debug)] pub struct ArrayAbi<T> { pub ptr: *mut *mut T, pub since: u32, pub until: u32, pub capacity...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs.rs
src/libfuncs.rs
//! # Compiler libfunc infrastructure //! //! Contains libfunc generation stuff (aka. the actual instructions). use crate::{ error::{panic::ToNativeAssertError, Error as CoreLibfuncBuilderError, Result}, metadata::MetadataStorage, native_panic, types::TypeBuilder, utils::ProgramRegistryExt, }; use ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/ffi.rs
src/ffi.rs
//! # FFI Wrappers //! //! This is a "hotfix" for missing Rust interfaces to the C/C++ libraries we use, namely LLVM/MLIR //! APIs that are missing from melior. use crate::{ error::{panic::ToNativeAssertError, Error, Result}, statistics::Statistics, utils::walk_ir::walk_llvm_instructions, }; use llvm_sys::...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils.rs
src/utils.rs
//! # Various utilities pub(crate) use self::{program_registry_ext::ProgramRegistryExt, range_ext::RangeExt}; use crate::{ error::Result as NativeResult, metadata::MetadataStorage, native_panic, types::TypeBuilder, OptLevel, }; use cairo_lang_runner::token_gas_cost; use cairo_lang_sierra::{ extensions::{ ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/runtime.rs
src/runtime.rs
#![allow(non_snake_case)] use crate::utils::BuiltinCosts; use cairo_lang_sierra_gas::core_libfunc_cost::{ DICT_SQUASH_REPEATED_ACCESS_COST, DICT_SQUASH_UNIQUE_KEY_COST, }; use itertools::Itertools; use lazy_static::lazy_static; use num_bigint::BigInt; use num_traits::{ToPrimitive, Zero}; use rand::Rng; use starkne...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/executor.rs
src/executor.rs
//! # Executors //! //! This module provides methods to execute the programs, either via JIT or compiled ahead //! of time. It also provides a cache to avoid recompiling previously compiled programs. pub use self::{aot::AotNativeExecutor, contract::AotContractExecutor, jit::JitNativeExecutor}; use crate::{ arch::{...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/cache.rs
src/cache.rs
pub use self::{aot::AotProgramCache, jit::JitProgramCache}; use std::hash::Hash; pub mod aot; pub mod jit; #[derive(Debug)] pub enum ProgramCache<'a, K> where K: PartialEq + Eq + Hash, { Aot(AotProgramCache<'a, K>), Jit(JitProgramCache<'a, K>), } impl<'a, K> From<AotProgramCache<'a, K>> for ProgramCache<...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/context.rs
src/context.rs
use crate::{ clone_option_mut, error::{panic::ToNativeAssertError, Error}, ffi::{get_data_layout_rep, get_target_triple}, metadata::{gas::GasMetadata, runtime_bindings::RuntimeBindingsMeta, MetadataStorage}, module::NativeModule, native_assert, statistics::Statistics, utils::{run_pass_ma...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/docs.rs
src/docs.rs
//! # Cairo Native Compiler and Execution Engine #![cfg(doc)] #[allow(clippy::needless_doctest_main)] #[cfg_attr(doc, aquamarine::aquamarine)] #[doc = include_str!("../docs/overview.md")] pub mod section01 {} #[cfg_attr(doc, aquamarine::aquamarine)] #[doc = include_str!("../docs/compilation_walkthrough.md")] pub mod...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata.rs
src/metadata.rs
//! # Code generation metadata //! //! The metadata is used for various stuff that would be otherwise difficult or plain impossible //! with the current design, such as: //! - Pass compile-time constants that would otherwise have to be hardcoded in various places (ex. //! [PrimeModuloMeta](self::prime_modulo)). /...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/statistics.rs
src/statistics.rs
use cairo_lang_sierra::extensions::circuit::{CircuitInfo, GateOffsets}; use serde::Serialize; use std::collections::BTreeMap; use crate::{error::Result, native_panic}; /// A set of compilation statistics gathered during the compilation. /// It should be completely filled at the end of the compilation. #[derive(Defaul...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/arch.rs
src/arch.rs
use crate::{ error::Result, native_panic, starknet::{ArrayAbi, Secp256k1Point, Secp256r1Point}, types::TypeBuilder, utils::libc_malloc, values::Value, }; use bumpalo::Bump; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType, CoreTypeConcrete}, starknet::{secp...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/compiler.rs
src/compiler.rs
//! # Compilation process //! //! A Sierra program is compiled one function at a time. Each function has a pre-entry block that //! will be ran only once, even in tail-recursive functions. All libfuncs are intended to place //! their stack-allocating operations there so as to not grow the stack when recursing. //! //! ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/struct.rs
src/libfuncs/struct.rs
//! # Struct-related libfuncs use super::LibfuncHelper; use crate::{ error::Result, libfuncs::r#box::{into_box, unbox}, metadata::{realloc_bindings::ReallocBindingsMeta, MetadataStorage}, native_panic, types::TypeBuilder, utils::ProgramRegistryExt, }; use cairo_lang_sierra::{ extensions::{ ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/circuit.rs
src/libfuncs/circuit.rs
//! # Circuit libfuncs //! //! Relevant casm code: https://github.com/starkware-libs/cairo/blob/v2.10.0/crates/cairo-lang-sierra-to-casm/src/invocations/circuit.rs use super::{increment_builtin_counter_by, LibfuncHelper}; use crate::{ error::{panic::ToNativeAssertError, Result, SierraAssertError}, execution_re...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/array.rs
src/libfuncs/array.rs
//! # Array libfuncs use super::LibfuncHelper; use crate::{ error::{Error, Result, SierraAssertError}, metadata::{ drop_overrides::DropOverridesMeta, dup_overrides::DupOverridesMeta, realloc_bindings::ReallocBindingsMeta, MetadataStorage, }, native_assert, types::array::calc_data_pr...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/coupon.rs
src/libfuncs/coupon.rs
//! # Branch alignment libfunc //! //! Natively compiled code doesn't need branch alignment because it has no notion of segments. //! Because of this, this libfunc is a no-op. use super::LibfuncHelper; use crate::{error::Result, metadata::MetadataStorage, utils::ProgramRegistryExt}; use cairo_lang_sierra::{ extens...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/box.rs
src/libfuncs/box.rs
//! # Box libfuncs //! //! A heap allocated value, which is internally a pointer that can't be null. use std::alloc::Layout; use super::LibfuncHelper; use crate::{ error::Result, metadata::{realloc_bindings::ReallocBindingsMeta, MetadataStorage}, native_panic, types::TypeBuilder, utils::ProgramReg...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/dup.rs
src/libfuncs/dup.rs
//! # State value duplication libfunc //! //! Most types are trivial and don't need any clone (or rather, they will be cloned automatically by //! MLIR). For those types, this libfunc is a no-op. //! //! However, types like an array need special handling. use super::LibfuncHelper; use crate::{ error::Result, m...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/int_range.rs
src/libfuncs/int_range.rs
//! # Int range libfuncs use super::LibfuncHelper; use crate::{ error::Result, metadata::MetadataStorage, types::TypeBuilder, utils::ProgramRegistryExt, }; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, lib_func::SignatureOnlyConcreteLibfunc, range::IntRangeConcre...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/bounded_int.rs
src/libfuncs/bounded_int.rs
//! # Bounded int libfuncs use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Result}, execution_result::RANGE_CHECK_BUILTIN_SIZE, metadata::MetadataStorage, native_assert, types::TypeBuilder, utils::RangeExt, }; use cairo_lang_sierra::{ extensions::{ bounded...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/pedersen.rs
src/libfuncs/pedersen.rs
//! # Pedersen hashing libfuncs //! use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Result}, execution_result::PEDERSEN_BUILTIN_SIZE, metadata::{runtime_bindings::RuntimeBindingsMeta, MetadataStorage}, utils::{get_integer_layout, ProgramRegistryExt}, }; use cairo_lang_sierra:...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/felt252_dict_entry.rs
src/libfuncs/felt252_dict_entry.rs
//! # `Felt` dictionary entry libfuncs use super::LibfuncHelper; use crate::{ error::{Error, Result}, metadata::{runtime_bindings::RuntimeBindingsMeta, MetadataStorage}, types::TypeBuilder, utils::ProgramRegistryExt, }; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/gas_reserve.rs
src/libfuncs/gas_reserve.rs
use crate::libfuncs::LibfuncHelper; use crate::{error::Result, metadata::MetadataStorage}; use cairo_lang_sierra::extensions::lib_func::SignatureOnlyConcreteLibfunc; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, gas_reserve::GasReserveConcreteLibfunc, }, program_regis...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/bool.rs
src/libfuncs/bool.rs
//! # Boolean libfuncs use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Result}, metadata::MetadataStorage, types::TypeBuilder, utils::ProgramRegistryExt, }; use cairo_lang_sierra::{ extensions::{ boolean::BoolConcreteLibfunc, core::{CoreLibfunc, CoreType},...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/nullable.rs
src/libfuncs/nullable.rs
//! # Nullable libfuncs //! //! Like a Box but it can be null. use super::LibfuncHelper; use crate::{error::Result, metadata::MetadataStorage}; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, lib_func::{SignatureAndTypeConcreteLibfunc, SignatureOnlyConcreteLibfunc}, nu...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/debug.rs
src/libfuncs/debug.rs
//! # Debug libfuncs // Printable: 9-13, 27, 32, 33-126 // is_ascii_graphic() -> 33-126 // is_ascii_whitespace(): // U+0009 HORIZONTAL TAB // U+000A LINE FEED // U+000C FORM FEED // U+000D CARRIAGE RETURN. // U+0020 SPACE use super::LibfuncHelper; use crate::{ error...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/starknet.rs
src/libfuncs/starknet.rs
//! # Starknet libfuncs use super::LibfuncHelper; use crate::{ error::{Error, Result}, ffi::get_struct_field_type_at, metadata::{drop_overrides::DropOverridesMeta, MetadataStorage}, starknet::handler::StarknetSyscallHandlerCallbacks, utils::{get_integer_layout, ProgramRegistryExt, PRIME}, }; use ca...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/drop.rs
src/libfuncs/drop.rs
//! # `AP` tracking libfuncs //! //! Most types are trivial and don't need dropping (or rather, they will be dropped automatically //! by MLIR). For those types, this libfunc is a no-op. //! //! However, types like an array need manual dropping. use super::LibfuncHelper; use crate::{ error::Result, metadata::{...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/gas.rs
src/libfuncs/gas.rs
//! # Gas management libfuncs use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Error, Result}, metadata::{gas::GasCost, runtime_bindings::RuntimeBindingsMeta, MetadataStorage}, native_panic, utils::BuiltinCosts, }; use cairo_lang_sierra::{ extensions::{ core::{Core...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/mem.rs
src/libfuncs/mem.rs
//! # Memory-related libfuncs //! //! Natively compiled code doesn't need this kind of memory tracking because it has no notion of the //! segments. Because of this, all of the memory-related libfuncs here are no-ops. use super::LibfuncHelper; use crate::{error::Result, metadata::MetadataStorage, utils::ProgramRegistr...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/uint256.rs
src/libfuncs/uint256.rs
//! # `u256`-related libfuncs use super::{increment_builtin_counter_conditionally_by, LibfuncHelper}; use crate::{error::Result, metadata::MetadataStorage, utils::ProgramRegistryExt}; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, int::unsigned256::Uint256Concrete, li...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/cast.rs
src/libfuncs/cast.rs
//! # Casting libfuncs use super::LibfuncHelper; use crate::{ error::Result, libfuncs::increment_builtin_counter, metadata::MetadataStorage, native_assert, native_panic, types::TypeBuilder, utils::{RangeExt, HALF_PRIME, PRIME}, }; use cairo_lang_sierra::{ extensions::{ casts::{CastC...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/felt252.rs
src/libfuncs/felt252.rs
//! # `Felt`-related libfuncs use super::LibfuncHelper; use crate::{ error::Result, metadata::MetadataStorage, utils::{ProgramRegistryExt, PRIME}, }; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, felt252::{ Felt252BinaryOperationConcrete, Felt252Binar...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/const.rs
src/libfuncs/const.rs
//! # Const libfuncs use super::LibfuncHelper; use crate::{ error::{Error, Result}, libfuncs::{r#enum::build_enum_value, r#struct::build_struct_value}, metadata::{realloc_bindings::ReallocBindingsMeta, MetadataStorage}, native_panic, types::TypeBuilder, utils::{ProgramRegistryExt, RangeExt, PRI...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/ec.rs
src/libfuncs/ec.rs
//! # Elliptic curve libfuncs use super::LibfuncHelper; use crate::{ error::{Error, Result}, execution_result::EC_OP_BUILTIN_SIZE, libfuncs::increment_builtin_counter_conditionally_by, metadata::{runtime_bindings::RuntimeBindingsMeta, MetadataStorage}, native_panic, utils::{get_integer_layout, ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/bytes31.rs
src/libfuncs/bytes31.rs
//! # Bytes31-related libfuncs use super::LibfuncHelper; use crate::{ error::{Error, Result}, metadata::MetadataStorage, utils::ProgramRegistryExt, }; use cairo_lang_sierra::{ extensions::{ bytes31::Bytes31ConcreteLibfunc, consts::SignatureAndConstConcreteLibfunc, core::{CoreLib...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/function_call.rs
src/libfuncs/function_call.rs
//! # Function call libfuncs //! //! Includes logic for handling direct tail recursive function calls. More information on this topic //! at the [tail recursive metadata](crate::metadata::tail_recursion). use super::LibfuncHelper; use crate::{ error::{Error, Result}, metadata::{tail_recursion::TailRecursionMet...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/int.rs
src/libfuncs/int.rs
use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Result}, execution_result::BITWISE_BUILTIN_SIZE, libfuncs::{increment_builtin_counter, increment_builtin_counter_by}, metadata::MetadataStorage, native_panic, types::TypeBuilder, utils::{ProgramRegistryExt, PRIME}, };...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/felt252_dict.rs
src/libfuncs/felt252_dict.rs
//! # `Felt` dictionary libfuncs use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Result}, execution_result::SEGMENT_ARENA_BUILTIN_SIZE, metadata::{ felt252_dict::Felt252DictOverrides, runtime_bindings::RuntimeBindingsMeta, MetadataStorage, }, native_panic, typ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/poseidon.rs
src/libfuncs/poseidon.rs
//! # Poseidon hashing libfuncs //! use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Result}, execution_result::POSEIDON_BUILTIN_SIZE, metadata::{runtime_bindings::RuntimeBindingsMeta, MetadataStorage}, utils::{get_integer_layout, ProgramRegistryExt}, }; use cairo_lang_sierra:...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/uint512.rs
src/libfuncs/uint512.rs
//! # `u512`-related libfuncs use super::LibfuncHelper; use crate::{error::Result, metadata::MetadataStorage, utils::ProgramRegistryExt}; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, int::unsigned512::Uint512Concrete, lib_func::SignatureOnlyConcreteLibfunc, ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/enum.rs
src/libfuncs/enum.rs
//! # Enum-related libfuncs //! //! Check out [the enum type](crate::types::enum) for more information on enum layouts. use super::LibfuncHelper; use crate::{ error::{panic::ToNativeAssertError, Error, Result}, metadata::{enum_snapshot_variants::EnumSnapshotVariantsMeta, MetadataStorage}, native_assert, na...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/starknet/secp256.rs
src/libfuncs/starknet/secp256.rs
use crate::{ error::Result, libfuncs::LibfuncHelper, metadata::MetadataStorage, starknet::handler::StarknetSyscallHandlerCallbacks, utils::{get_integer_layout, ProgramRegistryExt}, }; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, lib_func::SignatureOnlyCon...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/libfuncs/starknet/testing.rs
src/libfuncs/starknet/testing.rs
#![cfg(feature = "with-cheatcode")] use crate::{ error::{panic::ToNativeAssertError, Result}, libfuncs::LibfuncHelper, metadata::{runtime_bindings::RuntimeBindingsMeta, MetadataStorage}, utils::{get_integer_layout, ProgramRegistryExt}, }; use cairo_lang_sierra::{ extensions::{ core::{CoreLi...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/enum_snapshot_variants.rs
src/metadata/enum_snapshot_variants.rs
use cairo_lang_sierra::ids::ConcreteTypeId; use std::collections::HashMap; // Maps a Snapshot<Enum> type to its enum variant types #[derive(Default)] pub struct EnumSnapshotVariantsMeta { map: HashMap<ConcreteTypeId, Vec<ConcreteTypeId>>, } impl EnumSnapshotVariantsMeta { pub fn set_mapping(&mut self, snapsh...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/realloc_bindings.rs
src/metadata/realloc_bindings.rs
//! # Memory allocation external bindings //! //! This metadata ensures that the bindings to the C function `realloc` exist in the current //! compilation context. use melior::{ dialect::llvm, ir::{ attribute::{FlatSymbolRefAttribute, StringAttribute, TypeAttribute}, operation::OperationBuilder...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/profiler.rs
src/metadata/profiler.rs
#![cfg(feature = "with-libfunc-profiling")] //! The libfunc profiling feature is used to generate information about every libfunc executed in a sierra program. //! //! When this feature is used, the compiler will call the important methods: //! //! 1. `measure_timestamp`: called before every libfunc execution. //! //! ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/drop_overrides.rs
src/metadata/drop_overrides.rs
//! # Dropping logic overrides //! //! By default, values are discarded, but some cases (like arrays, boxes, nullables, dictionaries //! and some structs and enums) need a drop implementation instad. This metadata is a register of //! types that require a drop implementation as well as the logic to register and invoke ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/trace_dump.rs
src/metadata/trace_dump.rs
#![cfg(feature = "with-trace-dump")] use crate::error::{Error, Result}; use cairo_lang_sierra::{ ids::{ConcreteTypeId, VarId}, program::StatementIdx, }; use melior::{ dialect::{llvm, memref, ods}, helpers::{ArithBlockExt, BuiltinBlockExt, LlvmBlockExt}, ir::{ attribute::{FlatSymbolRefAttrib...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/debug_utils.rs
src/metadata/debug_utils.rs
//! # Debug utilities //! //! A collection of utilities to debug values in MLIR in execution. //! //! ## Example //! //! ```rust,ignore //! # use cairo_lang_sierra::{ //! # extensions::{ //! # core::{CoreLibfunc, CoreType}, //! # lib_func::SignatureAndTypeConcreteLibfunc, //! # GenericType, ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/auto_breakpoint.rs
src/metadata/auto_breakpoint.rs
#![cfg(feature = "with-debug-utils")] use super::{debug_utils::DebugUtils, MetadataStorage}; use crate::error::Error; use cairo_lang_sierra::ids::ConcreteTypeId; use melior::ir::{Block, Location}; use std::collections::HashSet; #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum BreakpointEvent { EnumInit { ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/runtime_bindings.rs
src/metadata/runtime_bindings.rs
//! # Runtime library bindings //! //! This metadata ensures that the bindings to the runtime functions exist in the current //! compilation context. use crate::{ error::{Error, Result}, libfuncs::LibfuncHelper, }; use itertools::Itertools; use melior::{ dialect::{ arith::{self, CmpiPredicate}, ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
true
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/gas.rs
src/metadata/gas.rs
//! This file contains the gas calculation metadata. //! //! Each statement has an associated `GasCost`, which represents the cost of //! executing that statement, in terms of tokens. //! //! To calculate the actual cost, the amount of tokens is multiplied by the cost //! of the given token type. The cost of each token...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/tail_recursion.rs
src/metadata/tail_recursion.rs
//! # Tail recursion information //! //! Whenever the compiler detects a direct tail-recursive function call it'll insert this metadata. //! If the libfunc handler decides to use it by setting a return target, the compiler will insert //! the required instructions to make it really tail-recursive. //! //! Directly recu...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/felt252_dict.rs
src/metadata/felt252_dict.rs
use super::{drop_overrides::DropOverridesMeta, MetadataStorage}; use crate::{ error::{Error, Result}, utils::ProgramRegistryExt, }; use cairo_lang_sierra::{ extensions::core::{CoreLibfunc, CoreType}, ids::ConcreteTypeId, program_registry::ProgramRegistry, }; use melior::{ dialect::llvm, help...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/metadata/dup_overrides.rs
src/metadata/dup_overrides.rs
//! # Duplication logic overrides //! //! By default, values are copied (aka. `memcpy`'d), but some cases (like arrays, boxes, nullables, //! dictionaries and some structs and enums) need a clone implementation instad. This metadata is //! a register of types that require a clone implementation as well as the logic to ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/cache/aot.rs
src/cache/aot.rs
use crate::error::{Error, Result}; use crate::{ context::NativeContext, executor::AotNativeExecutor, module::NativeModule, utils::SHARED_LIBRARY_EXT, OptLevel, }; use cairo_lang_sierra::program::Program; use libloading::Library; use std::{ collections::HashMap, fmt::{self, Debug}, hash::Hash, sy...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/cache/jit.rs
src/cache/jit.rs
use crate::error::Result; use crate::{context::NativeContext, executor::JitNativeExecutor, OptLevel}; use cairo_lang_sierra::program::Program; use std::{ collections::HashMap, fmt::{self, Debug}, hash::Hash, sync::Arc, }; /// A Cache for programs with the same context. pub struct JitProgramCache<'a, K>...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/mem_tracing.rs
src/utils/mem_tracing.rs
#![cfg(feature = "with-mem-tracing")] use libc::{c_void, size_t}; use melior::ExecutionEngine; use std::cell::UnsafeCell; thread_local! { static MEM_TRACING: UnsafeCell<MemTracing> = const { UnsafeCell::new(MemTracing::new()) }; } struct MemTracing { finished: Vec<AllocTrace>, pending: Vec<AllocTrace>, }...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/safe_runner.rs
src/utils/safe_runner.rs
//! # Safe runner //! //! The safe runner provides a way to run contracts without any risk of crashing due to invalid //! memory accesses, including stack overflows. The same mechanism can also be used to abort the //! current Cairo program execution, although it will probably leak some memory. //! //! It works by sett...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/program_registry_ext.rs
src/utils/program_registry_ext.rs
use crate::{error::Result, metadata::MetadataStorage, types::TypeBuilder}; use cairo_lang_sierra::{ extensions::core::{CoreLibfunc, CoreType}, ids::ConcreteTypeId, program_registry::ProgramRegistry, }; use melior::{ ir::{Module, Type}, Context, }; use std::alloc::Layout; pub trait ProgramRegistryEx...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/trace_dump.rs
src/utils/trace_dump.rs
#![cfg(feature = "with-trace-dump")] //! The trace dump feature is used to generate the execution trace of a sierra program. //! //! Take, for example, the following sierra code: //! //! ```sierra //! const_as_immediate<Const<felt252, 10>>() -> ([0]); //! const_as_immediate<Const<felt252, 20>>() -> ([1]); //! store_tem...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/walk_ir.rs
src/utils/walk_ir.rs
use llvm_sys::{ core::{ LLVMGetFirstBasicBlock, LLVMGetFirstFunction, LLVMGetFirstInstruction, LLVMGetNextBasicBlock, LLVMGetNextFunction, LLVMGetNextInstruction, }, prelude::{LLVMModuleRef, LLVMValueRef}, LLVMBasicBlock, LLVMValue, }; use melior::ir::{BlockLike, BlockRef, OperationRef};...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/testing.rs
src/utils/testing.rs
#![cfg(any(test, feature = "testing"))] use cairo_lang_compiler::CompilerConfig; use cairo_lang_filesystem::{db::init_dev_corelib, ids::CrateInput}; use cairo_lang_lowering::utils::InliningStrategy; use cairo_lang_sierra::{program::Program, ProgramParser}; use cairo_lang_starknet::{compile::compile_contract_in_prepare...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/range_ext.rs
src/utils/range_ext.rs
use cairo_lang_sierra::extensions::utils::Range; use num_bigint::{BigInt, BigUint, Sign}; use num_traits::One; pub trait RangeExt { /// Width in bits when the offset is zero (aka. the natural representation). fn zero_based_bit_width(&self) -> u32; /// Width in bits when the offset is not necessarily zero (...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/utils/sierra_gen.rs
src/utils/sierra_gen.rs
#![cfg(test)] use cairo_lang_sierra::{ extensions::{ branch_align::BranchAlignLibfunc, core::CoreType, enm::{EnumInitLibfunc, EnumType}, lib_func::{SierraApChange, SignatureSpecializationContext}, structure::{StructConstructLibfunc, StructType}, type_specialization_c...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/struct.rs
src/types/struct.rs
//! # Struct type //! //! A struct is just a fixed collection of values that may have different types, which are known at //! compile-time. Its fields are properly aligned and respect the declaration's field ordering. //! //! For example, the following struct would have a layout as described in the table below: //! //!...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/uint128_mul_guarantee.rs
src/types/uint128_mul_guarantee.rs
//! # Unsigned 128-bit multiplication guarantee type use super::WithSelf; use crate::{error::Result, metadata::MetadataStorage}; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, types::InfoOnlyConcreteType, }, program_registry::ProgramRegistry, }; use melior::{ dial...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/circuit.rs
src/types/circuit.rs
//! # `Circuit` type use std::alloc::Layout; use super::WithSelf; use crate::{ error::{Result, SierraAssertError}, metadata::{ drop_overrides::DropOverridesMeta, dup_overrides::DupOverridesMeta, realloc_bindings::ReallocBindingsMeta, MetadataStorage, }, utils::{get_integer_layout, layo...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/bitwise.rs
src/types/bitwise.rs
//! # Bitwise type //! //! The bitwise type is used in the VM for computing bitwise operations. Since this can be done //! natively in MLIR, this type is effectively an unit type. use super::WithSelf; use crate::{error::Result, metadata::MetadataStorage}; use cairo_lang_sierra::{ extensions::{ core::{CoreL...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/array.rs
src/types/array.rs
//! # Array type //! //! An array type is a dynamically allocated list of items. //! //! ## Layout //! //! Being dynamically allocated, we just need to keep the pointer to the data, its length and //! its capacity: //! //! | Index | Type | Description | //! | ----- | -------------- | ------------...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/gas_builtin.rs
src/types/gas_builtin.rs
//! # Gas builtin type //! //! The gas builtin is just a number indicating how many //! gas units currently remain. use super::WithSelf; use crate::{error::Result, metadata::MetadataStorage}; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, types::InfoOnlyConcreteType, }, ...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/uint8.rs
src/types/uint8.rs
//! # Unsigned 8-bit integer type use super::WithSelf; use crate::{error::Result, metadata::MetadataStorage}; use cairo_lang_sierra::{ extensions::{ core::{CoreLibfunc, CoreType}, types::InfoOnlyConcreteType, }, program_registry::ProgramRegistry, }; use melior::{ ir::{r#type::IntegerTyp...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false
lambdaclass/cairo_native
https://github.com/lambdaclass/cairo_native/blob/f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce/src/types/range_check.rs
src/types/range_check.rs
//! # Builtin costs type //! //! The range check type is used in the VM for checking whether values are in a specific range. //! Since this can be done natively in MLIR, this type is effectively an unit type. use super::WithSelf; use crate::{error::Result, metadata::MetadataStorage}; use cairo_lang_sierra::{ exten...
rust
Apache-2.0
f0a4fdbbad8a1730dea3b20c0b2ea140b9b853ce
2026-01-04T20:20:54.031924Z
false