Skip to content

Commit

Permalink
fix price math in test
Browse files Browse the repository at this point in the history
  • Loading branch information
camfairchild committed Jan 25, 2025
1 parent 8770079 commit f5df32a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pallets/subtensor/src/tests/move_stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1401,15 +1401,18 @@ fn test_do_swap_storage_updates() {
);

let alpha_fee =
SubtensorModule::get_alpha_price(destination_netuid) * I96F32::from_num(fee);
I96F32::from_num(fee) / SubtensorModule::get_alpha_price(destination_netuid);
let expected_value = I96F32::from_num(alpha)
* SubtensorModule::get_alpha_price(origin_netuid)
/ SubtensorModule::get_alpha_price(destination_netuid);
assert_abs_diff_eq!(
SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet(
&hotkey,
&coldkey,
destination_netuid
),
alpha - alpha_fee.to_num::<u64>(),
epsilon = 5
(expected_value - alpha_fee).to_num::<u64>(),
epsilon = (expected_value / 1000).to_num::<u64>()
);
});
}
Expand Down

0 comments on commit f5df32a

Please sign in to comment.