cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
cairo1-run
CLI: Allow loading arguments from file#1739
BREAKING: Remove unused CairoRunner
field original_steps
#1742
feat: Add --run_from_cairo_pie
to cairo-vm-cli
+ workflow #1730
Serialize directly into writer in CairoPie::write_zip_file
#1736
feat: Add support for cairo1 run with segements arena validation.
refactor: Add lib.rs
to cairo1-run#1714
feat: Implement CairoPie::read_zip_file
#1729
feat: Bump to 2.6.3 + Remove gas checks#1709
Known bugs & issues
segment to README, poining out issues derived from the removal of gas checks and cairo v2.6.3feat: Implement running from CairoPie
#1720
cairo_run_pie
CairoPie
methods run_validity_checks
& check_pie_compatibility
Program
method from_stripped_program
bugfix: Don't assume outer deref when fetching integer values from references#1732
feat: Implement extend_additional_data
for BuiltinRunner
#1726
BREAKING: Set dynamic params as null by default on air public input #1716
PublicInput
field layout_params
renamed to dynamic_params
& type changed from&'a CairoLayout
to ()
.feat: cairo1-run
accepts Sierra programs #1719
refactor(BREAKING): Use BuiltinName
enum instead of string representation #1722
BuiltinName
moved from crate::serde::deserialize_program
module to crate::types::builtin_name
.
BuiltinName
methods to_str
, to_str_with_suffix
, from_str
& from_str_with_suffix
.BuiltinName
method name
.BuiltinName
instead of &'static str
or String
.OUTPUT_BUILTIN_NAME
, HASH_BUILTIN_NAME
, RANGE_CHECK_BUILTIN_NAME
,RANGE_CHECK_96_BUILTIN_NAME
, SIGNATURE_BUILTIN_NAME
, BITWISE_BUILTIN_NAME
, EC_OP_BUILTIN_NAME
, KECCAK_BUILTIN_NAME
, POSEIDON_BUILTIN_NAME
, SEGMENT_ARENA_BUILTIN_NAME
, ADD_MOD_BUILTIN_NAME
&
MUL_MOD_BUILTIN_NAME
.BuiltinRunner
& ModBuiltinRunner
method identifier
BuiltinName
instead:
AirPrivateInput(pub HashMap<&'static str, Vec<PrivateInput>>)
-> AirPrivateInput(pub HashMap<BuiltinName, Vec<PrivateInput>>)
.CairoPieMetadata
field additional_data
: HashMap<String, BuiltinAdditionalData>,
-> CairoPieAdditionalData
with CairoPieAdditionalData(pub HashMap<BuiltinName, BuiltinAdditionalData>)
CairoPieMetadata
field builtin_segments
: HashMap<String, SegmentInfo>
-> HashMap<BuiltinName, SegmentInfo>
.ExecutiobResources
field builtin_instance_counter
: HashMap<String, usize>
-> HashMap<BuiltinName, usize>
BuiltinName
instead:
BuiltinRunner
, ModBuiltinRunner
& RangeCheckBuiltinRunner
method name
: &'static str
-> BuiltinName
.CairoRunner
method get_builtin_segment_info_for_pie
: Result<HashMap<String, cairo_pie::SegmentInfo>, RunnerError>
-> Result<HashMap<BuiltinName, cairo_pie::SegmentInfo>, RunnerError>
Notes: Serialization of vm outputs that now contain BuiltinName
& Display
implementation of BuiltinName
have not been affected by this PR
feat: Add recursive_with_poseidon
layout#1724
refactor(BREAKING): Use an enum to represent layout name#1715
LayoutName
to represent cairo layout names.CairoRunConfig
, Cairo1RunConfig
& CairoRunner
field layout
type changed from String
to LayoutName
.CairoLayout
field name
type changed from String
to LayoutName
.fix(BREAKING): Remove unsafe impl of Add<usize> for &'a Relocatable
#1718
fix(BREAKING): Handle triple dereference references#1708
ValueAddress
boolean field dereference
with boolean fields outer_dereference
& inner_dereference
HintReference
boolean field dereference
with boolean fields outer_dereference
& inner_dereference
cast([A + B], type)
such as cast([[fp + 2] + 2], felt)
.Bump starknet-types-core
version + Use the lib's pedersen hash #1692
refactor: Remove unused code & use constants whenever possible for builtin instance definitions#1707
feat: missing EC hints for Starknet OS 0.13.1 #1706
fix(BREAKING): Use program builtins in initialize_main_entrypoint
& read_return_values
#1703
initialize_main_entrypoint
now iterates over the program builtins when building the stack & inserts 0 for any missing builtinread_return_values
now only computes the final stack of the builtins in the programread_return_values
now takes a boolean argument allow_missing_builtins
BuiltinRunner::identifier
to get the BuiltinName
of each builtinOutputBuiltinRunner::get_public_memory
now takes a reference to MemorySegmentManager
VirtualMachine::get_memory_segment_addresses
moved to CairoRunner::get_memory_segment_addresses
feat(BREAKING): Add range_check96 builtin#1698
range_check96
builtin to the all_cairo
layout.RangeCheckBuiltinRunner
changes:
n_parts
, replacing it with const generic N_PARTS
.n_parts
argument form method new
._bound
, replacing it with public method bound
.name
& n_parts
.feat(BREAKING): Add mod builtin #1673
Main Changes:
ModBuiltinRunner
, implementing the builtins add_mod
& mul_mod
add_mod
& mul_mod
to the all_cairo
& dynamic
layouts under the mod_builtin
feature flag. This will be added to the main code in a future update.VirtualMachine::fill_memory
in order to perform the new builtin's main logic from within hintsadd_mod
and/or mul_mod
builtinsOther Changes:
air_private_input(&self, memory: &Memory) -> Vec<PrivateInput>
to pub fn air_private_input(&self, segments: &MemorySegmentManager) -> Vec<PrivateInput>
MayleRelocatable::sub_usize
Add<u32> for Relocatable
Memory::get_usize
get_memory_segment_addresses
from all builtin runners & the enumdeduce_memory_cell
& add_validation_rules
from all builtin runnersfinal_stack
from all builtin runners except output and move it to the enum implementationbugfix(BREAKING): Handle off2 immediate case in get_integer_from_reference
#1701
get_integer_from_reference
& get_integer_from_var_name
output changed from Result<Cow<'a, Felt252>, HintError>
to Result<Felt252, HintError>
feat: Reorganized builtins to be in the top of stack at the end of a run (Cairo1).
BREAKING: Remove CairoRunner::add_additional_hash_builtin
& VirtualMachine::disable_trace
#1658
feat: output builtin add_attribute method #1691
feat: add a method to retrieve the output builtin from the VM #1690
feat: Add zero segment #1668
feat: Bump cairo_lang to 0.13.1 in testing env #1687
feat(BREAKING): Use return type info from sierra when serializing return values in cairo1-run crate #1665
serialize_output
.serialize_output
to Cairo1RunConfig
.cairo_run_program
now returns an extra Option<String>
value with the serialized output if serialize_output
is enabled in the config.feat: Create hyper_threading crate to benchmark the cairo-vm
in a hyper-threaded environment #1679
feat: add a --tracer
option which hosts a web server that shows the line by line execution of cairo code along with memory registers #1265
feat: Fix error handling in initialize_state
#1657
feat: Make air public inputs deserializable #1657
feat: Show only layout builtins in air private input #1651
feat: Sort builtin segment info upon serialization for Cairo PIE #1654
feat: Fix output serialization for cairo 1 #1645
print_output
flag to Spans and Dictionariesfeat: Add flag to append return values to output segment when not running in proof_mode #1646
append_return_values
to both the CLI and Cairo1RunConfig
struct.feat: Compute program hash chain #1647
feat: Add cairo1-run output pretty-printing for felts, arrays/spans and dicts #1630
feat: output builtin features for bootloader support #1580
Bump starknet-types-core
dependency version to 0.0.9 #1628
feat: Implement Display
for MemorySegmentManager
#1606
fix: make Felt252DictEntryUpdate work with MaybeRelocatable instead of only Felt #1624.
chore: bump cairo-lang-
dependencies to 2.5.4 #1629
chore: bump cairo-lang-
dependencies to 2.5.3 #1596
refactor: Refactor cairo1-run
crate #1601
cairo_run_program
& struct Cairo1RunConfig
in cairo1-run::cairo_run
module.serialize_output
& structs FuncArg
and Error
in crate cairo1-run
are now public.feat(BREAKING): Add allow_missing_builtins
flag #1600
This new flag will skip the check that all builtins used by the program need to be present in the selected layout if enabled. It will also be enabled by default when running in proof_mode.
allow_missing_builtins
flag to cairo-vm-cli
crateallow_missing_builtins
field to CairoRunConfig
structallow_missing_builtins
boolean argument to CairoRunner
methods initialize
& initialize_builtins
feat: Append return values to the output segment when running cairo1-run in proof_mode #1597
feat: deserialize AIR private input #1589
feat(BREAKING): Remove unecessary conversion functions between Felt
& BigUint
/BigInt
#1562
perf: optimize instruction cache allocations by using VirtualMachine::load_data
#1441
feat: Add print_output
flag to cairo-1
crate [#1575] (https://github.com/lambdaclass/cairo-vm/pull/1575)
bugfixes(BREAKING): Fix memory hole count inconsistencies #[1585] (https://github.com/lambdaclass/cairo-vm/pull/1585)
get_memory_holes(&self, builtin_count: usize) -> Result<usize, MemoryError>
-> get_memory_holes(&self, builtin_count: usize, has_output_builtin: bool) -> Result<usize, MemoryError>
feat: Add cairo_pie_output
flag to cairo1-run
[#1581] (https://github.com/lambdaclass/cairo-vm/pull/1581)
feat: Add cairo_pie_output
flag to cairo_vm_cli
[#1578] (https://github.com/lambdaclass/cairo-vm/pull/1578)
CairoPie::write_zip_file
cairo-vm-cli
to struct definition using clap derivesfeat: Add doc + default impl for ResourceTracker trait [#1576] (https://github.com/lambdaclass/cairo-vm/pull/1576)
feat: Add air_private_input
flag to cairo1-run
[#1559] (https://github.com/lambdaclass/cairo-vm/pull/1559)
feat: Add args
flag to cairo1-run
[#1551] (https://github.com/lambdaclass/cairo-vm/pull/1551)
feat: Add air_public_input
flag to cairo1-run
[#1539] (https://github.com/lambdaclass/cairo-vm/pull/1539)
feat: Implement air_private_input #1552
feat: Add proof_mode
flag to cairo1-run
[#1537] (https://github.com/lambdaclass/cairo-vm/pull/1537)
proof_mode
to cairo1-run crate. Activating this flag will enable proof_mode compilation and executiondev: bump cairo 1 compiler dep to 2.4 #1530
Full Changelog: https://github.com/lambdaclass/cairo-vm/compare/v1.0.0-rc0...v1.0.0-rc1
feat: Use ProjectivePoint
from types-rs in ec_op builtin impl #1532
feat(BREAKING): Replace cairo-felt
crate with starknet-types-core
(0.0.5) #1408
feat(BREAKING): Add Cairo 1 proof mode compilation and execution [#1517] (https://github.com/lambdaclass/cairo-vm/pull/1517)
CairoRunner.proof_mode: bool
field and replace it with CairoRunner.runner_mode: RunnerMode
perf: Add extensive_hints
feature to prevent performance regression for the common use-case [#1503] (https://github.com/lambdaclass/cairo-vm/pull/1503)
extensive_hints
chore: remove cancel-duplicates workflow #1497
feat: Handle pc
s outside of program segment in VmException
[#1501] (https://github.com/lambdaclass/cairo-vm/pull/1501)
VmException
now shows the full pc value instead of just the offset (VmException.pc
field type changed to Relocatable
)VmException.traceback
now shows the full pc value for each entry instead of hardcoding its index to 0.pc
is outside of the program segment (segment_index != 0). VmException
fields inst_location
& error_attr_value
will be None
in such case.feat: Allow running instructions from pcs outside the program segement #1493
BREAKING: Partially Revert Optimize trace relocation #906
#1492
VirtualMachine::get_relocated_trace
& VirtualMachine::relocate_trace
.relocated_trace
field & relocate_trace
method to CairoRunner
.TraceEntry
for RelocatedTraceEntry
type in write_encoded_trace
& PublicInput::new
signatures.feat: Add HintProcessor::execute_hint_extensive + refactor hint_ranges #1491
Add trait method HintProcessorLogic::execute_hint_extensive
:
HintProcessorLogic::execute_hint
but it also returns a HintExtension
(type alias for HashMap<Relocatable, Vec<Box<dyn Any>>>
) that can be used to extend the current map of hints used by the VM. This behaviour achieves what the vm_load_data
primitive does for cairo-lang, and is needed to implement os hints.execute_hint
, but it's default implementation calls execute_hint
, so current implementors of the HintProcessor
trait won't notice any change.Signature changes:
pub fn step_hint(&mut self, hint_executor: &mut dyn HintProcessor, exec_scopes: &mut ExecutionScopes, hint_datas: &mut Vec<Box<dyn Any>>, constants: &HashMap<String, Felt252>) -> Result<(), VirtualMachineError>
-> pub fn step_hint(&mut self, hint_processor: &mut dyn HintProcessor, exec_scopes: &mut ExecutionScopes, hint_datas: &mut Vec<Box<dyn Any>>, hint_ranges: &mut HashMap<Relocatable, HintRange>, constants: &HashMap<String, Felt252>) -> Result<(), VirtualMachineError>
pub fn step(&mut self, hint_executor: &mut dyn HintProcessor, exec_scopes: &mut ExecutionScopes, hint_data: &[Box<dyn Any>], constants: &HashMap<String, Felt252>) -> Result<(), VirtualMachineError>
-> pub fn step(&mut self, hint_processor: &mut dyn HintProcessor, exec_scopes: &mut ExecutionScopes, hint_datas: &mut Vec<Box<dyn Any>>, hint_ranges: &mut HashMap<Relocatable, HintRange>, constants: &HashMap<String, Felt252>) -> Result<(), VirtualMachineError>
feat: add debugging capabilities behind print
feature flag. #1476
feat: add cairo_run_program
function that takes a Program
as an arg. #1496
Full Changelog: https://github.com/lambdaclass/cairo-vm/compare/v0.8.2...v0.8.3
feat: Make PublicInput fields public #1474
chore: bump starknet-crypto to v0.6.1 #1469
feat: Implement the Serialize and Deserialize methods for the Program struct #1458
feat: Use only program builtins when running cairo 1 programs #1457
feat: Use latest cairo-vm version in cairo1-run crate #1455
feat: Implement a CLI to run cairo 1 programs #1370
fix: Fix string code of BLAKE2S_ADD_UINT256
hint #1454
fix: Default to empty attributes vector when the field is missing from the program JSON #1450
fix: Change serialization of CairoPieMemory to match Python's binary format #1447
fix: Remove Deserialize derive from CairoPie and fix Serialize implementation to match Python's #1444
fix: ec_recover hints no longer panic when divisor is 0 #1433
feat: Implement the Serialize and Deserialize traits for the CairoPie struct #1438
fix: Using UINT256_HINT no longer panics when b is greater than 2^256 #1430
feat: Added a differential fuzzer for programs with whitelisted hints #1358
fix(breaking): Change return type of get_execution_resources
to RunnerError
#1398
Don't build wasm-demo in build
target + add ci job to run the wasm demo #1393
examples/wasm-demo
is no longer built during make build
make check
no longer compiles the cairo file used in the wasm-demoexamples/wasm-demo/src/array_sum.json
& example_program
wasm-demo
now uses the compiled cairo file in cairo_programs
directory instead of its own copyfeat: Add Program::new_for_proof
#1396
Add REDUCE_V2 hint #1420:
BREAKING: Add disable_trace_padding
to CairoRunConfig
#1233
feat: Implement CairoRunner.get_cairo_pie
#1375
fix: Fix SPLIT_FELT
hint #1387
refactor: combine Program.hints
and Program.hints_ranges
into custom collection #1366
fix: Fix div_mod #1383
div_mod
function so that it behaves like the cairo-lang versionmath_utils
crate can now return a MathError
: div_mod
, ec_add
, line_slope
, ec_double
, ec_double_slope
.UINT256_MUL_INV_MOD_P
hint so that it behaves like the python code.UINT256_MUL_DIV_MOD
when divides by zero #1367
fix: Handle error in hint UINT256_MUL_DIV_MOD
when divides by zero #1367
Add HintError::SyscallError and VmErrors::HINT_ERROR_STR constant #1357
feat: make arbitrary feature also enable a proptest::arbitrary::Arbitrary
implementation for Felt252
#1355
fix: correctly display invalid signature error message #1361