Skip to content

Commit f5df32a

Browse files
committed
fix price math in test
1 parent 8770079 commit f5df32a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pallets/subtensor/src/tests/move_stake.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,15 +1401,18 @@ fn test_do_swap_storage_updates() {
14011401
);
14021402

14031403
let alpha_fee =
1404-
SubtensorModule::get_alpha_price(destination_netuid) * I96F32::from_num(fee);
1404+
I96F32::from_num(fee) / SubtensorModule::get_alpha_price(destination_netuid);
1405+
let expected_value = I96F32::from_num(alpha)
1406+
* SubtensorModule::get_alpha_price(origin_netuid)
1407+
/ SubtensorModule::get_alpha_price(destination_netuid);
14051408
assert_abs_diff_eq!(
14061409
SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet(
14071410
&hotkey,
14081411
&coldkey,
14091412
destination_netuid
14101413
),
1411-
alpha - alpha_fee.to_num::<u64>(),
1412-
epsilon = 5
1414+
(expected_value - alpha_fee).to_num::<u64>(),
1415+
epsilon = (expected_value / 1000).to_num::<u64>()
14131416
);
14141417
});
14151418
}

0 commit comments

Comments
 (0)