Skip to content

Commit

Permalink
Fix a bug in dict_squash (wrong constants). (starkware-libs#2771)
Browse files Browse the repository at this point in the history
  • Loading branch information
liorgold2 authored Apr 13, 2023
1 parent f936344 commit fe425d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions crates/cairo-lang-runner/src/casm_run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,10 @@ impl HintProcessor for CairoHintProcessor {
lengths_and_indices.sort();
exec_scopes
.assign_or_update_variable("excluded_arc", Box::new(lengths_and_indices[2].1));
// ceil((PRIME / 2) / 2 ** 128).
let prime_over_2_high = 3544607988759775765608368578435044694_u128;
// ceil((PRIME / 3) / 2 ** 128).
let prime_over_3_high = 5316911983139663648412552867652567041_u128;
let prime_over_3_high = 3544607988759775765608368578435044694_u128;
// ceil((PRIME / 2) / 2 ** 128).
let prime_over_2_high = 5316911983139663648412552867652567041_u128;
let (range_check_base, range_check_offset) = extract_buffer(range_check_ptr);
let range_check_ptr = get_ptr(vm, range_check_base, &range_check_offset)?;
vm.insert_value(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,10 @@ fn validate_felt252_le(casm_builder: &mut CasmBuilder, range_check: Var, a: Var,
casm_build_extend! {casm_builder,
const one = 1;
const minus_1 = -1;
// ceil((PRIME / 2) / 2 ** 128).
const prime_over_2_high = 3544607988759775765608368578435044694_u128;
// ceil((PRIME / 3) / 2 ** 128).
const prime_over_3_high = 5316911983139663648412552867652567041_u128;
const prime_over_3_high = 3544607988759775765608368578435044694_u128;
// ceil((PRIME / 2) / 2 ** 128).
const prime_over_2_high = 5316911983139663648412552867652567041_u128;
// Guess two arc lengths.
hint AssertLeFindSmallArcs {range_check_ptr: range_check, a: a, b: b} into {};
// Calculate the arc lengths.
Expand Down
4 changes: 2 additions & 2 deletions crates/cairo-lang-starknet/test_data/test_contract.casm.json
Original file line number Diff line number Diff line change
Expand Up @@ -1550,12 +1550,12 @@
"0x480080017ffc8000",
"0x480080027ffb8000",
"0x484480017fff8000",
"0x4000000000000088000000000000001",
"0x2aaaaaaaaaaaab05555555555555556",
"0x48307fff7ffd8000",
"0x480080037ff88000",
"0x480080047ff78000",
"0x484480017fff8000",
"0x2aaaaaaaaaaaab05555555555555556",
"0x4000000000000088000000000000001",
"0x48307fff7ffd8000",
"0x48307fff7ffb8000",
"0x48507ffe7ffa8000",
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e_test_data/libfuncs/felt252_dict
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ memory[memory[ap + -4] + 1 + 3], memory[memory[ap + -4] + 1 + 2] = (
%}
[ap + 0] = [[ap + -4] + 1], ap++;
[ap + 0] = [[ap + -5] + 2], ap++;
[ap + 0] = [ap + -1] * 5316911983139663648412552867652567041, ap++;
[ap + 0] = [ap + -1] * 3544607988759775765608368578435044694, ap++;
[ap + 0] = [ap + -3] + [ap + -1], ap++;
[ap + 0] = [[ap + -8] + 3], ap++;
[ap + 0] = [[ap + -9] + 4], ap++;
[ap + 0] = [ap + -1] * 3544607988759775765608368578435044694, ap++;
[ap + 0] = [ap + -1] * 5316911983139663648412552867652567041, ap++;
[ap + 0] = [ap + -3] + [ap + -1], ap++;
[ap + 0] = [ap + -5] + [ap + -1], ap++;
[ap + 0] = [ap + -6] * [ap + -2], ap++;
Expand Down

0 comments on commit fe425d0

Please sign in to comment.