diff --git a/pallets/admin-utils/tests/mock.rs b/pallets/admin-utils/tests/mock.rs index 688d666be..24475a8c6 100644 --- a/pallets/admin-utils/tests/mock.rs +++ b/pallets/admin-utils/tests/mock.rs @@ -81,6 +81,7 @@ parameter_types! { pub const InitialMinDelegateTake: u16 = 5_898; // 9%; pub const InitialDefaultChildKeyTake: u16 = 0; // Allow 0 % pub const InitialMinChildKeyTake: u16 = 0; // Allow 0 % + pub const InitialMaxChildKeyTake: u16 = 11_796; // 18 %; pub const InitialWeightsVersionKey: u16 = 0; pub const InitialServingRateLimit: u64 = 0; // No limit. pub const InitialTxRateLimit: u64 = 0; // Disable rate limit for testing @@ -153,6 +154,7 @@ impl pallet_subtensor::Config for Test { type InitialMinDelegateTake = InitialMinDelegateTake; type InitialDefaultChildKeyTake = InitialDefaultChildKeyTake; type InitialMinChildKeyTake = InitialMinChildKeyTake; + type InitialMaxChildKeyTake = InitialMaxChildKeyTake; type InitialWeightsVersionKey = InitialWeightsVersionKey; type InitialMaxDifficulty = InitialMaxDifficulty; type InitialMinDifficulty = InitialMinDifficulty; diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index f264ca323..1966f64ab 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -181,12 +181,19 @@ pub mod pallet { pub fn DefaultMinDelegateTake() -> u16 { T::InitialMinDelegateTake::get() } + #[pallet::type_value] /// Default minimum childkey take. pub fn DefaultMinChildKeyTake() -> u16 { T::InitialMinChildKeyTake::get() } + #[pallet::type_value] + /// Default maximum childkey take. + pub fn DefaultMaxChildKeyTake() -> u16 { + T::InitialMaxChildKeyTake::get() + } + #[pallet::type_value] /// Default account take. pub fn DefaultAccountTake() -> u64 { @@ -619,7 +626,7 @@ pub mod pallet { #[pallet::storage] // --- ITEM ( min_delegate_take ) pub type MinDelegateTake = StorageValue<_, u16, ValueQuery, DefaultMinDelegateTake>; #[pallet::storage] // --- ITEM ( default_childkey_take ) - pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultChildKeyTake>; + pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMaxChildKeyTake>; #[pallet::storage] // --- ITEM ( min_childkey_take ) pub type MinChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMinChildKeyTake>; diff --git a/pallets/subtensor/src/macros/config.rs b/pallets/subtensor/src/macros/config.rs index 2a6d8db00..5b2d0f25e 100644 --- a/pallets/subtensor/src/macros/config.rs +++ b/pallets/subtensor/src/macros/config.rs @@ -122,6 +122,9 @@ mod config { /// Initial minimum childkey take. #[pallet::constant] type InitialMinChildKeyTake: Get; + /// Initial maximum childkey take. + #[pallet::constant] + type InitialMaxChildKeyTake: Get; /// Initial weights version key. #[pallet::constant] type InitialWeightsVersionKey: Get; diff --git a/pallets/subtensor/tests/children.rs b/pallets/subtensor/tests/children.rs index f36c21521..2b99030ab 100644 --- a/pallets/subtensor/tests/children.rs +++ b/pallets/subtensor/tests/children.rs @@ -1499,7 +1499,7 @@ fn test_get_network_max_stake() { let default_max_stake = SubtensorModule::get_network_max_stake(netuid); // Check that the default value is set correctly - assert_eq!(default_max_stake, 500_000_000_000_000); + assert_eq!(default_max_stake, u64::MAX); // Set a new max stake value let new_max_stake: u64 = 1_000_000; diff --git a/pallets/subtensor/tests/mock.rs b/pallets/subtensor/tests/mock.rs index 022849c56..6785bdb02 100644 --- a/pallets/subtensor/tests/mock.rs +++ b/pallets/subtensor/tests/mock.rs @@ -133,8 +133,9 @@ parameter_types! { pub const InitialFoundationDistribution: u64 = 0; pub const InitialDefaultDelegateTake: u16 = 11_796; // 18%, same as in production pub const InitialMinDelegateTake: u16 = 5_898; // 9%; - pub const InitialDefaultChildKeyTake: u16 = 11_796; // 18%, same as in production + pub const InitialDefaultChildKeyTake: u16 = 0 ;// 0 % pub const InitialMinChildKeyTake: u16 = 0; // 0 %; + pub const InitialMaxChildKeyTake: u16 = 11_796; // 18 %; pub const InitialWeightsVersionKey: u16 = 0; pub const InitialServingRateLimit: u64 = 0; // No limit. pub const InitialTxRateLimit: u64 = 0; // Disable rate limit for testing @@ -172,7 +173,7 @@ parameter_types! { pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn pub const InitialHotkeyEmissionTempo: u64 = 0; // Defaults to draining every block. - pub const InitialNetworkMaxStake: u64 = 500_000_000_000_000; // 500,000 TAO + pub const InitialNetworkMaxStake: u64 = u64::MAX; // Maximum possible value for u64 } @@ -367,6 +368,7 @@ impl pallet_subtensor::Config for Test { type InitialMinDelegateTake = InitialMinDelegateTake; type InitialDefaultChildKeyTake = InitialDefaultChildKeyTake; type InitialMinChildKeyTake = InitialMinChildKeyTake; + type InitialMaxChildKeyTake = InitialMaxChildKeyTake; type InitialTxChildKeyTakeRateLimit = InitialTxChildKeyTakeRateLimit; type InitialWeightsVersionKey = InitialWeightsVersionKey; type InitialMaxDifficulty = InitialMaxDifficulty; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 166a686e4..ab88db026 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -910,6 +910,7 @@ parameter_types! { pub const SubtensorInitialMinDelegateTake: u16 = 0; // Allow 0% delegate take pub const SubtensorInitialDefaultChildKeyTake: u16 = 0; // Allow 0% childkey take pub const SubtensorInitialMinChildKeyTake: u16 = 0; // 0 % + pub const SubtensorInitialMaxChildKeyTake: u16 = 11_796; // 18 % pub const SubtensorInitialWeightsVersionKey: u64 = 0; pub const SubtensorInitialMinDifficulty: u64 = 10_000_000; pub const SubtensorInitialMaxDifficulty: u64 = u64::MAX / 4; @@ -981,6 +982,7 @@ impl pallet_subtensor::Config for Runtime { type InitialTxRateLimit = SubtensorInitialTxRateLimit; type InitialTxDelegateTakeRateLimit = SubtensorInitialTxDelegateTakeRateLimit; type InitialTxChildKeyTakeRateLimit = SubtensorInitialTxChildKeyTakeRateLimit; + type InitialMaxChildKeyTake = SubtensorInitialMaxChildKeyTake; type InitialRAORecycledForRegistration = SubtensorInitialRAORecycledForRegistration; type InitialSenateRequiredStakePercentage = SubtensorInitialSenateRequiredStakePercentage; type InitialNetworkImmunityPeriod = SubtensorInitialNetworkImmunity;