Skip to content

Commit 5e6fc7e

Browse files
constconst
authored andcommitted
adds new test for missing hotkey value
1 parent d95a7df commit 5e6fc7e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pallets/subtensor/tests/migration.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,4 +335,18 @@ fn test_migrate_fix_total_coldkey_stake_no_entry_in_hotkeys() {
335335
})
336336
}
337337

338+
// SKIP_WASM_BUILD=1 RUST_LOG=info cargo test --test migration -- test_migrate_fix_total_coldkey_stake_one_hotkey_stake_missing --exact --nocapture
339+
#[test]
340+
fn test_migrate_fix_total_coldkey_stake_one_hotkey_stake_missing() {
341+
new_test_ext(1).execute_with(|| {
342+
let coldkey = U256::from(0);
343+
TotalColdkeyStake::<Test>::insert(coldkey, 100000000);
344+
StakingHotkeys::<Test>::insert(coldkey, vec![U256::from(1), U256::from(2), U256::from(3)]);
345+
Stake::<Test>::insert(U256::from(1), U256::from(0), 10000);
346+
Stake::<Test>::insert(U256::from(2), U256::from(0), 10000);
347+
pallet_subtensor::migration::do_migrate_fix_total_coldkey_stake::<Test>();
348+
assert_eq!(TotalColdkeyStake::<Test>::get(coldkey), 20000);
349+
})
350+
}
351+
338352

0 commit comments

Comments
 (0)