|
7 | 7 | use super::mock::*;
|
8 | 8 | use crate::epoch::math::safe_exp;
|
9 | 9 | use crate::*;
|
10 |
| -use frame_support::assert_ok; |
| 10 | +use frame_support::{assert_ok, assert_err}; |
11 | 11 | // use frame_system::Config;
|
12 | 12 | use rand::{distributions::Uniform, rngs::StdRng, seq::SliceRandom, thread_rng, Rng, SeedableRng};
|
13 | 13 | use sp_core::U256;
|
@@ -1486,40 +1486,38 @@ fn test_bonds_with_liquid_alpha() {
|
1486 | 1486 | });
|
1487 | 1487 | }
|
1488 | 1488 |
|
1489 |
| -// |
| 1489 | +// |
1490 | 1490 | #[test]
|
1491 | 1491 | fn test_set_alpha_disabled() {
|
1492 | 1492 | new_test_ext(1).execute_with(|| {
|
1493 |
| - assert!(false); |
1494 |
| - |
1495 |
| - // let netuid: u16 = 1; |
1496 |
| - // let hotkey: U256 = U256::from(1); |
1497 |
| - // let coldkey: U256 = U256::from(1 + 456); |
1498 |
| - // let signer = <<Test as Config>::RuntimeOrigin>::signed(coldkey); |
1499 |
| - |
1500 |
| - // // Enable Liquid Alpha and setup |
1501 |
| - // SubtensorModule::set_liquid_alpha_enabled(netuid, true); |
1502 |
| - // migrations::migrate_create_root_network::migrate_create_root_network::<Test>(); |
1503 |
| - // SubtensorModule::add_balance_to_coldkey_account(&coldkey, 1_000_000_000_000_000); |
1504 |
| - // assert_ok!(SubtensorModule::root_register(signer.clone(), hotkey,)); |
1505 |
| - // assert_ok!(SubtensorModule::add_stake(signer.clone(), hotkey, 1000)); |
1506 |
| - // // Only owner can set alpha values |
1507 |
| - // assert_ok!(SubtensorModule::register_network(signer.clone())); |
1508 |
| - |
1509 |
| - // // Explicitly set to false |
1510 |
| - // SubtensorModule::set_liquid_alpha_enabled(netuid, false); |
1511 |
| - // assert_err!( |
1512 |
| - // SubtensorModule::do_set_alpha_values(signer.clone(), netuid, 12_u16, u16::MAX), |
1513 |
| - // Error::<Test>::LiquidAlphaDisabled |
1514 |
| - // ); |
| 1493 | + let hotkey = U256::from(1); |
| 1494 | + let coldkey = U256::from(1 + 456); |
| 1495 | + let netuid = add_dynamic_network(&hotkey, &coldkey); |
| 1496 | + let signer = RuntimeOrigin::signed(coldkey); |
| 1497 | + |
| 1498 | + // Enable Liquid Alpha and setup |
| 1499 | + SubtensorModule::set_liquid_alpha_enabled(netuid, true); |
| 1500 | + migrations::migrate_create_root_network::migrate_create_root_network::<Test>(); |
| 1501 | + SubtensorModule::add_balance_to_coldkey_account(&coldkey, 1_000_000_000_000_000); |
| 1502 | + assert_ok!(SubtensorModule::root_register(signer.clone(), hotkey,)); |
| 1503 | + assert_ok!(SubtensorModule::add_stake(signer.clone(), hotkey, netuid, 1000)); |
| 1504 | + // Only owner can set alpha values |
| 1505 | + assert_ok!(SubtensorModule::register_network(signer.clone(), hotkey)); |
| 1506 | + |
| 1507 | + // Explicitly set to false |
| 1508 | + SubtensorModule::set_liquid_alpha_enabled(netuid, false); |
| 1509 | + assert_err!( |
| 1510 | + SubtensorModule::do_set_alpha_values(signer.clone(), netuid, 12_u16, u16::MAX), |
| 1511 | + Error::<Test>::LiquidAlphaDisabled |
| 1512 | + ); |
1515 | 1513 |
|
1516 |
| - // SubtensorModule::set_liquid_alpha_enabled(netuid, true); |
1517 |
| - // assert_ok!(SubtensorModule::do_set_alpha_values( |
1518 |
| - // signer.clone(), |
1519 |
| - // netuid, |
1520 |
| - // 12_u16, |
1521 |
| - // u16::MAX |
1522 |
| - // )); |
| 1514 | + SubtensorModule::set_liquid_alpha_enabled(netuid, true); |
| 1515 | + assert_ok!(SubtensorModule::do_set_alpha_values( |
| 1516 | + signer.clone(), |
| 1517 | + netuid, |
| 1518 | + 12_u16, |
| 1519 | + u16::MAX |
| 1520 | + )); |
1523 | 1521 | });
|
1524 | 1522 | }
|
1525 | 1523 |
|
|
0 commit comments