@@ -1251,3 +1251,101 @@ fn test_get_root_children_drain_with_half_take() {
1251
1251
) ;
1252
1252
} ) ;
1253
1253
}
1254
+
1255
+ // // SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::coinbase::test_get_root_children_with_weights --exact --show-output --nocapture
1256
+ // #[test]
1257
+ // fn test_get_root_children_with_weights() {
1258
+ // new_test_ext(1).execute_with(|| {
1259
+ // // Init netuid 1
1260
+ // let root: u16 = 0;
1261
+ // let alpha: u16 = 1;
1262
+ // add_network(root, 1, 0);
1263
+ // add_network(alpha, 1, 0);
1264
+ // // Set TAO weight to 1.
1265
+ // SubtensorModule::set_tao_weight(u64::MAX); // Set TAO weight to 1.
1266
+ // // Create keys.
1267
+ // let cold = U256::from(0);
1268
+ // let alice = U256::from(1);
1269
+ // let bob = U256::from(2);
1270
+ // // Register Alice and Bob to the root network and alpha subnet.
1271
+ // register_ok_neuron(alpha, alice, cold, 0);
1272
+ // register_ok_neuron(alpha, bob, cold, 0);
1273
+ // assert_ok!(SubtensorModule::root_register(
1274
+ // RuntimeOrigin::signed(cold).clone(),
1275
+ // alice,
1276
+ // ));
1277
+ // assert_ok!(SubtensorModule::root_register(
1278
+ // RuntimeOrigin::signed(cold).clone(),
1279
+ // bob,
1280
+ // ));
1281
+ // // Add stake for Alice and Bob on root.
1282
+ // let alice_root_stake: u64 = 1_000_000_000;
1283
+ // SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
1284
+ // &alice,
1285
+ // &cold,
1286
+ // root,
1287
+ // alice_root_stake,
1288
+ // );
1289
+ // let bob_root_stake: u64 = 1_000_000_000;
1290
+ // SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
1291
+ // &bob,
1292
+ // &cold,
1293
+ // root,
1294
+ // alice_root_stake,
1295
+ // );
1296
+ // // Add stake for Alice and Bob on netuid.
1297
+ // let alice_alpha_stake: u64 = 1_000_000_000;
1298
+ // SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
1299
+ // &alice,
1300
+ // &cold,
1301
+ // alpha,
1302
+ // alice_alpha_stake,
1303
+ // );
1304
+ // let bob_alpha_stake: u64 = 1_000_000_000;
1305
+ // SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet(
1306
+ // &bob,
1307
+ // &cold,
1308
+ // alpha,
1309
+ // bob_alpha_stake,
1310
+ // );
1311
+ // // Set Bob as 100% child of Alice on root.
1312
+ // mock_set_children_no_epochs(alpha, &alice, &[(u64::MAX, bob)]);
1313
+
1314
+ // // Set Bob childkey take to zero.
1315
+ // ChildkeyTake::<Test>::insert(bob, alpha, 0);
1316
+ // Delegates::<Test>::insert(alice, 0);
1317
+ // Delegates::<Test>::insert(bob, 0);
1318
+
1319
+ // // Set weights on the subnet.
1320
+ // assert_ok!(SubtensorModule::set_weights(
1321
+ // RuntimeOrigin::signed(alice),
1322
+ // alpha,
1323
+ // vec![0, 1],
1324
+ // vec![1, 1],
1325
+ // 0,
1326
+ // ));
1327
+ // assert_ok!(SubtensorModule::set_weights(
1328
+ // RuntimeOrigin::signed(bob),
1329
+ // alpha,
1330
+ // vec![0, 1],
1331
+ // vec![1, 1],
1332
+ // 0,
1333
+ // ));
1334
+
1335
+ // // Lets drain!
1336
+ // let pending_alpha: u64 = 1_000_000_000;
1337
+ // SubtensorModule::drain_pending_emission(alpha, pending_alpha, 0, 0, 0);
1338
+
1339
+ // // Alice and Bob make the same amount.
1340
+ // close(
1341
+ // AlphaDividendsPerSubnet::<Test>::get(alpha, alice),
1342
+ // pending_alpha / 2,
1343
+ // 10,
1344
+ // );
1345
+ // close(
1346
+ // AlphaDividendsPerSubnet::<Test>::get(alpha, bob),
1347
+ // pending_alpha / 2,
1348
+ // 10,
1349
+ // );
1350
+ // });
1351
+ // }
0 commit comments