Releases: lambdaclass/cairo-vm
v0.9.3
v1.0.0-rc3
-
bugfix: Fix handling of return values wrapped in
PanicResult
in cairo1-run crate #1763 -
refactor(BREAKING): Move the VM back to the CairoRunner #1743
CairoRunner
has a new public fieldvm: VirtualMachine
CairoRunner
no longer derivesDebug
CairoRunner
methodsnew_v2
&new
take an extra boolean argumenttrace_enabled
.- Functions
cairo_run
,cairo_run_program
&cairo_run_fuzzed_program
fromvm
crate andcairo_run_program
fromcairo1-run
crate now retun onlyCairoRunner
instead of(CairoRunner, VirtualMachine)
CairoRunner
methods no longer take a reference toVirtualMachine
. Methods that took an immutable reference to self and a mutable reference to the VM now take a mutable reference to self. Affected methods:initialize
initialize_builtins
initialize_all_builtins
initialize_segments
initialize_state
initialize_function_entrypoint
initialize_state
initialize_main_entrypoint
initialize_vm
run_until_pc
run_for_steps
run_until_steps
run_until_power_of_2
get_perm_range_check_limits
check_range_check_usage
get_memory_holes
check_diluted_check_usage
end_run
relocate_trace
relocate_memory
relocate
get_builtin_segments_info
get_builtin_segments_info_for_pie
get_execution_resources
finalize_segments
run_from_entrypoint
check_used_cells
check_memory_usage
initialize_function_runner_cairo_1
initialize_function_runner
read_return_values
get_builtins_final_stack
get_cairo_pie
get_air_public_input
get_air_private_input
get_memory_segment_addresses
- Functions & methods taking a reference to
CairoRunner
&VirtualMachine
now only take a reference toCairoRunner
:start_tracer
VmException::from_vm_error
get_error_attr_value
get_traceback
verify_secure_runner
- [hooks feature]
BeforeFirstStepHookFunc
dyn Fn no longer takes a mutable reference toCairoRunner
, along withVirtualMachine::execute_before_first_step
.
-
fix: add support for arrays shorter than 2 as arguments for cairo1-run #1737
-
bugfix: Fix BuiltinRunner::final_stack for SegmentArena#1747
-
feat: unify
arbitrary
,hooks
,print
andskip_next_instruction_hint
features as a singletest_utils
feature #1755- BREAKING: removed the above features
-
bugfix: cairo1-run CLI: Set finalize_builtins to true when using --air_public_input flag #1744
-
feat: Add hint
U256InvModN
toCairo1HintProcessor
#1744 -
perf: use a more compact representation for
MemoryCell
#1672- BREAKING:
Memory::get_value
will now always returnCow::Owned
variants, code that relied onCow::Borrowed
may break
- BREAKING:
v1.0.0-rc2
-
cairo1-run
CLI: Allow loading arguments from file#1739 -
BREAKING: Remove unused
CairoRunner
fieldoriginal_steps
#1742 -
feat: Add
--run_from_cairo_pie
tocairo-vm-cli
+ workflow #1730 -
Serialize directly into writer in
CairoPie::write_zip_file
#1736 -
feat: Add support for cairo1 run with segements arena validation.
- Refactored the runner CASM code generation to user a more high level builder.
- Added segment merging of the dictionary segments.
- Added validation of the generated segment arena in cairo1 run.
-
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
- Bump cairo_lang crates & corelib to v2.6.3
- Disable gas checks when compiling to sierra & casm
- Add
Known bugs & issues
segment to README, poining out issues derived from the removal of gas checks and cairo v2.6.3
-
feat: Implement running from
CairoPie
#1720- Add function
cairo_run_pie
- Add
CairoPie
methodsrun_validity_checks
&check_pie_compatibility
- Add
Program
methodfrom_stripped_program
- Add function
-
bugfix: Don't assume outer deref when fetching integer values from references#1732
-
feat: Implement
extend_additional_data
forBuiltinRunner
#1726 -
BREAKING: Set dynamic params as null by default on air public input #1716
PublicInput
fieldlayout_params
renamed todynamic_params
& type changed from&'a CairoLayout
to()
.
-
feat:
cairo1-run
accepts Sierra programs #1719 -
refactor(BREAKING): Use
BuiltinName
enum instead of string representation #1722BuiltinName
moved fromcrate::serde::deserialize_program
module tocrate::types::builtin_name
.- Implement
BuiltinName
methodsto_str
,to_str_with_suffix
,from_str
&from_str_with_suffix
.
- Implement
- Remove
BuiltinName
methodname
. - All builtin-related error variants now store
BuiltinName
instead of&'static str
orString
. - Remove constants:
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
. - Remove
BuiltinRunner
&ModBuiltinRunner
methodidentifier
- Structs containing string representation of builtin names now use
BuiltinName
instead:AirPrivateInput(pub HashMap<&'static str, Vec<PrivateInput>>)
->AirPrivateInput(pub HashMap<BuiltinName, Vec<PrivateInput>>)
.CairoPieMetadata
fieldadditional_data
:HashMap<String, BuiltinAdditionalData>,
->CairoPieAdditionalData
withCairoPieAdditionalData(pub HashMap<BuiltinName, BuiltinAdditionalData>)
CairoPieMetadata
fieldbuiltin_segments
:HashMap<String, SegmentInfo>
->HashMap<BuiltinName, SegmentInfo>
.ExecutiobResources
fieldbuiltin_instance_counter
:HashMap<String, usize>
->HashMap<BuiltinName, usize>
- Methods returning string representation of builtin names now use
BuiltinName
instead:BuiltinRunner
,ModBuiltinRunner
&RangeCheckBuiltinRunner
methodname
:&'static str
->BuiltinName
.CairoRunner
methodget_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 ofBuiltinName
have not been affected by this PR -
feat: Add
recursive_with_poseidon
layout#1724 -
refactor(BREAKING): Use an enum to represent layout name#1715
- Add enum
LayoutName
to represent cairo layout names. CairoRunConfig
,Cairo1RunConfig
&CairoRunner
fieldlayout
type changed fromString
toLayoutName
.CairoLayout
fieldname
type changed fromString
toLayoutName
.
- Add enum
-
fix(BREAKING): Remove unsafe impl of
Add<usize> for &'a Relocatable
#1718 -
fix(BREAKING): Handle triple dereference references#1708
- Replace
ValueAddress
boolean fielddereference
with boolean fieldsouter_dereference
&inner_dereference
- Replace
HintReference
boolean fielddereference
with boolean fieldsouter_dereference
&inner_dereference
- Reference parsing now handles the case of dereferences inside the cast. Aka references of type
cast([A + B], type)
such ascast([[fp + 2] + 2], felt)
.
- Replace
-
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
#1703initialize_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 program- BREAKING:
read_return_values
now takes a boolean argumentallow_missing_builtins
- Added method
BuiltinRunner::identifier
to get theBuiltinName
of each builtin - BREAKING:
OutputBuiltinRunner::get_public_memory
now takes a reference toMemorySegmentManager
- BREAKING: method
VirtualMachine::get_memory_segment_addresses
moved toCairoRunner::get_memory_segment_addresses
-
feat(BREAKING): Add range_check96 builtin#1698
- Add the new
range_check96
builtin to theall_cairo
layout. RangeCheckBuiltinRunner
changes:- Remove field
n_parts
, replacing it with const genericN_PARTS
. - Remome
n_parts
argument form methodnew
. - Remove field
_bound
, replacing it with public methodbound
. - Add public methods
name
&n_parts
.
- Remove field
- Add the new
-
feat(BREAKING): Add mod builtin #1673
Main Changes:
- Add the new
ModBuiltinRunner
, implementing the builtinsadd_mod
&mul_mod
- Adds
add_mod
&mul_mod
to theall_cairo
&dynamic
layouts under themod_builtin
feature flag. This will be added to the main code in a future update. - Add method
VirtualMachine::fill_memory
in order to perform the new builtin's main logic from within hints - Add hints to run arithmetic circuits using
add_mod
and/ormul_mod
builtins
Other Changes:
- BREAKING: BuiltinRunner method signature change from
air_private_input(&self, memory: &Memory) -> Vec<PrivateInput>
topub fn air_private_input(&self, segments: &MemorySegmentManager) -> Vec<PrivateInput>
- Add
MayleRelocatable::sub_usize
- Implement
Add<u32> for Relocatable
- Add
Memory::get_usize
- BREAKING: Clean up unused/duplicated code from builtins module:
- Remove unused method
get_memory_segment_addresses
from all builtin runners & the enum - Remove empty implementations of
deduce_memory_cell
&add_validation_rules
from all builtin runners - Remove duplicated implementation of
final_stack
from all builtin runners except output and move it to the enum implementation
- Remove unused method
- Add the new
-
bugfix(BREAKING): Handle off2 immediate case in
get_integer_from_reference
#1701get_integer_from_reference
&get_integer_from_var_name
output changed fromResult<Cow<'a, Felt252>, HintError>
toResult<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
- Removed public function
serialize_output
. - Add field
serialize_output
toCairo1RunConfig
. - Function
cairo_run_program
now returns an extraOption<String>
value with the serialized output ifserialize_output
is enabled in the config. - Output serialization improved as it now uses the sierra program data to identify return value's types.
- Removed public function
-
feat: Create hyper_threading crate to benchmark the
cairo-vm
in a hyper-threaded environment [#1679](ht...
v1.0.0-rc1
What changed
-
Bump
starknet-types-core
dependency version to 0.0.9 #1628 -
feat: Implement
Display
forMemorySegmentManager
#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- Add function
cairo_run_program
& structCairo1RunConfig
incairo1-run::cairo_run
module. - Function
serialize_output
& structsFuncArg
andError
in cratecairo1-run
are now public.
- Add function
-
feat(BREAKING): Add
allow_missing_builtins
flag #1600This 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.
- Add
allow_missing_builtins
flag tocairo-vm-cli
crate - Add
allow_missing_builtins
field toCairoRunConfig
struct - Add
allow_missing_builtins
boolean argument toCairoRunner
methodsinitialize
&initialize_builtins
- Add
-
feat: Append return values to the output segment when running cairo1-run in proof_mode #1597
- Add instructions to the proof_mode header to copy return values to the output segment before initiating the infinite loop
- Output builtin is now always included when running cairo 1 programs in proof_mode
-
feat: deserialize AIR private input #1589
-
feat(BREAKING): Remove unecessary conversion functions between
Felt
&BigUint
/BigInt
#1562- Remove the following functions:
- felt_from_biguint
- felt_from_bigint
- felt_to_biguint
- felt_to_bigint
- Remove the following functions:
-
perf: optimize instruction cache allocations by using
VirtualMachine::load_data
#1441 -
feat: Add
print_output
flag tocairo-1
crate [#1575] (#1575) -
bugfixes(BREAKING): Fix memory hole count inconsistencies #[1585] (#1585)
- Output builtin memory segment is no longer skipped when counting memory holes
- Temporary memory cells now keep their accessed status when relocated
- BREAKING: Signature change:
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 tocairo1-run
[#1581] (#1581) -
feat: Add
cairo_pie_output
flag tocairo_vm_cli
[#1578] (#1578)- Fix serialization of CairoPie to be fully compatible with the python version
- Add
CairoPie::write_zip_file
- Move handling of required and exclusive arguments in
cairo-vm-cli
to struct definition using clap derives
-
feat: Add doc + default impl for ResourceTracker trait [#1576] (#1576)
-
feat: Add
air_private_input
flag tocairo1-run
[#1559] (#1559) -
feat: Add
air_public_input
flag tocairo1-run
[#1539] (#1539) -
feat: Implement air_private_input #1552
-
feat: Add
proof_mode
flag tocairo1-run
[#1537] (#1537)- The cairo1-run crate no longer compiles and executes in proof_mode by default
- Add flag
proof_mode
to cairo1-run crate. Activating this flag will enable proof_mode compilation and execution
-
dev: bump cairo 1 compiler dep to 2.4 #1530
New Contributors
- @odesenfans made their first contribution in #1579
- @avilagaston9 made their first contribution in #1618
Full Changelog: v1.0.0-rc0...v1.0.0-rc1
v1.0.0-rc0
-
feat: Use
ProjectivePoint
from types-rs in ec_op builtin impl #1532 -
feat(BREAKING): Replace
cairo-felt
crate withstarknet-types-core
(0.0.5) #1408 -
feat(BREAKING): Add Cairo 1 proof mode compilation and execution [#1517] (#1517)
- In the cairo1-run crate, now the Cairo 1 Programs are compiled and executed in proof-mode
- BREAKING: Remove
CairoRunner.proof_mode: bool
field and replace it withCairoRunner.runner_mode: RunnerMode
-
perf: Add
extensive_hints
feature to prevent performance regression for the common use-case [#1503] (#1503)- Gates changes added by #1491 under the feature flag
extensive_hints
- Gates changes added by #1491 under the feature flag
-
chore: remove cancel-duplicates workflow #1497
-
feat: Handle
pc
s outside of program segment inVmException
[#1501] (#1501)VmException
now shows the full pc value instead of just the offset (VmException.pc
field type changed toRelocatable
)VmException.traceback
now shows the full pc value for each entry instead of hardcoding its index to 0.- Disable debug information for errors produced when
pc
is outside of the program segment (segment_index != 0).VmException
fieldsinst_location
&error_attr_value
will beNone
in such case.
-
feat: Allow running instructions from pcs outside the program segement #1493
-
BREAKING: Partially Revert
Optimize trace relocation #906
#1492- Remove methods
VirtualMachine::get_relocated_trace
&VirtualMachine::relocate_trace
. - Add
relocated_trace
field &relocate_trace
method toCairoRunner
. - Swap
TraceEntry
forRelocatedTraceEntry
type inwrite_encoded_trace
&PublicInput::new
signatures. - Now takes into account the program counter's segment index when building the execution trace instead of assuming it to be 0.
- Remove methods
-
feat: Add HintProcessor::execute_hint_extensive + refactor hint_ranges #1491
-
Add trait method
HintProcessorLogic::execute_hint_extensive
:- This method has a similar behaviour to
HintProcessorLogic::execute_hint
but it also returns aHintExtension
(type alias forHashMap<Relocatable, Vec<Box<dyn Any>>>
) that can be used to extend the current map of hints used by the VM. This behaviour achieves what thevm_load_data
primitive does for cairo-lang, and is needed to implement os hints. - This method is now used by the VM to execute hints instead of
execute_hint
, but it's default implementation callsexecute_hint
, so current implementors of theHintProcessor
trait won't notice any change.
- This method has a similar behaviour to
-
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 aProgram
as an arg. #1496
v0.9.2
v0.8.3
v0.9.1
-
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
v0.9.0
[0.9.0] - 2023-10-03
-
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
toRunnerError
#1398 -
Don't build wasm-demo in
build
target + add ci job to run the wasm demo #1393- Adds default-members to workspace
- Crate
examples/wasm-demo
is no longer built duringmake build
make check
no longer compiles the cairo file used in the wasm-demo- Removes Makefile targets
examples/wasm-demo/src/array_sum.json
&example_program
wasm-demo
now uses the compiled cairo file incairo_programs
directory instead of its own copy
-
feat: Add
Program::new_for_proof
#1396
v0.8.7
-
Add REDUCE_V2 hint #1420:
- Implement REDUCE_V2 hint
- Rename hint REDUCE -> REDUCE_V1
-
BREAKING: Add
disable_trace_padding
toCairoRunConfig
#1233 -
feat: Implement
CairoRunner.get_cairo_pie
#1375 -
fix: Fix
SPLIT_FELT
hint #1387 -
refactor: combine
Program.hints
andProgram.hints_ranges
into custom collection #1366 -
fix: Fix div_mod #1383
- Fixes
div_mod
function so that it behaves like the cairo-lang version - Various functions in the
math_utils
crate can now return aMathError
:div_mod
,ec_add
,line_slope
,ec_double
,ec_double_slope
. - Fixes
UINT256_MUL_INV_MOD_P
hint so that it behaves like the python code.
- Fixes