diff --git a/src/starkware/cairo/common/secp256r1/field.cairo b/src/starkware/cairo/common/secp256r1/field.cairo index 912a6e45..6b92259f 100644 --- a/src/starkware/cairo/common/secp256r1/field.cairo +++ b/src/starkware/cairo/common/secp256r1/field.cairo @@ -127,8 +127,9 @@ func verify_zero{range_check_ptr}(val: UnreducedBigInt3) { ids.q = q % PRIME %} - // 164 + 255.99 - 2 * 86 = 247.99, so we can require `q` to be in the range [-2**164, 2**164) - // as long as the most significant limb of `val` is in the range (-2**247.99, 2**247.99). + // Assuming the absolute values of the limbs are bounded by 2**247.99, the absolute value + // of q = (val.d2 * BASE**2 + val.d1 * BASE + val.d0) / secp256r1, is bounded by + // 2**247.995 * (2 ** 86)**2 / 2**255.995 = 2**164. assert_165_bit(q + 2 ** 164); tempvar r1 = (val.d0 + q * SECP_REM0) / BASE; diff --git a/src/starkware/cairo/lang/VERSION b/src/starkware/cairo/lang/VERSION index 09d19810..26acbf08 100644 --- a/src/starkware/cairo/lang/VERSION +++ b/src/starkware/cairo/lang/VERSION @@ -1 +1 @@ -0.12.2a0 +0.12.2 diff --git a/src/starkware/starknet/services/api/feeder_gateway/state_diff_commitment.py b/src/starkware/starknet/services/api/feeder_gateway/state_diff_commitment.py index b8cab8c8..33ab98e4 100644 --- a/src/starkware/starknet/services/api/feeder_gateway/state_diff_commitment.py +++ b/src/starkware/starknet/services/api/feeder_gateway/state_diff_commitment.py @@ -85,9 +85,9 @@ def calculate_state_diff_commitment( """ Calculates the commitment on the given state diff. - We assume that the state diff is well formed. For example: - * In the storage_diff, for a given contract there will be no contradicting storage entries. - * In the declared_classes, any class hash points to a single compiled class hash. + We assume that state_diff represents a valid state_diff. For example: + * In storage_diff, any storage entry key points to a single storage entry value. + * In declared_classes, any class hash points to a single compiled class hash. We do not assume the state diff to be sorted. The function sorts the state diff before computing the hash.