Skip to content

Commit

Permalink
fix is_s_updates_small
Browse files Browse the repository at this point in the history
  • Loading branch information
ftheirs committed Dec 27, 2024
1 parent ee1cbad commit feda12c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions crates/starknet-os/src/hints/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub fn set_n_updates_small(
let n_updates_small_packing_bound = get_constant(vars::ids::N_UPDATES_SMALL_PACKING_BOUND, constants)?;

let is_n_updates_small =
if n_actual_updates < *n_updates_small_packing_bound { Felt252::ZERO } else { Felt252::ONE };
if n_actual_updates < *n_updates_small_packing_bound { Felt252::ONE } else { Felt252::ZERO };

insert_value_from_var_name(vars::ids::IS_N_UPDATES_SMALL, is_n_updates_small, vm, ids_data, ap_tracking)
}
Expand Down Expand Up @@ -290,11 +290,11 @@ mod tests {

#[rstest]
// small updates
#[case(10, 0)]
#[case(255, 0)]
#[case(10, 1)]
#[case(255, 1)]
// big updates
#[case(256, 1)]
#[case(1024, 1)]
#[case(256, 0)]
#[case(1024, 0)]

fn test_set_n_updates_small_parameterized(#[case] actual_updates: u64, #[case] expected_is_n_updates_small: u64) {
let mut vm = VirtualMachine::new(false);
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet-os/src/io/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fn deserialize_contract_state_inner<I: Iterator<Item = Felt252>>(
let (nonce_n_changes, is_n_updates_small) = nonce_n_changes_one_flag.div_rem(&flag_bound);

// Parse n_changes
let n_updates_bound = if is_n_updates_small == Felt252::ZERO { n_updates_small_packing_bound } else { bound };
let n_updates_bound = if is_n_updates_small == Felt252::ONE { n_updates_small_packing_bound } else { bound };
let (nonce, n_changes) = nonce_n_changes.div_rem(&n_updates_bound);

// Parse nonces
Expand Down

0 comments on commit feda12c

Please sign in to comment.