From b3ced53a398fe0409187134f9eb92b1f428f2c7b Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 13 Jan 2026 10:18:53 +0800 Subject: [PATCH 1/6] init solution --- pallets/admin-utils/src/tests/mock.rs | 2 +- pallets/subtensor/src/tests/mock.rs | 2 +- pallets/transaction-fee/src/tests/mock.rs | 2 +- runtime/src/lib.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) 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/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/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 f4a120cbbb..ab15c401a5 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 From 97a9eca9f350f63d5edc0ce812920a674348be30 Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 13 Jan 2026 10:41:51 +0800 Subject: [PATCH 2/6] fix unit test --- pallets/admin-utils/src/tests/mod.rs | 34 ++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/pallets/admin-utils/src/tests/mod.rs b/pallets/admin-utils/src/tests/mod.rs index 365ef63ad5..e0a945da80 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!( @@ -2926,19 +2923,15 @@ fn test_sudo_set_start_call_delay_permissions_and_zero_delay() { ); // 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 - ); + 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" + assert!( + pallet_subtensor::FirstEmissionBlockNumber::::get(netuid).is_some(), + "Emission should be set" ); // Test 4: Root sets delay to zero @@ -2959,10 +2952,13 @@ fn test_sudo_set_start_call_delay_permissions_and_zero_delay() { // Test 5: Try to start the subnet again - should SUCCEED (delay is now zero) 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), From 33335a0be89c6dcd1dba7b786be89be9e1683dc1 Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 13 Jan 2026 11:29:50 +0800 Subject: [PATCH 3/6] fix test --- pallets/subtensor/src/tests/subnet.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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 + )); }); } From 1d225b3d0e119fd95f440a0302a24fda8344d2f2 Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 13 Jan 2026 13:26:48 +0800 Subject: [PATCH 4/6] bump version --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index ab15c401a5..e8d8b595ba 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -241,7 +241,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 366, + spec_version: 367, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From f668d9dc34d9cfb1a0ec7b5fd6ea88325d2e914b Mon Sep 17 00:00:00 2001 From: ibraheem-latent Date: Tue, 13 Jan 2026 14:03:15 -0800 Subject: [PATCH 5/6] use runtime default constant for start call --- node/src/chain_spec/localnet.rs | 3 --- 1 file changed, 3 deletions(-) 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, - }, }) } From cda6423f6cfe61fce0ed2c1fe770f10585531c34 Mon Sep 17 00:00:00 2001 From: open-junius Date: Wed, 14 Jan 2026 20:02:43 +0800 Subject: [PATCH 6/6] update test comments --- pallets/admin-utils/src/tests/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pallets/admin-utils/src/tests/mod.rs b/pallets/admin-utils/src/tests/mod.rs index e0a945da80..93d56ec343 100644 --- a/pallets/admin-utils/src/tests/mod.rs +++ b/pallets/admin-utils/src/tests/mod.rs @@ -2922,13 +2922,13 @@ 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) + // 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 + // Verify emission has been set assert!( pallet_subtensor::FirstEmissionBlockNumber::::get(netuid).is_some(), "Emission should be set" @@ -2950,7 +2950,7 @@ 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_err!( pallet_subtensor::Pallet::::start_call(