diff --git a/node/src/chain_spec/localnet.rs b/node/src/chain_spec/localnet.rs index b20372e4b9..02ea8896b5 100644 --- a/node/src/chain_spec/localnet.rs +++ b/node/src/chain_spec/localnet.rs @@ -124,8 +124,5 @@ fn localnet_genesis( "evmChainId": { "chainId": 42, }, - "subtensorModule": { - "startCallDelay": 10, - }, }) } diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index e1ab02d911..0117dff889 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -145,7 +145,7 @@ parameter_types! { pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days pub const InitialTaoWeight: u64 = u64::MAX/10; // 10% global weight. pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks - pub const InitialStartCallDelay: u64 = 7 * 24 * 60 * 60 / 12; // 7 days + pub const InitialStartCallDelay: u64 = 0; // 0 days pub const InitialKeySwapOnSubnetCost: u64 = 10_000_000; pub const HotkeySwapOnSubnetInterval: u64 = 7 * 24 * 60 * 60 / 12; // 7 days pub const LeaseDividendsDistributionInterval: u32 = 100; // 100 blocks diff --git a/pallets/admin-utils/src/tests/mod.rs b/pallets/admin-utils/src/tests/mod.rs index 365ef63ad5..93d56ec343 100644 --- a/pallets/admin-utils/src/tests/mod.rs +++ b/pallets/admin-utils/src/tests/mod.rs @@ -2898,10 +2898,7 @@ fn test_sudo_set_start_call_delay_permissions_and_zero_delay() { // Get initial delay value (should be non-zero) let initial_delay = pallet_subtensor::StartCallDelay::::get(); - assert!( - initial_delay > 0, - "Initial delay should be greater than zero" - ); + assert_eq!(initial_delay, 0); // Test 1: Non-root account should fail to set delay assert_noop!( @@ -2925,20 +2922,16 @@ fn test_sudo_set_start_call_delay_permissions_and_zero_delay() { "Default owner should be account 0" ); - // Test 3: Try to start the subnet immediately - should FAIL (delay not passed) - assert_err!( - pallet_subtensor::Pallet::::start_call( - <::RuntimeOrigin>::signed(coldkey_account_id), - netuid - ), - pallet_subtensor::Error::::NeedWaitingMoreBlocksToStarCall - ); + // Test 3: Can successfully start the subnet immediately + assert_ok!(pallet_subtensor::Pallet::::start_call( + <::RuntimeOrigin>::signed(coldkey_account_id), + netuid + )); - // Verify emission has not been set - assert_eq!( - pallet_subtensor::FirstEmissionBlockNumber::::get(netuid), - None, - "Emission should not be set yet" + // Verify emission has been set + assert!( + pallet_subtensor::FirstEmissionBlockNumber::::get(netuid).is_some(), + "Emission should be set" ); // Test 4: Root sets delay to zero @@ -2957,12 +2950,15 @@ fn test_sudo_set_start_call_delay_permissions_and_zero_delay() { pallet_subtensor::Event::StartCallDelaySet(0), )); - // Test 5: Try to start the subnet again - should SUCCEED (delay is now zero) + // Test 5: Try to start the subnet again - should be FAILED (first emission block already set) let current_block = frame_system::Pallet::::block_number(); - assert_ok!(pallet_subtensor::Pallet::::start_call( - <::RuntimeOrigin>::signed(coldkey_account_id), - netuid - )); + assert_err!( + pallet_subtensor::Pallet::::start_call( + <::RuntimeOrigin>::signed(coldkey_account_id), + netuid + ), + pallet_subtensor::Error::::FirstEmissionBlockNumberAlreadySet + ); assert_eq!( pallet_subtensor::FirstEmissionBlockNumber::::get(netuid), diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index c33be9068c..b744c9b771 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -218,7 +218,7 @@ parameter_types! { pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // Default as 5 days pub const InitialTaoWeight: u64 = 0; // 100% global weight. pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks - pub const InitialStartCallDelay: u64 = 7 * 24 * 60 * 60 / 12; // Default as 7 days + pub const InitialStartCallDelay: u64 = 0; // 0 days pub const InitialKeySwapOnSubnetCost: u64 = 10_000_000; pub const HotkeySwapOnSubnetInterval: u64 = 15; // 15 block, should be bigger than subnet number, then trigger clean up for all subnets pub const MaxContributorsPerLeaseToRemove: u32 = 3; diff --git a/pallets/subtensor/src/tests/subnet.rs b/pallets/subtensor/src/tests/subnet.rs index 456c33ce65..a547b30a14 100644 --- a/pallets/subtensor/src/tests/subnet.rs +++ b/pallets/subtensor/src/tests/subnet.rs @@ -89,7 +89,7 @@ fn test_do_start_call_fail_not_owner() { } #[test] -fn test_do_start_call_fail_with_cannot_start_call_now() { +fn test_do_start_call_can_start_now() { new_test_ext(0).execute_with(|| { let netuid = NetUid::from(1); let tempo: u16 = 13; @@ -106,13 +106,10 @@ fn test_do_start_call_fail_with_cannot_start_call_now() { assert_eq!(SubnetOwner::::get(netuid), coldkey_account_id); - assert_noop!( - SubtensorModule::start_call( - <::RuntimeOrigin>::signed(coldkey_account_id), - netuid - ), - Error::::NeedWaitingMoreBlocksToStarCall - ); + assert_ok!(SubtensorModule::start_call( + <::RuntimeOrigin>::signed(coldkey_account_id), + netuid + )); }); } diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index 75e90346b4..3bad4a275f 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -210,7 +210,7 @@ parameter_types! { pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // 5 days pub const InitialTaoWeight: u64 = u64::MAX/10; // 10% global weight. pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks - pub const InitialStartCallDelay: u64 = 7 * 24 * 60 * 60 / 12; // 7 days + pub const InitialStartCallDelay: u64 = 0; // 0 days pub const InitialKeySwapOnSubnetCost: u64 = 10_000_000; pub const HotkeySwapOnSubnetInterval: u64 = 7 * 24 * 60 * 60 / 12; // 7 days pub const LeaseDividendsDistributionInterval: u32 = 100; // 100 blocks diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 99be2f09d3..df2d8638c9 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -1057,8 +1057,8 @@ parameter_types! { pub const InitialDissolveNetworkScheduleDuration: BlockNumber = 5 * 24 * 60 * 60 / 12; // 5 days pub const SubtensorInitialTaoWeight: u64 = 971_718_665_099_567_868; // 0.05267697438728329% tao weight. pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks - // 7 * 24 * 60 * 60 / 12 = 7 days - pub const InitialStartCallDelay: u64 = prod_or_fast!(7 * 24 * 60 * 60 / 12, 10); + // 0 days + pub const InitialStartCallDelay: u64 = prod_or_fast!(0, 0); pub const SubtensorInitialKeySwapOnSubnetCost: u64 = 1_000_000; // 0.001 TAO pub const HotkeySwapOnSubnetInterval : BlockNumber = 5 * 24 * 60 * 60 / 12; // 5 days pub const LeaseDividendsDistributionInterval: BlockNumber = 100; // 100 blocks