Releases: lambdaclass/cairo-vm
v0.6.2
v0.8.2
-
chore: update dependencies, particularly lamdaworks 0.1.2 -> 0.1.3 #1323
-
fix: fix
UINT256_MUL_DIV_MODhint #1320 -
feat: add dependency installation script
install.sh#1298 -
fix: specify resolver version 2 in the virtual workspace's manifest #1311
-
feat: add
lambdaworks-feltfeature tocairo-vm-cli#1308 -
chore: update dependencies, particularly clap 3.2 -> 4.3 #1309
- this removes dependency on atty, that's no longer mantained
-
chore: remove unused dependencies #1307
- rand_core
- serde_bytes
- rusty-hook (dev-dependency)
-
chore: bump
cairo-lang-starknetandcairo-lang-casmdependencies to 2.0.0 #1313
v0.8.1
-
chore: change mentions of cairo-rs-py to cairo-vm-py #1296
-
rename github repo from https://github.com/lambdaclass/cairo-rs to https://github.com/lambdaclass/cairo-vm #1289
-
fix(security): avoid OOM crashes when programs jump to very high invalid addresses.
-
fix: add
to_bytes_beto the felt whenlambdaworks-feltfeature is active #1290 -
chore: mark
modpowandto_signed_bytes_leas deprecated #1290 -
fix: bump lambdaworks-math to latest version, that fixes no-std support #1293
-
build: remove dependency to
thiserror(usethiserror-no-std/stdinstead) -
chore: use LambdaWorks' implementation of bit operations for
Felt252#1291 -
update
cairo-lang-starknetandcairo-lang-casmdependencies to v2.0.0-rc6 #1299
v0.8.0
v0.7.0
-
BREAKING: Integrate
RunResourceslogic intoHintProcessortrait #1274- Rename trait
HintProcessortoHintProcessorLogic - Add trait
ResourceTracker - Trait
HintProcessoris nowHintProcessor: HintProcessorLogic + ResourceTracker BuiltinHintProcessor::new&Cairo1HintProcessor::newnow receive the argumetrun_resources: RunResourcesHintProcessorLogic::execute_hintno longer receivesrun_resources: &mut RunResources- Remove argument
run_resources: &mut RunResourcesfromCairoRunner::run_until_pc&CairoRunner::run_from_entrypoint
- Rename trait
-
build: remove unused implicit features from cairo-vm #1266
v0.6.1
v0.6.0
-
fix:
dibithint no longer fails when called with anmof zero #1247 -
fix(security): avoid denial of service on malicious input exploiting the scientific notation parser #1239
-
BREAKING: Change
RunResourcesusage:-
Modify field type
RunResources.n_steps: Option<usize>, -
Public Api Changes:
- CairoRunner::run_until_pc: Now receive a
&mut RunResourcesinstead of an&mut Option<RunResources> - CairoRunner::run_from_entrypoint: Now receive a
&mut RunResourcesinstead of an&mut Option<RunResources> - VirtualMachine::Step: Add
&mut RunResourcesas input - Trait HintProcessor::execute_hint: Add
&mut RunResourcesas an input
- CairoRunner::run_until_pc: Now receive a
-
-
perf: accumulate
minandmaxinstruction offsets during run to speed up range check #1080
BREAKING:Cairo_runner::get_perm_range_check_limitsno longer returns an error when called without trace enabled, as it no longer depends on it -
perf: process reference list on
Programcreation only #1214
Also keep them in aVec<_>instead of aHashMap<_, _>since it will be continuous anyway.
BREAKING:HintProcessor::compile_hintnow receies a&[HintReference]rather than&HashMap<usize, HintReference>- Public
CairoRunner::get_reference_listhas been removed
-
BREAKING: Add no_std compatibility to cairo-vm (cairo-1-hints feature still not supported)
-
Move the vm to its own directory and crate, different from the workspace #1215
-
Add an
ensure_no_stdcrate that the CI will use to check that new changes don't revertno_stdsupport #1215 #1232 -
replace the use of
num-prime::is_primeby a custom implementation, therefore restoringno_stdcompatibility #1238
-
v0.5.2
What's Changed
-
BREAKING: Compute
ExecutionResources.n_stepswithout requiring trace #1222CairoRunner::get_execution_resourcesreturn'sn_stepsfield value is now set tovm.current_stepinstead of0if bothoriginal_stepsandtraceare set toNone
-
Add
RunResources::get_n_stepsmethod #1225 -
refactor: simplify
mem_eq -
fix: pin Cairo compiler version #1220
-
perf: make
inner_rc_bounda constant, improving performance of the range-check builtin -
fix: substraction of
MaybeRelocatablealways behaves as signed #1218
v0.5.1
What's Changed
-
fix: fix overflow for
QUAD_BITandDI_BIThints #1209
Fixes #1205 -
fix: fix hints
UINT256_UNSIGNED_DIV_REM&&UINT256_EXPANDED_UNSIGNED_DIV_REM#1203 -
bugfix: fix deserialization of scientific notation with fractional values #1202
-
feat: implement
mem_eqfunction to test for equality of two ranges in memory #1198 -
perf: use
mem_eqinset_add#1198 -
feat: wrap big variants of
HintError,VirtualMachineError,RunnerError,MemoryError,MathError,InsufficientAllocatedCellsErrorinBox#1193- BREAKING: all tuple variants of
HintErrorwith a singleFelt252or multiple elements now receive a singleBox
- BREAKING: all tuple variants of
-
Add
Program::builtins_len method#1194 -
fix: Handle the deserialization of serde_json::Number with scientific notation (e.g.: Number(1e27)) in felt_from_number function #1188
-
feat: Add RunResources Struct #1175
- BREAKING: Modify
CairoRunner::run_until_pcarity. Addrun_resources: &mut Option<RunResources>input - BREAKING: Modify
CairoRunner::run_from_entrypointarity. Addrun_resources: &mut Option<RunResources>input
- BREAKING: Modify
-
fix: Fix 'as_int' conversion usage in hints
ASSERT_250_BIT&SIGNED_DIV_REM#1191 -
bugfix: Use cairo constants in
ASSERT_250_BIThint #1187 -
bugfix: Fix
EC_DOUBLE_ASSIGN_NEW_X_V2hint not takingSECP_Pvalue from the current execution scope #1186 -
fix: Fix hint
BIGINT_PACK_DIV_MOD#1189 -
fix: Fix possible subtraction overflow in
QUAD_BIT&DI_BIThints #1185- These hints now return an error when ids.m equals zero
-
fix: felt_from_number not properly returning parse errors #1012
-
fix: Fix felt sqrt and Signed impl #1150
- BREAKING: Fix
Felt252methodsabs,signum,is_positive,is_negativeandsqrt - BREAKING: Remove function
math_utils::sqrt(Now moved toFelt252::sqrt)
- BREAKING: Fix
-
feat: Add method
CairoRunner::initialize_function_runner_cairo_1#1151-
Add method
pub fn initialize_function_runner_cairo_1( &mut self, vm: &mut VirtualMachine, program_builtins: &[BuiltinName], ) -> Result<(), RunnerError>toCairoRunner -
BREAKING: Move field
builtinsfromSharedProgramDatatoProgram -
BREAKING: Remove argument
add_segment_arena_builtinfromCairoRunner::initialize_function_runner, it is now always false -
BREAKING: Add
segment_arenaenum variant toBuiltinName
-
-
Fix implementation of
InitSquashDataandShouldSkipSquashLoop -
Add more hints to
Cairo1HintProcessor#1171
#1143Cairo1HintProcessorcan now run the following hints:- Felt252DictEntryInit
- Felt252DictEntryUpdate
- GetCurrentAccessDelta
- InitSquashData
- AllocConstantSize
- GetCurrentAccessIndex
- ShouldContinueSquashLoop
- FieldSqrt
- Uint512DivMod
-
Add some small considerations regarding Cairo 1 programs #1144:
- Ignore Casm and Sierra files
- Add special flag to compile Cairo 1 programs
-
Make the VM able to run
CasmContractClassfiles undercairo-1-hintsfeature #1098- Implement
TryFrom<CasmContractClass> for Program - Add
Cairo1HintProcessor
- Implement
v0.4.0
What's Changed
-
perf: insert elements from the tail in
load_dataso reallocation happens only once #1117 -
Add
CairoRunner::get_program method#1123 -
Use to_signed_felt as function for felt252 as BigInt within [-P/2, P/2] range and use to_bigint as function for representation as BigInt. #1100
-
Implement hint on field_arithmetic lib #1090
BuiltinHintProcessornow supports the following hints:%{ def split(num: int, num_bits_shift: int, length: int): a = [] for _ in range(length): a.append( num & ((1 << num_bits_shift) - 1) ) num = num >> num_bits_shift return tuple(a) def pack(z, num_bits_shift: int) -> int: limbs = (z.d0, z.d1, z.d2) return sum(limb << (num_bits_shift * i) for i, limb in enumerate(limbs)) a = pack(ids.a, num_bits_shift = 128) b = pack(ids.b, num_bits_shift = 128) p = pack(ids.p, num_bits_shift = 128) res = (a - b) % p res_split = split(res, num_bits_shift=128, length=3) ids.res.d0 = res_split[0] ids.res.d1 = res_split[1] ids.res.d2 = res_split[2] %}
-
Add missing hint on cairo_secp lib #1089:
BuiltinHintProcessornow supports the following hint:from starkware.cairo.common.cairo_secp.secp_utils import pack slope = pack(ids.slope, PRIME) x0 = pack(ids.point0.x, PRIME) x1 = pack(ids.point1.x, PRIME) y0 = pack(ids.point0.y, PRIME) value = new_x = (pow(slope, 2, SECP_P) - x0 - x1) % SECP_P
-
Add missing hint on vrf.json whitelist #1055:
BuiltinHintProcessornow supports the following hint:%{ PRIME = 2**255 - 19 II = pow(2, (PRIME - 1) // 4, PRIME) xx = ids.xx.low + (ids.xx.high<<128) x = pow(xx, (PRIME + 3) // 8, PRIME) if (x * x - xx) % PRIME != 0: x = (x * II) % PRIME if x % 2 != 0: x = PRIME - x ids.x.low = x & ((1<<128)-1) ids.x.high = x >> 128 %}
-
Implement hint variant for finalize_blake2s#1072
BuiltinHintProcessornow supports the following hint:%{ # Add dummy pairs of input and output. from starkware.cairo.common.cairo_blake2s.blake2s_utils import IV, blake2s_compress _n_packed_instances = int(ids.N_PACKED_INSTANCES) assert 0 <= _n_packed_instances < 20 _blake2s_input_chunk_size_felts = int(ids.BLAKE2S_INPUT_CHUNK_SIZE_FELTS) assert 0 <= _blake2s_input_chunk_size_felts < 100 message = [0] * _blake2s_input_chunk_size_felts modified_iv = [IV[0] ^ 0x01010020] + IV[1:] output = blake2s_compress( message=message, h=modified_iv, t0=0, t1=0, f0=0xffffffff, f1=0, ) padding = (message + modified_iv + [0, 0xffffffff] + output) * (_n_packed_instances - 1) segments.write_arg(ids.blake2s_ptr_end, padding) %} ```
-
Implement fast_ec_add hint variant #1087
BuiltinHintProcessor now supports the following hint:
```python
%{
from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack
slope = pack(ids.slope, PRIME)
x0 = pack(ids.pt0.x, PRIME)
x1 = pack(ids.pt1.x, PRIME)
y0 = pack(ids.pt0.y, PRIME)
value = new_x = (pow(slope, 2, SECP_P) - x0 - x1) % SECP_P
%}
```
-
feat(hints): Add alternative string for hint IS_ZERO_PACK_EXTERNAL_SECP #1082
BuiltinHintProcessornow supports the following hint:%{ from starkware.cairo.common.cairo_secp.secp_utils import pack x = pack(ids.x, PRIME) % SECP_P %}
-
Add alternative hint code for ec_double hint #1083
BuiltinHintProcessornow supports the following hint:%{ from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack slope = pack(ids.slope, PRIME) x = pack(ids.pt.x, PRIME) y = pack(ids.pt.y, PRIME) value = new_x = (pow(slope, 2, SECP_P) - 2 * x) % SECP_P %}
-
fix(security)!: avoid DoS on malicious insertion to memory #1099
- A program could crash the library by attempting to insert a value at an address with a big offset; fixed by trying to reserve to check for allocation failure
- A program could crash the program by exploiting an integer overflow when attempting to insert a value at an address with offset
usize::MAX
BREAKING: added a new error variant
MemoryError::VecCapacityExceeded -
perf: specialize addition for
u64andFelt252#932- Avoids the creation of a new
Felt252instance for additions with a very restricted valid range - This impacts specially the addition of
RelocatablewithFelt252values inupdate_pc, which take a significant amount of time in some benchmarks
- Avoids the creation of a new
-
fix(starknet-crypto): bump version to
0.5.0#1088 -
feat(hints): Add alternative string for hint IS_ZERO_PACK #1081
BuiltinHintProcessornow supports the following hint:%{ from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack x = pack(ids.x, PRIME) % SECP_P %}
-
Add missing hints
NewHint#55,NewHint#56, andNewHint#57#1077BuiltinHintProcessornow supports the following hints:from starkware.cairo.common.cairo_secp.secp_utils import pack SECP_P=2**255-19 x = pack(ids.x, PRIME) % SECP_P
from starkware.cairo.common.cairo_secp.secp_utils import pack SECP_P=2**255-19 value = pack(ids.x, PRIME) % SECP_P
SECP_P=2**255-19 from starkware.python.math_utils import div_mod value = x_inv = div_mod(1, x, SECP_P)
-
Implement hint for
starkware.cairo.common.cairo_keccak.keccak._copy_inputsas described by whiteliststarknet/security/whitelists/cairo_keccak.json#1058BuiltinHintProcessornow supports the following hint:%{ ids.full_word = int(ids.n_bytes >= 8) %}
-
perf: cache decoded instructions #944
- Creates a new cache field in
VirtualMachinethat stores theInstructioninstances as they get decoded from memory, significantly reducing decoding overhead, with gains up to 9% in runtime according to benchmarks in the performance server
- Creates a new cache field in
-
Add alternative hint code for nondet_bigint3 hint #1071
BuiltinHintProcessornow supports the following hint:%{ from starkware.cairo.common.cairo_secp.secp_utils import split segments.write_arg(ids.res.address_, split(value)) %}
-
Add missing hint on vrf.json lib #1052:
BuiltinHintProcessornow supports the following hint:%{ from starkware.cairo.common.cairo_secp.secp_utils import pack SECP_P = 2**255-19 slope = pack(ids.slope, PRIME) x0 = pack(ids.point0.x, PRIME) x1 = pack(ids.point1.x, PRIME) y0 = pack(ids.point0.y, PRIME) value = new_x = (pow(slope, 2, SECP_P) - x0 - x1) % SECP_P %}
-
Implement hint for cairo_sha256_arbitrary_input_length whitelist #1091
BuiltinHintProcessornow supports the following hint:%{ from starkware.cairo.common.cairo_sha256.sha256_utils import ( compute_message_schedule, sha2_compress_function) _sha256_input_chunk_size_felts = int(ids.SHA256_INPUT_CHUNK_SIZE_FELTS) assert 0 <= _sha256_input_chunk_size_felts < 100 _sha256_state_size_felts = int(ids.SHA256_STATE_SIZE_FELTS) assert 0 <= _sha256_state_size_felts < 100 w = compute_message_schedule(memory.get_range( ids.sha256_start, _sha256_input_chunk_size_felts)) new_state = sha2_compress_function(memory.get_range(ids.state, _sha256_state_size_felts), w) segments.write_arg(ids.output, new_state) %}
-
Add missing hint on vrf.json lib #1053:
BuiltinHintProcessornow supports the following hint:%{ from starkware.cairo.common.cairo_secp.secp_utils import SECP_P, pack SECP_P = 2**255-19 slope = pack(ids.slope, PRIME) ...