Skip to content

Commit

Permalink
Fix n_nibbles_in_key computation.
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Apr 22, 2024
1 parent 0d12d0c commit 36e907e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/mpt.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,13 @@ func decode_node_list_lazy{range_check_ptr, bitwise_ptr: BitwiseBuiltin*}(
assert key_bits = key_bit_low;
}
}
let (n_nibbles_in_key, remainder) = felt_divmod(key_bits, 4);
assert remainder = 0;
local n_nibbles_in_key: felt; // <=> ceil(key_bits/4)
let (n_nibbles_in_key_tmp, remainder) = felt_divmod(key_bits, 4);
if (remainder != 0) {
assert n_nibbles_in_key = n_nibbles_in_key_tmp + 1;
} else {
assert n_nibbles_in_key = n_nibbles_in_key_tmp;
}
assert n_nibbles_in_key = n_nibbles_already_checked;
tempvar range_check_ptr = range_check_ptr;
tempvar bitwise_ptr = bitwise_ptr;
Expand Down

0 comments on commit 36e907e

Please sign in to comment.