Skip to content

Commit b00b5b3

Browse files
author
unconst
committed
cargo fmt
1 parent 0b6dd40 commit b00b5b3

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

pallets/subtensor/src/migrations/migrate_rao.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ pub fn migrate_rao<T: Config>() -> Weight {
8989

9090
let remaining_lock = lock.saturating_sub(pool_initial_tao);
9191
// Refund the owner for the remaining lock.
92-
SubnetMovingPrice::<T>::insert(netuid, I96F32::from_num(EmissionValues::<T>::get(netuid)).checked_div( I96F32::from_num(1_000_000_000) ).unwrap_or( I96F32::from_num(0.0) ) );
92+
SubnetMovingPrice::<T>::insert(
93+
netuid,
94+
I96F32::from_num(EmissionValues::<T>::get(netuid))
95+
.checked_div(I96F32::from_num(1_000_000_000))
96+
.unwrap_or(I96F32::from_num(0.0)),
97+
);
9398
Pallet::<T>::add_balance_to_coldkey_account(&owner, remaining_lock);
9499
SubnetLocked::<T>::insert(netuid, 0); // Clear lock amount.
95100
SubnetTAO::<T>::insert(netuid, pool_initial_tao);

pallets/subtensor/src/tests/migration.rs

+19-8
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use frame_system::Config;
1414
use sp_core::{crypto::Ss58Codec, H256, U256};
1515
use sp_io::hashing::twox_128;
1616
use sp_runtime::traits::Zero;
17-
use substrate_fixed::types::I96F32;
1817
use substrate_fixed::types::extra::U2;
18+
use substrate_fixed::types::I96F32;
1919

2020
#[allow(clippy::arithmetic_side_effects)]
2121
fn close(value: u64, target: u64, eps: u64) {
@@ -99,7 +99,6 @@ fn test_migration_delete_subnet_21() {
9999
})
100100
}
101101

102-
103102
fn run_migration_and_check(migration_name: &'static str) -> frame_support::weights::Weight {
104103
// Execute the migration and store its weight
105104
let weight: frame_support::weights::Weight =
@@ -230,9 +229,9 @@ fn test_migrate_rao() {
230229
SubnetLocked::<Test>::insert(netuid_1, lock_amount);
231230

232231
// Add some initial stake
233-
EmissionValues::<Test>::insert(netuid_1, 1_000_000_000 );
234-
EmissionValues::<Test>::insert(netuid_2, 2_000_000_000 );
235-
EmissionValues::<Test>::insert(netuid_3, 3_000_000_000 );
232+
EmissionValues::<Test>::insert(netuid_1, 1_000_000_000);
233+
EmissionValues::<Test>::insert(netuid_2, 2_000_000_000);
234+
EmissionValues::<Test>::insert(netuid_3, 3_000_000_000);
236235

237236
Owner::<Test>::insert(hotkey1, coldkey1);
238237
Owner::<Test>::insert(hotkey2, coldkey2);
@@ -373,9 +372,21 @@ fn test_migrate_rao() {
373372
// Run the coinbase
374373
let emission: u64 = 1_000_000_000;
375374
SubtensorModule::run_coinbase(I96F32::from_num(emission));
376-
close(SubnetTaoInEmission::<Test>::get(netuid_1), emission/6, 100);
377-
close(SubnetTaoInEmission::<Test>::get(netuid_2), 2*(emission/6), 100);
378-
close(SubnetTaoInEmission::<Test>::get(netuid_3), 3*(emission/6), 100);
375+
close(
376+
SubnetTaoInEmission::<Test>::get(netuid_1),
377+
emission / 6,
378+
100,
379+
);
380+
close(
381+
SubnetTaoInEmission::<Test>::get(netuid_2),
382+
2 * (emission / 6),
383+
100,
384+
);
385+
close(
386+
SubnetTaoInEmission::<Test>::get(netuid_3),
387+
3 * (emission / 6),
388+
100,
389+
);
379390
});
380391
}
381392

0 commit comments

Comments
 (0)