diff --git a/.github/workflows/run-benchmarks.yml b/.github/workflows/run-benchmarks.yml index 2693eba775..f54c6e1442 100644 --- a/.github/workflows/run-benchmarks.yml +++ b/.github/workflows/run-benchmarks.yml @@ -104,6 +104,11 @@ jobs: - name: Run & validate benchmarks timeout-minutes: 180 + env: + # PRs use fewer regression points; nightly/manual runs retain the + # full-resolution benchmark configuration. + STEPS: ${{ github.event_name == 'pull_request' && '15' || '50' }} + REPEAT: "20" run: | mkdir -p .bench_patch chmod +x scripts/benchmark_action.sh diff --git a/chain-extensions/src/lib.rs b/chain-extensions/src/lib.rs index 0315668441..ff97b4db4c 100644 --- a/chain-extensions/src/lib.rs +++ b/chain-extensions/src/lib.rs @@ -9,10 +9,14 @@ pub mod types; use crate::types::{ColdkeyLock, FunctionId, Output, StakeAvailability, SubnetRegistrationState}; use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::{DebugNoBound, traits::Get}; +use frame_support::{ + DebugNoBound, + dispatch::{DispatchResult, DispatchResultWithPostInfo}, + traits::Get, +}; use frame_system::RawOrigin; use pallet_contracts::chain_extension::{ - BufInBufOutState, ChainExtension, Environment, Ext, InitState, RetVal, SysConfig, + BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal, SysConfig, }; use pallet_subtensor::weights::WeightInfo as SubtensorWeightInfo; use pallet_subtensor_proxy as pallet_proxy; @@ -32,6 +36,43 @@ impl Default for SubtensorChainExtension { } } +fn finish_subtensor_call( + env: &mut Env, + charged: Env::ChargedAmount, + declared_weight: Weight, + call_result: DispatchResultWithPostInfo, +) -> Result +where + T: pallet_contracts::Config, + Env: SubtensorExtensionEnv, +{ + match call_result { + Ok(post_info) => { + env.adjust_weight(charged, post_info.actual_weight.unwrap_or(declared_weight)); + Ok(RetVal::Converging(Output::Success as u32)) + } + Err(error_with_post_info) => { + env.adjust_weight( + charged, + error_with_post_info + .post_info + .actual_weight + .unwrap_or(declared_weight), + ); + Ok(RetVal::Converging( + Output::from(error_with_post_info.error) as u32 + )) + } + } +} + +fn finish_fixed_subtensor_call(call_result: DispatchResult) -> Result { + match call_result { + Ok(()) => Ok(RetVal::Converging(Output::Success as u32)), + Err(error) => Ok(RetVal::Converging(Output::from(error) as u32)), + } +} + impl ChainExtension for SubtensorChainExtension where T: pallet_subtensor::Config @@ -82,13 +123,7 @@ where let call_result = pallet_subtensor::Pallet::::add_stake(origin.into(), hotkey, netuid, amount_staked); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_remove_stake_v1( @@ -116,13 +151,7 @@ where amount_unstaked, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_unstake_all_v1( @@ -137,20 +166,18 @@ where .read_as() .map_err(|_| DispatchError::Other("Failed to decode input parameters"))?; + let subnet_count = u32::from(pallet_subtensor::TotalNetworks::::get()); let weight = - <::WeightInfo as SubtensorWeightInfo>::unstake_all(); + <::WeightInfo as SubtensorWeightInfo>::unstake_all( + subnet_count, + ) + .saturating_add(T::DbWeight::get().reads(1)); env.charge_weight(weight)?; - let call_result = pallet_subtensor::Pallet::::unstake_all(origin.into(), hotkey); + let call_result = pallet_subtensor::Pallet::::do_unstake_all(origin.into(), hotkey); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_unstake_all_alpha_v1( @@ -165,21 +192,19 @@ where .read_as() .map_err(|_| DispatchError::Other("Failed to decode input parameters"))?; + let subnet_count = u32::from(pallet_subtensor::TotalNetworks::::get()); let weight = <::WeightInfo as SubtensorWeightInfo>::unstake_all_alpha( - ); + subnet_count, + ) + .saturating_add(T::DbWeight::get().reads(1)); env.charge_weight(weight)?; - let call_result = pallet_subtensor::Pallet::::unstake_all_alpha(origin.into(), hotkey); + let call_result = + pallet_subtensor::Pallet::::do_unstake_all_alpha(origin.into(), hotkey); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_move_stake_v1( @@ -214,13 +239,7 @@ where alpha_amount, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_transfer_stake_v1( @@ -255,13 +274,7 @@ where alpha_amount, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_swap_stake_v1( @@ -294,13 +307,7 @@ where alpha_amount, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_add_stake_limit_v1( @@ -335,13 +342,7 @@ where allow_partial, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_remove_stake_limit_v1( @@ -376,13 +377,7 @@ where allow_partial, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_swap_stake_limit_v1( @@ -420,13 +415,7 @@ where allow_partial, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_remove_stake_full_limit_v1( @@ -452,13 +441,7 @@ where limit_price, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_fixed_subtensor_call(call_result) } fn dispatch_set_coldkey_auto_stake_hotkey_v1( @@ -473,9 +456,42 @@ where .read_as() .map_err(|_| DispatchError::Other("Failed to decode input parameters"))?; - let weight = <::WeightInfo as SubtensorWeightInfo>::set_coldkey_auto_stake_hotkey(); - - env.charge_weight(weight)?; + // Charge the state reads used to derive this nested call's conservative + // benchmark bound separately. The top-level extrinsic ceiling cannot be + // reserved inside a contract whose enclosing gas limit is smaller. + let metering_reserve = T::DbWeight::get().reads(3); + let metering_charged = env.charge_weight(metering_reserve)?; + let (weight, metering_reads) = match &origin { + RawOrigin::Signed(coldkey) => { + let current_hotkey = + pallet_subtensor::AutoStakeDestination::::get(coldkey, netuid); + let old_coldkeys = current_hotkey + .as_ref() + .and_then(|old_hotkey| { + pallet_subtensor::AutoStakeDestinationColdkeys::::decode_len( + old_hotkey, netuid, + ) + }) + .unwrap_or_default() as u32; + let new_coldkeys = + pallet_subtensor::AutoStakeDestinationColdkeys::::decode_len(&hotkey, netuid) + .unwrap_or_default() as u32; + ( + <::WeightInfo as SubtensorWeightInfo>::set_coldkey_auto_stake_hotkey( + old_coldkeys, + new_coldkeys, + ), + if current_hotkey.is_some() { 3 } else { 2 }, + ) + } + _ => ( + <::WeightInfo as SubtensorWeightInfo>::set_coldkey_auto_stake_hotkey(0, 0), + 0, + ), + }; + env.adjust_weight(metering_charged, T::DbWeight::get().reads(metering_reads)); + + let charged = env.charge_weight(weight)?; let call_result = pallet_subtensor::Pallet::::set_coldkey_auto_stake_hotkey( origin.into(), @@ -483,13 +499,7 @@ where hotkey, ); - match call_result { - Ok(_) => Ok(RetVal::Converging(Output::Success as u32)), - Err(e) => { - let error_code = Output::from(e) as u32; - Ok(RetVal::Converging(error_code)) - } - } + finish_subtensor_call::(env, charged, weight, call_result) } fn dispatch_add_proxy_v1( @@ -925,8 +935,11 @@ trait SubtensorExtensionEnv where T: pallet_contracts::Config, { + type ChargedAmount; + fn func_id(&self) -> u16; - fn charge_weight(&mut self, weight: Weight) -> Result<(), DispatchError>; + fn charge_weight(&mut self, weight: Weight) -> Result; + fn adjust_weight(&mut self, charged: Self::ChargedAmount, actual_weight: Weight); fn read_as(&mut self) -> Result; fn write_output(&mut self, data: &[u8]) -> Result<(), DispatchError>; fn caller(&mut self) -> T::AccountId; @@ -963,12 +976,18 @@ where T::AccountId: Clone, E: Ext, { + type ChargedAmount = ChargedAmount; + fn func_id(&self) -> u16 { self.env.func_id() } - fn charge_weight(&mut self, weight: Weight) -> Result<(), DispatchError> { - self.env.charge_weight(weight).map(|_| ()) + fn charge_weight(&mut self, weight: Weight) -> Result { + self.env.charge_weight(weight) + } + + fn adjust_weight(&mut self, charged: Self::ChargedAmount, actual_weight: Weight) { + self.env.adjust_weight(charged, actual_weight); } fn read_as(&mut self) -> Result { diff --git a/chain-extensions/src/mock.rs b/chain-extensions/src/mock.rs index 6887dc5822..2891e8a822 100644 --- a/chain-extensions/src/mock.rs +++ b/chain-extensions/src/mock.rs @@ -444,6 +444,7 @@ impl pallet_subtensor::Config for Test { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = MaxEpochsPerBlock; type WeightInfo = (); + type MaxTransactionExtensionWeight = (); } // Swap-related parameter types diff --git a/chain-extensions/src/tests.rs b/chain-extensions/src/tests.rs index 3136cdc812..4a81e88a82 100644 --- a/chain-extensions/src/tests.rs +++ b/chain-extensions/src/tests.rs @@ -18,6 +18,26 @@ use subtensor_swap_interface::SwapHandler; type AccountId = ::AccountId; +fn unstake_all_weight(alpha_only: bool) -> Weight { + let subnet_count = u32::from(pallet_subtensor::TotalNetworks::::get()); + let benchmark_weight = if alpha_only { + <::WeightInfo as SubtensorWeightInfo>::unstake_all_alpha( + subnet_count, + ) + } else { + <::WeightInfo as SubtensorWeightInfo>::unstake_all( + subnet_count, + ) + }; + + match benchmark_weight + .checked_add(&::DbWeight::get().reads(1)) + { + Some(weight) => weight, + None => panic!("unstake benchmark and metering-read weights must not overflow"), + } +} + #[derive(Clone)] struct MockEnv { func_id: u16, @@ -53,7 +73,8 @@ fn set_coldkey_auto_stake_hotkey_success_sets_destination() { None ); - let expected_weight = <::WeightInfo as SubtensorWeightInfo>::set_coldkey_auto_stake_hotkey(); + let expected_weight = <::WeightInfo as SubtensorWeightInfo>::set_coldkey_auto_stake_hotkey(0, 0) + .saturating_add(::DbWeight::get().reads(2)); let mut env = MockEnv::new( FunctionId::SetColdkeyAutoStakeHotkeyV1, @@ -596,7 +617,7 @@ fn unstake_all_alpha_success_moves_stake_to_root() { stake_amount_raw.into(), )); - let expected_weight = <::WeightInfo as SubtensorWeightInfo>::unstake_all_alpha(); + let expected_weight = unstake_all_weight(true); let mut env = MockEnv::new(FunctionId::UnstakeAllAlphaV1, coldkey, hotkey.encode()) .with_expected_weight(expected_weight); @@ -1235,11 +1256,13 @@ impl MockEnv { } impl SubtensorExtensionEnv for MockEnv { + type ChargedAmount = Weight; + fn func_id(&self) -> u16 { self.func_id } - fn charge_weight(&mut self, weight: Weight) -> Result<(), DispatchError> { + fn charge_weight(&mut self, weight: Weight) -> Result { let prev = self.charged_weight.unwrap_or_default(); let cumulative = Weight::from_parts( prev.ref_time().checked_add(weight.ref_time()).unwrap(), @@ -1254,7 +1277,23 @@ impl SubtensorExtensionEnv for MockEnv { )); } self.charged_weight = Some(cumulative); - Ok(()) + Ok(weight) + } + + fn adjust_weight(&mut self, charged: Self::ChargedAmount, actual_weight: Weight) { + let remaining = match self + .charged_weight + .unwrap_or_default() + .checked_sub(&charged) + { + Some(remaining) => remaining, + None => panic!("adjusted weight cannot exceed the weight already charged"), + }; + let cumulative = match remaining.checked_add(&actual_weight) { + Some(cumulative) => cumulative, + None => panic!("adjusted actual weight must not overflow"), + }; + self.charged_weight = Some(cumulative); } fn read_as(&mut self) -> Result { @@ -1587,7 +1626,7 @@ fn unstake_all_success_unstakes_balance() { stake_amount_raw.into(), )); - let expected_weight = <::WeightInfo as SubtensorWeightInfo>::unstake_all(); + let expected_weight = unstake_all_weight(false); let pre_balance = pallet_subtensor::Pallet::::get_coldkey_balance(&coldkey); @@ -2057,7 +2096,7 @@ mod caller_dispatch_tests { stake_amount_raw.into(), )); - let expected_weight = <::WeightInfo as SubtensorWeightInfo>::unstake_all(); + let expected_weight = unstake_all_weight(false); let pre_balance = pallet_subtensor::Pallet::::get_coldkey_balance(&coldkey); @@ -2066,6 +2105,7 @@ mod caller_dispatch_tests { let ret = SubtensorChainExtension::::dispatch(&mut env).unwrap(); assert_success(ret); + assert_eq!(env.charged_weight(), Some(expected_weight)); let remaining_alpha = pallet_subtensor::Pallet::::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -2109,7 +2149,7 @@ mod caller_dispatch_tests { stake_amount_raw.into(), )); - let expected_weight = <::WeightInfo as SubtensorWeightInfo>::unstake_all_alpha(); + let expected_weight = unstake_all_weight(true); let mut env = MockEnv::new( FunctionId::CallerUnstakeAllAlphaV1, @@ -2120,6 +2160,7 @@ mod caller_dispatch_tests { let ret = SubtensorChainExtension::::dispatch(&mut env).unwrap(); assert_success(ret); + assert_eq!(env.charged_weight(), Some(expected_weight)); let subnet_alpha = pallet_subtensor::Pallet::::get_stake_for_hotkey_and_coldkey_on_subnet( @@ -2659,7 +2700,8 @@ mod caller_dispatch_tests { None ); - let expected_weight = <::WeightInfo as SubtensorWeightInfo>::set_coldkey_auto_stake_hotkey(); + let expected_weight = <::WeightInfo as SubtensorWeightInfo>::set_coldkey_auto_stake_hotkey(0, 0) + .saturating_add(::DbWeight::get().reads(2)); let mut env = MockEnv::new( FunctionId::CallerSetColdkeyAutoStakeHotkeyV1, diff --git a/eco-tests/src/mock.rs b/eco-tests/src/mock.rs index a4929a2cb7..c97438c8ce 100644 --- a/eco-tests/src/mock.rs +++ b/eco-tests/src/mock.rs @@ -155,6 +155,8 @@ impl system::Config for Test { parameter_types! { pub const BlockHashCount: u64 = 250; pub const SS58Prefix: u8 = 42; + pub MaxTransactionExtensionWeight: Weight = + <() as pallet_subtensor::weights::WeightInfo>::check_coldkey_swap_extension(); } pub const MOCK_BLOCK_BUILDER: u64 = 12345u64; @@ -338,6 +340,7 @@ impl pallet_subtensor::Config for Test { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = MaxEpochsPerBlock; type WeightInfo = (); + type MaxTransactionExtensionWeight = MaxTransactionExtensionWeight; type AlphaAssets = AlphaAssets; } diff --git a/node/src/benchmarking.rs b/node/src/benchmarking.rs index d0c0ac9a40..fcb4022532 100644 --- a/node/src/benchmarking.rs +++ b/node/src/benchmarking.rs @@ -136,13 +136,14 @@ pub fn create_benchmark_extrinsic( frame_system::CheckWeight::::new(), ), ( - transaction_payment_wrapper::ChargeTransactionPaymentWrapper::new(TaoBalance::new(0)), sudo_wrapper::SudoTransactionExtension::::new(), pallet_shield::CheckShieldedTxValidity::::new(), pallet_subtensor::SubtensorTransactionExtension::::new(), pallet_drand::drand_priority::DrandPriority::::new(), + transaction_payment_wrapper::ChargeTransactionPaymentWrapper::new(TaoBalance::new(0)), ), frame_metadata_hash_extension::CheckMetadataHash::::new(true), + frame_system::WeightReclaim::::new(), ); let raw_payload = runtime::SignedPayload::from_raw( @@ -160,6 +161,7 @@ pub fn create_benchmark_extrinsic( ), ((), (), (), (), ()), None, + (), ), ); let signature = raw_payload.using_encoded(|e| sender.sign(e)); diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index ad8152b8e2..859f9fec7d 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -253,6 +253,7 @@ impl pallet_subtensor::Config for Test { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = MaxEpochsPerBlock; type WeightInfo = (); + type MaxTransactionExtensionWeight = (); } parameter_types! { diff --git a/pallets/subtensor/src/benchmarks/benchmarks.rs b/pallets/subtensor/src/benchmarks/benchmarks.rs index 375bdb61ea..c9d84f66fc 100644 --- a/pallets/subtensor/src/benchmarks/benchmarks.rs +++ b/pallets/subtensor/src/benchmarks/benchmarks.rs @@ -9,7 +9,9 @@ use crate::Pallet as Subtensor; use crate::staking::lock::LockState; +use crate::subnets::leasing::SubnetLease; use crate::subnets::mechanism::GLOBAL_MAX_SUBNET_COUNT; +use crate::subnets::symbols::SYMBOLS; use crate::*; use codec::{Compact, Encode}; use frame_benchmarking::v2::*; @@ -77,18 +79,21 @@ mod pallet_benchmarks { ); } + // The admin dispatch rejects values above this runtime-configured limit, + // so larger subnet populations cannot be reached through runtime calls. #[benchmark] - fn set_weights() { + fn set_weights(n: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { let netuid = NetUid::from(1); let version_key: u64 = 1; let tempo: u16 = 1; Subtensor::::init_new_network(netuid, tempo); - Subtensor::::set_max_allowed_uids(netuid, 4096); + let max_uids = u16::try_from(n).expect("benchmark component fits in u16"); + Subtensor::::set_max_allowed_uids(netuid, max_uids); SubtokenEnabled::::insert(netuid, true); Subtensor::::set_network_registration_allowed(netuid, true); - Subtensor::::set_max_registrations_per_block(netuid, 4096); - Subtensor::::set_target_registrations_per_interval(netuid, 4096); + Subtensor::::set_max_registrations_per_block(netuid, max_uids); + Subtensor::::set_target_registrations_per_interval(netuid, max_uids); Subtensor::::set_commit_reveal_weights_enabled(netuid, false); SubnetTAO::::insert(netuid, TaoBalance::from(1_000_000_000_000_u64)); SubnetAlphaIn::::insert(netuid, AlphaBalance::from(1_000_000_000_000_000_u64)); @@ -99,7 +104,7 @@ mod pallet_benchmarks { let mut weights = Vec::new(); let signer: T::AccountId = account("Alice", 0, seed); - for _ in 0..4096 { + for _ in 0..n { let hotkey: T::AccountId = account("Alice", 0, seed); let coldkey: T::AccountId = account("Test", 0, seed); seed += 1; @@ -297,16 +302,20 @@ mod pallet_benchmarks { let coldkey: T::AccountId = account("Test", 0, seed); let hotkey: T::AccountId = account("TestHotkey", 0, seed); + setup_worst_case_queued_network_registration::(); Subtensor::::set_network_rate_limit(1); let amount: u64 = 100_000_000_000_000u64.saturating_mul(2); add_balance_to_coldkey_account::(&coldkey, amount.into()); #[extrinsic_call] _(RawOrigin::Signed(coldkey.clone()), hotkey.clone()); + + assert_eq!(NetworkRegistrationQueue::::get().len(), 1); + assert!(!Subtensor::::hotkey_account_exists(&hotkey)); } #[benchmark] - fn commit_weights() { + fn commit_weights(q: Linear<0, 9>) { let tempo: u16 = 1; let netuid = NetUid::from(1); let version_key: u64 = 0; @@ -342,65 +351,46 @@ mod pallet_benchmarks { Subtensor::::set_validator_permit_for_uid(netuid, 0, true); Subtensor::::set_commit_reveal_weights_enabled(netuid, true); + let netuid_index = Subtensor::::get_mechanism_storage_index( + netuid, + subtensor_runtime_common::MechId::MAIN, + ); + let commit_epoch = Subtensor::::current_epoch_with_lookahead(netuid); + let commit_block = Subtensor::::get_current_block_as_u64(); + WeightCommits::::insert( + netuid_index, + &hotkey, + (0..q) + .map(|i| { + ( + H256::repeat_byte((i as u8).saturating_add(1)), + commit_epoch, + commit_block, + 0, + ) + }) + .collect::>(), + ); + #[extrinsic_call] _(RawOrigin::Signed(hotkey.clone()), netuid, commit_hash); } + // Benchmark the largest reachable subnet population. Values above this + // cannot pass the subnet's max-UID check. #[benchmark] - fn reveal_weights() { - let tempo: u16 = 0; - let netuid = NetUid::from(1); - let version_key: u64 = 0; - let uids: Vec = vec![0]; - let weight_values: Vec = vec![10]; - let salt: Vec = vec![8]; - let hotkey: T::AccountId = account("hot", 0, 1); - let coldkey: T::AccountId = account("cold", 1, 2); - - Subtensor::::init_new_network(netuid, tempo); - Subtensor::::set_network_registration_allowed(netuid, true); - SubtokenEnabled::::insert(netuid, true); - Subtensor::::set_weights_set_rate_limit(netuid, 0); - Subtensor::::set_difficulty(netuid, 1); - - Subtensor::::set_burn(netuid, benchmark_registration_burn()); - seed_swap_reserves::(netuid); - fund_for_registration::(netuid, &coldkey); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(coldkey.clone()).into(), - netuid, - hotkey.clone() - )); - - Subtensor::::set_validator_permit_for_uid(netuid, 0, true); - Subtensor::::set_commit_reveal_weights_enabled(netuid, true); - - let commit_hash: H256 = BlakeTwo256::hash_of(&( - hotkey.clone(), - netuid, - uids.clone(), - weight_values.clone(), - salt.clone(), - version_key, - )); - assert_ok!(Subtensor::::commit_weights( - RawOrigin::Signed(hotkey.clone()).into(), - netuid, - commit_hash, - )); - - // Advance the epoch counter into the commit's reveal window. - let reveal_period = Subtensor::::get_reveal_period(netuid); - SubnetEpochIndex::::mutate(netuid, |e| *e = e.saturating_add(reveal_period)); + fn reveal_weights(n: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>, q: Linear<1, 10>) { + let mecid = subtensor_runtime_common::MechId::MAIN; + let (netuid, hotkey, uids, weight_values, salt, version_key) = + setup_reveal_weight_benchmark::("reveal_weights", mecid, n, q); #[extrinsic_call] _( - RawOrigin::Signed(hotkey.clone()), + RawOrigin::Signed(hotkey), netuid, - uids.clone(), - weight_values.clone(), - salt.clone(), + uids, + weight_values, + salt, version_key, ); } @@ -457,8 +447,12 @@ mod pallet_benchmarks { _(RawOrigin::Signed(coldkey), new_coldkey_hash); } + // Sample a full runtime-reachable subnet population. The generated linear + // model is evaluated with coldkey_swap_work(), so larger aggregate + // association sets remain charged by extrapolation without constructing + // 65,535 synthetic storage rows for every benchmark repeat. #[benchmark] - fn swap_coldkey_announced() { + fn swap_coldkey_announced(w: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { let old_coldkey: T::AccountId = account("old_coldkey", 0, 0); let new_coldkey: T::AccountId = account("new_coldkey", 0, 0); let new_coldkey_hash: T::Hash = ::Hashing::hash_of(&new_coldkey); @@ -492,22 +486,50 @@ mod pallet_benchmarks { old_coldkey.clone(), )); - // Worst case: migrate the full bounded collateral-hotkey index plus - // lineage / aggregate updates that the legacy weight omitted. let locked = AlphaBalance::from(1_000_000_u64); + SubnetOwner::::insert(netuid, &old_coldkey); + AutoStakeDestination::::insert(&old_coldkey, netuid, &hotkey1); + Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( + &hotkey1, + &old_coldkey, + netuid, + locked, + ); seed_miner_collateral_position::(netuid, &hotkey1, &old_coldkey, locked); - for i in 1..MAX_COLDKEY_COLLATERAL_HOTKEYS { - let extra_hot: T::AccountId = account("collateral_hot", i, 0); + + let mut owned_hotkeys = vec![hotkey1.clone()]; + let mut staking_hotkeys = vec![hotkey1.clone()]; + for i in 1..w { + let extra_hot: T::AccountId = account("announced_owned_hot", i, 0); Owner::::insert(&extra_hot, &old_coldkey); - seed_miner_collateral_position::(netuid, &extra_hot, &old_coldkey, locked); + Alpha::::insert( + (&extra_hot, &old_coldkey, netuid), + U64F64::from_num(locked.to_u64()), + ); + TotalHotkeyShares::::insert(&extra_hot, netuid, U64F64::from_num(locked.to_u64())); + TotalHotkeyAlpha::::insert(&extra_hot, netuid, locked); + owned_hotkeys.push(extra_hot.clone()); + staking_hotkeys.push(extra_hot.clone()); + if i < MAX_COLDKEY_COLLATERAL_HOTKEYS { + seed_miner_collateral_position::(netuid, &extra_hot, &old_coldkey, locked); + } } + OwnedHotkeys::::insert(&old_coldkey, owned_hotkeys); + StakingHotkeys::::insert(&old_coldkey, staking_hotkeys); + let mut auto_stake_coldkeys = (1..w) + .map(|i| account("announced_auto_stake_coldkey", i, 0)) + .collect::>(); + auto_stake_coldkeys.push(old_coldkey.clone()); + AutoStakeDestinationColdkeys::::insert(&hotkey1, netuid, auto_stake_coldkeys); #[extrinsic_call] _(RawOrigin::Signed(old_coldkey), new_coldkey); } + // This is a regression training range, not a dispatch cap. Runtime weight + // accounting passes the complete state-derived work count to WeightInfo. #[benchmark] - fn swap_coldkey() { + fn swap_coldkey(w: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { let old_coldkey: T::AccountId = account("old_coldkey", 0, 0); let new_coldkey: T::AccountId = account("new_coldkey", 0, 0); let hotkey1: T::AccountId = account("hotkey1", 0, 0); @@ -544,15 +566,41 @@ mod pallet_benchmarks { }; IdentitiesV2::::insert(&old_coldkey, identity); - // Worst case: migrate the full bounded collateral-hotkey index plus - // lineage / aggregate updates that the legacy weight omitted. let locked = AlphaBalance::from(1_000_000_u64); + SubnetOwner::::insert(netuid, &old_coldkey); + AutoStakeDestination::::insert(&old_coldkey, netuid, &hotkey1); + Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( + &hotkey1, + &old_coldkey, + netuid, + locked, + ); seed_miner_collateral_position::(netuid, &hotkey1, &old_coldkey, locked); - for i in 1..MAX_COLDKEY_COLLATERAL_HOTKEYS { - let extra_hot: T::AccountId = account("collateral_hot", i, 0); + + let mut owned_hotkeys = vec![hotkey1.clone()]; + let mut staking_hotkeys = vec![hotkey1.clone()]; + for i in 1..w { + let extra_hot: T::AccountId = account("root_owned_hot", i, 0); Owner::::insert(&extra_hot, &old_coldkey); - seed_miner_collateral_position::(netuid, &extra_hot, &old_coldkey, locked); + Alpha::::insert( + (&extra_hot, &old_coldkey, netuid), + U64F64::from_num(locked.to_u64()), + ); + TotalHotkeyShares::::insert(&extra_hot, netuid, U64F64::from_num(locked.to_u64())); + TotalHotkeyAlpha::::insert(&extra_hot, netuid, locked); + owned_hotkeys.push(extra_hot.clone()); + staking_hotkeys.push(extra_hot.clone()); + if i < MAX_COLDKEY_COLLATERAL_HOTKEYS { + seed_miner_collateral_position::(netuid, &extra_hot, &old_coldkey, locked); + } } + OwnedHotkeys::::insert(&old_coldkey, owned_hotkeys); + StakingHotkeys::::insert(&old_coldkey, staking_hotkeys); + let mut auto_stake_coldkeys = (1..w) + .map(|i| account("root_auto_stake_coldkey", i, 0)) + .collect::>(); + auto_stake_coldkeys.push(old_coldkey.clone()); + AutoStakeDestinationColdkeys::::insert(&hotkey1, netuid, auto_stake_coldkeys); #[extrinsic_call] _( @@ -603,69 +651,47 @@ mod pallet_benchmarks { _(RawOrigin::Root, coldkey); } + // The per-row work uses the largest runtime-reachable subnet population. #[benchmark] - fn batch_reveal_weights() { - let tempo: u16 = 0; - let netuid = NetUid::from(1); - let num_commits: usize = 10; - - let hotkey: T::AccountId = account("hot", 0, 1); - let coldkey: T::AccountId = account("cold", 0, 2); - - Subtensor::::init_new_network(netuid, tempo); - Subtensor::::set_network_registration_allowed(netuid, true); - Subtensor::::set_commit_reveal_weights_enabled(netuid, true); - Subtensor::::set_weights_set_rate_limit(netuid, 0); - Subtensor::::set_difficulty(netuid, 1); - SubtokenEnabled::::insert(netuid, true); - - Subtensor::::set_burn(netuid, benchmark_registration_burn()); - seed_swap_reserves::(netuid); - fund_for_registration::(netuid, &coldkey); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(coldkey.clone()).into(), - netuid, - hotkey.clone() - )); - - Subtensor::::set_validator_permit_for_uid(netuid, 0, true); + fn batch_reveal_weights(b: Linear<1, 10>) { + let mecid = subtensor_runtime_common::MechId::MAIN; + let (netuid, hotkey, uids, values, _, _) = setup_reveal_weight_benchmark::( + "batch_reveal", + mecid, + T::InitialMaxAllowedUids::get().into(), + 10, + ); + let netuid_index = Subtensor::::get_mechanism_storage_index(netuid, mecid); let mut uids_list = Vec::new(); let mut values_list = Vec::new(); let mut salts_list = Vec::new(); let mut version_keys = Vec::new(); + let mut commits = VecDeque::new(); - for i in 0..num_commits { - let uids = vec![0u16]; - let values = vec![i as u16]; - let salts = vec![i as u16]; + for i in 0..b { + let salts = vec![i as u16; uids.len()]; let version_key_i: u64 = i as u64; - - let commit_hash: H256 = BlakeTwo256::hash_of(&( - hotkey.clone(), - netuid, - uids.clone(), - values.clone(), - salts.clone(), + let commit_hash = Subtensor::::get_commit_hash( + &hotkey, + netuid_index, + &uids, + &values, + &salts, version_key_i, + ); + commits.push_back(( + commit_hash, + 0, + Subtensor::::get_current_block_as_u64(), + 0, )); - - assert_ok!(Subtensor::::commit_weights( - RawOrigin::Signed(hotkey.clone()).into(), - netuid, - commit_hash - )); - - uids_list.push(uids); - values_list.push(values); + uids_list.push(uids.clone()); + values_list.push(values.clone()); salts_list.push(salts); version_keys.push(version_key_i); } - - // Advance the epoch counter into the reveal window for these commits. - let reveal_period = Subtensor::::get_reveal_period(netuid); - SubnetEpochIndex::::mutate(netuid, |e| *e = e.saturating_add(reveal_period)); + WeightCommits::::insert(netuid_index, &hotkey, commits); #[extrinsic_call] _( @@ -1274,6 +1300,14 @@ mod pallet_benchmarks { SubtokenEnabled::::insert(netuid, true); Subtensor::::init_new_network(netuid, 1); let _ = Subtensor::::create_account_if_non_existent(&coldkey, &hot); + ColdkeyCollateralHotkeys::::mutate(netuid, &coldkey, |hotkeys| { + for index in 0..MAX_COLDKEY_COLLATERAL_HOTKEYS.saturating_sub(1) { + let existing: T::AccountId = account("min_collateral_existing", index, 1); + hotkeys + .try_push(existing) + .expect("benchmark collateral index remains within its existing bound"); + } + }); #[extrinsic_call] _( @@ -1338,33 +1372,38 @@ mod pallet_benchmarks { ); } + // Every sampled item takes the more expensive successful path on a + // distinct subnet. This is a regression training range, not a dispatch + // cap; WeightInfo continues the measured per-item slope over the complete + // input length. #[benchmark] - fn batch_commit_weights() { + fn batch_commit_weights(b: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { let hotkey: T::AccountId = whitelisted_caller(); - let netuid = NetUid::from(1); - let count: usize = 3; + let coldkey: T::AccountId = account("batch_commit_cold", 0, 1); let mut netuids: Vec> = Vec::new(); let mut hashes: Vec = Vec::new(); + Owner::::insert(&hotkey, &coldkey); - Subtensor::::init_new_network(netuid, 1); - Subtensor::::set_network_registration_allowed(netuid, true); - SubtokenEnabled::::insert(netuid, true); - Subtensor::::set_weights_set_rate_limit(netuid, 0); - - Subtensor::::set_burn(netuid, benchmark_registration_burn()); - seed_swap_reserves::(netuid); - fund_for_registration::(netuid, &hotkey); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(hotkey.clone()).into(), - netuid, - hotkey.clone() - )); - - Subtensor::::set_validator_permit_for_uid(netuid, 0, true); - Subtensor::::set_commit_reveal_weights_enabled(netuid, true); + for i in 0..b { + let netuid = NetUid::from((i + 1) as u16); + Subtensor::::init_new_network(netuid, 1); + SubtokenEnabled::::insert(netuid, true); + Subtensor::::set_weights_set_rate_limit(netuid, 0); + Subtensor::::set_commit_reveal_weights_enabled(netuid, true); + Subtensor::::append_neuron(netuid, &hotkey, 0); + Subtensor::::set_validator_permit_for_uid(netuid, 0, true); - for i in 0..count { + let netuid_index = Subtensor::::get_mechanism_storage_index( + netuid, + subtensor_runtime_common::MechId::MAIN, + ); + WeightCommits::::insert( + netuid_index, + &hotkey, + (0..9_u8) + .map(|seed| (H256::repeat_byte(seed.saturating_add(1)), 0, 0, 0)) + .collect::>(), + ); netuids.push(Compact(netuid)); hashes.push(H256::repeat_byte(i as u8)); } @@ -1377,36 +1416,31 @@ mod pallet_benchmarks { ); } + // Sample independent successful rows and extrapolate the measured linear + // slope over the complete input length at dispatch. #[benchmark] - fn batch_set_weights() { + fn batch_set_weights(b: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { let hotkey: T::AccountId = whitelisted_caller(); - let netuid = NetUid::from(1); + let coldkey: T::AccountId = account("batch_set_cold", 0, 1); let version: u64 = 1; let entries: Vec<(Compact, Compact)> = vec![(Compact(0u16), Compact(0u16))]; - let netuids: Vec> = vec![Compact(netuid)]; - let weights: Vec, Compact)>> = vec![entries.clone()]; - let keys: Vec> = vec![Compact(version)]; - - Subtensor::::init_new_network(netuid, 1); - Subtensor::::set_network_registration_allowed(netuid, true); - SubtokenEnabled::::insert(netuid, true); - Subtensor::::set_commit_reveal_weights_enabled(netuid, false); - - // Avoid any weights set rate-limit edge cases during benchmark setup. - Subtensor::::set_weights_set_rate_limit(netuid, 0); - - Subtensor::::set_burn(netuid, benchmark_registration_burn()); - seed_swap_reserves::(netuid); - fund_for_registration::(netuid, &hotkey); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(hotkey.clone()).into(), - netuid, - hotkey.clone() - )); + let mut netuids = Vec::with_capacity(b as usize); + let mut weights = Vec::with_capacity(b as usize); + let mut keys = Vec::with_capacity(b as usize); + Owner::::insert(&hotkey, &coldkey); - // Batch set weights generally requires validator permit. - Subtensor::::set_validator_permit_for_uid(netuid, 0, true); + for i in 0..b { + let netuid = NetUid::from((i + 1) as u16); + Subtensor::::init_new_network(netuid, 1); + SubtokenEnabled::::insert(netuid, true); + Subtensor::::set_commit_reveal_weights_enabled(netuid, false); + Subtensor::::set_weights_set_rate_limit(netuid, 0); + Subtensor::::append_neuron(netuid, &hotkey, 0); + Subtensor::::set_validator_permit_for_uid(netuid, 0, true); + netuids.push(Compact(netuid)); + weights.push(entries.clone()); + keys.push(Compact(version)); + } #[extrinsic_call] _( @@ -1446,11 +1480,12 @@ mod pallet_benchmarks { } #[benchmark] - fn register_network_with_identity() { + fn register_network_with_identity(i: Linear<1, 6_400>) { let coldkey: T::AccountId = whitelisted_caller(); let hotkey: T::AccountId = account("Alice", 0, 1); - let identity: Option = None; + let identity = Some(subnet_identity_with_bytes(i)); + setup_worst_case_queued_network_registration::(); Subtensor::::set_network_registration_allowed(1.into(), true); Subtensor::::set_network_rate_limit(1); let amount: u64 = 9_999_999_999_999; @@ -1462,10 +1497,13 @@ mod pallet_benchmarks { hotkey.clone(), identity.clone(), ); + + assert_eq!(NetworkRegistrationQueue::::get().len(), 1); + assert!(!Subtensor::::hotkey_account_exists(&hotkey)); } #[benchmark] - fn serve_axon_tls() { + fn serve_axon_tls(c: Linear<1, 65>) { let caller: T::AccountId = whitelisted_caller(); let netuid = NetUid::from(1); let version: u32 = 1; @@ -1475,7 +1513,7 @@ mod pallet_benchmarks { let proto: u8 = 0; let p1: u8 = 0; let p2: u8 = 0; - let cert: Vec = vec![]; + let cert: Vec = vec![u8::MAX; c as usize]; Subtensor::::init_new_network(netuid, 1); Subtensor::::set_network_registration_allowed(netuid, true); @@ -1507,17 +1545,11 @@ mod pallet_benchmarks { } #[benchmark] - fn set_identity() { + fn set_identity(i: Linear<1, 4_096>) { let netuid = NetUid::from(1); let coldkey: T::AccountId = whitelisted_caller(); let hotkey: T::AccountId = account("Alice", 0, 5); - let name = b"n".to_vec(); - let url = vec![]; - let repo = vec![]; - let img = vec![]; - let disc = vec![]; - let descr = vec![]; - let add = vec![]; + let identity = chain_identity_with_bytes(i); let _ = Subtensor::::create_account_if_non_existent(&coldkey, &hotkey); Subtensor::::init_new_network(netuid, 1); @@ -1538,28 +1570,21 @@ mod pallet_benchmarks { #[extrinsic_call] _( RawOrigin::Signed(coldkey.clone()), - name, - url, - repo, - img, - disc, - descr, - add, + identity.name, + identity.url, + identity.github_repo, + identity.image, + identity.discord, + identity.description, + identity.additional, ); } #[benchmark] - fn set_subnet_identity() { + fn set_subnet_identity(i: Linear<1, 6_400>) { let coldkey: T::AccountId = whitelisted_caller(); let netuid = NetUid::from(1); - let name = b"n".to_vec(); - let repo = vec![]; - let contact = vec![]; - let url = vec![]; - let disc = vec![]; - let descr = vec![]; - let logo_url = vec![]; - let add = vec![]; + let identity = subnet_identity_with_bytes(i); Subtensor::::init_new_network(netuid, 1); SubnetOwner::::insert(netuid, coldkey.clone()); @@ -1569,14 +1594,14 @@ mod pallet_benchmarks { _( RawOrigin::Signed(coldkey.clone()), netuid, - name, - repo, - contact, - url, - disc, - descr, - logo_url, - add, + identity.subnet_name, + identity.github_repo, + identity.subnet_contact, + identity.subnet_url, + identity.discord, + identity.description, + identity.logo_url, + identity.additional, ); } @@ -1636,58 +1661,23 @@ mod pallet_benchmarks { _(RawOrigin::Signed(coldkey.clone()), hot); } + // Each sampled subnet contains a live stake position. The generated model + // is evaluated with TotalNetworks, so the full finite netuid domain remains + // charged by extrapolation. #[benchmark] - fn unstake_all() { - let coldkey: T::AccountId = whitelisted_caller(); - let hotkey: T::AccountId = account("A", 0, 14); - let _ = Subtensor::::create_account_if_non_existent(&coldkey, &hotkey); + fn unstake_all(n: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { + let (coldkey, hotkey) = setup_unstake_all_benchmark::("unstake_all", n); #[extrinsic_call] _(RawOrigin::Signed(coldkey.clone()), hotkey); } + // Each sampled subnet contains a live stake position. The generated model + // is evaluated with TotalNetworks, so the full finite netuid domain remains + // charged by extrapolation. #[benchmark] - fn unstake_all_alpha() { - let netuid = NetUid::from(1); - let tempo: u16 = 1; - let seed: u32 = 1; - - Subtensor::::init_new_network(netuid, tempo); - Subtensor::::set_network_registration_allowed(netuid, true); - SubtokenEnabled::::insert(netuid, true); - - Subtensor::::set_max_allowed_uids(netuid, 4096); - assert_eq!(Subtensor::::get_max_allowed_uids(netuid), 4096); - - let coldkey: T::AccountId = account("Test", 0, seed); - let hotkey: T::AccountId = account("Alice", 0, seed); - Subtensor::::set_burn(netuid, benchmark_registration_burn()); - - set_reserves::( - netuid, - TaoBalance::from(150_000_000_000_u64), - AlphaBalance::from(100_000_000_000_u64), - ); - - // Registration now requires keep-alive coverage of the burn; fund - // above burn + ED rather than a flat token amount. - fund_for_registration::(netuid, &coldkey); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(coldkey.clone()).into(), - netuid, - hotkey.clone() - )); - - let staked_amt = TaoBalance::from(100_000_000_000_u64); - add_balance_to_coldkey_account::(&coldkey.clone(), staked_amt); - - assert_ok!(Subtensor::::add_stake( - RawOrigin::Signed(coldkey.clone()).into(), - hotkey.clone(), - netuid, - staked_amt - )); + fn unstake_all_alpha(n: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { + let (coldkey, hotkey) = setup_unstake_all_benchmark::("unstake_all_alpha", n); #[extrinsic_call] _(RawOrigin::Signed(coldkey), hotkey); @@ -1795,6 +1785,7 @@ mod pallet_benchmarks { pallet_crowdloan::CurrentCrowdloanId::::set(Some(0)); + setup_worst_case_network_creation::(); let emissions_share = Percent::from_percent(30); #[extrinsic_call] _( @@ -1814,57 +1805,57 @@ mod pallet_benchmarks { #[benchmark] fn terminate_lease(k: Linear<2, { T::MaxContributors::get() }>) { - let crowdloan_id = 0; let beneficiary: T::AccountId = whitelisted_caller(); - let deposit = TaoBalance::from(20_000_000_000_u64); // 20 TAO - let now = frame_system::Pallet::::block_number(); - let crowdloan_end = now + T::MaximumBlockDuration::get(); - let cap = TaoBalance::from(2_000_000_000_000_u64); // 2000 TAO + let lease_id = 0; + let lease_coldkey: T::AccountId = account("lease_coldkey", lease_id, 0); + let lease_hotkey: T::AccountId = account("lease_hotkey", lease_id, 0); + let netuid = NetUid::from(1); + let lease_end = T::MaximumBlockDuration::get(); + let emissions_share = Percent::from_percent(30); - let funds_account: T::AccountId = account("funds", 0, 0); - add_balance_to_coldkey_account::(&funds_account, cap); + // Termination only consumes the resulting lease state. Registering a + // worst-case subnet here repeats unrelated network-registration work + // for every sample and previously dominated this benchmark's runtime. + Subtensor::::init_new_network(netuid, 1); + SubnetOwner::::insert(netuid, &lease_coldkey); + frame_system::Pallet::::inc_providers(&lease_coldkey); + frame_system::Pallet::::inc_providers(&lease_hotkey); - pallet_crowdloan::Crowdloans::::insert( - crowdloan_id, - pallet_crowdloan::CrowdloanInfo { - creator: beneficiary.clone(), - deposit, - min_contribution: 0.into(), - end: crowdloan_end, - cap, - raised: cap, - finalized: false, - funds_account: funds_account.clone(), - call: None, - target_address: None, - contributors_count: T::MaxContributors::get(), - }, + // The runtime proxy implementation reserves a deposit from the lease + // account while installing the relation removed by the measured call. + add_balance_to_coldkey_account::( + &lease_coldkey, + TaoBalance::from(2_000_000_000_000_u64), ); + assert_ok!(T::ProxyInterface::add_lease_beneficiary_proxy( + &lease_coldkey, + &beneficiary, + )); - frame_system::Pallet::::set_block_number(crowdloan_end); - - pallet_crowdloan::Contributions::::insert(crowdloan_id, &beneficiary, deposit); + SubnetLeases::::insert( + lease_id, + SubnetLease { + beneficiary: beneficiary.clone(), + coldkey: lease_coldkey, + hotkey: lease_hotkey, + emissions_share, + end_block: Some(lease_end), + netuid, + cost: TaoBalance::from(1_000_000_000_u64), + }, + ); + SubnetUidToLeaseId::::insert(netuid, lease_id); + AccumulatedLeaseDividends::::insert(lease_id, AlphaBalance::from(u64::MAX)); + // Lease shares exclude the beneficiary, while `k` includes it. let contributors = k - 1; - let amount = (cap - deposit) / TaoBalance::from(contributors); for i in 0..contributors { let contributor = account::("contributor", i.try_into().unwrap(), 0); - pallet_crowdloan::Contributions::::insert(crowdloan_id, contributor, amount); + SubnetLeaseShares::::insert(lease_id, contributor, U64F64::from_num(1_u32)); } - pallet_crowdloan::CurrentCrowdloanId::::set(Some(0)); - - let emissions_share = Percent::from_percent(30); - let lease_end = crowdloan_end + 1000u32.into(); - assert_ok!(Subtensor::::register_leased_network( - RawOrigin::Signed(beneficiary.clone()).into(), - emissions_share, - Some(lease_end), - )); - frame_system::Pallet::::set_block_number(lease_end); - let lease_id = 0; let lease = SubnetLeases::::get(0).unwrap(); let hotkey = account::("beneficiary_hotkey", 0, 0); let _ = Subtensor::::create_account_if_non_existent(&beneficiary, &hotkey); @@ -1892,7 +1883,20 @@ mod pallet_benchmarks { Subtensor::::init_new_network(netuid, tempo); SubnetOwner::::insert(netuid, coldkey.clone()); - let new_symbol = Subtensor::::get_symbol_for_subnet(NetUid::from(42)); + // Force both symbol scans to traverse their complete existing domain: + // the requested symbol is last in the registry and every other symbol + // is already assigned on chain. + let new_symbol = SYMBOLS + .last() + .expect("symbol registry is non-empty") + .to_vec(); + for (index, symbol) in SYMBOLS + .iter() + .enumerate() + .take(SYMBOLS.len().saturating_sub(1)) + { + TokenSymbol::::insert(NetUid::from((index + 2) as u16), symbol.to_vec()); + } #[extrinsic_call] _(RawOrigin::Signed(coldkey), netuid, new_symbol.clone()); @@ -1901,10 +1905,13 @@ mod pallet_benchmarks { } #[benchmark] - fn commit_timelocked_weights() { + fn commit_timelocked_weights( + c: Linear<1, MAX_CRV3_COMMIT_SIZE_BYTES>, + q: Linear<0, { T::InitialMaxAllowedUids::get() as u32 }>, + ) { let hotkey: T::AccountId = whitelisted_caller(); let netuid = NetUid::from(1); - let vec_commit: Vec = vec![0; MAX_CRV3_COMMIT_SIZE_BYTES as usize]; + let vec_commit: Vec = vec![0; c as usize]; let commit: BoundedVec<_, _> = vec_commit.try_into().unwrap(); let round: u64 = 0; @@ -1928,6 +1935,30 @@ mod pallet_benchmarks { Subtensor::::set_commit_reveal_weights_enabled(netuid, true); WeightsSetRateLimit::::set(netuid, 0); + let netuid_index = Subtensor::::get_mechanism_storage_index( + netuid, + subtensor_runtime_common::MechId::MAIN, + ); + let epoch = Subtensor::::current_epoch_with_lookahead(netuid); + let maximum_existing_commit: BoundedVec<_, _> = + vec![u8::MAX; MAX_CRV3_COMMIT_SIZE_BYTES as usize] + .try_into() + .expect("maximum benchmark commit fits its bound"); + TimelockedWeightCommits::::insert( + netuid_index, + epoch, + (0..q) + .map(|i| { + let account = if i >= q.saturating_sub(9) { + hotkey.clone() + } else { + account("timelocked_other", i, 1) + }; + (account, 0, maximum_existing_commit.clone(), u64::from(i)) + }) + .collect::>(), + ); + #[extrinsic_call] _( RawOrigin::Signed(hotkey.clone()), @@ -1939,10 +1970,14 @@ mod pallet_benchmarks { } #[benchmark] - fn set_coldkey_auto_stake_hotkey() { + fn set_coldkey_auto_stake_hotkey( + o: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>, + n: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>, + ) { let coldkey: T::AccountId = whitelisted_caller(); let netuid = NetUid::from(1); let hotkey: T::AccountId = account("A", 0, 1); + let old_hotkey: T::AccountId = account("old_auto_stake", 0, 1); SubtokenEnabled::::insert(netuid, true); Subtensor::::init_new_network(netuid, 1); @@ -1956,85 +1991,97 @@ mod pallet_benchmarks { netuid, hotkey.clone() )); + Owner::::insert(&old_hotkey, &coldkey); + AutoStakeDestination::::insert(&coldkey, netuid, &old_hotkey); + let mut old_coldkeys = (0..o.saturating_sub(1)) + .map(|index| account("old_auto_stake_coldkey", index, 1)) + .collect::>(); + old_coldkeys.push(coldkey.clone()); + AutoStakeDestinationColdkeys::::insert(&old_hotkey, netuid, old_coldkeys); + AutoStakeDestinationColdkeys::::insert( + &hotkey, + netuid, + (0..n) + .map(|index| account("new_auto_stake_coldkey", index, 1)) + .collect::>(), + ); #[extrinsic_call] _(RawOrigin::Signed(coldkey.clone()), netuid, hotkey.clone()); } + // Exercise enough entries to establish the storage-encoding slope. The + // dispatch passes the complete set length to WeightInfo, including sets + // larger than the live netuid domain. #[benchmark] - fn set_root_claim_type() { + fn set_root_claim_type(s: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { let coldkey: T::AccountId = whitelisted_caller(); + let subnets = (0..s).map(|netuid| NetUid::from(netuid as u16)).collect(); #[extrinsic_call] - _(RawOrigin::Signed(coldkey.clone()), RootClaimTypeEnum::Keep); + _( + RawOrigin::Signed(coldkey.clone()), + RootClaimTypeEnum::KeepSubnets { subnets }, + ); } #[benchmark] - fn claim_root() { + fn claim_root( + h: Linear<1, { MAX_ROOT_CLAIM_HOTKEYS as u32 }>, + s: Linear<1, { MAX_SUBNET_CLAIMS as u32 }>, + ) { let coldkey: T::AccountId = whitelisted_caller(); - let hotkey: T::AccountId = account("A", 0, 1); - - let netuid = Subtensor::::get_next_netuid(); - - let lock_cost = Subtensor::::get_network_lock_cost(); - add_balance_to_coldkey_account::(&coldkey, lock_cost.into()); - - assert_ok!(Subtensor::::register_network( - RawOrigin::Signed(coldkey.clone()).into(), - hotkey.clone() - )); - - SubtokenEnabled::::insert(netuid, true); - - Subtensor::::set_network_registration_allowed(netuid, true); - - NetworkRegistrationAllowed::::insert(netuid, true); - FirstEmissionBlockNumber::::insert(netuid, 0); - - SubnetMechanism::::insert(netuid, 1); - SubnetworkN::::insert(netuid, 1); - Subtensor::::set_tao_weight(u64::MAX); - - let root_stake = 100_000_000u64; - Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( - &hotkey, - &coldkey, - NetUid::ROOT, - root_stake.into(), - ); - - let initial_total_hotkey_alpha = 100_000_000u64; - Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( - &hotkey, - &coldkey, - netuid, - initial_total_hotkey_alpha.into(), - ); - - let pending_root_alpha = 10_000_000u64; - Subtensor::::distribute_emission( - netuid, - AlphaBalance::ZERO, - pending_root_alpha.into(), - pending_root_alpha.into(), - AlphaBalance::ZERO, - ); - - let initial_stake = - Subtensor::::get_stake_for_hotkey_and_coldkey_on_subnet(&hotkey, &coldkey, netuid); + let subnets = (1..=s) + .map(|index| { + let netuid = NetUid::from(index as u16); + Subtensor::::init_new_network(netuid, 1); + SubtokenEnabled::::insert(netuid, true); + SubnetMechanism::::insert(netuid, 1); + RootClaimableThreshold::::insert(netuid, I96F32::from(0)); + seed_swap_reserves::(netuid); + let subnet_account = + Subtensor::::get_subnet_account_id(netuid).expect("subnet account exists"); + add_balance_to_coldkey_account::( + &subnet_account, + TaoBalance::from(150_000_000_000_u64), + ); + netuid + }) + .collect::>(); + + for index in 0..h { + let hotkey: T::AccountId = account("claim_root_hotkey", index, 1); + Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( + &hotkey, + &coldkey, + NetUid::ROOT, + 100_000_000u64.into(), + ); + RootClaimable::::insert( + &hotkey, + subnets + .iter() + .map(|netuid| (*netuid, I96F32::from(1))) + .collect::>(), + ); + } - assert_ok!(Subtensor::::set_root_claim_type( - RawOrigin::Signed(coldkey.clone()).into(), - RootClaimTypeEnum::Keep - )); + RootClaimType::::insert(&coldkey, RootClaimTypeEnum::Swap); + // Exercise the coldkey-index insertion branch too. + StakingColdkeys::::remove(&coldkey); #[extrinsic_call] - _(RawOrigin::Signed(coldkey.clone()), BTreeSet::from([netuid])); - - let new_stake = - Subtensor::::get_stake_for_hotkey_and_coldkey_on_subnet(&hotkey, &coldkey, netuid); + _(RawOrigin::Signed(coldkey.clone()), subnets.clone()); - assert!(new_stake > initial_stake); + for hotkey in StakingHotkeys::::get(&coldkey) { + assert!( + Subtensor::::get_stake_for_hotkey_and_coldkey_on_subnet( + &hotkey, + &coldkey, + NetUid::ROOT, + ) > AlphaBalance::from(100_000_000u64) + ); + } } #[benchmark] @@ -2293,6 +2340,14 @@ mod pallet_benchmarks { let evm_secret_key = benchmark_evm_secret_key(); let evm_key = evm_key_from_secret_key(&evm_secret_key); + for offset in 1..MAX_ASSOCIATED_UIDS_PER_EVM_ADDRESS { + Subtensor::::set_associated_evm_address( + netuid, + uid.saturating_add(offset as u16), + evm_key, + 1, + ); + } let signature = signature_for_associate_evm_key::(&hotkey, block_number, &evm_secret_key); @@ -2310,9 +2365,13 @@ mod pallet_benchmarks { AssociatedEvmAddress::::get(netuid, uid), Some((evm_key, block_number)) ); + let mut expected_associations = (1..MAX_ASSOCIATED_UIDS_PER_EVM_ADDRESS) + .map(|offset| (uid.saturating_add(offset as u16), 1)) + .collect::>(); + expected_associations.push((uid, block_number)); assert_eq!( AssociatedUidsByEvmAddress::::get(netuid, evm_key).into_inner(), - vec![(uid, block_number)] + expected_associations ); } @@ -2482,8 +2541,9 @@ mod pallet_benchmarks { } } + // Mechanism UID capacity is also constrained by InitialMaxAllowedUids. #[benchmark] - fn set_mechanism_weights(n: Linear<1, 4096>) { + fn set_mechanism_weights(n: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>) { let mecid = subtensor_runtime_common::MechId::MAIN; let (netuid, hotkey, uids, weight_values, _salt, version_key) = setup_mechanism_weight_benchmark::(mecid, n); @@ -2501,16 +2561,16 @@ mod pallet_benchmarks { } #[benchmark] - fn commit_mechanism_weights() { + fn commit_mechanism_weights(q: Linear<0, 9>) { let mecid = subtensor_runtime_common::MechId::MAIN; let (netuid, hotkey, uids, weight_values, _salt, version_key) = - setup_mechanism_weight_benchmark::(mecid, 4096); + setup_mechanism_weight_benchmark::(mecid, T::InitialMaxAllowedUids::get().into()); let commit_hash: H256 = BlakeTwo256::hash_of(&(hotkey.clone(), netuid, uids, weight_values, version_key)); let netuid_index = Subtensor::::get_mechanism_storage_index(netuid, mecid); let mut commits = VecDeque::new(); - for i in 0..9u8 { - commits.push_back((H256::repeat_byte(i + 1), 0, 0, 0)); + for i in 0..q { + commits.push_back((H256::repeat_byte((i as u8).saturating_add(1)), 0, 0, 0)); } WeightCommits::::insert(netuid_index, &hotkey, commits); @@ -2523,107 +2583,13 @@ mod pallet_benchmarks { ); } #[benchmark] - fn reveal_mechanism_weights(n: Linear<1, 4096>) { + fn reveal_mechanism_weights( + n: Linear<1, { T::InitialMaxAllowedUids::get() as u32 }>, + q: Linear<1, 10>, + ) { let mecid = subtensor_runtime_common::MechId::MAIN; - let netuid = NetUid::from(1); - let netuid_index = Subtensor::::get_mechanism_storage_index(netuid, mecid); - let version_key: u64 = 0; - let uid_count = n.clamp(1, 4096); - - // Use a non-firing benchmark subnet. This mirrors the existing - // `reveal_weights` benchmark and removes the stateful scheduler - // look-ahead from this extrinsic benchmark's setup. The measured code is - // still the real reveal dispatch below; tempo is only used here to keep - // current_epoch_with_lookahead() pinned to SubnetEpochIndex. - Subtensor::::init_new_network(netuid, 0); - SubtokenEnabled::::insert(netuid, true); - Subtensor::::set_network_registration_allowed(netuid, true); - Subtensor::::set_max_allowed_uids(netuid, 4096); - Subtensor::::set_max_registrations_per_block(netuid, 4096); - Subtensor::::set_target_registrations_per_interval(netuid, 4096); - Subtensor::::set_weights_set_rate_limit(netuid, 0); - Subtensor::::set_stake_threshold(0); - Subtensor::::set_commit_reveal_weights_enabled(netuid, true); - Subtensor::::set_burn(netuid, benchmark_registration_burn()); - set_reserves::( - netuid, - TaoBalance::from(1_000_000_000_000_u64), - AlphaBalance::from(1_000_000_000_000_000_u64), - ); - - let reveal_period = core::cmp::max(MIN_COMMIT_REVEAL_PEROIDS, 1_u64); - assert_ok!(Subtensor::::set_reveal_period(netuid, reveal_period)); - - let mut uids = Vec::with_capacity(uid_count as usize); - let mut weight_values = Vec::with_capacity(uid_count as usize); - let mut signer_hotkey: Option = None; - - for seed in 0..uid_count { - let hotkey: T::AccountId = account("mechanism_reveal_hot", seed, 1); - let coldkey: T::AccountId = account("mechanism_reveal_cold", seed, 2); - - Burn::::insert(netuid, benchmark_registration_burn()); - RegistrationsThisInterval::::insert(netuid, 0); - fund_for_registration::(netuid, &coldkey); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(coldkey.clone()).into(), - netuid, - hotkey.clone(), - )); - - let uid = Subtensor::::get_uid_for_net_and_hotkey(netuid, &hotkey).unwrap(); - Subtensor::::set_validator_permit_for_uid(netuid, uid, true); - - if signer_hotkey.is_none() { - signer_hotkey = Some(hotkey.clone()); - } - uids.push(uid); - weight_values.push(uid.saturating_add(1)); - } - - let hotkey = signer_hotkey.expect("at least one benchmark neuron is registered"); - let salt: Vec = vec![u16::MAX; uid_count as usize]; - let commit_hash = Subtensor::::get_commit_hash( - &hotkey, - netuid_index, - &uids, - &weight_values, - &salt, - version_key, - ); - - // Worst-case the successful CR-v2 reveal queue. The valid commit is at - // the back of the bounded 10-entry queue, so reveal scans and drains the - // maximum prefix. These commits are intentionally non-expired: expired - // front entries are a failure path for this dispatch when the provided - // hash is among the drained hashes. - let commit_epoch = 0_u64; - let commit_block = Subtensor::::get_current_block_as_u64(); - let mut commits = VecDeque::new(); - for i in 0..9_u8 { - let mut dummy_hash = H256::repeat_byte(i.saturating_add(1)); - if dummy_hash == commit_hash { - dummy_hash = H256::repeat_byte(i.saturating_add(11)); - } - commits.push_back((dummy_hash, commit_epoch, commit_block, 0)); - } - commits.push_back((commit_hash, commit_epoch, commit_block, 0)); - WeightCommits::::insert(netuid_index, &hotkey, commits); - - // With tempo 0, should_run_epoch() is false and current_epoch_with_lookahead() - // equals SubnetEpochIndex. Put the subnet exactly in the reveal epoch. - LastEpochBlock::::insert(netuid, 0); - BlocksSinceLastStep::::insert(netuid, 0); - PendingEpochAt::::insert(netuid, 0); - SubnetEpochIndex::::insert(netuid, reveal_period); - - assert_eq!( - Subtensor::::current_epoch_with_lookahead(netuid), - reveal_period - ); - assert!(Subtensor::::is_reveal_block_range(netuid, commit_epoch)); - assert!(!Subtensor::::is_commit_expired(netuid, commit_epoch)); + let (netuid, hotkey, uids, weight_values, salt, version_key) = + setup_reveal_weight_benchmark::("mechanism_reveal", mecid, n, q); #[extrinsic_call] _( @@ -2638,17 +2604,29 @@ mod pallet_benchmarks { } #[benchmark] - fn commit_crv3_mechanism_weights() { + fn commit_crv3_mechanism_weights( + c: Linear<1, MAX_CRV3_COMMIT_SIZE_BYTES>, + q: Linear<0, { T::InitialMaxAllowedUids::get() as u32 }>, + ) { let mecid = subtensor_runtime_common::MechId::MAIN; let (netuid, hotkey, _uids, _weight_values, _salt, _version_key) = - setup_mechanism_weight_benchmark::(mecid, 4096); - let vec_commit: Vec = vec![u8::MAX; MAX_CRV3_COMMIT_SIZE_BYTES as usize]; + setup_mechanism_weight_benchmark::(mecid, T::InitialMaxAllowedUids::get().into()); + let vec_commit: Vec = vec![u8::MAX; c as usize]; let commit: BoundedVec<_, _> = vec_commit.try_into().unwrap(); let netuid_index = Subtensor::::get_mechanism_storage_index(netuid, mecid); let epoch = Subtensor::::current_epoch_with_lookahead(netuid); + let maximum_existing_commit: BoundedVec<_, _> = + vec![u8::MAX; MAX_CRV3_COMMIT_SIZE_BYTES as usize] + .try_into() + .expect("maximum benchmark commit fits its bound"); let mut existing = VecDeque::new(); - for i in 0..9u64 { - existing.push_back((hotkey.clone(), 0, commit.clone(), i)); + for i in 0..q { + let account = if i >= q.saturating_sub(9) { + hotkey.clone() + } else { + account("crv3_mechanism_other", i, 1) + }; + existing.push_back((account, 0, maximum_existing_commit.clone(), u64::from(i))); } TimelockedWeightCommits::::insert(netuid_index, epoch, existing); @@ -2663,17 +2641,29 @@ mod pallet_benchmarks { } #[benchmark] - fn commit_timelocked_mechanism_weights() { + fn commit_timelocked_mechanism_weights( + c: Linear<1, MAX_CRV3_COMMIT_SIZE_BYTES>, + q: Linear<0, { T::InitialMaxAllowedUids::get() as u32 }>, + ) { let mecid = subtensor_runtime_common::MechId::MAIN; let (netuid, hotkey, _uids, _weight_values, _salt, _version_key) = - setup_mechanism_weight_benchmark::(mecid, 4096); - let vec_commit: Vec = vec![u8::MAX; MAX_CRV3_COMMIT_SIZE_BYTES as usize]; + setup_mechanism_weight_benchmark::(mecid, T::InitialMaxAllowedUids::get().into()); + let vec_commit: Vec = vec![u8::MAX; c as usize]; let commit: BoundedVec<_, _> = vec_commit.try_into().unwrap(); let netuid_index = Subtensor::::get_mechanism_storage_index(netuid, mecid); let epoch = Subtensor::::current_epoch_with_lookahead(netuid); + let maximum_existing_commit: BoundedVec<_, _> = + vec![u8::MAX; MAX_CRV3_COMMIT_SIZE_BYTES as usize] + .try_into() + .expect("maximum benchmark commit fits its bound"); let mut existing = VecDeque::new(); - for i in 0..9u64 { - existing.push_back((hotkey.clone(), 0, commit.clone(), i)); + for i in 0..q { + let account = if i >= q.saturating_sub(9) { + hotkey.clone() + } else { + account("timelocked_mechanism_other", i, 1) + }; + existing.push_back((account, 0, maximum_existing_commit.clone(), u64::from(i))); } TimelockedWeightCommits::::insert(netuid_index, epoch, existing); let version = Subtensor::::get_commit_reveal_weights_version(); @@ -2695,20 +2685,16 @@ mod pallet_benchmarks { let old_hotkey: T::AccountId = account("old_hotkey", 0, 1); let new_hotkey: T::AccountId = account("new_hotkey", 0, 1); - for netuid_raw in 1..=GLOBAL_MAX_SUBNET_COUNT { + // Seed the exact storage consumed by the measured swap. Running a + // complete burned registration here would benchmark setup work 4,095 + // times per repeat without changing the measured state. + for netuid_raw in 1..GLOBAL_MAX_SUBNET_COUNT { let netuid = NetUid::from(netuid_raw); Subtensor::::init_new_network(netuid, 1); SubtokenEnabled::::insert(netuid, true); - Subtensor::::set_network_registration_allowed(netuid, true); - Burn::::insert(netuid, benchmark_registration_burn()); seed_swap_reserves::(netuid); - fund_for_registration::(netuid, &coldkey); - - assert_ok!(Subtensor::::burned_register( - RawOrigin::Signed(coldkey.clone()).into(), - netuid, - old_hotkey.clone(), - )); + Subtensor::::set_max_allowed_uids(netuid, 1); + Subtensor::::append_neuron(netuid, &old_hotkey, 0); let alpha_amount = AlphaBalance::from(1_000_000_u64); SubnetAlphaOut::::insert(netuid, alpha_amount * 2.into()); @@ -2721,8 +2707,9 @@ mod pallet_benchmarks { } Owner::::insert(&old_hotkey, &coldkey); + let ed = ::ExistentialDeposit::get(); let cost = Subtensor::::get_key_swap_cost(); - add_balance_to_coldkey_account::(&coldkey, cost.into()); + add_balance_to_coldkey_account::(&coldkey, cost + ed); #[extrinsic_call] _( @@ -2749,8 +2736,11 @@ mod pallet_benchmarks { #[benchmark] fn dissolve_network() { let netuid = NetUid::from(1); - let (_hotkey, coldkey, _uids, _weights) = - setup_worst_case_registered_subnet::("dissolve", netuid, 4096); + let (_hotkey, coldkey, _uids, _weights) = setup_worst_case_registered_subnet::( + "dissolve", + netuid, + T::InitialMaxAllowedUids::get().into(), + ); SubnetOwner::::insert(netuid, coldkey.clone()); #[extrinsic_call] @@ -2760,8 +2750,11 @@ mod pallet_benchmarks { #[benchmark] fn root_dissolve_network() { let netuid = NetUid::from(1); - let (_hotkey, _coldkey, _uids, _weights) = - setup_worst_case_registered_subnet::("root_dissolve", netuid, 4096); + let (_hotkey, _coldkey, _uids, _weights) = setup_worst_case_registered_subnet::( + "root_dissolve", + netuid, + T::InitialMaxAllowedUids::get().into(), + ); #[extrinsic_call] _(RawOrigin::Root, netuid); diff --git a/pallets/subtensor/src/benchmarks/helpers.rs b/pallets/subtensor/src/benchmarks/helpers.rs index 2f45e98e80..6ac3ebf7c1 100644 --- a/pallets/subtensor/src/benchmarks/helpers.rs +++ b/pallets/subtensor/src/benchmarks/helpers.rs @@ -19,6 +19,37 @@ pub(super) fn benchmark_registration_burn() -> TaoBalance { TaoBalance::from(1_000_000) } +fn identity_field(remaining: &mut u32, field_limit: u32) -> Vec { + let field_len = (*remaining).min(field_limit); + *remaining = (*remaining).saturating_sub(field_len); + vec![u8::MAX; field_len as usize] +} + +pub(super) fn chain_identity_with_bytes(mut bytes: u32) -> ChainIdentityOfV2 { + ChainIdentityV2 { + name: identity_field(&mut bytes, 256), + url: identity_field(&mut bytes, 256), + github_repo: identity_field(&mut bytes, 256), + image: identity_field(&mut bytes, 1024), + discord: identity_field(&mut bytes, 256), + description: identity_field(&mut bytes, 1024), + additional: identity_field(&mut bytes, 1024), + } +} + +pub(super) fn subnet_identity_with_bytes(mut bytes: u32) -> SubnetIdentityOfV3 { + SubnetIdentityOfV3 { + subnet_name: identity_field(&mut bytes, 256), + github_repo: identity_field(&mut bytes, 1024), + subnet_contact: identity_field(&mut bytes, 1024), + subnet_url: identity_field(&mut bytes, 1024), + discord: identity_field(&mut bytes, 256), + description: identity_field(&mut bytes, 1024), + logo_url: identity_field(&mut bytes, 1024), + additional: identity_field(&mut bytes, 1024), + } +} + pub(super) fn add_balance_to_coldkey_account(coldkey: &T::AccountId, tao: TaoBalance) { let credit = Subtensor::::mint_tao(tao); let _ = Subtensor::::spend_tao(coldkey, credit, tao).unwrap(); @@ -175,6 +206,47 @@ pub(super) fn setup_full_root_registration_benchmark() { ); } +pub(super) fn setup_worst_case_network_creation() { + setup_full_root_registration_benchmark::(); + Subtensor::::set_max_subnets(GLOBAL_MAX_SUBNET_COUNT); + + // Leave exactly one live subnet slot. Network creation must scan the full + // live-domain twice (capacity and next-netuid), scan all assigned symbols, + // and calculate the median price across every existing subnet. + for netuid_raw in 1..GLOBAL_MAX_SUBNET_COUNT { + let netuid = NetUid::from(netuid_raw); + NetworksAdded::::insert(netuid, true); + TokenSymbol::::insert(netuid, Subtensor::::get_symbol_for_subnet(netuid)); + set_reserves::( + netuid, + TaoBalance::from(150_000_000_000_u64), + AlphaBalance::from(100_000_000_000_u64), + ); + } + TotalNetworks::::put(GLOBAL_MAX_SUBNET_COUNT); +} + +/// Fill every currently available subnet slot and leave one dissolved subnet +/// awaiting cleanup. In this state a permissionless registration can only +/// validate, lock its funds, and append to `NetworkRegistrationQueue`; the +/// network creation itself is deferred to `on_idle`. +pub(super) fn setup_worst_case_queued_network_registration() { + Subtensor::::set_max_subnets(GLOBAL_MAX_SUBNET_COUNT); + + for netuid_raw in 1..GLOBAL_MAX_SUBNET_COUNT { + let netuid = NetUid::from(netuid_raw); + NetworksAdded::::insert(netuid, true); + set_reserves::( + netuid, + TaoBalance::from(150_000_000_000_u64), + AlphaBalance::from(100_000_000_000_u64), + ); + } + + DissolveCleanupQueue::::put(vec![NetUid::from(GLOBAL_MAX_SUBNET_COUNT)]); + TotalNetworks::::put(GLOBAL_MAX_SUBNET_COUNT); +} + /// Add a zero lock to a random hotkey just so that the lock records exist pub(super) fn add_lock(coldkey: &T::AccountId, netuid: NetUid) { let hotkey: T::AccountId = account("RandomHotkey", 0, 999); @@ -215,10 +287,10 @@ pub(super) fn set_benchmark_block_number(block_number: u64) { /// state instead of a one-subnet toy state. /// /// Only the runtime-capped number of subnet epochs are made due in the measured -/// block. The remaining subnets are fully populated and live, but not eligible -/// for epoch execution in this block. This mirrors production behavior where -/// `MaxEpochsPerBlock` bounds the number of Yuma epochs that can execute in a -/// single block. +/// block. The remaining subnets are live but not eligible for epoch execution. +/// Neuron-level state is only seeded for due subnets because `block_step` does +/// not read it from deferred subnets. This keeps repeated setup proportional to +/// state the measured call can actually observe. pub(super) fn setup_block_step_benchmark() { const MAINNET_SUBNETS: u16 = 128; const MAINNET_NEURONS_PER_SUBNET: u16 = 256; @@ -283,10 +355,9 @@ pub(super) fn setup_block_step_benchmark() { } } - // 128 live non-root subnets, each with 256 registered neurons. The first 128 - // neurons per subnet are validator-permit neurons with dense weight and bond - // rows. Only the first `MaxEpochsPerBlock` subnets are scheduled to run their - // epoch in this measured block; the rest remain live ambient state. + // Keep 128 live non-root subnets for the ambient per-subnet scans. Only the + // first `MaxEpochsPerBlock` subnets are scheduled to run their epoch and + // therefore need the full 256-neuron state with dense weight and bond rows. for subnet_index in 1..=MAINNET_SUBNETS { let netuid = NetUid::from(subnet_index); let netuid_index = NetUidStorageIndex::from(netuid); @@ -323,27 +394,26 @@ pub(super) fn setup_block_step_benchmark() { BlocksSinceLastStep::::insert(netuid, 0); } - for uid in 0..MAINNET_NEURONS_PER_SUBNET { - let hotkey: T::AccountId = - account("block_step_hot", u32::from(subnet_index), u32::from(uid)); - let coldkey: T::AccountId = - account("block_step_cold", u32::from(subnet_index), u32::from(uid)); - - Owner::::insert(&hotkey, &coldkey); - Subtensor::::append_neuron(netuid, &hotkey, 0); - Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( - &hotkey, - &coldkey, - netuid, - AlphaBalance::from(VALIDATOR_ALPHA_STAKE), - ); - - // Worst case for coinbase: every incentivized miner has standing - // collateral that must be settled. Alternate below-floor capture - // (stake write into the lock) and above-floor drain (release back - // to free stake) so both settle branches are measured. Only seed - // epoch-due subnets so ambient live state stays cheap. - if epoch_is_due_this_block { + if epoch_is_due_this_block { + for uid in 0..MAINNET_NEURONS_PER_SUBNET { + let hotkey: T::AccountId = + account("block_step_hot", u32::from(subnet_index), u32::from(uid)); + let coldkey: T::AccountId = + account("block_step_cold", u32::from(subnet_index), u32::from(uid)); + + Owner::::insert(&hotkey, &coldkey); + Subtensor::::append_neuron(netuid, &hotkey, 0); + Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( + &hotkey, + &coldkey, + netuid, + AlphaBalance::from(VALIDATOR_ALPHA_STAKE), + ); + + // Worst case for coinbase: every incentivized miner has + // standing collateral that must be settled. Alternate + // below-floor capture and above-floor drain so both settle + // branches are measured. let (locked, min_locked) = if uid % 2 == 0 { ( AlphaBalance::from(VALIDATOR_ALPHA_STAKE / 4), @@ -370,12 +440,12 @@ pub(super) fn setup_block_step_benchmark() { let _ = hotkeys.try_push(hotkey.clone()); } }); - } - if uid < MAINNET_VALIDATORS_PER_SUBNET { - Subtensor::::set_validator_permit_for_uid(netuid, uid, true); - Weights::::insert(netuid_index, uid, dense_weights.clone()); - Bonds::::insert(netuid_index, uid, dense_weights.clone()); + if uid < MAINNET_VALIDATORS_PER_SUBNET { + Subtensor::::set_validator_permit_for_uid(netuid, uid, true); + Weights::::insert(netuid_index, uid, dense_weights.clone()); + Bonds::::insert(netuid_index, uid, dense_weights.clone()); + } } } } @@ -457,7 +527,7 @@ pub(super) fn setup_worst_case_registered_subnet( netuid: NetUid, uid_count: u32, ) -> (T::AccountId, T::AccountId, Vec, Vec) { - let uid_count = uid_count.clamp(1, 4096); + let max_uids = u16::try_from(uid_count).expect("benchmark component fits in u16"); let mut uids = Vec::with_capacity(uid_count as usize); let mut weights = Vec::with_capacity(uid_count as usize); let mut signer_hotkey: Option = None; @@ -466,9 +536,9 @@ pub(super) fn setup_worst_case_registered_subnet( Subtensor::::init_new_network(netuid, 1); SubtokenEnabled::::insert(netuid, true); Subtensor::::set_network_registration_allowed(netuid, true); - Subtensor::::set_max_allowed_uids(netuid, 4096); - Subtensor::::set_max_registrations_per_block(netuid, 4096); - Subtensor::::set_target_registrations_per_interval(netuid, 4096); + Subtensor::::set_max_allowed_uids(netuid, max_uids); + Subtensor::::set_max_registrations_per_block(netuid, max_uids); + Subtensor::::set_target_registrations_per_interval(netuid, max_uids); Subtensor::::set_difficulty(netuid, 1); Subtensor::::set_weights_set_rate_limit(netuid, 0); Subtensor::::set_stake_threshold(0); @@ -518,8 +588,134 @@ pub(super) fn setup_mechanism_weight_benchmark( let version_key: u64 = 0; let (hotkey, _coldkey, uids, weight_values) = setup_worst_case_registered_subnet::("mechanism", netuid, uid_count); - let salt: Vec = vec![u16::MAX; uid_count.clamp(1, 4096) as usize]; + let salt: Vec = vec![u16::MAX; uid_count as usize]; + Subtensor::::set_commit_reveal_weights_enabled(netuid, true); + + (netuid, hotkey, uids, weight_values, salt, version_key) +} + +pub(super) fn setup_reveal_weight_benchmark( + label: &'static str, + mecid: subtensor_runtime_common::MechId, + uid_count: u32, + commit_count: u32, +) -> (NetUid, T::AccountId, Vec, Vec, Vec, u64) { + let netuid = NetUid::from(1); + let netuid_index = Subtensor::::get_mechanism_storage_index(netuid, mecid); + let version_key = 0_u64; + let max_uids = u16::try_from(uid_count).expect("benchmark component fits in u16"); + + // Tempo zero keeps the stateful epoch look-ahead pinned to the explicitly + // seeded epoch counter. + Subtensor::::init_new_network(netuid, 0); + SubtokenEnabled::::insert(netuid, true); + Subtensor::::set_network_registration_allowed(netuid, true); + Subtensor::::set_max_allowed_uids(netuid, max_uids); + Subtensor::::set_max_registrations_per_block(netuid, max_uids); + Subtensor::::set_target_registrations_per_interval(netuid, max_uids); + Subtensor::::set_weights_set_rate_limit(netuid, 0); + Subtensor::::set_stake_threshold(0); Subtensor::::set_commit_reveal_weights_enabled(netuid, true); + Subtensor::::set_burn(netuid, benchmark_registration_burn()); + set_reserves::( + netuid, + TaoBalance::from(1_000_000_000_000_u64), + AlphaBalance::from(1_000_000_000_000_000_u64), + ); + + let reveal_period = core::cmp::max(MIN_COMMIT_REVEAL_PEROIDS, 1_u64); + assert_ok!(Subtensor::::set_reveal_period(netuid, reveal_period)); + + let mut uids = Vec::with_capacity(uid_count as usize); + let mut weight_values = Vec::with_capacity(uid_count as usize); + let mut signer_hotkey = None; + + for seed in 0..uid_count { + let hotkey: T::AccountId = account(label, seed, 1); + let coldkey: T::AccountId = account(label, seed, 2); + Burn::::insert(netuid, benchmark_registration_burn()); + RegistrationsThisInterval::::insert(netuid, 0); + fund_for_registration::(netuid, &coldkey); + + assert_ok!(Subtensor::::burned_register( + RawOrigin::Signed(coldkey).into(), + netuid, + hotkey.clone(), + )); + + let uid = Subtensor::::get_uid_for_net_and_hotkey(netuid, &hotkey).unwrap(); + Subtensor::::set_validator_permit_for_uid(netuid, uid, true); + signer_hotkey.get_or_insert_with(|| hotkey.clone()); + uids.push(uid); + weight_values.push(uid.saturating_add(1)); + } + + let hotkey = signer_hotkey.expect("at least one benchmark neuron is registered"); + let salt = vec![u16::MAX; uid_count as usize]; + let commit_hash = Subtensor::::get_commit_hash( + &hotkey, + netuid_index, + &uids, + &weight_values, + &salt, + version_key, + ); + + // Put the matching commit last so the successful reveal scans the complete + // bounded queue and drains its maximum prefix. + let commit_epoch = 0_u64; + let commit_block = Subtensor::::get_current_block_as_u64(); + let mut commits = VecDeque::new(); + for i in 0..commit_count.saturating_sub(1) { + let byte = (i as u8).saturating_add(1); + let mut dummy_hash = H256::repeat_byte(byte); + if dummy_hash == commit_hash { + dummy_hash = H256::repeat_byte(byte.saturating_add(11)); + } + commits.push_back((dummy_hash, commit_epoch, commit_block, 0)); + } + commits.push_back((commit_hash, commit_epoch, commit_block, 0)); + WeightCommits::::insert(netuid_index, &hotkey, commits); + + LastEpochBlock::::insert(netuid, 0); + BlocksSinceLastStep::::insert(netuid, 0); + PendingEpochAt::::insert(netuid, 0); + SubnetEpochIndex::::insert(netuid, reveal_period); + + assert_eq!( + Subtensor::::current_epoch_with_lookahead(netuid), + reveal_period + ); + assert!(Subtensor::::is_reveal_block_range(netuid, commit_epoch)); + assert!(!Subtensor::::is_commit_expired(netuid, commit_epoch)); (netuid, hotkey, uids, weight_values, salt, version_key) } + +pub(super) fn setup_unstake_all_benchmark( + label: &'static str, + subnet_count: u32, +) -> (T::AccountId, T::AccountId) { + let coldkey: T::AccountId = account(label, 0, 1); + let hotkey: T::AccountId = account(label, 0, 2); + Owner::::insert(&hotkey, &coldkey); + OwnedHotkeys::::insert(&coldkey, vec![hotkey.clone()]); + + for netuid_raw in 1..=subnet_count { + let netuid = NetUid::from(netuid_raw as u16); + Subtensor::::init_new_network(netuid, 1); + SubtokenEnabled::::insert(netuid, true); + seed_swap_reserves::(netuid); + let subnet_account = + Subtensor::::get_subnet_account_id(netuid).expect("benchmark subnet account exists"); + add_balance_to_coldkey_account::(&subnet_account, TaoBalance::from(150_000_000_000_u64)); + Subtensor::::increase_stake_for_hotkey_and_coldkey_on_subnet( + &hotkey, + &coldkey, + netuid, + AlphaBalance::from(1_000_000_u64), + ); + } + + (coldkey, hotkey) +} diff --git a/pallets/subtensor/src/extensions/subtensor.rs b/pallets/subtensor/src/extensions/subtensor.rs index 7899ed855e..75bcb9cb2e 100644 --- a/pallets/subtensor/src/extensions/subtensor.rs +++ b/pallets/subtensor/src/extensions/subtensor.rs @@ -1,10 +1,11 @@ use crate::{ Call, CheckColdkeySwap, CheckDelegateTake, CheckEvmKeyAssociation, CheckRateLimits, CheckServingEndpoints, CheckWeights, Config, Error, guards::applicable_call, + weights::WeightInfo, }; use codec::{Decode, DecodeWithMemTracking, Encode}; use frame_support::{ - dispatch::{DispatchExtension, DispatchInfo, PostDispatchInfo}, + dispatch::{DispatchExtension, DispatchInfo, GetDispatchInfo, PostDispatchInfo}, traits::{IsSubType, OriginTrait}, weights::Weight, }; @@ -12,10 +13,7 @@ use scale_info::TypeInfo; use sp_runtime::traits::{ DispatchInfoOf, Dispatchable, Implication, TransactionExtension, ValidateResult, }; -use sp_runtime::{ - impl_tx_ext_default, - transaction_validity::{TransactionSource, TransactionValidityError}, -}; +use sp_runtime::transaction_validity::{TransactionSource, TransactionValidityError}; use sp_std::marker::PhantomData; use subtensor_macros::freeze_struct; use subtensor_runtime_common::CustomTransactionError; @@ -75,6 +73,39 @@ impl SubtensorTransactionExtension { Self(Default::default()) } + /// Return a call-independent upper bound for the validation work performed + /// by this extension. + /// + /// Individual calls enable different guard combinations, and some calls + /// enable more than one guard. Summing every guard is deliberately + /// conservative. + pub fn maximum_weight() -> Weight { + ::WeightInfo::check_coldkey_swap_extension() + .saturating_add(::WeightInfo::check_weights_extension()) + .saturating_add(::WeightInfo::check_rate_limits_extension()) + .saturating_add(::WeightInfo::check_delegate_take_extension()) + .saturating_add(::WeightInfo::check_serving_endpoints_extension()) + .saturating_add(::WeightInfo::check_evm_key_association_extension()) + } + + /// Weight consumed by the validation guards themselves, excluding any + /// top-level dispatch reserve. + pub fn validation_weight(call: &CallOf) -> Weight + where + T: pallet_shield::Config, + CallOf: Dispatchable + + IsSubType> + + IsSubType>, + { + use DispatchExtension as DE; + as DE>>::weight(call) + .saturating_add( as DE>>::weight(call)) + .saturating_add( as DE>>::weight(call)) + .saturating_add( as DE>>::weight(call)) + .saturating_add( as DE>>::weight(call)) + .saturating_add( as DE>>::weight(call)) + } + fn check(origin: &OriginOf, call: &CallOf) -> Result<(), Error> where T: pallet_shield::Config, @@ -113,6 +144,7 @@ impl TransactionExtension> for SubtensorTransactionExtension where T: Config + pallet_shield::Config + Send + Sync + TypeInfo, CallOf: Dispatchable, Info = DispatchInfo, PostInfo = PostDispatchInfo> + + GetDispatchInfo + IsSubType> + IsSubType>, OriginOf: Clone + OriginTrait, @@ -124,13 +156,7 @@ where type Pre = (); fn weight(&self, call: &CallOf) -> Weight { - use DispatchExtension as DE; - as DE>>::weight(call) - .saturating_add( as DE>>::weight(call)) - .saturating_add( as DE>>::weight(call)) - .saturating_add( as DE>>::weight(call)) - .saturating_add( as DE>>::weight(call)) - .saturating_add( as DE>>::weight(call)) + Self::validation_weight(call) } fn validate( @@ -148,7 +174,16 @@ where .map_err(|error| TransactionValidityError::from(CustomTransactionError::from(error))) } - impl_tx_ext_default!(CallOf; prepare); + fn prepare( + self, + _val: Self::Val, + _origin: &OriginOf, + _call: &CallOf, + _info: &DispatchInfoOf>, + _len: usize, + ) -> Result { + Ok(()) + } } #[cfg(test)] @@ -303,4 +338,26 @@ mod tests { } }); } + + #[test] + fn dynamic_call_declares_the_maximum_dispatch_weight() { + new_test_ext(1).execute_with(|| { + let call = RuntimeCall::SubtensorModule(SubtensorCall::set_weights { + netuid: NetUid::from(1), + dests: vec![0], + weights: vec![1], + version_key: 0, + }); + let call_weight = call.get_dispatch_info().call_weight; + + assert!( + SubtensorModule::max_normal_dispatch_weight().all_lte(call_weight), + "dispatch metadata must include the maximum declaration" + ); + assert_eq!( + TransactionExtension::weight(&SubtensorTransactionExtension::::new(), &call), + expected_transaction_extension_weight(&call) + ); + }); + } } diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 3cf4318e9d..d8dc9a30d8 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -44,6 +44,7 @@ pub mod staking; pub mod subnets; pub mod swap; pub mod utils; +mod weight_accounting; pub mod weights; use crate::utils::rate_limiting::{Hyperparameter, TransactionType}; use macros::{config, dispatches, errors, events, genesis, hooks}; diff --git a/pallets/subtensor/src/macros/config.rs b/pallets/subtensor/src/macros/config.rs index 6f6718a15c..6be1a9daa1 100644 --- a/pallets/subtensor/src/macros/config.rs +++ b/pallets/subtensor/src/macros/config.rs @@ -76,6 +76,13 @@ mod config { /// Weight information for extrinsics in this pallet. type WeightInfo: crate::weights::WeightInfo; + /// Maximum combined weight charged by transaction and FRAME dispatch + /// extensions around a Subtensor call. This is reserved from the normal + /// extrinsic limit so calls with unbounded state fan-out can precharge + /// the largest admissible call weight without making the enclosing + /// extrinsic overweight. + type MaxTransactionExtensionWeight: Get; + // Initial Value Constants /// Initial currency issuance. diff --git a/pallets/subtensor/src/macros/dispatches.rs b/pallets/subtensor/src/macros/dispatches.rs index 4c190a7497..27f7206e81 100644 --- a/pallets/subtensor/src/macros/dispatches.rs +++ b/pallets/subtensor/src/macros/dispatches.rs @@ -16,6 +16,7 @@ mod dispatches { use crate::MAX_ROOT_CLAIM_HOTKEYS; use crate::MAX_ROOT_CLAIM_THRESHOLD; use crate::MAX_SUBNET_CLAIMS; + use crate::weight_accounting::{WithBenchmarkWeight, encoded_collection_len}; /// Dispatchable functions allow users to interact with the pallet and invoke state changes. /// These functions materialize as "extrinsics", which are often compared to transactions. @@ -67,19 +68,27 @@ mod dispatches { /// /// * `MaxWeightExceeded`: Attempting to set weights with max value exceeding limit. #[pallet::call_index(0)] - #[pallet::weight((::WeightInfo::set_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::set_weights(dests.len() as u32) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn set_weights( origin: OriginFor, netuid: NetUid, dests: Vec, weights: Vec, version_key: u64, - ) -> DispatchResult { - if Self::get_commit_reveal_weights_enabled(netuid) { + ) -> DispatchResultWithPostInfo { + let actual_weight = ::WeightInfo::set_weights(dests.len() as u32); + let result = if Self::get_commit_reveal_weights_enabled(netuid) { Err(Error::::CommitRevealEnabled.into()) } else { Self::do_set_weights(origin, netuid, dests, weights, version_key) - } + }; + result.with_benchmark_weight(actual_weight) } /// Sets the caller weights for the incentive mechanism for mechanisms. The call @@ -127,7 +136,13 @@ mod dispatches { /// /// * `MaxWeightExceeded`: Attempting to set weights with max value exceeding limit. #[pallet::call_index(119)] - #[pallet::weight((::WeightInfo::set_mechanism_weights(dests.len() as u32), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::set_mechanism_weights(dests.len() as u32) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn set_mechanism_weights( origin: OriginFor, netuid: NetUid, @@ -135,12 +150,15 @@ mod dispatches { dests: Vec, weights: Vec, version_key: u64, - ) -> DispatchResult { - if Self::get_commit_reveal_weights_enabled(netuid) { + ) -> DispatchResultWithPostInfo { + let actual_weight = + ::WeightInfo::set_mechanism_weights(dests.len() as u32); + let result = if Self::get_commit_reveal_weights_enabled(netuid) { Err(Error::::CommitRevealEnabled.into()) } else { Self::do_set_mechanism_weights(origin, netuid, mecid, dests, weights, version_key) - } + }; + result.with_benchmark_weight(actual_weight) } /// Allows a hotkey to set weights for multiple netuids as a batch. @@ -161,14 +179,33 @@ mod dispatches { /// * `BatchWeightItemFailed`: On failure for each failed item in the batch. /// #[pallet::call_index(80)] - #[pallet::weight((::WeightInfo::batch_set_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::batch_set_weights(netuids.len() as u32) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn batch_set_weights( origin: OriginFor, netuids: Vec>, weights: Vec, Compact)>>, version_keys: Vec>, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + // The batch benchmark measures the per-row orchestration with one + // edge in each row. Add only the incremental edge work from the + // single-row benchmark; adding the whole row weight would charge + // its fixed cost twice. + let one_edge_weight = ::WeightInfo::set_weights(1); + let actual_weight = ::WeightInfo::batch_set_weights(netuids.len() as u32) + .saturating_add(weights.iter().fold(Weight::zero(), |weight, row| { + weight.saturating_add( + ::WeightInfo::set_weights(row.len() as u32) + .saturating_sub(one_edge_weight), + ) + })); Self::do_batch_set_weights(origin, netuids, weights, version_keys) + .with_benchmark_weight(actual_weight) } /// Used to commit a hash of your weight values to later be revealed. @@ -186,13 +223,25 @@ mod dispatches { /// * `TooManyUnrevealedCommits`: Attempting to commit when the user has more than the allowed limit of unrevealed commits. /// #[pallet::call_index(96)] - #[pallet::weight((::WeightInfo::commit_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::commit_weights(0) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn commit_weights( origin: OriginFor, netuid: NetUid, commit_hash: H256, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let hotkey = ensure_signed(origin.clone())?; + let netuid_index = + Self::get_mechanism_storage_index(netuid, subtensor_runtime_common::MechId::MAIN); + let commit_count = + encoded_collection_len(&WeightCommits::::hashed_key_for(netuid_index, &hotkey)); Self::do_commit_weights(origin, netuid, commit_hash) + .with_benchmark_weight(::WeightInfo::commit_weights(commit_count)) } /// Used to commit a hash of your weight values to later be revealed for mechanisms. @@ -212,14 +261,27 @@ mod dispatches { /// * `TooManyUnrevealedCommits`: Attempting to commit when the user has more than the allowed limit of unrevealed commits. /// #[pallet::call_index(115)] - #[pallet::weight((::WeightInfo::commit_mechanism_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::commit_mechanism_weights(0) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn commit_mechanism_weights( origin: OriginFor, netuid: NetUid, mecid: MechId, commit_hash: H256, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let hotkey = ensure_signed(origin.clone())?; + let netuid_index = Self::get_mechanism_storage_index(netuid, mecid); + let commit_count = + encoded_collection_len(&WeightCommits::::hashed_key_for(netuid_index, &hotkey)); Self::do_commit_mechanism_weights(origin, netuid, mecid, commit_hash) + .with_benchmark_weight(::WeightInfo::commit_mechanism_weights( + commit_count, + )) } /// Allows a hotkey to commit weight hashes for multiple netuids as a batch. @@ -238,13 +300,39 @@ mod dispatches { /// * `BatchWeightItemFailed`: On failure for each failed item in the batch. /// #[pallet::call_index(100)] - #[pallet::weight((::WeightInfo::batch_commit_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::batch_commit_weights(netuids.len() as u32) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn batch_commit_weights( origin: OriginFor, netuids: Vec>, commit_hashes: Vec, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let hotkey = ensure_signed(origin.clone())?; + let maximum_queue_weight = ::WeightInfo::commit_weights(9); + let unused_weight = netuids.iter().fold(Weight::zero(), |weight, netuid| { + let netuid_index = Self::get_mechanism_storage_index( + netuid.0, + subtensor_runtime_common::MechId::MAIN, + ); + let queue_len = encoded_collection_len(&WeightCommits::::hashed_key_for( + netuid_index, + &hotkey, + )); + weight.saturating_add( + maximum_queue_weight + .saturating_sub(::WeightInfo::commit_weights(queue_len)), + ) + }); + let actual_weight = + ::WeightInfo::batch_commit_weights(netuids.len() as u32) + .saturating_sub(unused_weight); Self::do_batch_commit_weights(origin, netuids, commit_hashes) + .with_benchmark_weight(actual_weight) } /// Used to reveal the weights for a previously committed hash. @@ -274,7 +362,13 @@ mod dispatches { /// * `InvalidRevealCommitHashNotMatch`: The revealed hash does not match any committed hash. /// #[pallet::call_index(97)] - #[pallet::weight((::WeightInfo::reveal_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::reveal_weights(uids.len() as u32, 1) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn reveal_weights( origin: OriginFor, netuid: NetUid, @@ -282,8 +376,16 @@ mod dispatches { values: Vec, salt: Vec, version_key: u64, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let hotkey = ensure_signed(origin.clone())?; + let netuid_index = + Self::get_mechanism_storage_index(netuid, subtensor_runtime_common::MechId::MAIN); + let commit_count = + encoded_collection_len(&WeightCommits::::hashed_key_for(netuid_index, &hotkey)); + let actual_weight = + ::WeightInfo::reveal_weights(uids.len() as u32, commit_count); Self::do_reveal_weights(origin, netuid, uids, values, salt, version_key) + .with_benchmark_weight(actual_weight) } /// Used to reveal the weights for a previously committed hash for mechanisms. @@ -315,7 +417,13 @@ mod dispatches { /// * `InvalidRevealCommitHashNotMatch`: The revealed hash does not match any committed hash. /// #[pallet::call_index(116)] - #[pallet::weight((::WeightInfo::reveal_mechanism_weights(uids.len() as u32), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::reveal_mechanism_weights(uids.len() as u32, 1) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn reveal_mechanism_weights( origin: OriginFor, netuid: NetUid, @@ -324,7 +432,15 @@ mod dispatches { values: Vec, salt: Vec, version_key: u64, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let hotkey = ensure_signed(origin.clone())?; + let netuid_index = Self::get_mechanism_storage_index(netuid, mecid); + let commit_count = + encoded_collection_len(&WeightCommits::::hashed_key_for(netuid_index, &hotkey)); + let actual_weight = ::WeightInfo::reveal_mechanism_weights( + uids.len() as u32, + commit_count, + ); Self::do_reveal_mechanism_weights( origin, netuid, @@ -334,6 +450,7 @@ mod dispatches { salt, version_key, ) + .with_benchmark_weight(actual_weight) } // Used to commit encrypted commit-reveal v3 weight values to later be revealed. @@ -398,14 +515,27 @@ mod dispatches { /// * `TooManyUnrevealedCommits`: Attempting to commit when the user has more than the allowed limit of unrevealed commits. /// #[pallet::call_index(117)] - #[pallet::weight((::WeightInfo::commit_crv3_mechanism_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::commit_crv3_mechanism_weights(commit.len() as u32, 0) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn commit_crv3_mechanism_weights( origin: OriginFor, netuid: NetUid, mecid: MechId, commit: BoundedVec>, reveal_round: u64, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let commit_len = commit.len() as u32; + let netuid_index = Self::get_mechanism_storage_index(netuid, mecid); + let epoch = Self::current_epoch_with_lookahead(netuid); + let queue_len = encoded_collection_len(&TimelockedWeightCommits::::hashed_key_for( + netuid_index, + epoch, + )); Self::do_commit_timelocked_mechanism_weights( origin, netuid, @@ -414,6 +544,9 @@ mod dispatches { reveal_round, 4, ) + .with_benchmark_weight( + ::WeightInfo::commit_crv3_mechanism_weights(commit_len, queue_len), + ) } /// The implementation for batch revealing committed weights. @@ -444,7 +577,13 @@ mod dispatches { /// /// * `InvalidInputLengths`: The input vectors are of mismatched lengths. #[pallet::call_index(98)] - #[pallet::weight((::WeightInfo::batch_reveal_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::batch_reveal_weights(uids_list.len() as u32) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn batch_reveal_weights( origin: OriginFor, netuid: NetUid, @@ -452,7 +591,22 @@ mod dispatches { values_list: Vec>, salts_list: Vec>, version_keys: Vec, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let reveal_count = uids_list.len() as u32; + // The batch benchmark runs every reveal at the full UID-domain + // workload. Subtract the measured single-reveal difference for + // each shorter row to obtain the work this call actually performs. + let maximum_row_weight = ::WeightInfo::reveal_weights( + T::InitialMaxAllowedUids::get().into(), + 10, + ); + let unused_weight = uids_list.iter().fold(Weight::zero(), |weight, row| { + weight.saturating_add(maximum_row_weight.saturating_sub( + ::WeightInfo::reveal_weights(row.len() as u32, 10), + )) + }); + let actual_weight = ::WeightInfo::batch_reveal_weights(reveal_count) + .saturating_sub(unused_weight); Self::do_batch_reveal_weights( origin, netuid, @@ -461,6 +615,7 @@ mod dispatches { salts_list, version_keys, ) + .with_benchmark_weight(actual_weight) } /// Allows delegates to decrease its take value. @@ -705,7 +860,13 @@ mod dispatches { /// * `ServingRateLimitExceeded`: Attempting to set prometheus information withing the rate limit min. /// #[pallet::call_index(40)] - #[pallet::weight((::WeightInfo::serve_axon_tls(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::serve_axon_tls(certificate.len() as u32) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn serve_axon_tls( origin: OriginFor, netuid: NetUid, @@ -717,7 +878,8 @@ mod dispatches { placeholder1: u8, placeholder2: u8, certificate: Vec, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let certificate_len = certificate.len() as u32; Self::do_serve_axon( origin, netuid, @@ -730,6 +892,7 @@ mod dispatches { placeholder2, Some(certificate), ) + .with_benchmark_weight(::WeightInfo::serve_axon_tls(certificate_len)) } /// Set prometheus information for the neuron. @@ -836,7 +999,9 @@ mod dispatches { )] #[pallet::call_index(70)] #[pallet::weight(( - ::WeightInfo::swap_hotkey(), + crate::Pallet::::precharge_maximum( + ::WeightInfo::swap_hotkey() + ), DispatchClass::Normal, Pays::Yes ))] @@ -881,25 +1046,30 @@ mod dispatches { /// /// Only callable by root as it doesn't require an announcement and can be used to swap any coldkey. #[pallet::call_index(71)] - #[pallet::weight(::WeightInfo::swap_coldkey())] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::swap_coldkey(0) + ))] pub fn swap_coldkey( origin: OriginFor, old_coldkey: T::AccountId, new_coldkey: T::AccountId, swap_cost: TaoBalance, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { ensure_root(origin)?; + let work = Self::coldkey_swap_work(&old_coldkey); + (|| -> DispatchResult { + if !swap_cost.is_zero() { + Self::charge_swap_cost(&old_coldkey, swap_cost)?; + } + Self::do_swap_coldkey(&old_coldkey, &new_coldkey)?; - if !swap_cost.is_zero() { - Self::charge_swap_cost(&old_coldkey, swap_cost)?; - } - Self::do_swap_coldkey(&old_coldkey, &new_coldkey)?; - - // We also clear any announcement or dispute for security reasons - ColdkeySwapAnnouncements::::remove(&old_coldkey); - ColdkeySwapDisputes::::remove(old_coldkey); + // We also clear any announcement or dispute for security reasons + ColdkeySwapAnnouncements::::remove(&old_coldkey); + ColdkeySwapDisputes::::remove(old_coldkey); - Ok(()) + Ok(()) + })() + .with_benchmark_weight(::WeightInfo::swap_coldkey(work)) } /// Sets the childkey take for a given hotkey. @@ -957,9 +1127,11 @@ mod dispatches { origin: OriginFor, tx_rate_limit: u64, ) -> DispatchResult { - ensure_root(origin)?; - Self::set_tx_childkey_take_rate_limit(tx_rate_limit); - Ok(()) + (|| -> DispatchResult { + ensure_root(origin)?; + Self::set_tx_childkey_take_rate_limit(tx_rate_limit); + Ok(()) + })() } /// Sets the minimum allowed childkey take. @@ -976,9 +1148,11 @@ mod dispatches { #[pallet::call_index(76)] #[pallet::weight(::WeightInfo::sudo_set_min_childkey_take())] pub fn sudo_set_min_childkey_take(origin: OriginFor, take: PerU16) -> DispatchResult { - ensure_root(origin)?; - Self::set_min_childkey_take(take); - Ok(()) + (|| -> DispatchResult { + ensure_root(origin)?; + Self::set_min_childkey_take(take); + Ok(()) + })() } /// Sets the maximum allowed childkey take. @@ -995,9 +1169,11 @@ mod dispatches { #[pallet::call_index(77)] #[pallet::weight(::WeightInfo::sudo_set_max_childkey_take())] pub fn sudo_set_max_childkey_take(origin: OriginFor, take: PerU16) -> DispatchResult { - ensure_root(origin)?; - Self::set_max_childkey_take(take); - Ok(()) + (|| -> DispatchResult { + ensure_root(origin)?; + Self::set_max_childkey_take(take); + Ok(()) + })() } /// User register a new subnetwork @@ -1037,8 +1213,10 @@ mod dispatches { _coldkey: T::AccountId, netuid: NetUid, ) -> DispatchResult { - ensure_root(origin)?; - Self::do_dissolve_network(netuid) + (|| -> DispatchResult { + ensure_root(origin)?; + Self::do_dissolve_network(netuid) + })() } /// Set a single child for a given hotkey on a specified network. @@ -1077,15 +1255,22 @@ mod dispatches { /// 8. **New Children Assignment**: Assigns the new child to the hotkey and updates the parent list for the new child. // TODO: Benchmark this call #[pallet::call_index(67)] - #[pallet::weight((::WeightInfo::set_children(children.len() as u32), DispatchClass::Normal, Pays::Yes))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::set_children(children.len() as u32) + ), + DispatchClass::Normal, + Pays::Yes + ))] pub fn set_children( origin: OriginFor, hotkey: T::AccountId, netuid: NetUid, children: Vec<(u64, T::AccountId)>, ) -> DispatchResultWithPostInfo { - Self::do_schedule_children(origin, hotkey, netuid, children)?; - Ok(().into()) + let actual_weight = ::WeightInfo::set_children(children.len() as u32); + Self::do_schedule_children(origin, hotkey, netuid, children) + .with_benchmark_weight(actual_weight) } /// Schedules a coldkey swap operation to be executed at a future block. @@ -1118,7 +1303,17 @@ mod dispatches { /// * `ip_type`: The ip type v4 or v6. /// #[pallet::call_index(68)] - #[pallet::weight(::WeightInfo::set_identity())] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::set_identity( + name.len() + .saturating_add(url.len()) + .saturating_add(github_repo.len()) + .saturating_add(image.len()) + .saturating_add(discord.len()) + .saturating_add(description.len()) + .saturating_add(additional.len()) as u32 + ) + ))] pub fn set_identity( origin: OriginFor, name: Vec, @@ -1128,7 +1323,15 @@ mod dispatches { discord: Vec, description: Vec, additional: Vec, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let identity_bytes = name + .len() + .saturating_add(url.len()) + .saturating_add(github_repo.len()) + .saturating_add(image.len()) + .saturating_add(discord.len()) + .saturating_add(description.len()) + .saturating_add(additional.len()) as u32; Self::do_set_identity( origin, name, @@ -1139,6 +1342,7 @@ mod dispatches { description, additional, ) + .with_benchmark_weight(::WeightInfo::set_identity(identity_bytes)) } /// Set the identity information for a subnet. @@ -1153,7 +1357,18 @@ mod dispatches { /// /// * `subnet_contact`: The contact information for the subnet. #[pallet::call_index(78)] - #[pallet::weight(::WeightInfo::set_subnet_identity())] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::set_subnet_identity( + subnet_name.len() + .saturating_add(github_repo.len()) + .saturating_add(subnet_contact.len()) + .saturating_add(subnet_url.len()) + .saturating_add(discord.len()) + .saturating_add(description.len()) + .saturating_add(logo_url.len()) + .saturating_add(additional.len()) as u32 + ) + ))] pub fn set_subnet_identity( origin: OriginFor, netuid: NetUid, @@ -1165,7 +1380,16 @@ mod dispatches { description: Vec, logo_url: Vec, additional: Vec, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let identity_bytes = subnet_name + .len() + .saturating_add(github_repo.len()) + .saturating_add(subnet_contact.len()) + .saturating_add(subnet_url.len()) + .saturating_add(discord.len()) + .saturating_add(description.len()) + .saturating_add(logo_url.len()) + .saturating_add(additional.len()) as u32; Self::do_set_subnet_identity( origin, netuid, @@ -1178,17 +1402,41 @@ mod dispatches { logo_url, additional, ) + .with_benchmark_weight(::WeightInfo::set_subnet_identity( + identity_bytes, + )) } /// User register a new subnetwork #[pallet::call_index(79)] - #[pallet::weight(::WeightInfo::register_network_with_identity())] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::register_network_with_identity( + identity.as_ref().map(|identity| identity.encoded_size() as u32).unwrap_or_default() + ) + ))] pub fn register_network_with_identity( origin: OriginFor, hotkey: T::AccountId, identity: Option, - ) -> DispatchResult { - Self::do_register_network(origin, &hotkey, 1, identity) + ) -> DispatchResultWithPostInfo { + let identity_bytes = identity + .as_ref() + .map(|identity| { + identity + .subnet_name + .len() + .saturating_add(identity.github_repo.len()) + .saturating_add(identity.subnet_contact.len()) + .saturating_add(identity.subnet_url.len()) + .saturating_add(identity.discord.len()) + .saturating_add(identity.description.len()) + .saturating_add(identity.logo_url.len()) + .saturating_add(identity.additional.len()) as u32 + }) + .unwrap_or_default(); + Self::do_register_network(origin, &hotkey, 1, identity).with_benchmark_weight( + ::WeightInfo::register_network_with_identity(identity_bytes), + ) } /// The implementation for the extrinsic unstake_all: Removes all stake from a hotkey account across all subnets and adds it onto a coldkey. @@ -1210,9 +1458,18 @@ mod dispatches { /// /// * `TxRateLimitExceeded`: Thrown if key has hit transaction rate limit. #[pallet::call_index(83)] - #[pallet::weight(::WeightInfo::unstake_all())] - pub fn unstake_all(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { - Self::do_unstake_all(origin, hotkey) + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::unstake_all(0) + ))] + pub fn unstake_all( + origin: OriginFor, + hotkey: T::AccountId, + ) -> DispatchResultWithPostInfo { + let subnet_count = u32::from(TotalNetworks::::get()); + Self::do_unstake_all(origin, hotkey).with_benchmark_weight( + ::WeightInfo::unstake_all(subnet_count) + .saturating_add(T::DbWeight::get().reads(1)), + ) } /// The implementation for the extrinsic unstake_all: Removes all stake from a hotkey account across all subnets and adds it onto a coldkey. @@ -1234,9 +1491,18 @@ mod dispatches { /// /// * `TxRateLimitExceeded`: Thrown if key has hit transaction rate limit. #[pallet::call_index(84)] - #[pallet::weight(::WeightInfo::unstake_all_alpha())] - pub fn unstake_all_alpha(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { - Self::do_unstake_all_alpha(origin, hotkey) + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::unstake_all_alpha(0) + ))] + pub fn unstake_all_alpha( + origin: OriginFor, + hotkey: T::AccountId, + ) -> DispatchResultWithPostInfo { + let subnet_count = u32::from(TotalNetworks::::get()); + Self::do_unstake_all_alpha(origin, hotkey).with_benchmark_weight( + ::WeightInfo::unstake_all_alpha(subnet_count) + .saturating_add(T::DbWeight::get().reads(1)), + ) } /// The implementation for the extrinsic move_stake: Moves specified amount of stake from a hotkey to another across subnets. @@ -1521,11 +1787,10 @@ mod dispatches { #[pallet::call_index(91)] #[pallet::weight(::WeightInfo::try_associate_hotkey())] pub fn try_associate_hotkey(origin: OriginFor, hotkey: T::AccountId) -> DispatchResult { - let coldkey = ensure_signed(origin)?; - - Self::do_try_associate_hotkey(&coldkey, &hotkey)?; - - Ok(()) + (|| -> DispatchResult { + let coldkey = ensure_signed(origin)?; + Self::do_try_associate_hotkey(&coldkey, &hotkey) + })() } /// Initiates a call on a subnet. @@ -1539,8 +1804,7 @@ mod dispatches { #[pallet::call_index(92)] #[pallet::weight(::WeightInfo::start_call())] pub fn start_call(origin: OriginFor, netuid: NetUid) -> DispatchResult { - Self::do_start_call(origin, netuid)?; - Ok(()) + Self::do_start_call(origin, netuid) } /// Attempts to associate a hotkey with an EVM key. @@ -1637,9 +1901,11 @@ mod dispatches { origin: OriginFor, cooldown: u64, ) -> DispatchResult { - ensure_root(origin)?; - PendingChildKeyCooldown::::put(cooldown); - Ok(()) + (|| -> DispatchResult { + ensure_root(origin)?; + PendingChildKeyCooldown::::put(cooldown); + Ok(()) + })() } /// Removes all stake from a hotkey on a subnet with a price limit. @@ -1725,16 +1991,18 @@ mod dispatches { netuid: NetUid, symbol: Vec, ) -> DispatchResult { - Self::ensure_subnet_owner_or_root(origin, netuid)?; - ensure!(Self::if_subnet_exist(netuid), Error::::SubnetNotExists); + (|| -> DispatchResult { + Self::ensure_subnet_owner_or_root(origin, netuid)?; + ensure!(Self::if_subnet_exist(netuid), Error::::SubnetNotExists); - Self::ensure_symbol_exists(&symbol)?; - Self::ensure_symbol_available(&symbol)?; + Self::ensure_symbol_exists(&symbol)?; + Self::ensure_symbol_available(&symbol)?; - TokenSymbol::::insert(netuid, symbol.clone()); + TokenSymbol::::insert(netuid, symbol.clone()); - Self::deposit_event(Event::SymbolUpdated { netuid, symbol }); - Ok(()) + Self::deposit_event(Event::SymbolUpdated { netuid, symbol }); + Ok(()) + })() } /// Used to commit timelock encrypted commit-reveal weight values to later be revealed. @@ -1757,14 +2025,28 @@ mod dispatches { /// /// * `commit_reveal_version`: The client (bittensor-drand) version. #[pallet::call_index(113)] - #[pallet::weight((::WeightInfo::commit_timelocked_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::commit_timelocked_weights(commit.len() as u32, 0) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn commit_timelocked_weights( origin: OriginFor, netuid: NetUid, commit: BoundedVec>, reveal_round: u64, commit_reveal_version: u16, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let commit_len = commit.len() as u32; + let netuid_index = + Self::get_mechanism_storage_index(netuid, subtensor_runtime_common::MechId::MAIN); + let epoch = Self::current_epoch_with_lookahead(netuid); + let queue_len = encoded_collection_len(&TimelockedWeightCommits::::hashed_key_for( + netuid_index, + epoch, + )); Self::do_commit_timelocked_weights( origin, netuid, @@ -1772,6 +2054,9 @@ mod dispatches { reveal_round, commit_reveal_version, ) + .with_benchmark_weight( + ::WeightInfo::commit_timelocked_weights(commit_len, queue_len), + ) } /// Set the autostake destination hotkey for a coldkey. @@ -1784,12 +2069,14 @@ mod dispatches { /// /// * `hotkey`: The hotkey account to designate as the autostake destination. #[pallet::call_index(114)] - #[pallet::weight(::WeightInfo::set_coldkey_auto_stake_hotkey())] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::set_coldkey_auto_stake_hotkey(0, 0) + ))] pub fn set_coldkey_auto_stake_hotkey( origin: OriginFor, netuid: NetUid, hotkey: T::AccountId, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { let coldkey = ensure_signed(origin)?; ensure!(Self::if_subnet_exist(netuid), Error::::SubnetNotExists); ensure!( @@ -1798,33 +2085,49 @@ mod dispatches { ); let current_hotkey = AutoStakeDestination::::get(coldkey.clone(), netuid); - if let Some(current_hotkey) = current_hotkey { - ensure!( - current_hotkey != hotkey, - Error::::SameAutoStakeHotkeyAlreadySet - ); - - // Remove the coldkey from the old hotkey (if present) - AutoStakeDestinationColdkeys::::mutate(current_hotkey.clone(), netuid, |v| { - v.retain(|c| c != &coldkey); - }); - } + let old_coldkeys = current_hotkey + .as_ref() + .and_then(|old_hotkey| { + AutoStakeDestinationColdkeys::::decode_len(old_hotkey, netuid) + }) + .unwrap_or_default() as u32; + let new_coldkeys = AutoStakeDestinationColdkeys::::decode_len(&hotkey, netuid) + .unwrap_or_default() as u32; + let actual_weight = ::WeightInfo::set_coldkey_auto_stake_hotkey( + old_coldkeys, + new_coldkeys, + ); - // Add the coldkey to the new hotkey (if not already present) - AutoStakeDestination::::insert(coldkey.clone(), netuid, hotkey.clone()); - AutoStakeDestinationColdkeys::::mutate(hotkey.clone(), netuid, |v| { - if !v.contains(&coldkey) { - v.push(coldkey.clone()); + let result = (|| -> DispatchResult { + if let Some(current_hotkey) = current_hotkey { + ensure!( + current_hotkey != hotkey, + Error::::SameAutoStakeHotkeyAlreadySet + ); + + // Remove the coldkey from the old hotkey (if present). + AutoStakeDestinationColdkeys::::mutate(current_hotkey, netuid, |v| { + v.retain(|c| c != &coldkey); + }); } - }); - Self::deposit_event(Event::AutoStakeDestinationSet { - coldkey, - netuid, - hotkey, - }); + // Add the coldkey to the new hotkey (if not already present). + AutoStakeDestination::::insert(coldkey.clone(), netuid, hotkey.clone()); + AutoStakeDestinationColdkeys::::mutate(hotkey.clone(), netuid, |v| { + if !v.contains(&coldkey) { + v.push(coldkey.clone()); + } + }); - Ok(()) + Self::deposit_event(Event::AutoStakeDestinationSet { + coldkey, + netuid, + hotkey, + }); + + Ok(()) + })(); + result.with_benchmark_weight(actual_weight) } /// Used to commit timelock encrypted commit-reveal weight values to later be revealed for @@ -1850,7 +2153,16 @@ mod dispatches { /// /// * `commit_reveal_version`: The client (bittensor-drand) version. #[pallet::call_index(118)] - #[pallet::weight((::WeightInfo::commit_timelocked_mechanism_weights(), DispatchClass::Normal, Pays::No))] + #[pallet::weight(( + crate::Pallet::::precharge_maximum( + ::WeightInfo::commit_timelocked_mechanism_weights( + commit.len() as u32, + 0 + ) + ), + DispatchClass::Normal, + Pays::No + ))] pub fn commit_timelocked_mechanism_weights( origin: OriginFor, netuid: NetUid, @@ -1858,7 +2170,14 @@ mod dispatches { commit: BoundedVec>, reveal_round: u64, commit_reveal_version: u16, - ) -> DispatchResult { + ) -> DispatchResultWithPostInfo { + let commit_len = commit.len() as u32; + let netuid_index = Self::get_mechanism_storage_index(netuid, mecid); + let epoch = Self::current_epoch_with_lookahead(netuid); + let queue_len = encoded_collection_len(&TimelockedWeightCommits::::hashed_key_for( + netuid_index, + epoch, + )); Self::do_commit_timelocked_mechanism_weights( origin, netuid, @@ -1867,6 +2186,11 @@ mod dispatches { reveal_round, commit_reveal_version, ) + .with_benchmark_weight( + ::WeightInfo::commit_timelocked_mechanism_weights( + commit_len, queue_len, + ), + ) } /// Remove a subnetwork @@ -1874,8 +2198,10 @@ mod dispatches { #[pallet::call_index(120)] #[pallet::weight(::WeightInfo::root_dissolve_network())] pub fn root_dissolve_network(origin: OriginFor, netuid: NetUid) -> DispatchResult { - ensure_root(origin)?; - Self::do_dissolve_network(netuid) + (|| -> DispatchResult { + ensure_root(origin)?; + Self::do_dissolve_network(netuid) + })() } /// Claims the root emissions for a coldkey. @@ -1890,13 +2216,9 @@ mod dispatches { /// * `TooManyRootClaimHotkeys`: The coldkey's hotkey fanout exceeds one claim's bound. /// #[pallet::call_index(121)] - // The benchmark covers one hotkey and one subnet. Manual claims bound both - // dimensions below and refund unused weight after execution. - #[pallet::weight( - ::WeightInfo::claim_root() - .saturating_mul(MAX_ROOT_CLAIM_HOTKEYS as u64) - .saturating_mul(MAX_SUBNET_CLAIMS as u64) - )] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::claim_root(0, subnets.len() as u32) + ))] pub fn claim_root( origin: OriginFor, subnets: BTreeSet, @@ -1915,12 +2237,27 @@ mod dispatches { Error::::TooManyRootClaimHotkeys ); + let coldkey_was_indexed = StakingColdkeys::::contains_key(&coldkey); Self::maybe_add_coldkey_index(&coldkey); - let weight = T::DbWeight::get() - .reads(1) - .saturating_add(Self::do_root_claim(coldkey, Some(subnets))?); - Ok((Some(weight), Pays::Yes).into()) + let index_weight = if coldkey_was_indexed { + T::DbWeight::get().reads(1) + } else { + T::DbWeight::get().reads_writes(3, 3) + }; + let measured_weight = + index_weight.saturating_add(Self::do_root_claim(coldkey, Some(subnets.clone()))?); + + // The generated two-component benchmark accounts for the CPU + // fanout; the operation-level meter remains a floor for DB/proof + // accounting and keeps this safe before the benchmark action + // refreshes the generated file. + let benchmark_weight = ::WeightInfo::claim_root( + hotkey_count as u32, + subnets.len() as u32, + ); + let actual_weight = measured_weight.max(benchmark_weight); + Ok((Some(actual_weight), Pays::Yes).into()) } /// Sets the root claim type for the coldkey. @@ -1931,37 +2268,48 @@ mod dispatches { /// * `RootClaimTypeSet`: On the successfully setting the root claim type for the coldkey. /// #[pallet::call_index(122)] - #[pallet::weight(::WeightInfo::set_root_claim_type())] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::set_root_claim_type(0) + ))] pub fn set_root_claim_type( origin: OriginFor, new_root_claim_type: RootClaimTypeEnum, - ) -> DispatchResult { - let coldkey: T::AccountId = ensure_signed(origin)?; + ) -> DispatchResultWithPostInfo { + let subnet_count = match &new_root_claim_type { + RootClaimTypeEnum::KeepSubnets { subnets } => subnets.len() as u32, + RootClaimTypeEnum::Swap | RootClaimTypeEnum::Keep => 0, + }; + (|| -> DispatchResult { + let coldkey: T::AccountId = ensure_signed(origin)?; - if let RootClaimTypeEnum::KeepSubnets { subnets } = &new_root_claim_type { - ensure!(!subnets.is_empty(), Error::::InvalidSubnetNumber); - } + if let RootClaimTypeEnum::KeepSubnets { subnets } = &new_root_claim_type { + ensure!(!subnets.is_empty(), Error::::InvalidSubnetNumber); + } - Self::maybe_add_coldkey_index(&coldkey); + Self::maybe_add_coldkey_index(&coldkey); - Self::change_root_claim_type(&coldkey, new_root_claim_type); - Ok(()) + Self::change_root_claim_type(&coldkey, new_root_claim_type); + Ok(()) + })() + .with_benchmark_weight(::WeightInfo::set_root_claim_type(subnet_count)) } /// Sets root claim number (sudo extrinsic). Zero disables auto-claim. #[pallet::call_index(123)] #[pallet::weight(::WeightInfo::sudo_set_num_root_claims())] pub fn sudo_set_num_root_claims(origin: OriginFor, new_value: u64) -> DispatchResult { - ensure_root(origin)?; + (|| -> DispatchResult { + ensure_root(origin)?; - ensure!( - new_value <= MAX_NUM_ROOT_CLAIMS, - Error::::InvalidNumRootClaim - ); + ensure!( + new_value <= MAX_NUM_ROOT_CLAIMS, + Error::::InvalidNumRootClaim + ); - NumRootClaim::::set(new_value); + NumRootClaim::::set(new_value); - Ok(()) + Ok(()) + })() } /// Sets root claim threshold for subnet (sudo or owner origin). @@ -1972,17 +2320,19 @@ mod dispatches { netuid: NetUid, new_value: u64, ) -> DispatchResult { - Self::ensure_subnet_owner_or_root(origin, netuid)?; - ensure!(Self::if_subnet_exist(netuid), Error::::SubnetNotExists); + (|| -> DispatchResult { + Self::ensure_subnet_owner_or_root(origin, netuid)?; + ensure!(Self::if_subnet_exist(netuid), Error::::SubnetNotExists); - ensure!( - new_value <= I96F32::from(MAX_ROOT_CLAIM_THRESHOLD), - Error::::InvalidRootClaimThreshold - ); + ensure!( + new_value <= I96F32::from(MAX_ROOT_CLAIM_THRESHOLD), + Error::::InvalidRootClaimThreshold + ); - RootClaimableThreshold::::set(netuid, new_value.into()); + RootClaimableThreshold::::set(netuid, new_value.into()); - Ok(()) + Ok(()) + })() } /// Announces a coldkey swap using BlakeTwo256 hash of the new coldkey. @@ -2005,28 +2355,33 @@ mod dispatches { origin: OriginFor, new_coldkey_hash: T::Hash, ) -> DispatchResult { - let who = ensure_signed(origin)?; - let now = >::block_number(); - - if let Some((when, _)) = ColdkeySwapAnnouncements::::get(who.clone()) { - let reannouncement_delay = ColdkeySwapReannouncementDelay::::get(); - let min_when = when.saturating_add(reannouncement_delay); - ensure!(now >= min_when, Error::::ColdkeySwapReannouncedTooEarly); - } else { - // Only charge the swap cost on the first announcement - let swap_cost = Self::get_key_swap_cost(); - Self::charge_swap_cost(&who, swap_cost)?; - } + (|| -> DispatchResult { + let who = ensure_signed(origin)?; + let now = >::block_number(); + + if let Some((when, _)) = ColdkeySwapAnnouncements::::get(who.clone()) { + let reannouncement_delay = ColdkeySwapReannouncementDelay::::get(); + let min_when = when.saturating_add(reannouncement_delay); + ensure!(now >= min_when, Error::::ColdkeySwapReannouncedTooEarly); + } else { + // Only charge the swap cost on the first announcement + let swap_cost = Self::get_key_swap_cost(); + Self::charge_swap_cost(&who, swap_cost)?; + } - let delay = ColdkeySwapAnnouncementDelay::::get(); - let when = now.saturating_add(delay); - ColdkeySwapAnnouncements::::insert(who.clone(), (when, new_coldkey_hash.clone())); + let delay = ColdkeySwapAnnouncementDelay::::get(); + let when = now.saturating_add(delay); + ColdkeySwapAnnouncements::::insert( + who.clone(), + (when, new_coldkey_hash.clone()), + ); - Self::deposit_event(Event::ColdkeySwapAnnounced { - who, - new_coldkey_hash, - }); - Ok(()) + Self::deposit_event(Event::ColdkeySwapAnnounced { + who, + new_coldkey_hash, + }); + Ok(()) + })() } /// Performs a coldkey swap if an announcement has been made. @@ -2038,27 +2393,32 @@ mod dispatches { /// /// The `ColdkeySwapped` event is emitted on successful swap. #[pallet::call_index(126)] - #[pallet::weight(::WeightInfo::swap_coldkey_announced())] + #[pallet::weight(crate::Pallet::::precharge_maximum( + ::WeightInfo::swap_coldkey_announced(0) + ))] pub fn swap_coldkey_announced( origin: OriginFor, new_coldkey: T::AccountId, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - let (when, new_coldkey_hash) = ColdkeySwapAnnouncements::::take(who.clone()) - .ok_or(Error::::ColdkeySwapAnnouncementNotFound)?; + ) -> DispatchResultWithPostInfo { + let who = ensure_signed(origin.clone())?; + let work = Self::coldkey_swap_work(&who); + (|| -> DispatchResult { + let who = ensure_signed(origin)?; - ensure!( - new_coldkey_hash == T::Hashing::hash_of(&new_coldkey), - Error::::AnnouncedColdkeyHashDoesNotMatch - ); + let (when, new_coldkey_hash) = ColdkeySwapAnnouncements::::take(who.clone()) + .ok_or(Error::::ColdkeySwapAnnouncementNotFound)?; - let now = >::block_number(); - ensure!(now >= when, Error::::ColdkeySwapTooEarly); + ensure!( + new_coldkey_hash == T::Hashing::hash_of(&new_coldkey), + Error::::AnnouncedColdkeyHashDoesNotMatch + ); - Self::do_swap_coldkey(&who, &new_coldkey)?; + let now = >::block_number(); + ensure!(now >= when, Error::::ColdkeySwapTooEarly); - Ok(()) + Self::do_swap_coldkey(&who, &new_coldkey) + })() + .with_benchmark_weight(::WeightInfo::swap_coldkey_announced(work)) } /// Dispute a coldkey swap. @@ -2071,22 +2431,24 @@ mod dispatches { #[pallet::call_index(127)] #[pallet::weight(::WeightInfo::dispute_coldkey_swap())] pub fn dispute_coldkey_swap(origin: OriginFor) -> DispatchResult { - let coldkey = ensure_signed(origin)?; + (|| -> DispatchResult { + let coldkey = ensure_signed(origin)?; - ensure!( - ColdkeySwapAnnouncements::::contains_key(&coldkey), - Error::::ColdkeySwapAnnouncementNotFound - ); - ensure!( - !ColdkeySwapDisputes::::contains_key(&coldkey), - Error::::ColdkeySwapAlreadyDisputed - ); + ensure!( + ColdkeySwapAnnouncements::::contains_key(&coldkey), + Error::::ColdkeySwapAnnouncementNotFound + ); + ensure!( + !ColdkeySwapDisputes::::contains_key(&coldkey), + Error::::ColdkeySwapAlreadyDisputed + ); - let now = >::block_number(); - ColdkeySwapDisputes::::insert(&coldkey, now); + let now = >::block_number(); + ColdkeySwapDisputes::::insert(&coldkey, now); - Self::deposit_event(Event::ColdkeySwapDisputed { coldkey }); - Ok(()) + Self::deposit_event(Event::ColdkeySwapDisputed { coldkey }); + Ok(()) + })() } /// Reset a coldkey swap by clearing the announcement and dispute status. @@ -2098,13 +2460,15 @@ mod dispatches { #[pallet::call_index(128)] #[pallet::weight(::WeightInfo::reset_coldkey_swap())] pub fn reset_coldkey_swap(origin: OriginFor, coldkey: T::AccountId) -> DispatchResult { - ensure_root(origin)?; + (|| -> DispatchResult { + ensure_root(origin)?; - ColdkeySwapAnnouncements::::remove(&coldkey); - ColdkeySwapDisputes::::remove(&coldkey); + ColdkeySwapAnnouncements::::remove(&coldkey); + ColdkeySwapDisputes::::remove(&coldkey); - Self::deposit_event(Event::ColdkeySwapReset { who: coldkey }); - Ok(()) + Self::deposit_event(Event::ColdkeySwapReset { who: coldkey }); + Ok(()) + })() } /// Enables voting power tracking for a subnet. @@ -2126,8 +2490,10 @@ mod dispatches { origin: OriginFor, netuid: NetUid, ) -> DispatchResult { - Self::ensure_subnet_owner_or_root(origin, netuid)?; - Self::do_enable_voting_power_tracking(netuid) + (|| -> DispatchResult { + Self::ensure_subnet_owner_or_root(origin, netuid)?; + Self::do_enable_voting_power_tracking(netuid) + })() } /// Schedules disabling of voting power tracking for a subnet. @@ -2150,8 +2516,10 @@ mod dispatches { origin: OriginFor, netuid: NetUid, ) -> DispatchResult { - Self::ensure_subnet_owner_or_root(origin, netuid)?; - Self::do_disable_voting_power_tracking(netuid) + (|| -> DispatchResult { + Self::ensure_subnet_owner_or_root(origin, netuid)?; + Self::do_disable_voting_power_tracking(netuid) + })() } /// Sets the EMA alpha value for voting power calculation on a subnet. @@ -2176,8 +2544,10 @@ mod dispatches { netuid: NetUid, alpha: u64, ) -> DispatchResult { - ensure_root(origin)?; - Self::do_set_voting_power_ema_alpha(netuid, alpha) + (|| -> DispatchResult { + ensure_root(origin)?; + Self::do_set_voting_power_ema_alpha(netuid, alpha) + })() } /// The extrinsic is a combination of add_stake(add_stake_limit) and burn_alpha. We buy @@ -2201,20 +2571,22 @@ mod dispatches { #[pallet::call_index(133)] #[pallet::weight(::WeightInfo::clear_coldkey_swap_announcement())] pub fn clear_coldkey_swap_announcement(origin: OriginFor) -> DispatchResult { - let who = ensure_signed(origin)?; - let now = >::block_number(); + (|| -> DispatchResult { + let who = ensure_signed(origin)?; + let now = >::block_number(); - let Some((when, _)) = ColdkeySwapAnnouncements::::get(who.clone()) else { - return Err(Error::::ColdkeySwapAnnouncementNotFound.into()); - }; - let delay = ColdkeySwapReannouncementDelay::::get(); - let min_when = when.saturating_add(delay); - ensure!(now >= min_when, Error::::ColdkeySwapClearTooEarly); + let Some((when, _)) = ColdkeySwapAnnouncements::::get(who.clone()) else { + return Err(Error::::ColdkeySwapAnnouncementNotFound.into()); + }; + let delay = ColdkeySwapReannouncementDelay::::get(); + let min_when = when.saturating_add(delay); + ensure!(now >= min_when, Error::::ColdkeySwapClearTooEarly); - ColdkeySwapAnnouncements::::remove(&who); + ColdkeySwapAnnouncements::::remove(&who); - Self::deposit_event(Event::ColdkeySwapCleared { who }); - Ok(()) + Self::deposit_event(Event::ColdkeySwapCleared { who }); + Ok(()) + })() } /// User register a new subnetwork via burning token, but only if the @@ -2241,22 +2613,24 @@ mod dispatches { hotkey: T::AccountId, enabled: bool, ) -> DispatchResult { - let coldkey = ensure_signed(origin)?; + (|| -> DispatchResult { + let coldkey = ensure_signed(origin)?; - ensure!( - Self::coldkey_owns_hotkey(&coldkey, &hotkey), - Error::::NonAssociatedColdKey - ); + ensure!( + Self::coldkey_owns_hotkey(&coldkey, &hotkey), + Error::::NonAssociatedColdKey + ); - ensure!( - Self::is_hotkey_registered_on_network(NetUid::ROOT, &hotkey), - Error::::HotKeyNotRegisteredInSubNet - ); + ensure!( + Self::is_hotkey_registered_on_network(NetUid::ROOT, &hotkey), + Error::::HotKeyNotRegisteredInSubNet + ); - AutoParentDelegationEnabled::::insert(&hotkey, enabled); + AutoParentDelegationEnabled::::insert(&hotkey, enabled); - Self::deposit_event(Event::AutoParentDelegationEnabledSet { hotkey, enabled }); - Ok(()) + Self::deposit_event(Event::AutoParentDelegationEnabledSet { hotkey, enabled }); + Ok(()) + })() } /// Locks stake on a subnet to a specific hotkey, building conviction over time. @@ -2278,8 +2652,10 @@ mod dispatches { netuid: NetUid, amount: AlphaBalance, ) -> DispatchResult { - let coldkey = ensure_signed(origin)?; - Self::do_lock_stake(&coldkey, netuid, &hotkey, amount) + (|| -> DispatchResult { + let coldkey = ensure_signed(origin)?; + Self::do_lock_stake(&coldkey, netuid, &hotkey, amount) + })() } /// Moves an existing lock for a coldkey on a subnet from one hotkey to another. @@ -2301,8 +2677,10 @@ mod dispatches { destination_hotkey: T::AccountId, netuid: NetUid, ) -> DispatchResult { - let coldkey = ensure_signed(origin)?; - Self::do_move_lock(&coldkey, &destination_hotkey, netuid) + (|| -> DispatchResult { + let coldkey = ensure_signed(origin)?; + Self::do_move_lock(&coldkey, &destination_hotkey, netuid) + })() } /// Sets or clears the caller's perpetual lock flag for a subnet. @@ -2317,8 +2695,10 @@ mod dispatches { netuid: NetUid, enabled: bool, ) -> DispatchResult { - let coldkey = ensure_signed(origin)?; - Self::do_set_perpetual_lock(&coldkey, netuid, enabled) + (|| -> DispatchResult { + let coldkey = ensure_signed(origin)?; + Self::do_set_perpetual_lock(&coldkey, netuid, enabled) + })() } /// Deprecated compatibility entry point retained for call-index stability. @@ -2369,10 +2749,12 @@ mod dispatches { #[pallet::call_index(142)] #[pallet::weight((::WeightInfo::set_reject_locked_alpha(), DispatchClass::Normal, Pays::Yes))] pub fn set_reject_locked_alpha(origin: OriginFor, enabled: bool) -> DispatchResult { - let coldkey = ensure_signed(origin)?; - Self::set_accept_locked_alpha(&coldkey, !enabled); - Self::deposit_event(Event::RejectLockedAlphaUpdated { coldkey, enabled }); - Ok(()) + (|| -> DispatchResult { + let coldkey = ensure_signed(origin)?; + Self::set_accept_locked_alpha(&coldkey, !enabled); + Self::deposit_event(Event::RejectLockedAlphaUpdated { coldkey, enabled }); + Ok(()) + })() } /// Transfers a specified amount of stake from one coldkey to another, landing it diff --git a/pallets/subtensor/src/swap/swap_coldkey.rs b/pallets/subtensor/src/swap/swap_coldkey.rs index b887acc8ce..36d3951b0c 100644 --- a/pallets/subtensor/src/swap/swap_coldkey.rs +++ b/pallets/subtensor/src/swap/swap_coldkey.rs @@ -3,6 +3,39 @@ use frame_support::storage::{TransactionOutcome, with_transaction}; use super::*; impl Pallet { + /// Collapse every state-driven coldkey-swap fan-out into one conservative + /// benchmark component. The benchmark populates all dimensions together, + /// so taking their maximum never understates a sparse real-world shape. + pub fn coldkey_swap_work(old_coldkey: &T::AccountId) -> u32 { + let netuids = Self::get_all_subnet_netuids(); + let network_count = netuids.len() as u32; + let staking_hotkeys = + StakingHotkeys::::decode_len(old_coldkey).unwrap_or_default() as u32; + let stake_work = network_count.saturating_mul(staking_hotkeys); + let owned_hotkeys = OwnedHotkeys::::decode_len(old_coldkey).unwrap_or_default() as u32; + + let mut auto_stake_work = 0_u32; + let mut collateral_work = 0_u32; + for netuid in netuids { + if let Some(hotkey) = AutoStakeDestination::::get(old_coldkey, netuid) { + auto_stake_work = auto_stake_work.saturating_add( + AutoStakeDestinationColdkeys::::decode_len(hotkey, netuid) + .unwrap_or_default() as u32, + ); + } + collateral_work = collateral_work.saturating_add( + ColdkeyCollateralHotkeys::::decode_len(netuid, old_coldkey).unwrap_or_default() + as u32, + ); + } + + network_count + .max(stake_work) + .max(owned_hotkeys) + .max(auto_stake_work) + .max(collateral_work) + } + /// Transfer all assets, stakes, subnet ownerships, and hotkey associations from `old_coldkey` to /// to `new_coldkey`. pub fn do_swap_coldkey( @@ -116,12 +149,13 @@ impl Pallet { netuid, alpha_old, ); - Self::increase_stake_for_hotkey_and_coldkey_on_subnet( - &hotkey, - new_coldkey, - netuid, - alpha_old, - ); + // The association vector is migrated once after all subnet stake + // rows have moved. Updating it for every row would repeatedly + // decode and scan a growing vector, turning the swap into + // quadratic work that cannot be represented by a linear + // benchmark component. + let mut alpha_share_pool = Self::get_alpha_share_pool(hotkey.clone(), netuid); + alpha_share_pool.update_value_for_one(new_coldkey, alpha_old.to_u64() as i64); let new_dest_alpha = Self::get_stake_for_hotkey_and_coldkey_on_subnet(&hotkey, new_coldkey, netuid); @@ -154,9 +188,10 @@ impl Pallet { fn transfer_staking_hotkeys(old_coldkey: &T::AccountId, new_coldkey: &T::AccountId) { let old_staking_hotkeys: Vec = StakingHotkeys::::get(old_coldkey); let mut new_staking_hotkeys: Vec = StakingHotkeys::::get(new_coldkey); + let destination_was_empty = new_staking_hotkeys.is_empty(); for hotkey in old_staking_hotkeys { // If the hotkey is not already in the new coldkey, add it. - if !new_staking_hotkeys.contains(&hotkey) { + if destination_was_empty || !new_staking_hotkeys.contains(&hotkey) { new_staking_hotkeys.push(hotkey); } } @@ -172,13 +207,18 @@ impl Pallet { ) -> DispatchResult { let old_owned_hotkeys: Vec = OwnedHotkeys::::get(old_coldkey); let mut new_owned_hotkeys: Vec = OwnedHotkeys::::get(new_coldkey); + let destination_was_empty = new_owned_hotkeys.is_empty(); for owned_hotkey in old_owned_hotkeys.iter() { // Remove the hotkey from the old coldkey. Owner::::remove(owned_hotkey); // Add the hotkey to the new coldkey. Self::set_hotkey_owner(new_coldkey, owned_hotkey)?; // Addd the owned hotkey to the new set of owned hotkeys. - if !new_owned_hotkeys.contains(owned_hotkey) { + // A valid destination has no staking hotkeys (checked before the + // transaction), and therefore normally has no owned hotkeys + // either. Avoid repeatedly scanning the growing destination in + // that common and benchmarked path. + if destination_was_empty || !new_owned_hotkeys.contains(owned_hotkey) { new_owned_hotkeys.push(owned_hotkey.clone()); } } diff --git a/pallets/subtensor/src/swap/swap_hotkey.rs b/pallets/subtensor/src/swap/swap_hotkey.rs index b4fb7336f0..851e876bea 100644 --- a/pallets/subtensor/src/swap/swap_hotkey.rs +++ b/pallets/subtensor/src/swap/swap_hotkey.rs @@ -1,4 +1,6 @@ use super::*; +use crate::weights::WeightInfo; +use frame_support::dispatch::DispatchClass; use frame_support::storage::{TransactionOutcome, with_transaction}; use frame_support::weights::Weight; use share_pool::SafeFloat; @@ -12,19 +14,44 @@ struct PreparedHotkeyStake { } impl Pallet { - /// Use the generated all-subnet stake-moving benchmark for every v2 path - /// that scans and moves stake. Preserve the previous lightweight weight for - /// the single-subnet `keep_stake` path, which does not scan stake prefixes. - pub fn swap_hotkey_v2_dispatch_weight(netuid: &Option, keep_stake: bool) -> Weight { - if netuid.is_none() || !keep_stake { - <::WeightInfo as crate::weights::WeightInfo>::swap_hotkey() - } else { - // +1 read / +4 writes vs the pre-lineage keep_stake path: root lookup, - // LastHotkeySwap, successor clear+insert, root insert. - Weight::from_parts(275_300_000, 0) - .saturating_add(T::DbWeight::get().reads(53_u64)) - .saturating_add(T::DbWeight::get().writes(39_u64)) - } + /// Reserve the largest call weight that can fit in a normal extrinsic after + /// accounting for the runtime's transaction extensions. This is a weight + /// ceiling, not an item-count cap: execution still meters the state it + /// actually touches and returns that amount for the refund. + pub fn max_normal_dispatch_weight() -> Weight { + let block_weights = T::BlockWeights::get(); + let normal = block_weights.get(DispatchClass::Normal); + let max_extrinsic = normal + .max_extrinsic + .or(normal.max_total) + .unwrap_or(block_weights.max_block); + + max_extrinsic.saturating_sub(T::MaxTransactionExtensionWeight::get()) + } + + /// Declare the maximum admissible weight for state-dependent dispatches. + /// + /// The declaration belongs to the call rather than a signed transaction + /// extension so wrappers inherit it when dispatching this call internally. + /// FRAME can then safely refund the measured post-dispatch weight without + /// capping nested accounting at a smaller benchmark-model declaration. + pub fn precharge_maximum(_benchmark_model: Weight) -> Weight { + Self::max_normal_dispatch_weight() + } + + /// Reserve the maximum dispatch weight and refund the measured result. + pub fn swap_hotkey_v2_dispatch_weight(_netuid: &Option, _keep_stake: bool) -> Weight { + Self::precharge_maximum(::WeightInfo::swap_hotkey_v2()) + } + + /// Combine operation-level storage accounting with the benchmarked CPU and + /// proof-size floor. The larger value is the real post-dispatch charge: + /// small calls retain the benchmark floor, while calls with larger + /// state fan-out pay for every storage operation actually performed. + fn actual_hotkey_swap_weight(measured: Weight) -> Weight { + measured + .max(::WeightInfo::swap_hotkey()) + .max(::WeightInfo::swap_hotkey_v2()) } /// Read and merge the old hotkey's V1/V2 stake rows once. V2 keeps the @@ -167,7 +194,9 @@ impl Pallet { let prepared_stake = if keep_stake { None } else { - Some(Self::prepare_hotkey_stake(old_hotkey)) + let prepared = Self::prepare_hotkey_stake(old_hotkey); + weight.saturating_accrue(T::DbWeight::get().reads(prepared.positions.len() as u64)); + Some(prepared) }; // Preflight collateral-index capacity before charging or writing so a @@ -304,13 +333,7 @@ impl Pallet { new_hotkey: new_hotkey.clone(), }); - // Stake-moving paths retain the generated pre-dispatch benchmark weight. - // `keep_stake` does not inspect stake prefixes and may keep its dynamic refund. - if keep_stake { - Ok(Some(weight).into()) - } else { - Ok(None.into()) - } + Ok(Some(Self::actual_hotkey_swap_weight(weight)).into()) })(); match result { @@ -577,11 +600,7 @@ impl Pallet { netuid, }); - if keep_stake { - Ok(Some(weight).into()) - } else { - Ok(None.into()) - } + Ok(Some(Self::actual_hotkey_swap_weight(weight)).into()) } // do hotkey swap public part for both swap all subnets and just swap one subnet diff --git a/pallets/subtensor/src/tests/auto_stake_hotkey.rs b/pallets/subtensor/src/tests/auto_stake_hotkey.rs index ae73d173fa..0ae7f3c02e 100644 --- a/pallets/subtensor/src/tests/auto_stake_hotkey.rs +++ b/pallets/subtensor/src/tests/auto_stake_hotkey.rs @@ -1,6 +1,7 @@ use super::mock::*; +use crate::weights::WeightInfo; use crate::*; -use frame_support::{assert_noop, assert_ok}; +use frame_support::{assert_noop, assert_ok, dispatch::GetDispatchInfo}; use sp_core::U256; use subtensor_runtime_common::NetUid; @@ -100,7 +101,7 @@ fn test_set_coldkey_auto_stake_hotkey_same_hotkey_again() { )); // Second call with same hotkey should fail - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::set_coldkey_auto_stake_hotkey( RuntimeOrigin::signed(coldkey), netuid, @@ -171,3 +172,46 @@ fn test_set_coldkey_auto_stake_hotkey_change_hotkey() { ); }); } + +#[test] +fn auto_stake_refund_uses_real_reverse_index_lengths() { + new_test_ext(1).execute_with(|| { + let owner_coldkey = U256::from(1); + let owner_hotkey = U256::from(2); + let coldkey = U256::from(10); + let old_hotkey = U256::from(11); + let new_hotkey = U256::from(12); + let netuid = add_dynamic_network(&owner_hotkey, &owner_coldkey); + + Uids::::insert(netuid, new_hotkey, 0); + AutoStakeDestination::::insert(coldkey, netuid, old_hotkey); + AutoStakeDestinationColdkeys::::insert( + old_hotkey, + netuid, + vec![U256::from(20), U256::from(21), coldkey], + ); + AutoStakeDestinationColdkeys::::insert( + new_hotkey, + netuid, + vec![U256::from(30), U256::from(31)], + ); + + let call = RuntimeCall::SubtensorModule(crate::Call::set_coldkey_auto_stake_hotkey { + netuid, + hotkey: new_hotkey, + }); + let declared_weight = call.get_dispatch_info().call_weight; + let post_info = match SubtensorModule::set_coldkey_auto_stake_hotkey( + RuntimeOrigin::signed(coldkey), + netuid, + new_hotkey, + ) { + Ok(post_info) => post_info, + Err(error) => panic!("auto-stake destination must change: {error:?}"), + }; + let actual_weight = ::WeightInfo::set_coldkey_auto_stake_hotkey(3, 2); + + assert_eq!(post_info.actual_weight, Some(actual_weight)); + assert!(actual_weight.all_lt(declared_weight)); + }); +} diff --git a/pallets/subtensor/src/tests/batch_tx.rs b/pallets/subtensor/src/tests/batch_tx.rs index 07f63c9933..cfaebebe37 100644 --- a/pallets/subtensor/src/tests/batch_tx.rs +++ b/pallets/subtensor/src/tests/batch_tx.rs @@ -1,6 +1,7 @@ use super::mock::*; use frame_support::{ assert_ok, + dispatch::GetDispatchInfo, traits::{Contains, Currency}, }; use frame_system::Config; @@ -38,6 +39,36 @@ fn test_batch_txs() { }); } +#[test] +fn test_nested_variable_work_call_refunds_from_its_own_declaration() { + let coldkey = U256::from(1); + let inner_call = RuntimeCall::SubtensorModule(crate::Call::swap_coldkey_announced { + new_coldkey: U256::from(2), + }); + let outer_call = RuntimeCall::Utility(pallet_utility::Call::batch { + calls: vec![inner_call.clone()], + }); + let declared_weight = outer_call.get_dispatch_info().call_weight; + + new_test_ext(1).execute_with(|| { + let Ok(post_info) = Utility::batch( + <::RuntimeOrigin>::signed(coldkey), + vec![inner_call], + ) else { + panic!("utility batch returns dispatch post info"); + }; + let Some(actual_weight) = post_info.actual_weight else { + panic!("utility batch reports its nested actual weight"); + }; + + assert!( + actual_weight.all_lt(declared_weight), + "nested actual weight {actual_weight:?} must refund from declaration \ + {declared_weight:?}" + ); + }); +} + #[test] fn test_cant_nest_batch_txs() { let bob = U256::from(1); diff --git a/pallets/subtensor/src/tests/children.rs b/pallets/subtensor/src/tests/children.rs index 703ecb4807..12a3d5b96e 100644 --- a/pallets/subtensor/src/tests/children.rs +++ b/pallets/subtensor/src/tests/children.rs @@ -4,11 +4,12 @@ use super::mock; use super::mock::*; use approx::assert_abs_diff_eq; -use frame_support::{assert_err, assert_noop, assert_ok}; +use frame_support::{assert_err, assert_noop, assert_ok, dispatch::GetDispatchInfo}; use substrate_fixed::types::{I64F64, I96F32}; use subtensor_runtime_common::{AlphaBalance, NetUidStorageIndex, TaoBalance}; use subtensor_swap_interface::SwapHandler; +use crate::weights::WeightInfo; use crate::{utils::rate_limiting::TransactionType, *}; use sp_core::U256; use sp_runtime::PerU16; @@ -44,6 +45,44 @@ fn test_do_set_child_singular_success() { }); } +#[test] +fn set_children_declares_and_reports_benchmarked_component_weight() { + new_test_ext(1).execute_with(|| { + let coldkey = U256::from(1); + let hotkey = U256::from(2); + let child = U256::from(3); + let netuid = NetUid::from(1); + add_network(netuid, 13, 0); + register_ok_neuron(netuid, hotkey, coldkey, 0); + + let call = RuntimeCall::SubtensorModule(crate::Call::set_children { + hotkey, + netuid, + children: vec![(u64::MAX, child)], + }); + let declared_weight = call.get_dispatch_info().call_weight; + + let post_info = match SubtensorModule::set_children( + RuntimeOrigin::signed(coldkey), + hotkey, + netuid, + vec![(u64::MAX, child)], + ) { + Ok(post_info) => post_info, + Err(error) => panic!("set_children must succeed: {error:?}"), + }; + assert_eq!( + post_info.actual_weight, + Some(::WeightInfo::set_children(1)) + ); + assert!( + post_info + .actual_weight + .is_some_and(|actual| actual.all_lt(declared_weight)) + ); + }); +} + // 2: Attempt to set child in non-existent network // SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::children::test_do_set_child_singular_network_does_not_exist --exact --show-output --nocapture #[test] @@ -2751,7 +2790,7 @@ fn test_childkey_set_weights_single_parent() { ); // Check the child cannot set weights - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::set_weights( RuntimeOrigin::signed(child), netuid, @@ -2846,7 +2885,7 @@ fn test_set_weights_no_parent() { ); // Check the hotkey cannot set weights - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::set_weights( RuntimeOrigin::signed(hotkey), netuid, diff --git a/pallets/subtensor/src/tests/claim_root.rs b/pallets/subtensor/src/tests/claim_root.rs index 02edc09097..495d39b801 100644 --- a/pallets/subtensor/src/tests/claim_root.rs +++ b/pallets/subtensor/src/tests/claim_root.rs @@ -133,7 +133,10 @@ fn test_claim_root_with_drain_emissions() { assert_abs_diff_eq!( new_stake, - (I96F32::from(root_stake) * claimable).saturating_to_num::(), + I96F32::from(root_stake) + .checked_mul(claimable) + .unwrap() + .to_num::(), epsilon = 10u64, ); @@ -1670,7 +1673,7 @@ fn test_claim_root_subnet_limits() { } #[test] -fn test_claim_root_declared_weight_covers_stored_hotkey_fanout() { +fn test_claim_root_maximum_reserve_covers_stored_hotkey_fanout() { new_test_ext(1).execute_with(|| { let owner_coldkey = U256::from(1001); let coldkey = U256::from(1003); @@ -1714,9 +1717,11 @@ fn test_claim_root_declared_weight_covers_stored_hotkey_fanout() { .actual_weight .expect("claim reports actual weight"); + let maximum_dispatch_weight = SubtensorModule::max_normal_dispatch_weight(); assert!( - actual_weight.all_lte(declared_weight), - "actual weight {actual_weight:?} exceeds declared weight {declared_weight:?}" + actual_weight.all_lte(maximum_dispatch_weight), + "actual weight {actual_weight:?} exceeds maximum dispatch reserve \ + {maximum_dispatch_weight:?}" ); let max_extrinsic = BlockWeights::get() @@ -1990,7 +1995,7 @@ fn test_claim_root_with_keep_subnets() { .expect("claimable must exist at this point"); // Claim root alpha - assert_err!( + frame_support::assert_err_ignore_postinfo!( SubtensorModule::set_root_claim_type( RuntimeOrigin::signed(coldkey), RootClaimTypeEnum::KeepSubnets { @@ -2020,7 +2025,10 @@ fn test_claim_root_with_keep_subnets() { assert_abs_diff_eq!( new_stake, - (I96F32::from(root_stake) * claimable).saturating_to_num::(), + I96F32::from(root_stake) + .checked_mul(claimable) + .unwrap() + .to_num::(), epsilon = 10u64, ); }); diff --git a/pallets/subtensor/src/tests/locks.rs b/pallets/subtensor/src/tests/locks.rs index cbf87a7901..3a6df74626 100644 --- a/pallets/subtensor/src/tests/locks.rs +++ b/pallets/subtensor/src/tests/locks.rs @@ -3981,7 +3981,7 @@ fn test_failed_coldkey_swap_extrinsic_rolls_back_state_changes() { }, ); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey( RuntimeOrigin::root(), old_coldkey, diff --git a/pallets/subtensor/src/tests/mechanism.rs b/pallets/subtensor/src/tests/mechanism.rs index 764e67617e..60d71a2afe 100644 --- a/pallets/subtensor/src/tests/mechanism.rs +++ b/pallets/subtensor/src/tests/mechanism.rs @@ -39,6 +39,7 @@ use super::mock::*; use crate::coinbase::reveal_commits::WeightsTlockPayload; use crate::subnets::mechanism::{GLOBAL_MAX_SUBNET_COUNT, MAX_MECHANISM_COUNT_PER_SUBNET}; +use crate::weights::WeightInfo; use crate::*; use alloc::collections::BTreeMap; use approx::assert_abs_diff_eq; @@ -1066,14 +1067,20 @@ fn test_set_mechanism_weights_happy_path_sets_row_under_subid() { // Call extrinsic let dests = vec![uid2, uid3]; let weights = vec![88u16, 0xFFFF]; - assert_ok!(SubtensorModule::set_mechanism_weights( - RawOrigin::Signed(hk1).into(), - netuid, - mecid, - dests.clone(), - weights.clone(), - 0, // version_key - )); + assert_ok!( + SubtensorModule::set_mechanism_weights( + RawOrigin::Signed(hk1).into(), + netuid, + mecid, + dests.clone(), + weights.clone(), + 0, // version_key + ) + .map(|post_info| post_info.actual_weight), + Some(::WeightInfo::set_mechanism_weights( + dests.len() as u32 + )) + ); // Verify row exists under the chosen mecid and not under a different mecid let idx1 = SubtensorModule::get_mechanism_storage_index(netuid, mecid); @@ -1123,7 +1130,7 @@ fn test_set_mechanism_weights_above_mechanism_count_fails() { // Call extrinsic let dests = vec![uid2]; let weights = vec![88u16]; - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::set_mechanism_weights( RawOrigin::Signed(hk1).into(), netuid, @@ -1204,15 +1211,22 @@ fn test_commit_reveal_mechanism_weights_ok() { // Advance one epoch, then reveal step_epochs(1, netuid); - assert_ok!(SubtensorModule::reveal_mechanism_weights( - RuntimeOrigin::signed(hk1), - netuid, - mecid, - dests.clone(), - weights.clone(), - salt, - version_key - )); + assert_ok!( + SubtensorModule::reveal_mechanism_weights( + RuntimeOrigin::signed(hk1), + netuid, + mecid, + dests.clone(), + weights.clone(), + salt, + version_key + ) + .map(|post_info| post_info.actual_weight), + Some(::WeightInfo::reveal_mechanism_weights( + dests.len() as u32, + 1, + )) + ); // Verify weights stored under the chosen mecid (normalized keeps max=0xFFFF here) assert_eq!( @@ -1278,7 +1292,7 @@ fn test_commit_reveal_above_mechanism_count_fails() { )); // Commit in epoch 0 - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::commit_mechanism_weights( RuntimeOrigin::signed(hk1), netuid, @@ -1290,7 +1304,7 @@ fn test_commit_reveal_above_mechanism_count_fails() { // Advance one epoch, then attempt to reveal step_epochs(1, netuid); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::reveal_mechanism_weights( RuntimeOrigin::signed(hk1), netuid, @@ -1474,7 +1488,7 @@ fn test_crv3_above_mechanism_count_fails() { ct.serialize_compressed(&mut commit_bytes).expect("serialize"); // Commit (sub variant) - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::commit_timelocked_mechanism_weights( RuntimeOrigin::signed(hotkey1), netuid, @@ -1531,7 +1545,7 @@ fn test_do_commit_crv3_mechanism_weights_committing_too_fast() { )); // immediate second commit on SAME mecid blocked - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::commit_timelocked_mechanism_weights( RuntimeOrigin::signed(hotkey), netuid, @@ -1558,7 +1572,7 @@ fn test_do_commit_crv3_mechanism_weights_committing_too_fast() { // still too fast on original mecid after 2 blocks step_block(2); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::commit_timelocked_mechanism_weights( RuntimeOrigin::signed(hotkey), netuid, diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index d9ab976293..32ec476c73 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -208,6 +208,8 @@ impl system::Config for Test { parameter_types! { pub const BlockHashCount: u64 = 250; pub const SS58Prefix: u8 = 42; + pub MaxTransactionExtensionWeight: Weight = + <() as crate::weights::WeightInfo>::check_coldkey_swap_extension(); } pub const MOCK_BLOCK_BUILDER: u64 = 12345u64; @@ -390,6 +392,7 @@ impl crate::Config for Test { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = MaxEpochsPerBlock; type WeightInfo = (); + type MaxTransactionExtensionWeight = MaxTransactionExtensionWeight; } // Swap-related parameter types diff --git a/pallets/subtensor/src/tests/mock_high_ed.rs b/pallets/subtensor/src/tests/mock_high_ed.rs index f991cab592..5867278f14 100644 --- a/pallets/subtensor/src/tests/mock_high_ed.rs +++ b/pallets/subtensor/src/tests/mock_high_ed.rs @@ -130,6 +130,8 @@ impl system::Config for Test { parameter_types! { pub const BlockHashCount: u64 = 250; pub const SS58Prefix: u8 = 42; + pub MaxTransactionExtensionWeight: Weight = + <() as crate::weights::WeightInfo>::check_coldkey_swap_extension(); } pub const MOCK_BLOCK_BUILDER: u64 = 12345u64; @@ -312,6 +314,7 @@ impl crate::Config for Test { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = MaxEpochsPerBlock; type WeightInfo = (); + type MaxTransactionExtensionWeight = MaxTransactionExtensionWeight; } // Swap-related parameter types diff --git a/pallets/subtensor/src/tests/mod.rs b/pallets/subtensor/src/tests/mod.rs index bbf2c4404a..9d8799797d 100644 --- a/pallets/subtensor/src/tests/mod.rs +++ b/pallets/subtensor/src/tests/mod.rs @@ -1,3 +1,46 @@ +trait DispatchErrorValue { + fn dispatch_error(self) -> sp_runtime::DispatchError; +} + +impl DispatchErrorValue for sp_runtime::DispatchError { + fn dispatch_error(self) -> sp_runtime::DispatchError { + self + } +} + +impl DispatchErrorValue for frame_support::dispatch::DispatchErrorWithPostInfo { + fn dispatch_error(self) -> sp_runtime::DispatchError { + self.error + } +} + +macro_rules! assert_dispatch_err { + ($call:expr, $error:expr $(,)?) => {{ + let actual = match $call { + Ok(_) => panic!("expected dispatch error"), + Err(error) => crate::tests::DispatchErrorValue::dispatch_error(error), + }; + let expected: sp_runtime::DispatchError = $error.into(); + assert_eq!(actual, expected); + }}; +} + +/// Assert a post-info dispatch error without discarding the storage no-op +/// guarantee. Variable-weight dispatches legitimately attach `actual_weight` +/// to errors, so FRAME's `assert_noop!` is too strict for these calls. +macro_rules! assert_noop_ignore_postinfo { + ($call:expr, $error:expr $(,)?) => {{ + let storage_root = + frame_support::__private::storage_root(frame_support::__private::StateVersion::V1); + assert_dispatch_err!($call, $error); + assert_eq!( + storage_root, + frame_support::__private::storage_root(frame_support::__private::StateVersion::V1), + "storage has been mutated" + ); + }}; +} + mod auto_stake_hotkey; mod batch_tx; mod children; diff --git a/pallets/subtensor/src/tests/staking.rs b/pallets/subtensor/src/tests/staking.rs index 19af1e22b7..0dc50d5081 100644 --- a/pallets/subtensor/src/tests/staking.rs +++ b/pallets/subtensor/src/tests/staking.rs @@ -17,6 +17,7 @@ use subtensor_swap_interface::{Order, SwapHandler}; use super::mock; use super::mock::*; +use crate::weights::WeightInfo as _; use crate::*; /*********************************************************** @@ -4509,7 +4510,7 @@ fn test_unstake_all_alpha_hits_liquidity_min() { // Try to unstake, but we reduce liquidity too far - assert_err!( + frame_support::assert_err_ignore_postinfo!( SubtensorModule::unstake_all_alpha(RuntimeOrigin::signed(coldkey), hotkey), Error::::AmountTooLow ); @@ -4551,10 +4552,16 @@ fn test_unstake_all_alpha_works() { ); // Unstake all alpha to root - assert_ok!(SubtensorModule::unstake_all_alpha( - RuntimeOrigin::signed(coldkey), - hotkey, - )); + let subnet_count = u32::from(TotalNetworks::::get()); + let post_info = + SubtensorModule::unstake_all_alpha(RuntimeOrigin::signed(coldkey), hotkey).unwrap(); + assert_eq!( + post_info.actual_weight, + Some( + ::WeightInfo::unstake_all_alpha(subnet_count) + .saturating_add(::DbWeight::get().reads(1)) + ) + ); let new_alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet(&hotkey, &coldkey, netuid); @@ -4597,10 +4604,16 @@ fn test_unstake_all_works() { u64::from(stake_amount * 100.into()).into(), ); // Unstake all alpha to free balance - assert_ok!(SubtensorModule::unstake_all( - RuntimeOrigin::signed(coldkey), - hotkey, - )); + let subnet_count = u32::from(TotalNetworks::::get()); + let post_info = + SubtensorModule::unstake_all(RuntimeOrigin::signed(coldkey), hotkey).unwrap(); + assert_eq!( + post_info.actual_weight, + Some( + ::WeightInfo::unstake_all(subnet_count) + .saturating_add(::DbWeight::get().reads(1)) + ) + ); let new_alpha = SubtensorModule::get_stake_for_hotkey_and_coldkey_on_subnet(&hotkey, &coldkey, netuid); diff --git a/pallets/subtensor/src/tests/subnet.rs b/pallets/subtensor/src/tests/subnet.rs index be1487b4ec..7c2c8d61e6 100644 --- a/pallets/subtensor/src/tests/subnet.rs +++ b/pallets/subtensor/src/tests/subnet.rs @@ -479,7 +479,7 @@ fn test_subtoken_enable_reject_trading_before_enable() { ); // For unstake_all_alpha, the result is AmountTooLow because no re-staking happens. - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::unstake_all_alpha( RuntimeOrigin::signed(coldkey_account_id), hotkey_account_id diff --git a/pallets/subtensor/src/tests/swap_coldkey.rs b/pallets/subtensor/src/tests/swap_coldkey.rs index 18edc2098e..cc62062b92 100644 --- a/pallets/subtensor/src/tests/swap_coldkey.rs +++ b/pallets/subtensor/src/tests/swap_coldkey.rs @@ -302,7 +302,7 @@ fn test_swap_coldkey_announced_without_announcement_fails() { let who = U256::from(1); let new_coldkey = U256::from(2); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey_announced(RuntimeOrigin::signed(who), new_coldkey), Error::::ColdkeySwapAnnouncementNotFound ); @@ -320,7 +320,7 @@ fn test_swap_coldkey_announced_with_mismatched_coldkey_hash_fails() { ColdkeySwapAnnouncements::::insert(who, (now, new_coldkey_hash)); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey_announced(RuntimeOrigin::signed(who), other_coldkey), Error::::AnnouncedColdkeyHashDoesNotMatch ); @@ -339,7 +339,7 @@ fn test_swap_coldkey_announced_too_early_fails() { let delay = ColdkeySwapAnnouncementDelay::::get(); ColdkeySwapAnnouncements::::insert(who, (now + delay, new_coldkey_hash)); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey_announced( ::RuntimeOrigin::signed(who), new_coldkey @@ -350,7 +350,7 @@ fn test_swap_coldkey_announced_too_early_fails() { // Now + delay - 1 case run_to_block(now + delay - 1); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey_announced( ::RuntimeOrigin::signed(who), new_coldkey @@ -383,7 +383,7 @@ fn test_swap_coldkey_announced_with_already_associated_coldkey_fails() { SubtensorModule::create_account_if_non_existent(&new_coldkey, &hotkey); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey_announced( ::RuntimeOrigin::signed(who), new_coldkey @@ -410,7 +410,7 @@ fn test_swap_coldkey_announced_with_hotkey_fails() { SubtensorModule::create_account_if_non_existent(&new_coldkey, &hotkey); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey_announced( ::RuntimeOrigin::signed(who), hotkey @@ -711,7 +711,7 @@ fn test_swap_coldkey_with_not_enough_balance_to_pay_swap_cost_fails() { let swap_cost = SubtensorModule::get_key_swap_cost(); // No balance to pay swap cost - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey( RuntimeOrigin::root(), old_coldkey, @@ -725,7 +725,7 @@ fn test_swap_coldkey_with_not_enough_balance_to_pay_swap_cost_fails() { let balance = SubtensorModule::get_key_swap_cost() + ExistentialDeposit::get() - 1.into(); add_balance_to_coldkey_account(&old_coldkey, balance); - assert_noop!( + assert_noop_ignore_postinfo!( SubtensorModule::swap_coldkey( RuntimeOrigin::root(), old_coldkey, diff --git a/pallets/subtensor/src/tests/weights.rs b/pallets/subtensor/src/tests/weights.rs index 23318eca4a..7dd266b39c 100644 --- a/pallets/subtensor/src/tests/weights.rs +++ b/pallets/subtensor/src/tests/weights.rs @@ -4,8 +4,8 @@ use ark_serialize::CanonicalDeserialize; use ark_serialize::CanonicalSerialize; use codec::Compact; use frame_support::{ - assert_err, assert_ok, - dispatch::{DispatchClass, DispatchResult, GetDispatchInfo, Pays}, + assert_ok, + dispatch::{DispatchClass, DispatchResult, DispatchResultWithPostInfo, GetDispatchInfo, Pays}, }; use pallet_drand::types::Pulse; use rand_chacha::{ChaCha20Rng, rand_core::SeedableRng}; @@ -31,6 +31,25 @@ use w3f_bls::EngineBLS; use super::mock::*; use crate::coinbase::reveal_commits::{LegacyWeightsTlockPayload, WeightsTlockPayload}; use crate::*; + +// Variable-weight dispatches attach their measured weight on both success and +// failure. Compare the dispatch error while deliberately leaving post info out +// of legacy error assertions. +macro_rules! assert_err { + ($call:expr, $error:expr $(,)?) => { + assert_dispatch_err!($call, $error) + }; +} + +fn assert_weighted_dispatch_error(result: DispatchResultWithPostInfo, expected: Error) { + let error = result.expect_err("dispatch should fail"); + assert_eq!(error.error, expected.into()); + assert!( + error.post_info.actual_weight.is_some(), + "variable-weight failures must report actual weight" + ); +} + /*************************** pub fn set_weights() tests *****************************/ @@ -154,7 +173,7 @@ fn test_weights_err_no_validator_permit() { weight_values, 0, ); - assert_eq!(result, Err(Error::::NeuronNoValidatorPermit.into())); + assert_weighted_dispatch_error(result, Error::::NeuronNoValidatorPermit); let weights_keys: Vec = vec![1, 2]; let weight_values: Vec = vec![1, 2]; @@ -209,7 +228,7 @@ fn test_set_stake_threshold_failed() { // Check that it fails at the pallet level. SubtensorModule::set_stake_threshold(100_000_000_000_000); - assert_eq!( + assert_weighted_dispatch_error( SubtensorModule::set_weights( RuntimeOrigin::signed(hotkey), netuid, @@ -217,7 +236,7 @@ fn test_set_stake_threshold_failed() { weights.clone(), version_key, ), - Err(Error::::NotEnoughStakeToSetWeights.into()) + Error::::NotEnoughStakeToSetWeights, ); // Now passes assert_ok!(SubtensorModule::do_add_stake( @@ -301,15 +320,15 @@ fn test_weights_version_key() { // Setting fails with incorrect keys. // validator:12312 < network:20313 (rejected: validator not updated) - assert_eq!( + assert_weighted_dispatch_error( SubtensorModule::set_weights( RuntimeOrigin::signed(hotkey), netuid1, weights_keys.clone(), weight_values.clone(), - key0 + key0, ), - Err(Error::::IncorrectWeightVersionKey.into()) + Error::::IncorrectWeightVersionKey, ); }); } @@ -369,7 +388,7 @@ fn test_weights_err_setting_weights_too_fast() { if i % 10 == 1 { assert_ok!(result); } else { - assert_eq!(result, Err(Error::::SettingWeightsTooFast.into())); + assert_weighted_dispatch_error(result, Error::::SettingWeightsTooFast); } run_to_block(i + 1); } @@ -476,7 +495,10 @@ fn test_no_signature() { let values: Vec = vec![]; SubtensorModule::set_commit_reveal_weights_enabled(1.into(), false); let result = SubtensorModule::set_weights(RuntimeOrigin::none(), 1.into(), uids, values, 0); - assert_eq!(result, Err(DispatchError::BadOrigin)); + assert_eq!( + result.map_err(|error| error.error), + Err(DispatchError::BadOrigin) + ); }); } @@ -586,7 +608,7 @@ fn test_set_weight_not_enough_values() { weight_values, 0, ); - assert_eq!(result, Err(Error::::WeightVecLengthIsLow.into())); + assert_weighted_dispatch_error(result, Error::::WeightVecLengthIsLow); // Shouldnt fail because we setting a single value but it is the self weight. let weight_keys: Vec = vec![0]; // self weight. @@ -640,10 +662,7 @@ fn test_set_weight_too_many_uids() { weight_values, 0, ); - assert_eq!( - result, - Err(Error::::UidsLengthExceedUidsInSubNet.into()) - ); + assert_weighted_dispatch_error(result, Error::::UidsLengthExceedUidsInSubNet); // Shouldnt fail because we are setting less weights than there are neurons. let weight_keys: Vec = vec![0, 1]; // Only on neurons that exist. @@ -2118,7 +2137,8 @@ fn commit_reveal_set_weights( version_key, )); - SubtensorModule::commit_weights(RuntimeOrigin::signed(hotkey), netuid, commit_hash)?; + SubtensorModule::commit_weights(RuntimeOrigin::signed(hotkey), netuid, commit_hash) + .map_err(|error| error.error)?; step_epochs(1, netuid); @@ -2129,7 +2149,8 @@ fn commit_reveal_set_weights( weights, salt, version_key, - )?; + ) + .map_err(|error| error.error)?; Ok(()) } @@ -3636,9 +3657,10 @@ fn test_highly_concurrent_commits_and_reveals_with_multiple_hotkeys() { commits.remove(0); } Err(e) => { - if e == Error::::RevealTooEarly.into() - || e == Error::::ExpiredWeightCommit.into() - || e == Error::::InvalidRevealCommitHashNotMatch.into() + if e.error == Error::::RevealTooEarly.into() + || e.error == Error::::ExpiredWeightCommit.into() + || e.error + == Error::::InvalidRevealCommitHashNotMatch.into() { log::info!("Expected error during reveal after epoch advancement: {e:?}"); } else { @@ -3681,9 +3703,10 @@ fn test_highly_concurrent_commits_and_reveals_with_multiple_hotkeys() { } Err(e) => { // Check if the error is due to reveal being too early or commit expired - if e == Error::::RevealTooEarly.into() - || e == Error::::ExpiredWeightCommit.into() - || e == Error::::InvalidRevealCommitHashNotMatch.into() + if e.error == Error::::RevealTooEarly.into() + || e.error == Error::::ExpiredWeightCommit.into() + || e.error + == Error::::InvalidRevealCommitHashNotMatch.into() { log::info!("Expected error during reveal after epoch advancement: {e:?}"); break; @@ -3710,20 +3733,19 @@ fn test_highly_concurrent_commits_and_reveals_with_multiple_hotkeys() { for (_commit_hash, salt, uids, values, version_key) in commits.iter() { let reveal_result = SubtensorModule::reveal_weights( RuntimeOrigin::signed(*hotkey), - netuid, + netuid, uids.clone(), values.clone(), salt.clone(), *version_key, ); - assert_eq!( + assert_dispatch_err!( reveal_result, - Err(Error::::ExpiredWeightCommit.into()), - "Expected ExpiredWeightCommit error, got {reveal_result:?}" + Error::::ExpiredWeightCommit ); } -} + } for hotkey in &hotkeys { commit_info_map.insert(*hotkey, Vec::new()); @@ -6113,7 +6135,7 @@ fn test_subnet_owner_can_validate_without_stake_or_manual_permit() { &[owner_uid], &[1u16], )); - assert_eq!( + assert_weighted_dispatch_error( SubtensorModule::set_weights( RuntimeOrigin::signed(other_hotkey), netuid, @@ -6121,7 +6143,7 @@ fn test_subnet_owner_can_validate_without_stake_or_manual_permit() { vec![1u16], 0, ), - Err(Error::::NeuronNoValidatorPermit.into()) + Error::::NeuronNoValidatorPermit, ); // The subnet owner bypasses both the stake gate and the validator-permit gate. diff --git a/pallets/subtensor/src/weight_accounting.rs b/pallets/subtensor/src/weight_accounting.rs new file mode 100644 index 0000000000..7c649a511d --- /dev/null +++ b/pallets/subtensor/src/weight_accounting.rs @@ -0,0 +1,103 @@ +use codec::Decode; +use frame_support::{ + dispatch::{ + DispatchErrorWithPostInfo, DispatchResult, DispatchResultWithPostInfo, PostDispatchInfo, + }, + weights::Weight, +}; + +/// Read the SCALE collection length prefix without decoding the full storage value. +pub(crate) fn encoded_collection_len(storage_key: &[u8]) -> u32 { + let mut prefix = [0_u8; 5]; + let Some(encoded_len) = sp_io::storage::read(storage_key, &mut prefix, 0) else { + return 0; + }; + let prefix_len = usize::try_from(encoded_len) + .unwrap_or(prefix.len()) + .min(prefix.len()); + let mut encoded_prefix = prefix.get(..prefix_len).unwrap_or_default(); + codec::Compact::::decode(&mut encoded_prefix) + .map(|length| length.0) + .unwrap_or_default() +} + +/// Attach measured post-dispatch weight regardless of dispatch outcome. +pub(crate) trait WithBenchmarkWeight { + fn with_benchmark_weight(self, actual_weight: Weight) -> DispatchResultWithPostInfo; +} + +impl WithBenchmarkWeight for DispatchResult { + fn with_benchmark_weight(self, actual_weight: Weight) -> DispatchResultWithPostInfo { + let post_info = PostDispatchInfo { + actual_weight: Some(actual_weight), + ..Default::default() + }; + match self { + Ok(()) => Ok(post_info), + Err(error) => Err(DispatchErrorWithPostInfo { post_info, error }), + } + } +} + +#[cfg(test)] +mod tests { + use super::WithBenchmarkWeight; + use frame_support::{ + dispatch::{DispatchResult, Pays}, + weights::Weight, + }; + use sp_runtime::DispatchError; + + #[test] + fn attaches_actual_weight_to_successful_dispatch() { + let actual_weight = Weight::from_parts(123, 456); + let result: DispatchResult = Ok(()); + + let post_info = match result.with_benchmark_weight(actual_weight) { + Ok(post_info) => post_info, + Err(_) => panic!("dispatch must remain successful"), + }; + + assert_eq!(post_info.actual_weight, Some(actual_weight)); + assert_eq!(post_info.pays_fee, Pays::Yes); + } + + #[test] + fn attaches_actual_weight_to_failed_dispatch() { + let actual_weight = Weight::from_parts(123, 456); + let result: DispatchResult = Err(DispatchError::Other("expected failure")); + + let error = match result.with_benchmark_weight(actual_weight) { + Err(error) => error, + Ok(_) => panic!("dispatch must remain failed"), + }; + + assert_eq!(error.post_info.actual_weight, Some(actual_weight)); + assert_eq!(error.post_info.pays_fee, Pays::Yes); + assert_eq!(error.error, DispatchError::Other("expected failure")); + } + + #[test] + fn attaches_zero_actual_weight() { + let result: DispatchResult = Ok(()); + + let post_info = match result.with_benchmark_weight(Weight::zero()) { + Ok(post_info) => post_info, + Err(_) => panic!("dispatch must remain successful"), + }; + + assert_eq!(post_info.actual_weight, Some(Weight::zero())); + } + + #[test] + fn attaches_max_actual_weight_without_clamping() { + let result: DispatchResult = Ok(()); + + let post_info = match result.with_benchmark_weight(Weight::MAX) { + Ok(post_info) => post_info, + Err(_) => panic!("dispatch must remain successful"), + }; + + assert_eq!(post_info.actual_weight, Some(Weight::MAX)); + } +} diff --git a/pallets/subtensor/src/weights.rs b/pallets/subtensor/src/weights.rs index 63bd54336a..fa6519150e 100644 --- a/pallets/subtensor/src/weights.rs +++ b/pallets/subtensor/src/weights.rs @@ -37,24 +37,24 @@ use core::marker::PhantomData; /// Weight functions needed for `pallet_subtensor`. pub trait WeightInfo { fn register() -> Weight; - fn set_weights() -> Weight; + fn set_weights(n: u32, ) -> Weight; fn add_stake() -> Weight; fn serve_axon() -> Weight; fn serve_prometheus() -> Weight; fn burned_register() -> Weight; fn root_register() -> Weight; fn register_network() -> Weight; - fn commit_weights() -> Weight; - fn reveal_weights() -> Weight; + fn commit_weights(q: u32, ) -> Weight; + fn reveal_weights(n: u32, q: u32, ) -> Weight; fn sudo_set_tx_childkey_take_rate_limit() -> Weight; fn set_childkey_take() -> Weight; fn announce_coldkey_swap() -> Weight; - fn swap_coldkey_announced() -> Weight; - fn swap_coldkey() -> Weight; + fn swap_coldkey_announced(w: u32, ) -> Weight; + fn swap_coldkey(w: u32, ) -> Weight; fn dispute_coldkey_swap() -> Weight; fn clear_coldkey_swap_announcement() -> Weight; fn reset_coldkey_swap() -> Weight; - fn batch_reveal_weights() -> Weight; + fn batch_reveal_weights(b: u32, ) -> Weight; fn recycle_alpha() -> Weight; fn burn_alpha() -> Weight; fn block_step() -> Weight; @@ -69,26 +69,26 @@ pub trait WeightInfo { fn add_collateral() -> Weight; fn set_min_collateral() -> Weight; fn swap_stake() -> Weight; - fn batch_commit_weights() -> Weight; - fn batch_set_weights() -> Weight; + fn batch_commit_weights(b: u32, ) -> Weight; + fn batch_set_weights(b: u32, ) -> Weight; fn decrease_take() -> Weight; fn increase_take() -> Weight; - fn register_network_with_identity() -> Weight; - fn serve_axon_tls() -> Weight; - fn set_identity() -> Weight; - fn set_subnet_identity() -> Weight; + fn register_network_with_identity(i: u32, ) -> Weight; + fn serve_axon_tls(c: u32, ) -> Weight; + fn set_identity(i: u32, ) -> Weight; + fn set_subnet_identity(i: u32, ) -> Weight; fn swap_hotkey() -> Weight; fn try_associate_hotkey() -> Weight; - fn unstake_all() -> Weight; - fn unstake_all_alpha() -> Weight; + fn unstake_all(n: u32, ) -> Weight; + fn unstake_all_alpha(n: u32, ) -> Weight; fn remove_stake_full_limit() -> Weight; fn register_leased_network(k: u32, ) -> Weight; fn terminate_lease(k: u32, ) -> Weight; fn update_symbol() -> Weight; - fn commit_timelocked_weights() -> Weight; - fn set_coldkey_auto_stake_hotkey() -> Weight; - fn set_root_claim_type() -> Weight; - fn claim_root() -> Weight; + fn commit_timelocked_weights(c: u32, q: u32, ) -> Weight; + fn set_coldkey_auto_stake_hotkey(o: u32, n: u32, ) -> Weight; + fn set_root_claim_type(s: u32, ) -> Weight; + fn claim_root(h: u32, s: u32, ) -> Weight; fn sudo_set_num_root_claims() -> Weight; fn sudo_set_root_claim_threshold() -> Weight; fn set_auto_parent_delegation_enabled() -> Weight; @@ -105,10 +105,10 @@ pub trait WeightInfo { fn check_serving_endpoints_extension() -> Weight; fn check_evm_key_association_extension() -> Weight; fn set_mechanism_weights(n: u32, ) -> Weight; - fn commit_mechanism_weights() -> Weight; - fn reveal_mechanism_weights(n: u32, ) -> Weight; - fn commit_crv3_mechanism_weights() -> Weight; - fn commit_timelocked_mechanism_weights() -> Weight; + fn commit_mechanism_weights(q: u32, ) -> Weight; + fn reveal_mechanism_weights(n: u32, q: u32, ) -> Weight; + fn commit_crv3_mechanism_weights(c: u32, q: u32, ) -> Weight; + fn commit_timelocked_mechanism_weights(c: u32, q: u32, ) -> Weight; fn swap_hotkey_v2() -> Weight; fn sudo_set_min_childkey_take() -> Weight; fn sudo_set_max_childkey_take() -> Weight; @@ -227,6 +227,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Swap::SwapBalancer` (r:0 w:1) @@ -235,10 +237,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `289875` // Estimated: `926940` - // Minimum execution time: 2_761_000_000 picoseconds. - Weight::from_parts(364_683_000, 6148) - .saturating_add(T::DbWeight::get().reads(34_u64)) - .saturating_add(T::DbWeight::get().writes(29_u64)) + // Minimum execution time: 5_410_239_000 picoseconds. + Weight::from_parts(5_451_619_000, 926940) + .saturating_add(T::DbWeight::get().reads(814_u64)) + .saturating_add(T::DbWeight::get().writes(294_u64)) } /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -264,7 +266,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:4096 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -274,14 +276,19 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `188820` - // Estimated: `10327410` - // Minimum execution time: 7_637_000_000 picoseconds. - Weight::from_parts(8_632_000_000, 10327410) - .saturating_add(T::DbWeight::get().reads(4112_u64)) + /// The range of component `n` is `[1, 256]`. + fn set_weights(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1946 + n * (48 ±0)` + // Estimated: `7770 + n * (2524 ±0)` + // Minimum execution time: 96_213_000 picoseconds. + Weight::from_parts(106_270_857, 7770) + // Standard Error: 6_960 + .saturating_add(Weight::from_parts(3_035_677, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(16_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2524).saturating_mul(n.into())) } /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:0) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -349,8 +356,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2304` // Estimated: `8727` - // Minimum execution time: 301_000_000 picoseconds. - Weight::from_parts(310_000_000, 8727) + // Minimum execution time: 672_791_000 picoseconds. + Weight::from_parts(690_027_000, 8727) .saturating_add(T::DbWeight::get().reads(32_u64)) .saturating_add(T::DbWeight::get().writes(16_u64)) } @@ -366,8 +373,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `828` // Estimated: `4293` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 4293) + // Minimum execution time: 34_521_000 picoseconds. + Weight::from_parts(35_733_000, 4293) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -383,8 +390,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `927` // Estimated: `4392` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 4392) + // Minimum execution time: 33_079_000 picoseconds. + Weight::from_parts(33_860_000, 4392) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -434,10 +441,12 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::MinNonImmuneUids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::FeeRate` (r:1 w:0) - /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:1 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// Storage: `Swap::FeeRate` (r:1 w:0) + /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetAlphaOut` (r:1 w:1) @@ -460,6 +469,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:1 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CollateralDrainRatio` (r:1 w:0) /// Proof: `SubtensorModule::CollateralDrainRatio` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:1 w:1) @@ -504,20 +515,20 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::SwapBalancer` (r:0 w:1) - /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) fn burned_register() -> Weight { // Proof Size summary in bytes: // Measured: `289277` // Estimated: `926342` - // Minimum execution time: 2_807_000_000 picoseconds. - Weight::from_parts(365_124_000, 6148) - .saturating_add(T::DbWeight::get().reads(34_u64)) - .saturating_add(T::DbWeight::get().writes(29_u64)) + // Minimum execution time: 5_567_739_000 picoseconds. + Weight::from_parts(5_597_854_000, 926342) + .saturating_add(T::DbWeight::get().reads(825_u64)) + .saturating_add(T::DbWeight::get().writes(300_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -583,34 +594,36 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) fn root_register() -> Weight { // Proof Size summary in bytes: // Measured: `29210` // Estimated: `191075` - // Minimum execution time: 566_000_000 picoseconds. - Weight::from_parts(621_000_000, 191075) + // Minimum execution time: 1_038_104_000 picoseconds. + Weight::from_parts(1_052_875_000, 191075) .saturating_add(T::DbWeight::get().reads(219_u64)) - .saturating_add(T::DbWeight::get().writes(88_u64)) + .saturating_add(T::DbWeight::get().writes(89_u64)) } - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRegistrationStartBlock` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRegistrationStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRateLimit` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:1) + /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:0) /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetLimit` (r:1 w:0) /// Proof: `SubtensorModule::SubnetLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:1) + /// Storage: `SubtensorModule::NetworksAdded` (r:4097 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:0) + /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:1) /// Proof: `SubtensorModule::NetworkRegistrationQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:1) + /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:0) /// Proof: `SubtensorModule::NetworkLastLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkMinLockCost` (r:1 w:0) /// Proof: `SubtensorModule::NetworkMinLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -618,105 +631,33 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::NetworkLockReductionInterval` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:0) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:2 w:2) + /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:1) + /// Storage: `SubtensorModule::NetworkRegistrationLockId` (r:1 w:1) + /// Proof: `SubtensorModule::NetworkRegistrationLockId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(899), added: 3374, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(499), added: 2974, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:4095 w:0) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:0) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:0) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Swap::SwapBalancer` (r:1 w:0) /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:1) - /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Kappa` (r:1 w:1) - /// Proof: `SubtensorModule::Kappa` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ActivityCutoff` (r:1 w:1) - /// Proof: `SubtensorModule::ActivityCutoff` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegistrationsThisInterval` (r:1 w:1) - /// Proof: `SubtensorModule::RegistrationsThisInterval` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Active` (r:1 w:1) - /// Proof: `SubtensorModule::Active` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Emission` (r:1 w:1) - /// Proof: `SubtensorModule::Emission` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Consensus` (r:1 w:1) - /// Proof: `SubtensorModule::Consensus` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) - /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Incentive` (r:1 w:1) - /// Proof: `SubtensorModule::Incentive` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) - /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Dividends` (r:1 w:1) - /// Proof: `SubtensorModule::Dividends` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorTrust` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorTrust` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegisteredSubnetCounter` (r:1 w:1) - /// Proof: `SubtensorModule::RegisteredSubnetCounter` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) - /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) - /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:1) - /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Burn` (r:0 w:1) - /// Proof: `SubtensorModule::Burn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RAORecycledForRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::RAORecycledForRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetLocked` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegisteredAt` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegisteredAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetVolume` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlockAtRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::BlockAtRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinAllowedWeights` (r:0 w:1) - /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedValidators` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedValidators` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:0 w:1) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaOut` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:0 w:1) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:0 w:1) - /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ImmunityPeriod` (r:0 w:1) - /// Proof: `SubtensorModule::ImmunityPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEmissionEnabled` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetEmissionEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationAllowed` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegistrationAllowed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Yuma3On` (r:0 w:1) - /// Proof: `SubtensorModule::Yuma3On` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:1) - /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedUids` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedUids` (`max_values`: None, `max_size`: None, mode: `Measured`) fn register_network() -> Weight { // Proof Size summary in bytes: - // Measured: `1532` - // Estimated: `9947` - // Minimum execution time: 145_000_000 picoseconds. - Weight::from_parts(153_000_000, 9947) - .saturating_add(T::DbWeight::get().reads(41_u64)) - .saturating_add(T::DbWeight::get().writes(48_u64)) + // Measured: `26204` + // Estimated: `10167269` + // Minimum execution time: 24_850_246_000 picoseconds. + Weight::from_parts(25_084_210_000, 10167269) + .saturating_add(T::DbWeight::get().reads(8210_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -739,25 +680,29 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:1 w:0) + /// Proof: `SubtensorModule::RevealPeriodEpochs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1249` - // Estimated: `4714` - // Minimum execution time: 35_000_000 picoseconds. - Weight::from_parts(36_000_000, 4714) - .saturating_add(T::DbWeight::get().reads(13_u64)) + /// The range of component `q` is `[0, 9]`. + fn commit_weights(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1329 + q * (56 ±0)` + // Estimated: `4793 + q * (56 ±0)` + // Minimum execution time: 73_549_000 picoseconds. + Weight::from_parts(80_888_761, 4793) + // Standard Error: 143_240 + .saturating_add(Weight::from_parts(1_154_761, 0).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 56).saturating_mul(q.into())) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Tempo` (r:1 w:0) @@ -784,20 +729,31 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:0) + /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Keys` (r:256 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn reveal_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1650` - // Estimated: `7590` - // Minimum execution time: 56_000_000 picoseconds. - Weight::from_parts(58_000_000, 7590) + /// The range of component `n` is `[1, 256]`. + /// The range of component `q` is `[1, 10]`. + fn reveal_weights(n: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2056 + n * (40 ±0) + q * (56 ±0)` + // Estimated: `7858 + n * (2516 ±0) + q * (63 ±1)` + // Minimum execution time: 119_107_000 picoseconds. + Weight::from_parts(106_415_328, 7858) + // Standard Error: 7_839 + .saturating_add(Weight::from_parts(3_201_505, 0).saturating_mul(n.into())) + // Standard Error: 208_872 + .saturating_add(Weight::from_parts(1_814_190, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(19_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2516).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 63).saturating_mul(q.into())) } /// Storage: `SubtensorModule::TxChildkeyTakeRateLimit` (r:0 w:1) /// Proof: `SubtensorModule::TxChildkeyTakeRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -805,8 +761,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 5_320_000 picoseconds. + Weight::from_parts(5_771_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -829,8 +785,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1033` // Estimated: `4498` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(28_000_000, 4498) + // Minimum execution time: 51_987_000 picoseconds. + Weight::from_parts(53_469_000, 4498) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -846,41 +802,51 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `694` // Estimated: `4159` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 4159) + // Minimum execution time: 43_134_000 picoseconds. + Weight::from_parts(43_885_000, 4159) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } - /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:1) - /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingHotkeys` (r:2 w:2) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) + /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:2) + /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Owner` (r:1 w:255) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IdentitiesV2` (r:2 w:0) /// Proof: `SubtensorModule::IdentitiesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AccountFlags` (r:2 w:2) /// Proof: `SubtensorModule::AccountFlags` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:0) + /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:1) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:0) - /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:4 w:0) + /// Storage: `SubtensorModule::Alpha` (r:1020 w:254) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:4 w:2) + /// Storage: `SubtensorModule::AlphaV2` (r:766 w:765) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:510 w:510) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:510 w:254) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:510) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::RootClaimed` (r:510 w:510) + /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:64 w:64) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::UnlockRate` (r:1 w:0) /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) @@ -891,49 +857,67 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::DecayingLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - fn swap_coldkey_announced() -> Weight { - // Worst case includes migrating MAX_COLDKEY_COLLATERAL_HOTKEYS collateral - // positions via ColdkeyCollateralHotkeys plus coldkey lineage writes. - // Proof Size summary in bytes: - // Measured: `2110` - // Estimated: `100000` - // Minimum execution time: 450_000_000 picoseconds. - Weight::from_parts(450_000_000, 100000) - .saturating_add(T::DbWeight::get().reads(250_u64)) - .saturating_add(T::DbWeight::get().writes(200_u64)) + /// Storage: `SubtensorModule::ColdkeyRoot` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeySuccessor` (r:0 w:2) + /// Proof: `SubtensorModule::ColdkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `w` is `[1, 256]`. + fn swap_coldkey_announced(w: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `8534 + w * (354 ±0)` + // Estimated: `114740 + w * (10266 ±1)` + // Minimum execution time: 511_650_000 picoseconds. + Weight::from_parts(848_759_751, 114740) + // Standard Error: 292_166 + .saturating_add(Weight::from_parts(230_225_780, 0).saturating_mul(w.into())) + .saturating_add(T::DbWeight::get().reads(78_u64)) + .saturating_add(T::DbWeight::get().reads((14_u64).saturating_mul(w.into()))) + .saturating_add(T::DbWeight::get().writes(61_u64)) + .saturating_add(T::DbWeight::get().writes((12_u64).saturating_mul(w.into()))) + .saturating_add(Weight::from_parts(0, 10266).saturating_mul(w.into())) } + /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingHotkeys` (r:2 w:2) + /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) + /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:2) + /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:1) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingHotkeys` (r:2 w:2) - /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::Owner` (r:1 w:255) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IdentitiesV2` (r:2 w:2) /// Proof: `SubtensorModule::IdentitiesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AccountFlags` (r:2 w:2) /// Proof: `SubtensorModule::AccountFlags` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:0) + /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:1) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:0) - /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:4 w:0) + /// Storage: `SubtensorModule::Alpha` (r:1020 w:254) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:4 w:2) + /// Storage: `SubtensorModule::AlphaV2` (r:766 w:765) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:510 w:510) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:510 w:254) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:510) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::RootClaimed` (r:510 w:510) + /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:64 w:64) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::UnlockRate` (r:1 w:0) /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) @@ -942,20 +926,28 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DecayingLock` (r:1 w:0) /// Proof: `SubtensorModule::DecayingLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyRoot` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:0 w:1) /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeySwapDisputes` (r:0 w:1) /// Proof: `SubtensorModule::ColdkeySwapDisputes` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn swap_coldkey() -> Weight { - // Worst case includes migrating MAX_COLDKEY_COLLATERAL_HOTKEYS collateral - // positions via ColdkeyCollateralHotkeys plus coldkey lineage writes. - // Proof Size summary in bytes: - // Measured: `2166` - // Estimated: `100000` - // Minimum execution time: 480_000_000 picoseconds. - Weight::from_parts(480_000_000, 100000) - .saturating_add(T::DbWeight::get().reads(250_u64)) - .saturating_add(T::DbWeight::get().writes(210_u64)) + /// Storage: `SubtensorModule::ColdkeySuccessor` (r:0 w:2) + /// Proof: `SubtensorModule::ColdkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `w` is `[1, 256]`. + fn swap_coldkey(w: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `8643 + w * (353 ±0)` + // Estimated: `114909 + w * (10265 ±1)` + // Minimum execution time: 533_803_000 picoseconds. + Weight::from_parts(836_625_489, 114909) + // Standard Error: 336_726 + .saturating_add(Weight::from_parts(230_397_375, 0).saturating_mul(w.into())) + .saturating_add(T::DbWeight::get().reads(78_u64)) + .saturating_add(T::DbWeight::get().reads((14_u64).saturating_mul(w.into()))) + .saturating_add(T::DbWeight::get().writes(65_u64)) + .saturating_add(T::DbWeight::get().writes((12_u64).saturating_mul(w.into()))) + .saturating_add(Weight::from_parts(0, 10265).saturating_mul(w.into())) } /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:0) /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -965,8 +957,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `665` // Estimated: `4130` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 4130) + // Minimum execution time: 20_801_000 picoseconds. + Weight::from_parts(21_823_000, 4130) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -978,8 +970,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `613` // Estimated: `4078` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 4078) + // Minimum execution time: 17_175_000 picoseconds. + Weight::from_parts(17_886_000, 4078) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -991,8 +983,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + // Minimum execution time: 6_870_000 picoseconds. + Weight::from_parts(7_451_000, 0) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -1027,20 +1019,26 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:0) + /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Keys` (r:256 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn batch_reveal_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `2155` - // Estimated: `8095` - // Minimum execution time: 209_000_000 picoseconds. - Weight::from_parts(218_000_000, 8095) - .saturating_add(T::DbWeight::get().reads(19_u64)) + /// The range of component `b` is `[1, 10]`. + fn batch_reveal_weights(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `12306 + b * (56 ±0)` + // Estimated: `646896 + b * (56 ±0)` + // Minimum execution time: 918_255_000 picoseconds. + Weight::from_parts(618_698_455, 646896) + // Standard Error: 408_776 + .saturating_add(Weight::from_parts(305_971_237, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(275_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 56).saturating_mul(b.into())) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1076,8 +1074,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1754` // Estimated: `5219` - // Minimum execution time: 94_000_000 picoseconds. - Weight::from_parts(98_000_000, 5219) + // Minimum execution time: 203_813_000 picoseconds. + Weight::from_parts(206_256_000, 5219) .saturating_add(T::DbWeight::get().reads(15_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -1113,8 +1111,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1754` // Estimated: `5219` - // Minimum execution time: 92_000_000 picoseconds. - Weight::from_parts(102_000_000, 5219) + // Minimum execution time: 196_812_000 picoseconds. + Weight::from_parts(198_484_000, 5219) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -1164,6 +1162,12 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetMovingPrice` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinerBurned` (r:128 w:2) /// Proof: `SubtensorModule::MinerBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::EmissionGateBar` (r:1 w:1) + /// Proof: `SubtensorModule::EmissionGateBar` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::EmissionBarQuantile` (r:1 w:0) + /// Proof: `SubtensorModule::EmissionBarQuantile` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::EmissionGateExponent` (r:1 w:0) + /// Proof: `SubtensorModule::EmissionGateExponent` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetEmissionEnabled` (r:128 w:0) /// Proof: `SubtensorModule::SubnetEmissionEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:128 w:127) @@ -1214,7 +1218,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::BlockAtRegistration` (r:512 w:0) /// Proof: `SubtensorModule::BlockAtRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:1024 w:512) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:1024 w:0) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ParentKeys` (r:512 w:0) /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1266,36 +1270,28 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Delegates` (r:512 w:0) /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:513 w:0) - /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:542 w:512) - /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:512 w:0) - /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:512 w:512) - /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:512 w:512) - /// Proof: `SubtensorModule::AlphaDividendsPerSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimable` (r:512 w:512) - /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootAlphaDividendsPerSubnet` (r:512 w:512) - /// Proof: `SubtensorModule::RootAlphaDividendsPerSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::EMAPriceHalvingBlocks` (r:128 w:0) /// Proof: `SubtensorModule::EMAPriceHalvingBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetMovingAlpha` (r:1 w:0) /// Proof: `SubtensorModule::SubnetMovingAlpha` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::PendingChildKeys` (r:129 w:0) /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NumStakingColdkeys` (r:1 w:0) + /// Storage: `SubtensorModule::NumStakingColdkeys` (r:1 w:1) /// Proof: `SubtensorModule::NumStakingColdkeys` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NumRootClaim` (r:1 w:0) /// Proof: `SubtensorModule::NumRootClaim` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:1 w:0) + /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:1 w:4) /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaMapLastKey` (r:1 w:0) /// Proof: `SubtensorModule::AlphaMapLastKey` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Alpha` (r:1 w:0) + /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaV2MapLastKey` (r:1 w:1) /// Proof: `SubtensorModule::AlphaV2MapLastKey` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AlphaV2` (r:31 w:0) + /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingColdkeys` (r:4 w:4) + /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootProp` (r:0 w:128) /// Proof: `SubtensorModule::RootProp` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Active` (r:0 w:2) @@ -1326,12 +1322,12 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetTaoInEmission` (`max_values`: None, `max_size`: None, mode: `Measured`) fn block_step() -> Weight { // Proof Size summary in bytes: - // Measured: `35625441` - // Estimated: `38160831` - // Minimum execution time: 74_108_000_000 picoseconds. - Weight::from_parts(80_064_000_000, 38160831) - .saturating_add(T::DbWeight::get().reads(13414_u64)) - .saturating_add(T::DbWeight::get().writes(7064_u64)) + // Measured: `954514` + // Estimated: `3489904` + // Minimum execution time: 74_166_154_000 picoseconds. + Weight::from_parts(75_178_727_000, 3489904) + .saturating_add(T::DbWeight::get().reads(9838_u64)) + .saturating_add(T::DbWeight::get().writes(4002_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1349,8 +1345,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1118` // Estimated: `4583` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 4583) + // Minimum execution time: 37_375_000 picoseconds. + Weight::from_parts(38_237_000, 4583) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -1420,8 +1416,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2304` // Estimated: `8727` - // Minimum execution time: 382_000_000 picoseconds. - Weight::from_parts(395_000_000, 8727) + // Minimum execution time: 887_529_000 picoseconds. + Weight::from_parts(893_257_000, 8727) .saturating_add(T::DbWeight::get().reads(32_u64)) .saturating_add(T::DbWeight::get().writes(16_u64)) } @@ -1459,8 +1455,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1979` // Estimated: `7919` - // Minimum execution time: 106_000_000 picoseconds. - Weight::from_parts(110_000_000, 7919) + // Minimum execution time: 231_404_000 picoseconds. + Weight::from_parts(233_587_000, 7919) .saturating_add(T::DbWeight::get().reads(20_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -1520,8 +1516,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2142` // Estimated: `10557` - // Minimum execution time: 292_000_000 picoseconds. - Weight::from_parts(299_000_000, 10557) + // Minimum execution time: 640_842_000 picoseconds. + Weight::from_parts(660_131_000, 10557) .saturating_add(T::DbWeight::get().reads(30_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } @@ -1579,8 +1575,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2176` // Estimated: `10591` - // Minimum execution time: 374_000_000 picoseconds. - Weight::from_parts(387_000_000, 10591) + // Minimum execution time: 854_380_000 picoseconds. + Weight::from_parts(871_364_000, 10591) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } @@ -1656,8 +1652,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2662` // Estimated: `11077` - // Minimum execution time: 457_000_000 picoseconds. - Weight::from_parts(484_000_000, 11077) + // Minimum execution time: 1_051_072_000 picoseconds. + Weight::from_parts(1_059_665_000, 11077) .saturating_add(T::DbWeight::get().reads(49_u64)) .saturating_add(T::DbWeight::get().writes(24_u64)) } @@ -1703,8 +1699,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2023` // Estimated: `7963` - // Minimum execution time: 134_000_000 picoseconds. - Weight::from_parts(142_000_000, 7963) + // Minimum execution time: 295_469_000 picoseconds. + Weight::from_parts(301_017_000, 7963) .saturating_add(T::DbWeight::get().reads(21_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -1748,8 +1744,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2162` // Estimated: `8102` - // Minimum execution time: 141_000_000 picoseconds. - Weight::from_parts(146_000_000, 8102) + // Minimum execution time: 295_189_000 picoseconds. + Weight::from_parts(301_839_000, 8102) .saturating_add(T::DbWeight::get().reads(24_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -1759,10 +1755,6 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMovingPrice` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetMovingPrice` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Alpha` (r:1 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaV2` (r:1 w:1) @@ -1775,6 +1767,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinerCollateral` (r:1 w:1) /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetMovingPrice` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetMovingPrice` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) @@ -1823,10 +1819,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_collateral() -> Weight { // Proof Size summary in bytes: - // Measured: `2602` - // Estimated: `8542` - // Minimum execution time: 351_000_000 picoseconds. - Weight::from_parts(371_000_000, 8542) + // Measured: `2635` + // Estimated: `8575` + // Minimum execution time: 1_029_640_000 picoseconds. + Weight::from_parts(1_038_523_000, 8575) .saturating_add(T::DbWeight::get().reads(34_u64)) .saturating_add(T::DbWeight::get().writes(17_u64)) } @@ -1836,16 +1832,18 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinerCollateral` (r:1 w:1) /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CollateralDrainRatio` (r:1 w:0) /// Proof: `SubtensorModule::CollateralDrainRatio` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_min_collateral() -> Weight { // Proof Size summary in bytes: - // Measured: `1015` - // Estimated: `4480` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 4480) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `2104` + // Estimated: `5569` + // Minimum execution time: 50_105_000 picoseconds. + Weight::from_parts(51_417_000, 5569) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:2 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -1919,90 +1917,97 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2505` // Estimated: `10920` - // Minimum execution time: 371_000_000 picoseconds. - Weight::from_parts(388_000_000, 10920) + // Minimum execution time: 801_911_000 picoseconds. + Weight::from_parts(823_494_000, 10920) .saturating_add(T::DbWeight::get().reads(49_u64)) .saturating_add(T::DbWeight::get().writes(24_u64)) } - /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) + /// Storage: `SubtensorModule::WeightCommits` (r:255 w:255) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:255 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) + /// Storage: `SubtensorModule::MechanismCountCurrent` (r:255 w:0) /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) + /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:255 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:1 w:0) + /// Storage: `SubtensorModule::Uids` (r:255 w:0) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) + /// Storage: `SubtensorModule::LastUpdate` (r:255 w:255) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetEpochIndex` (r:255 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:1 w:0) + /// Storage: `SubtensorModule::Tempo` (r:255 w:0) /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) + /// Storage: `SubtensorModule::PendingEpochAt` (r:255 w:0) /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) + /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:255 w:0) /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) + /// Storage: `SubtensorModule::LastEpochBlock` (r:255 w:0) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightsSetRateLimit` (r:1 w:0) - /// Proof: `SubtensorModule::WeightsSetRateLimit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:1 w:0) + /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:255 w:0) /// Proof: `SubtensorModule::RevealPeriodEpochs` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn batch_commit_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1300` - // Estimated: `4765` - // Minimum execution time: 77_000_000 picoseconds. - Weight::from_parts(79_000_000, 4765) - .saturating_add(T::DbWeight::get().reads(15_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetworkN` (r:255 w:0) + /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[1, 256]`. + fn batch_commit_weights(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1119 + b * (708 ±0)` + // Estimated: `2091 + b * (3184 ±0)` + // Minimum execution time: 83_064_000 picoseconds. + Weight::from_parts(51_165_232, 2091) + // Standard Error: 56_628 + .saturating_add(Weight::from_parts(52_908_198, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads((14_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into()))) + .saturating_add(Weight::from_parts(0, 3184).saturating_mul(b.into())) + } + /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:255 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) + /// Storage: `SubtensorModule::NetworksAdded` (r:255 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) + /// Storage: `SubtensorModule::MechanismCountCurrent` (r:255 w:0) /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetworkN` (r:255 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:1 w:0) + /// Storage: `SubtensorModule::Uids` (r:255 w:0) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:255 w:0) /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TaoWeight` (r:1 w:0) /// Proof: `SubtensorModule::TaoWeight` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:256 w:0) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ParentKeys` (r:1 w:0) + /// Storage: `SubtensorModule::ParentKeys` (r:255 w:0) /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ChildKeys` (r:1 w:0) + /// Storage: `SubtensorModule::ChildKeys` (r:255 w:0) /// Proof: `SubtensorModule::ChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakeThreshold` (r:1 w:0) /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) + /// Storage: `SubtensorModule::WeightsVersionKey` (r:255 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) + /// Storage: `SubtensorModule::LastUpdate` (r:255 w:255) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) + /// Storage: `SubtensorModule::MinAllowedWeights` (r:255 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Weights` (r:0 w:1) + /// Storage: `SubtensorModule::Weights` (r:0 w:255) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn batch_set_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1455` - // Estimated: `7395` - // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(54_000_000, 7395) - .saturating_add(T::DbWeight::get().reads(16_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) + /// The range of component `b` is `[1, 256]`. + fn batch_set_weights(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1402 + b * (132 ±0)` + // Estimated: `4839 + b * (2608 ±0)` + // Minimum execution time: 93_839_000 picoseconds. + Weight::from_parts(67_055_248, 4839) + // Standard Error: 36_122 + .saturating_add(Weight::from_parts(52_400_699, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((13_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into()))) + .saturating_add(Weight::from_parts(0, 2608).saturating_mul(b.into())) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2016,8 +2021,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `830` // Estimated: `4295` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 4295) + // Minimum execution time: 28_212_000 picoseconds. + Weight::from_parts(29_064_000, 4295) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -2035,28 +2040,28 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `923` // Estimated: `4388` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_000_000, 4388) + // Minimum execution time: 32_959_000 picoseconds. + Weight::from_parts(34_201_000, 4388) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRegistrationStartBlock` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRegistrationStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRateLimit` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:1) + /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:0) /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetLimit` (r:1 w:0) /// Proof: `SubtensorModule::SubnetLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:1) + /// Storage: `SubtensorModule::NetworksAdded` (r:4097 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:0) + /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:1) /// Proof: `SubtensorModule::NetworkRegistrationQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:1) + /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:0) /// Proof: `SubtensorModule::NetworkLastLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkMinLockCost` (r:1 w:0) /// Proof: `SubtensorModule::NetworkMinLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -2064,104 +2069,31 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::NetworkLockReductionInterval` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:0) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:1) + /// Storage: `SubtensorModule::NetworkRegistrationLockId` (r:1 w:1) + /// Proof: `SubtensorModule::NetworkRegistrationLockId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(899), added: 3374, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(499), added: 2974, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:4095 w:0) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:0) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:0) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Swap::SwapBalancer` (r:1 w:0) /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:1) - /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Kappa` (r:1 w:1) - /// Proof: `SubtensorModule::Kappa` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ActivityCutoff` (r:1 w:1) - /// Proof: `SubtensorModule::ActivityCutoff` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegistrationsThisInterval` (r:1 w:1) - /// Proof: `SubtensorModule::RegistrationsThisInterval` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Active` (r:1 w:1) - /// Proof: `SubtensorModule::Active` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Emission` (r:1 w:1) - /// Proof: `SubtensorModule::Emission` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Consensus` (r:1 w:1) - /// Proof: `SubtensorModule::Consensus` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) - /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Incentive` (r:1 w:1) - /// Proof: `SubtensorModule::Incentive` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) - /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Dividends` (r:1 w:1) - /// Proof: `SubtensorModule::Dividends` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorTrust` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorTrust` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegisteredSubnetCounter` (r:1 w:1) - /// Proof: `SubtensorModule::RegisteredSubnetCounter` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) - /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) - /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:1) - /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Burn` (r:0 w:1) - /// Proof: `SubtensorModule::Burn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RAORecycledForRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::RAORecycledForRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetLocked` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegisteredAt` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegisteredAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetVolume` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlockAtRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::BlockAtRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinAllowedWeights` (r:0 w:1) - /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedValidators` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedValidators` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:0 w:1) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaOut` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:0 w:1) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:0 w:1) - /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ImmunityPeriod` (r:0 w:1) - /// Proof: `SubtensorModule::ImmunityPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEmissionEnabled` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetEmissionEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationAllowed` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegistrationAllowed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Yuma3On` (r:0 w:1) - /// Proof: `SubtensorModule::Yuma3On` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:1) - /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedUids` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedUids` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn register_network_with_identity() -> Weight { - // Proof Size summary in bytes: - // Measured: `1468` - // Estimated: `9883` - // Minimum execution time: 143_000_000 picoseconds. - Weight::from_parts(148_000_000, 9883) - .saturating_add(T::DbWeight::get().reads(40_u64)) - .saturating_add(T::DbWeight::get().writes(47_u64)) + /// The range of component `i` is `[1, 6400]`. + fn register_network_with_identity(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `26140` + // Estimated: `10167205` + // Minimum execution time: 24_776_080_000 picoseconds. + Weight::from_parts(25_143_120_245, 10167205) + // Standard Error: 5_405 + .saturating_add(Weight::from_parts(9_577, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads(8209_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2171,14 +2103,19 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ServingRateLimit` (r:1 w:0) /// Proof: `SubtensorModule::ServingRateLimit` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn serve_axon_tls() -> Weight { + /// Storage: `SubtensorModule::NeuronCertificates` (r:0 w:1) + /// Proof: `SubtensorModule::NeuronCertificates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `c` is `[1, 65]`. + fn serve_axon_tls(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `799` // Estimated: `4264` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 4264) + // Minimum execution time: 37_305_000 picoseconds. + Weight::from_parts(38_740_250, 4264) + // Standard Error: 1_545 + .saturating_add(Weight::from_parts(2_366, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:0) /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2186,12 +2123,15 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IdentitiesV2` (r:0 w:1) /// Proof: `SubtensorModule::IdentitiesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_identity() -> Weight { + /// The range of component `i` is `[1, 4096]`. + fn set_identity(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `889` // Estimated: `6829` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 6829) + // Minimum execution time: 29_864_000 picoseconds. + Weight::from_parts(31_701_058, 6829) + // Standard Error: 26 + .saturating_add(Weight::from_parts(994, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -2201,21 +2141,20 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetIdentitiesV3` (r:0 w:1) /// Proof: `SubtensorModule::SubnetIdentitiesV3` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_subnet_identity() -> Weight { + /// The range of component `i` is `[1, 6400]`. + fn set_subnet_identity(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `738` // Estimated: `4203` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 4203) + // Minimum execution time: 20_361_000 picoseconds. + Weight::from_parts(21_260_801, 4203) + // Standard Error: 13 + .saturating_add(Weight::from_parts(991, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:2 w:2) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:18 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinerCollateral` (r:17 w:0) - /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:18 w:34) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimable` (r:2 w:2) @@ -2228,6 +2167,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaV2` (r:2547 w:2546) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:18 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:17 w:0) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:2 w:5) /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ChildKeys` (r:34 w:34) @@ -2282,16 +2225,20 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Delegates` (r:1 w:0) /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeyRoot` (r:16 w:16) + /// Proof: `SubtensorModule::HotkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Keys` (r:0 w:16) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:32) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) fn swap_hotkey() -> Weight { // Proof Size summary in bytes: // Measured: `219071` // Estimated: `6523886` - // Minimum execution time: 83_390_000_000 picoseconds. - Weight::from_parts(87_695_000_000, 6523886) - .saturating_add(T::DbWeight::get().reads(6928_u64)) - .saturating_add(T::DbWeight::get().writes(4111_u64)) + // Minimum execution time: 180_055_982_000 picoseconds. + Weight::from_parts(180_361_786_000, 6523886) + .saturating_add(T::DbWeight::get().reads(6944_u64)) + .saturating_add(T::DbWeight::get().writes(4159_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:1) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2303,72 +2250,125 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `818` // Estimated: `4283` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 4283) + // Minimum execution time: 23_314_000 picoseconds. + Weight::from_parts(24_026_000, 4283) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } + /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:0) + /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Storage: `SubtensorModule::NetworksAdded` (r:257 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubtokenEnabled` (r:2 w:0) + /// Storage: `SubtensorModule::SubtokenEnabled` (r:256 w:0) /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn unstake_all() -> Weight { - // Proof Size summary in bytes: - // Measured: `774` - // Estimated: `9189` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 9189) - .saturating_add(T::DbWeight::get().reads(6_u64)) + /// Storage: `SubtensorModule::Alpha` (r:255 w:0) + /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AlphaV2` (r:255 w:255) + /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:255 w:255) + /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:255 w:0) + /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:255 w:255) + /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:255 w:0) + /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetTAO` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::FeeRate` (r:1 w:0) + /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) + /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:0) + /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Lock` (r:255 w:0) + /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:255 w:0) + /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:255 w:0) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetAlphaOut` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) + /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetVolume` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:256 w:256) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `AlphaAssets::AlphaBurned` (r:1 w:1) + /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetTaoFlow` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) + /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:0 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 256]`. + fn unstake_all(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1400 + n * (216 ±0)` + // Estimated: `7381 + n * (2692 ±0)` + // Minimum execution time: 652_356_000 picoseconds. + Weight::from_parts(659_517_000, 7381) + // Standard Error: 303_806 + .saturating_add(Weight::from_parts(328_544_863, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().reads((17_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6_u64)) + .saturating_add(T::DbWeight::get().writes((9_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2692).saturating_mul(n.into())) } + /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:0) + /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Storage: `SubtensorModule::NetworksAdded` (r:257 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubtokenEnabled` (r:2 w:0) + /// Storage: `SubtensorModule::SubtokenEnabled` (r:256 w:0) /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:2 w:0) + /// Storage: `SubtensorModule::Alpha` (r:256 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:2 w:2) + /// Storage: `SubtensorModule::AlphaV2` (r:256 w:256) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:256 w:0) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:2 w:0) + /// Storage: `SubtensorModule::SubnetMechanism` (r:256 w:0) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTAO` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetTAO` (r:256 w:256) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Swap::FeeRate` (r:1 w:0) /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::SubnetAlphaIn` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:256 w:256) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::PalSwapInitialized` (r:1 w:0) + /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) - /// Storage: `Swap::SwapBalancer` (r:1 w:0) - /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Lock` (r:2 w:0) + /// Storage: `SubtensorModule::Lock` (r:256 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:1 w:0) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:255 w:0) /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinerCollateral` (r:1 w:0) + /// Storage: `SubtensorModule::MinerCollateral` (r:255 w:0) /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaOut` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetAlphaOut` (r:256 w:256) /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetVolume` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetVolume` (r:256 w:256) /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:4 w:3) + /// Storage: `System::Account` (r:258 w:257) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// Storage: `AlphaAssets::AlphaBurned` (r:1 w:1) /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTaoFlow` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetTaoFlow` (r:256 w:256) /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimable` (r:1 w:0) /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2380,14 +2380,22 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn unstake_all_alpha() -> Weight { - // Proof Size summary in bytes: - // Measured: `2235` - // Estimated: `11306` - // Minimum execution time: 380_000_000 picoseconds. - Weight::from_parts(384_000_000, 11306) - .saturating_add(T::DbWeight::get().reads(45_u64)) - .saturating_add(T::DbWeight::get().writes(25_u64)) + /// Storage: `Swap::SwapBalancer` (r:0 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 256]`. + fn unstake_all_alpha(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1436 + n * (216 ±0)` + // Estimated: `8727 + n * (2692 ±0)` + // Minimum execution time: 815_200_000 picoseconds. + Weight::from_parts(209_875_996, 8727) + // Standard Error: 254_399 + .saturating_add(Weight::from_parts(340_296_632, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(28_u64)) + .saturating_add(T::DbWeight::get().reads((17_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(18_u64)) + .saturating_add(T::DbWeight::get().writes((9_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2692).saturating_mul(n.into())) } /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2443,8 +2451,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2176` // Estimated: `10591` - // Minimum execution time: 388_000_000 picoseconds. - Weight::from_parts(415_000_000, 10591) + // Minimum execution time: 857_213_000 picoseconds. + Weight::from_parts(875_579_000, 10591) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } @@ -2456,7 +2464,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::NextSubnetLeaseId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:503 w:503) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::Owner` (r:65 w:1) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRegistrationStartBlock` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRegistrationStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -2466,7 +2474,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetLimit` (r:1 w:0) /// Proof: `SubtensorModule::SubnetLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:1) + /// Storage: `SubtensorModule::NetworksAdded` (r:4098 w:1) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -2480,13 +2488,13 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::NetworkLockReductionInterval` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:0) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetMechanism` (r:4096 w:1) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::SwapBalancer` (r:1 w:0) + /// Storage: `Swap::SwapBalancer` (r:2 w:0) /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:1) /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -2510,6 +2518,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Incentive` (r:1 w:1) /// Proof: `SubtensorModule::Incentive` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:1) + /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Dividends` (r:1 w:1) @@ -2520,13 +2530,27 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RegisteredSubnetCounter` (r:1 w:1) /// Proof: `SubtensorModule::RegisteredSubnetCounter` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) + /// Storage: `SubtensorModule::TokenSymbol` (r:4097 w:1) /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:1) + /// Storage: `SubtensorModule::Keys` (r:65 w:1) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:3 w:1) + /// Storage: `SubtensorModule::AutoParentDelegationEnabled` (r:64 w:0) + /// Proof: `SubtensorModule::AutoParentDelegationEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TransactionKeyLastBlock` (r:64 w:64) + /// Proof: `SubtensorModule::TransactionKeyLastBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ChildKeys` (r:64 w:64) + /// Proof: `SubtensorModule::ChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ParentKeys` (r:65 w:65) + /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:262208 w:0) + /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakeThreshold` (r:1 w:0) + /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubtokenEnabled` (r:1 w:0) + /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:1) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Proxy::Proxies` (r:1 w:1) /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(789), added: 3264, mode: `MaxEncodedLen`) @@ -2562,8 +2586,6 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastEpochBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Uids` (r:0 w:1) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ImmunityPeriod` (r:0 w:1) @@ -2576,6 +2598,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::NetworkRegistrationAllowed` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Yuma3On` (r:0 w:1) /// Proof: `SubtensorModule::Yuma3On` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:1) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MaxAllowedUids` (r:0 w:1) @@ -2583,15 +2607,15 @@ impl WeightInfo for SubstrateWeight { /// The range of component `k` is `[2, 500]`. fn register_leased_network(k: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1835 + k * (44 ±0)` - // Estimated: `10256 + k * (2579 ±0)` - // Minimum execution time: 259_000_000 picoseconds. - Weight::from_parts(171_942_062, 10256) - // Standard Error: 74_270 - .saturating_add(Weight::from_parts(29_141_808, 0).saturating_mul(k.into())) - .saturating_add(T::DbWeight::get().reads(50_u64)) + // Measured: `67249 + k * (44 ±0)` + // Estimated: `649033047 + k * (2579 ±0)` + // Minimum execution time: 1_927_714_663_000 picoseconds. + Weight::from_parts(1_988_707_555_887, 649033047) + // Standard Error: 30_155_939 + .saturating_add(Weight::from_parts(75_339_439, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(274930_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(k.into()))) - .saturating_add(T::DbWeight::get().writes(53_u64)) + .saturating_add(T::DbWeight::get().writes(247_u64)) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(k.into()))) .saturating_add(Weight::from_parts(0, 2579).saturating_mul(k.into())) } @@ -2634,17 +2658,29 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) + /// Storage: `SubtensorModule::TokenSymbol` (r:441 w:1) /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_symbol() -> Weight { // Proof Size summary in bytes: - // Measured: `762` - // Estimated: `9177` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 9177) - .saturating_add(T::DbWeight::get().reads(5_u64)) + // Measured: `4822` + // Estimated: `1097287` + // Minimum execution time: 1_234_524_000 picoseconds. + Weight::from_parts(1_246_181_000, 1097287) + .saturating_add(T::DbWeight::get().reads(443_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Tempo` (r:1 w:0) + /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) + /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) + /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) + /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -2659,26 +2695,20 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:1 w:0) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) - /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) - /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_timelocked_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1248` - // Estimated: `4713` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(51_000_000, 4713) + /// The range of component `c` is `[1, 5000]`. + /// The range of component `q` is `[0, 256]`. + fn commit_timelocked_weights(c: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1326` + // Estimated: `4782` + // Minimum execution time: 87_861_000 picoseconds. + Weight::from_parts(87_193_676, 4782) + // Standard Error: 62 + .saturating_add(Weight::from_parts(1_846, 0).saturating_mul(c.into())) + // Standard Error: 1_218 + .saturating_add(Weight::from_parts(12_137, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -2688,16 +2718,24 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AutoStakeDestination` (r:1 w:1) /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:1 w:1) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:2 w:2) /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_coldkey_auto_stake_hotkey() -> Weight { - // Proof Size summary in bytes: - // Measured: `809` - // Estimated: `4274` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 4274) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) + /// The range of component `o` is `[1, 256]`. + /// The range of component `n` is `[1, 256]`. + fn set_coldkey_auto_stake_hotkey(o: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1057 + n * (32 ±0) + o * (32 ±0)` + // Estimated: `6994 + n * (32 ±0) + o * (32 ±0)` + // Minimum execution time: 53_840_000 picoseconds. + Weight::from_parts(48_773_245, 6994) + // Standard Error: 1_088 + .saturating_add(Weight::from_parts(29_048, 0).saturating_mul(o.into())) + // Standard Error: 1_088 + .saturating_add(Weight::from_parts(32_888, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(o.into())) } /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:1) /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -2707,47 +2745,90 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::RootClaimType` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:0 w:1) /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_root_claim_type() -> Weight { + /// The range of component `s` is `[1, 256]`. + fn set_root_claim_type(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `476` // Estimated: `3941` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 3941) + // Minimum execution time: 15_903_000 picoseconds. + Weight::from_parts(17_442_349, 3941) + // Standard Error: 441 + .saturating_add(Weight::from_parts(43_853, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } - /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:0) - /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NumStakingColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::NumStakingColdkeys` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimType` (r:1 w:0) /// Proof: `SubtensorModule::RootClaimType` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimable` (r:1 w:0) + /// Storage: `SubtensorModule::RootClaimable` (r:256 w:0) /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:2 w:0) + /// Storage: `SubtensorModule::Alpha` (r:256 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:2 w:1) + /// Storage: `SubtensorModule::AlphaV2` (r:256 w:256) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:1) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:256 w:0) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:1) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimed` (r:1 w:1) + /// Storage: `SubtensorModule::RootClaimed` (r:1280 w:1280) /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimableThreshold` (r:1 w:0) + /// Storage: `SubtensorModule::RootClaimableThreshold` (r:5 w:0) /// Proof: `SubtensorModule::RootClaimableThreshold` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn claim_root() -> Weight { - // Proof Size summary in bytes: - // Measured: `1969` - // Estimated: `7909` - // Minimum execution time: 66_000_000 picoseconds. - Weight::from_parts(70_000_000, 7909) - .saturating_add(T::DbWeight::get().reads(17_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) + /// Storage: `SubtensorModule::SubnetMechanism` (r:5 w:0) + /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetTAO` (r:6 w:6) + /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::PalSwapInitialized` (r:5 w:5) + /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetAlphaOut` (r:6 w:6) + /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) + /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetVolume` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:6 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:6 w:6) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetRootSellTao` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetRootSellTao` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetProtocolFlow` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetProtocolFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:0 w:1) + /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:0 w:5) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// The range of component `h` is `[1, 256]`. + /// The range of component `s` is `[1, 5]`. + fn claim_root(h: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + h * (453 ±0) + s * (4941 ±0)` + // Estimated: `18636 + h * (5340 ±1) + s * (200971 ±99)` + // Minimum execution time: 1_654_578_000 picoseconds. + Weight::from_parts(1_665_985_000, 18636) + // Standard Error: 29_564_732 + .saturating_add(Weight::from_parts(563_045_949, 0).saturating_mul(h.into())) + // Standard Error: 1_519_828_563 + .saturating_add(Weight::from_parts(24_042_963_573, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(76_u64)) + .saturating_add(T::DbWeight::get().reads((8_u64).saturating_mul(h.into()))) + .saturating_add(T::DbWeight::get().reads((83_u64).saturating_mul(s.into()))) + .saturating_add(T::DbWeight::get().writes(60_u64)) + .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(h.into()))) + .saturating_add(T::DbWeight::get().writes((83_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 5340).saturating_mul(h.into())) + .saturating_add(Weight::from_parts(0, 200971).saturating_mul(s.into())) } /// Storage: `SubtensorModule::NumRootClaim` (r:0 w:1) /// Proof: `SubtensorModule::NumRootClaim` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -2755,8 +2836,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 1_943_000 picoseconds. + Weight::from_parts(2_203_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -2767,8 +2848,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `652` // Estimated: `4117` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(7_000_000, 4117) + // Minimum execution time: 13_390_000 picoseconds. + Weight::from_parts(13_871_000, 4117) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -2782,8 +2863,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `899` // Estimated: `4364` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 4364) + // Minimum execution time: 24_907_000 picoseconds. + Weight::from_parts(25_968_000, 4364) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -2859,8 +2940,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2307` // Estimated: `8727` - // Minimum execution time: 459_000_000 picoseconds. - Weight::from_parts(477_000_000, 8727) + // Minimum execution time: 1_043_049_000 picoseconds. + Weight::from_parts(1_050_651_000, 8727) .saturating_add(T::DbWeight::get().reads(35_u64)) .saturating_add(T::DbWeight::get().writes(17_u64)) } @@ -2870,8 +2951,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_063_000 picoseconds. + Weight::from_parts(2_364_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -2914,8 +2995,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1830` // Estimated: `7770` - // Minimum execution time: 61_000_000 picoseconds. - Weight::from_parts(63_000_000, 7770) + // Minimum execution time: 120_930_000 picoseconds. + Weight::from_parts(122_642_000, 7770) .saturating_add(T::DbWeight::get().reads(18_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -2947,8 +3028,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1515` // Estimated: `7455` - // Minimum execution time: 80_000_000 picoseconds. - Weight::from_parts(84_000_000, 7455) + // Minimum execution time: 161_830_000 picoseconds. + Weight::from_parts(163_964_000, 7455) .saturating_add(T::DbWeight::get().reads(15_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -2964,10 +3045,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::AssociatedUidsByEvmAddress` (`max_values`: None, `max_size`: None, mode: `Measured`) fn associate_evm_key() -> Weight { // Proof Size summary in bytes: - // Measured: `1157` - // Estimated: `4622` - // Minimum execution time: 378_000_000 picoseconds. - Weight::from_parts(395_000_000, 4622) + // Measured: `2028` + // Estimated: `5493` + // Minimum execution time: 754_240_000 picoseconds. + Weight::from_parts(770_985_000, 5493) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -3004,8 +3085,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `733` // Estimated: `4198` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 4198) + // Minimum execution time: 16_882_000 picoseconds. + Weight::from_parts(17_523_000, 4198) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) @@ -3032,8 +3113,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1731` // Estimated: `7671` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 7671) + // Minimum execution time: 51_777_000 picoseconds. + Weight::from_parts(53_138_000, 7671) .saturating_add(T::DbWeight::get().reads(11_u64)) } /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) @@ -3054,8 +3135,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1019` // Estimated: `4484` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 4484) + // Minimum execution time: 34_031_000 picoseconds. + Weight::from_parts(35_063_000, 4484) .saturating_add(T::DbWeight::get().reads(7_u64)) } /// Storage: `SubtensorModule::MinDelegateTake` (r:1 w:0) @@ -3082,8 +3163,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `647` // Estimated: `4112` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 4112) + // Minimum execution time: 18_865_000 picoseconds. + Weight::from_parts(19_356_000, 4112) .saturating_add(T::DbWeight::get().reads(3_u64)) } /// Storage: `SubtensorModule::Uids` (r:1 w:0) @@ -3122,7 +3203,7 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:4096 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -3132,20 +3213,22 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[1, 4096]`. + /// The range of component `n` is `[1, 256]`. fn set_mechanism_weights(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4079 + n * (45 ±0)` - // Estimated: `9373 + n * (2520 ±0)` - // Minimum execution time: 53_000_000 picoseconds. - Weight::from_parts(56_000_000, 9373) - // Standard Error: 3_996 - .saturating_add(Weight::from_parts(1_961_926, 0).saturating_mul(n.into())) + // Measured: `1958 + n * (47 ±0)` + // Estimated: `7755 + n * (2523 ±0)` + // Minimum execution time: 98_967_000 picoseconds. + Weight::from_parts(104_968_496, 7755) + // Standard Error: 10_821 + .saturating_add(Weight::from_parts(3_078_694, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 2523).saturating_mul(n.into())) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -3168,27 +3251,29 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:1 w:0) /// Proof: `SubtensorModule::RevealPeriodEpochs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_mechanism_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `37406` - // Estimated: `40871` - // Minimum execution time: 116_000_000 picoseconds. - Weight::from_parts(124_000_000, 40871) + /// The range of component `q` is `[0, 9]`. + fn commit_mechanism_weights(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `5117 + q * (56 ±0)` + // Estimated: `8581 + q * (56 ±0)` + // Minimum execution time: 106_728_000 picoseconds. + Weight::from_parts(119_844_770, 8581) + // Standard Error: 92_814 + .saturating_add(Weight::from_parts(502_577, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 56).saturating_mul(q.into())) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Tempo` (r:1 w:0) @@ -3217,26 +3302,42 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:0) /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:4096 w:0) + /// Storage: `SubtensorModule::Keys` (r:256 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[1, 4096]`. - fn reveal_mechanism_weights(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `4835 + n * (37 ±0)` - // Estimated: `10114 + n * (2512 ±0)` - // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(61_000_000, 10114) - // Standard Error: 4_010 - .saturating_add(Weight::from_parts(2_031_383, 0).saturating_mul(n.into())) + /// The range of component `n` is `[1, 256]`. + /// The range of component `q` is `[1, 10]`. + fn reveal_mechanism_weights(n: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2202 + n * (39 ±0) + q * (56 ±0)` + // Estimated: `7938 + n * (2515 ±0) + q * (64 ±2)` + // Minimum execution time: 118_376_000 picoseconds. + Weight::from_parts(120_360_699, 7938) + // Standard Error: 6_088 + .saturating_add(Weight::from_parts(3_166_185, 0).saturating_mul(n.into())) + // Standard Error: 162_218 + .saturating_add(Weight::from_parts(789_994, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(19_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 2512).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 2515).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(q.into())) } + /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Tempo` (r:1 w:0) + /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) + /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) + /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) + /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -3251,6 +3352,23 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `c` is `[1, 5000]`. + /// The range of component `q` is `[0, 256]`. + fn commit_crv3_mechanism_weights(c: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `5142` + // Estimated: `8598` + // Minimum execution time: 119_888_000 picoseconds. + Weight::from_parts(126_488_582, 8598) + // Standard Error: 242 + .saturating_add(Weight::from_parts(699, 0).saturating_mul(c.into())) + // Standard Error: 4_730 + .saturating_add(Weight::from_parts(27_620, 0).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(14_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Tempo` (r:1 w:0) @@ -3263,17 +3381,6 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_crv3_mechanism_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `36927` - // Estimated: `40392` - // Minimum execution time: 117_000_000 picoseconds. - Weight::from_parts(132_000_000, 40392) - .saturating_add(T::DbWeight::get().reads(14_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -3288,111 +3395,109 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:1 w:0) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) - /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) - /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_timelocked_mechanism_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `36927` - // Estimated: `40392` - // Minimum execution time: 113_000_000 picoseconds. - Weight::from_parts(130_000_000, 40392) + /// The range of component `c` is `[1, 5000]`. + /// The range of component `q` is `[0, 256]`. + fn commit_timelocked_mechanism_weights(c: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `5142` + // Estimated: `8598` + // Minimum execution time: 117_545_000 picoseconds. + Weight::from_parts(120_035_444, 8598) + // Standard Error: 164 + .saturating_add(Weight::from_parts(2_011, 0).saturating_mul(c.into())) + // Standard Error: 3_201 + .saturating_add(Weight::from_parts(20_382, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::Owner` (r:2 w:2) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:4098 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinerCollateral` (r:4097 w:0) - /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::IsNetworkMember` (r:4098 w:8194) + /// Storage: `SubtensorModule::IsNetworkMember` (r:4097 w:8192) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimable` (r:2 w:2) /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:8193 w:8192) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:8191 w:8190) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimed` (r:1 w:0) /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:8193 w:0) + /// Storage: `SubtensorModule::Alpha` (r:8191 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:8193 w:8192) + /// Storage: `SubtensorModule::AlphaV2` (r:8191 w:8190) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:4097 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:4096 w:0) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:2 w:5) /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ChildKeys` (r:8194 w:8194) + /// Storage: `SubtensorModule::ChildKeys` (r:8192 w:8192) /// Proof: `SubtensorModule::ChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastHotkeySwapOnNetuid` (r:4096 w:4096) + /// Storage: `SubtensorModule::LastHotkeySwapOnNetuid` (r:4095 w:4095) /// Proof: `SubtensorModule::LastHotkeySwapOnNetuid` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:1) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:4097 w:0) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:4096 w:0) /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:4097 w:0) + /// Storage: `SubtensorModule::HotkeyLock` (r:4096 w:0) /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:4097 w:0) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:4096 w:0) /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:1) /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ChildkeyTake` (r:4097 w:0) + /// Storage: `SubtensorModule::ChildkeyTake` (r:4096 w:0) /// Proof: `SubtensorModule::ChildkeyTake` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ParentKeys` (r:8194 w:8194) + /// Storage: `SubtensorModule::ParentKeys` (r:8192 w:8192) /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingChildKeys` (r:8194 w:0) + /// Storage: `SubtensorModule::PendingChildKeys` (r:8192 w:0) /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:4097 w:0) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:4096 w:0) /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (r:8194 w:4097) + /// Storage: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (r:8192 w:4096) /// Proof: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:8194 w:8194) + /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:8192 w:8192) /// Proof: `SubtensorModule::AlphaDividendsPerSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::VotingPower` (r:4097 w:0) + /// Storage: `SubtensorModule::VotingPower` (r:4096 w:0) /// Proof: `SubtensorModule::VotingPower` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AutoParentDelegationEnabled` (r:1 w:0) /// Proof: `SubtensorModule::AutoParentDelegationEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:4096 w:8192) + /// Storage: `SubtensorModule::Uids` (r:4095 w:8190) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Prometheus` (r:4096 w:0) + /// Storage: `SubtensorModule::Prometheus` (r:4095 w:0) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Axons` (r:4096 w:0) + /// Storage: `SubtensorModule::Axons` (r:4095 w:0) /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:4096 w:0) + /// Storage: `SubtensorModule::MechanismCountCurrent` (r:4095 w:0) /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:4096 w:0) + /// Storage: `SubtensorModule::WeightCommits` (r:4095 w:0) /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LoadedEmission` (r:4096 w:0) + /// Storage: `SubtensorModule::LoadedEmission` (r:4095 w:0) /// Proof: `SubtensorModule::LoadedEmission` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NeuronCertificates` (r:4096 w:0) + /// Storage: `SubtensorModule::NeuronCertificates` (r:4095 w:0) /// Proof: `SubtensorModule::NeuronCertificates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:8192 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:8190 w:0) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:8192 w:8192) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:8190 w:8190) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:1) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Delegates` (r:1 w:0) /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:0 w:4096) + /// Storage: `SubtensorModule::HotkeyRoot` (r:4095 w:4095) + /// Proof: `SubtensorModule::HotkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Keys` (r:0 w:4095) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:8190) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) fn swap_hotkey_v2() -> Weight { // Proof Size summary in bytes: - // Measured: `542010` - // Estimated: `20823150` - // Minimum execution time: 572_681_000_000 picoseconds. - Weight::from_parts(594_286_000_000, 20823150) - .saturating_add(T::DbWeight::get().reads(151588_u64)) - .saturating_add(T::DbWeight::get().writes(77845_u64)) + // Measured: `562991` + // Estimated: `20839181` + // Minimum execution time: 1_280_853_785_000 picoseconds. + Weight::from_parts(1_295_934_332_000, 20839181) + .saturating_add(T::DbWeight::get().reads(155646_u64)) + .saturating_add(T::DbWeight::get().writes(90111_u64)) } /// Storage: `SubtensorModule::MinChildkeyTake` (r:0 w:1) /// Proof: `SubtensorModule::MinChildkeyTake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -3400,8 +3505,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 5_239_000 picoseconds. + Weight::from_parts(5_440_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::MaxChildkeyTake` (r:0 w:1) @@ -3410,8 +3515,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 5_239_000 picoseconds. + Weight::from_parts(5_620_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:1) @@ -3489,12 +3594,14 @@ impl WeightInfo for SubstrateWeight { /// Storage: `SubtensorModule::PendingChildKeys` (r:0 w:1) /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `c` is `[1, 5]`. - fn set_children(_c: u32, ) -> Weight { + fn set_children(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1536` // Estimated: `9951` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(55_660_572, 9951) + // Minimum execution time: 98_717_000 picoseconds. + Weight::from_parts(100_617_442, 9951) + // Standard Error: 127_751 + .saturating_add(Weight::from_parts(585_332, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -3502,8 +3609,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 1_793_000 picoseconds. + Weight::from_parts(2_003_000, 0) } /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -3517,8 +3624,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `738` // Estimated: `4203` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 4203) + // Minimum execution time: 22_203_000 picoseconds. + Weight::from_parts(23_314_000, 4203) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -3534,8 +3641,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `799` // Estimated: `4264` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 4264) + // Minimum execution time: 28_673_000 picoseconds. + Weight::from_parts(29_495_000, 4264) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -3547,8 +3654,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `619` // Estimated: `4084` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 4084) + // Minimum execution time: 17_296_000 picoseconds. + Weight::from_parts(18_137_000, 4084) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -3598,10 +3705,12 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::MinNonImmuneUids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::FeeRate` (r:1 w:0) - /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:1 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// Storage: `Swap::FeeRate` (r:1 w:0) + /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetAlphaOut` (r:1 w:1) @@ -3624,6 +3733,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:1 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CollateralDrainRatio` (r:1 w:0) /// Proof: `SubtensorModule::CollateralDrainRatio` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:1 w:1) @@ -3668,20 +3779,20 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::SwapBalancer` (r:0 w:1) - /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) fn register_limit() -> Weight { // Proof Size summary in bytes: // Measured: `289796` // Estimated: `926861` - // Minimum execution time: 2_829_000_000 picoseconds. - Weight::from_parts(345_012_000, 6148) - .saturating_add(T::DbWeight::get().reads(34_u64)) - .saturating_add(T::DbWeight::get().writes(29_u64)) + // Minimum execution time: 5_566_279_000 picoseconds. + Weight::from_parts(5_599_105_000, 926861) + .saturating_add(T::DbWeight::get().reads(825_u64)) + .saturating_add(T::DbWeight::get().writes(300_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -3709,8 +3820,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1226` // Estimated: `7166` - // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(54_000_000, 7166) + // Minimum execution time: 108_622_000 picoseconds. + Weight::from_parts(109_934_000, 7166) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -3718,15 +3829,15 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 783_000 picoseconds. - Weight::from_parts(887_000, 0) + // Minimum execution time: 1_693_000 picoseconds. + Weight::from_parts(1_893_000, 0) } fn set_activity_cutoff_factor() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 803_000 picoseconds. - Weight::from_parts(891_000, 0) + // Minimum execution time: 1_683_000 picoseconds. + Weight::from_parts(1_862_000, 0) } /// Storage: `SubtensorModule::AccountFlags` (r:1 w:1) /// Proof: `SubtensorModule::AccountFlags` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -3734,8 +3845,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `562` // Estimated: `4027` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 4027) + // Minimum execution time: 14_066_000 picoseconds. + Weight::from_parts(14_467_000, 4027) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -3841,6 +3952,8 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Swap::SwapBalancer` (r:0 w:1) @@ -3849,10 +3962,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `289875` // Estimated: `926940` - // Minimum execution time: 2_761_000_000 picoseconds. - Weight::from_parts(364_683_000, 6148) - .saturating_add(RocksDbWeight::get().reads(34_u64)) - .saturating_add(RocksDbWeight::get().writes(29_u64)) + // Minimum execution time: 5_410_239_000 picoseconds. + Weight::from_parts(5_451_619_000, 926940) + .saturating_add(RocksDbWeight::get().reads(814_u64)) + .saturating_add(RocksDbWeight::get().writes(294_u64)) } /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -3878,7 +3991,7 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:4096 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -3888,14 +4001,19 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `188820` - // Estimated: `10327410` - // Minimum execution time: 7_637_000_000 picoseconds. - Weight::from_parts(8_632_000_000, 10327410) - .saturating_add(RocksDbWeight::get().reads(4112_u64)) + /// The range of component `n` is `[1, 256]`. + fn set_weights(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1946 + n * (48 ±0)` + // Estimated: `7770 + n * (2524 ±0)` + // Minimum execution time: 96_213_000 picoseconds. + Weight::from_parts(106_270_857, 7770) + // Standard Error: 6_960 + .saturating_add(Weight::from_parts(3_035_677, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(16_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2524).saturating_mul(n.into())) } /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:0) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -3963,8 +4081,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2304` // Estimated: `8727` - // Minimum execution time: 301_000_000 picoseconds. - Weight::from_parts(310_000_000, 8727) + // Minimum execution time: 672_791_000 picoseconds. + Weight::from_parts(690_027_000, 8727) .saturating_add(RocksDbWeight::get().reads(32_u64)) .saturating_add(RocksDbWeight::get().writes(16_u64)) } @@ -3980,8 +4098,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `828` // Estimated: `4293` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 4293) + // Minimum execution time: 34_521_000 picoseconds. + Weight::from_parts(35_733_000, 4293) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -3997,8 +4115,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `927` // Estimated: `4392` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 4392) + // Minimum execution time: 33_079_000 picoseconds. + Weight::from_parts(33_860_000, 4392) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4048,10 +4166,12 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::MinNonImmuneUids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::FeeRate` (r:1 w:0) - /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:1 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// Storage: `Swap::FeeRate` (r:1 w:0) + /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetAlphaOut` (r:1 w:1) @@ -4074,6 +4194,8 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:1 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CollateralDrainRatio` (r:1 w:0) /// Proof: `SubtensorModule::CollateralDrainRatio` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:1 w:1) @@ -4118,20 +4240,20 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::SwapBalancer` (r:0 w:1) - /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) fn burned_register() -> Weight { // Proof Size summary in bytes: // Measured: `289277` // Estimated: `926342` - // Minimum execution time: 2_807_000_000 picoseconds. - Weight::from_parts(365_124_000, 6148) - .saturating_add(RocksDbWeight::get().reads(34_u64)) - .saturating_add(RocksDbWeight::get().writes(29_u64)) + // Minimum execution time: 5_567_739_000 picoseconds. + Weight::from_parts(5_597_854_000, 926342) + .saturating_add(RocksDbWeight::get().reads(825_u64)) + .saturating_add(RocksDbWeight::get().writes(300_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -4197,34 +4319,36 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) fn root_register() -> Weight { // Proof Size summary in bytes: // Measured: `29210` // Estimated: `191075` - // Minimum execution time: 566_000_000 picoseconds. - Weight::from_parts(621_000_000, 191075) + // Minimum execution time: 1_038_104_000 picoseconds. + Weight::from_parts(1_052_875_000, 191075) .saturating_add(RocksDbWeight::get().reads(219_u64)) - .saturating_add(RocksDbWeight::get().writes(88_u64)) + .saturating_add(RocksDbWeight::get().writes(89_u64)) } - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRegistrationStartBlock` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRegistrationStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRateLimit` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:1) + /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:0) /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetLimit` (r:1 w:0) /// Proof: `SubtensorModule::SubnetLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:1) + /// Storage: `SubtensorModule::NetworksAdded` (r:4097 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:0) + /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:1) /// Proof: `SubtensorModule::NetworkRegistrationQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:1) + /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:0) /// Proof: `SubtensorModule::NetworkLastLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkMinLockCost` (r:1 w:0) /// Proof: `SubtensorModule::NetworkMinLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -4232,105 +4356,33 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::NetworkLockReductionInterval` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:0) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:2 w:2) + /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:1) + /// Storage: `SubtensorModule::NetworkRegistrationLockId` (r:1 w:1) + /// Proof: `SubtensorModule::NetworkRegistrationLockId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(899), added: 3374, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(499), added: 2974, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:4095 w:0) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:0) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:0) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Swap::SwapBalancer` (r:1 w:0) /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:1) - /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Kappa` (r:1 w:1) - /// Proof: `SubtensorModule::Kappa` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ActivityCutoff` (r:1 w:1) - /// Proof: `SubtensorModule::ActivityCutoff` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegistrationsThisInterval` (r:1 w:1) - /// Proof: `SubtensorModule::RegistrationsThisInterval` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Active` (r:1 w:1) - /// Proof: `SubtensorModule::Active` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Emission` (r:1 w:1) - /// Proof: `SubtensorModule::Emission` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Consensus` (r:1 w:1) - /// Proof: `SubtensorModule::Consensus` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) - /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Incentive` (r:1 w:1) - /// Proof: `SubtensorModule::Incentive` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) - /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Dividends` (r:1 w:1) - /// Proof: `SubtensorModule::Dividends` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorTrust` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorTrust` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegisteredSubnetCounter` (r:1 w:1) - /// Proof: `SubtensorModule::RegisteredSubnetCounter` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) - /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) - /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:1) - /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Burn` (r:0 w:1) - /// Proof: `SubtensorModule::Burn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RAORecycledForRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::RAORecycledForRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetLocked` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegisteredAt` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegisteredAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetVolume` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlockAtRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::BlockAtRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinAllowedWeights` (r:0 w:1) - /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedValidators` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedValidators` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:0 w:1) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaOut` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:0 w:1) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:0 w:1) - /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ImmunityPeriod` (r:0 w:1) - /// Proof: `SubtensorModule::ImmunityPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEmissionEnabled` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetEmissionEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationAllowed` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegistrationAllowed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Yuma3On` (r:0 w:1) - /// Proof: `SubtensorModule::Yuma3On` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:1) - /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedUids` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedUids` (`max_values`: None, `max_size`: None, mode: `Measured`) fn register_network() -> Weight { // Proof Size summary in bytes: - // Measured: `1532` - // Estimated: `9947` - // Minimum execution time: 145_000_000 picoseconds. - Weight::from_parts(153_000_000, 9947) - .saturating_add(RocksDbWeight::get().reads(41_u64)) - .saturating_add(RocksDbWeight::get().writes(48_u64)) + // Measured: `26204` + // Estimated: `10167269` + // Minimum execution time: 24_850_246_000 picoseconds. + Weight::from_parts(25_084_210_000, 10167269) + .saturating_add(RocksDbWeight::get().reads(8210_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -4353,25 +4405,29 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:1 w:0) + /// Proof: `SubtensorModule::RevealPeriodEpochs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1249` - // Estimated: `4714` - // Minimum execution time: 35_000_000 picoseconds. - Weight::from_parts(36_000_000, 4714) - .saturating_add(RocksDbWeight::get().reads(13_u64)) + /// The range of component `q` is `[0, 9]`. + fn commit_weights(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1329 + q * (56 ±0)` + // Estimated: `4793 + q * (56 ±0)` + // Minimum execution time: 73_549_000 picoseconds. + Weight::from_parts(80_888_761, 4793) + // Standard Error: 143_240 + .saturating_add(Weight::from_parts(1_154_761, 0).saturating_mul(q.into())) + .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 56).saturating_mul(q.into())) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Tempo` (r:1 w:0) @@ -4398,20 +4454,31 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:0) + /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Keys` (r:256 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn reveal_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1650` - // Estimated: `7590` - // Minimum execution time: 56_000_000 picoseconds. - Weight::from_parts(58_000_000, 7590) + /// The range of component `n` is `[1, 256]`. + /// The range of component `q` is `[1, 10]`. + fn reveal_weights(n: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2056 + n * (40 ±0) + q * (56 ±0)` + // Estimated: `7858 + n * (2516 ±0) + q * (63 ±1)` + // Minimum execution time: 119_107_000 picoseconds. + Weight::from_parts(106_415_328, 7858) + // Standard Error: 7_839 + .saturating_add(Weight::from_parts(3_201_505, 0).saturating_mul(n.into())) + // Standard Error: 208_872 + .saturating_add(Weight::from_parts(1_814_190, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(19_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2516).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 63).saturating_mul(q.into())) } /// Storage: `SubtensorModule::TxChildkeyTakeRateLimit` (r:0 w:1) /// Proof: `SubtensorModule::TxChildkeyTakeRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -4419,8 +4486,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 5_320_000 picoseconds. + Weight::from_parts(5_771_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -4443,8 +4510,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1033` // Estimated: `4498` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(28_000_000, 4498) + // Minimum execution time: 51_987_000 picoseconds. + Weight::from_parts(53_469_000, 4498) .saturating_add(RocksDbWeight::get().reads(8_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -4460,41 +4527,51 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `694` // Estimated: `4159` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 4159) + // Minimum execution time: 43_134_000 picoseconds. + Weight::from_parts(43_885_000, 4159) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:1) - /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingHotkeys` (r:2 w:2) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) + /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:2) + /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Owner` (r:1 w:255) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IdentitiesV2` (r:2 w:0) /// Proof: `SubtensorModule::IdentitiesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AccountFlags` (r:2 w:2) /// Proof: `SubtensorModule::AccountFlags` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:0) + /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:1) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:0) - /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:4 w:0) + /// Storage: `SubtensorModule::Alpha` (r:1020 w:254) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:4 w:2) + /// Storage: `SubtensorModule::AlphaV2` (r:766 w:765) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:510 w:510) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:510 w:254) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:510) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::RootClaimed` (r:510 w:510) + /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:64 w:64) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::UnlockRate` (r:1 w:0) /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) @@ -4505,49 +4582,67 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::DecayingLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - fn swap_coldkey_announced() -> Weight { - // Worst case includes migrating MAX_COLDKEY_COLLATERAL_HOTKEYS collateral - // positions via ColdkeyCollateralHotkeys plus coldkey lineage writes. - // Proof Size summary in bytes: - // Measured: `2110` - // Estimated: `100000` - // Minimum execution time: 450_000_000 picoseconds. - Weight::from_parts(450_000_000, 100000) - .saturating_add(RocksDbWeight::get().reads(250_u64)) - .saturating_add(RocksDbWeight::get().writes(200_u64)) + /// Storage: `SubtensorModule::ColdkeyRoot` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeySuccessor` (r:0 w:2) + /// Proof: `SubtensorModule::ColdkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `w` is `[1, 256]`. + fn swap_coldkey_announced(w: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `8534 + w * (354 ±0)` + // Estimated: `114740 + w * (10266 ±1)` + // Minimum execution time: 511_650_000 picoseconds. + Weight::from_parts(848_759_751, 114740) + // Standard Error: 292_166 + .saturating_add(Weight::from_parts(230_225_780, 0).saturating_mul(w.into())) + .saturating_add(RocksDbWeight::get().reads(78_u64)) + .saturating_add(RocksDbWeight::get().reads((14_u64).saturating_mul(w.into()))) + .saturating_add(RocksDbWeight::get().writes(61_u64)) + .saturating_add(RocksDbWeight::get().writes((12_u64).saturating_mul(w.into()))) + .saturating_add(Weight::from_parts(0, 10266).saturating_mul(w.into())) } + /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingHotkeys` (r:2 w:2) + /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) + /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:2) + /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:1) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingHotkeys` (r:2 w:2) - /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::Owner` (r:1 w:255) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IdentitiesV2` (r:2 w:2) /// Proof: `SubtensorModule::IdentitiesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AccountFlags` (r:2 w:2) /// Proof: `SubtensorModule::AccountFlags` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:0) + /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:1) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestination` (r:2 w:0) - /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:4 w:0) + /// Storage: `SubtensorModule::Alpha` (r:1020 w:254) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:4 w:2) + /// Storage: `SubtensorModule::AlphaV2` (r:766 w:765) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:510 w:510) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:510 w:254) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:510) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:2 w:2) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:3 w:2) + /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::RootClaimed` (r:510 w:510) + /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:64 w:64) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::UnlockRate` (r:1 w:0) /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) @@ -4556,20 +4651,28 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DecayingLock` (r:1 w:0) /// Proof: `SubtensorModule::DecayingLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyRoot` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:0 w:1) /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeySwapDisputes` (r:0 w:1) /// Proof: `SubtensorModule::ColdkeySwapDisputes` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn swap_coldkey() -> Weight { - // Worst case includes migrating MAX_COLDKEY_COLLATERAL_HOTKEYS collateral - // positions via ColdkeyCollateralHotkeys plus coldkey lineage writes. - // Proof Size summary in bytes: - // Measured: `2166` - // Estimated: `100000` - // Minimum execution time: 480_000_000 picoseconds. - Weight::from_parts(480_000_000, 100000) - .saturating_add(RocksDbWeight::get().reads(250_u64)) - .saturating_add(RocksDbWeight::get().writes(210_u64)) + /// Storage: `SubtensorModule::ColdkeySuccessor` (r:0 w:2) + /// Proof: `SubtensorModule::ColdkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `w` is `[1, 256]`. + fn swap_coldkey(w: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `8643 + w * (353 ±0)` + // Estimated: `114909 + w * (10265 ±1)` + // Minimum execution time: 533_803_000 picoseconds. + Weight::from_parts(836_625_489, 114909) + // Standard Error: 336_726 + .saturating_add(Weight::from_parts(230_397_375, 0).saturating_mul(w.into())) + .saturating_add(RocksDbWeight::get().reads(78_u64)) + .saturating_add(RocksDbWeight::get().reads((14_u64).saturating_mul(w.into()))) + .saturating_add(RocksDbWeight::get().writes(65_u64)) + .saturating_add(RocksDbWeight::get().writes((12_u64).saturating_mul(w.into()))) + .saturating_add(Weight::from_parts(0, 10265).saturating_mul(w.into())) } /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:0) /// Proof: `SubtensorModule::ColdkeySwapAnnouncements` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -4579,8 +4682,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `665` // Estimated: `4130` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 4130) + // Minimum execution time: 20_801_000 picoseconds. + Weight::from_parts(21_823_000, 4130) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4592,8 +4695,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `613` // Estimated: `4078` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 4078) + // Minimum execution time: 17_175_000 picoseconds. + Weight::from_parts(17_886_000, 4078) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4605,8 +4708,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + // Minimum execution time: 6_870_000 picoseconds. + Weight::from_parts(7_451_000, 0) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -4641,20 +4744,26 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:0) + /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Keys` (r:256 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn batch_reveal_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `2155` - // Estimated: `8095` - // Minimum execution time: 209_000_000 picoseconds. - Weight::from_parts(218_000_000, 8095) - .saturating_add(RocksDbWeight::get().reads(19_u64)) + /// The range of component `b` is `[1, 10]`. + fn batch_reveal_weights(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `12306 + b * (56 ±0)` + // Estimated: `646896 + b * (56 ±0)` + // Minimum execution time: 918_255_000 picoseconds. + Weight::from_parts(618_698_455, 646896) + // Standard Error: 408_776 + .saturating_add(Weight::from_parts(305_971_237, 0).saturating_mul(b.into())) + .saturating_add(RocksDbWeight::get().reads(275_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 56).saturating_mul(b.into())) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -4690,8 +4799,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1754` // Estimated: `5219` - // Minimum execution time: 94_000_000 picoseconds. - Weight::from_parts(98_000_000, 5219) + // Minimum execution time: 203_813_000 picoseconds. + Weight::from_parts(206_256_000, 5219) .saturating_add(RocksDbWeight::get().reads(15_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -4727,8 +4836,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1754` // Estimated: `5219` - // Minimum execution time: 92_000_000 picoseconds. - Weight::from_parts(102_000_000, 5219) + // Minimum execution time: 196_812_000 picoseconds. + Weight::from_parts(198_484_000, 5219) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -4778,6 +4887,12 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetMovingPrice` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinerBurned` (r:128 w:2) /// Proof: `SubtensorModule::MinerBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::EmissionGateBar` (r:1 w:1) + /// Proof: `SubtensorModule::EmissionGateBar` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::EmissionBarQuantile` (r:1 w:0) + /// Proof: `SubtensorModule::EmissionBarQuantile` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::EmissionGateExponent` (r:1 w:0) + /// Proof: `SubtensorModule::EmissionGateExponent` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetEmissionEnabled` (r:128 w:0) /// Proof: `SubtensorModule::SubnetEmissionEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:128 w:127) @@ -4828,7 +4943,7 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::BlockAtRegistration` (r:512 w:0) /// Proof: `SubtensorModule::BlockAtRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:1024 w:512) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:1024 w:0) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ParentKeys` (r:512 w:0) /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -4880,36 +4995,28 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Delegates` (r:512 w:0) /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:513 w:0) - /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:542 w:512) - /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:512 w:0) - /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:512 w:512) - /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:512 w:512) - /// Proof: `SubtensorModule::AlphaDividendsPerSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimable` (r:512 w:512) - /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootAlphaDividendsPerSubnet` (r:512 w:512) - /// Proof: `SubtensorModule::RootAlphaDividendsPerSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::EMAPriceHalvingBlocks` (r:128 w:0) /// Proof: `SubtensorModule::EMAPriceHalvingBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetMovingAlpha` (r:1 w:0) /// Proof: `SubtensorModule::SubnetMovingAlpha` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::PendingChildKeys` (r:129 w:0) /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NumStakingColdkeys` (r:1 w:0) + /// Storage: `SubtensorModule::NumStakingColdkeys` (r:1 w:1) /// Proof: `SubtensorModule::NumStakingColdkeys` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NumRootClaim` (r:1 w:0) /// Proof: `SubtensorModule::NumRootClaim` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:1 w:0) + /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:1 w:4) /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaMapLastKey` (r:1 w:0) /// Proof: `SubtensorModule::AlphaMapLastKey` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Alpha` (r:1 w:0) + /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaV2MapLastKey` (r:1 w:1) /// Proof: `SubtensorModule::AlphaV2MapLastKey` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AlphaV2` (r:31 w:0) + /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingColdkeys` (r:4 w:4) + /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootProp` (r:0 w:128) /// Proof: `SubtensorModule::RootProp` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Active` (r:0 w:2) @@ -4940,12 +5047,12 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetTaoInEmission` (`max_values`: None, `max_size`: None, mode: `Measured`) fn block_step() -> Weight { // Proof Size summary in bytes: - // Measured: `35625441` - // Estimated: `38160831` - // Minimum execution time: 74_108_000_000 picoseconds. - Weight::from_parts(80_064_000_000, 38160831) - .saturating_add(RocksDbWeight::get().reads(13414_u64)) - .saturating_add(RocksDbWeight::get().writes(7064_u64)) + // Measured: `954514` + // Estimated: `3489904` + // Minimum execution time: 74_166_154_000 picoseconds. + Weight::from_parts(75_178_727_000, 3489904) + .saturating_add(RocksDbWeight::get().reads(9838_u64)) + .saturating_add(RocksDbWeight::get().writes(4002_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -4963,8 +5070,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1118` // Estimated: `4583` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 4583) + // Minimum execution time: 37_375_000 picoseconds. + Weight::from_parts(38_237_000, 4583) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -5034,8 +5141,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2304` // Estimated: `8727` - // Minimum execution time: 382_000_000 picoseconds. - Weight::from_parts(395_000_000, 8727) + // Minimum execution time: 887_529_000 picoseconds. + Weight::from_parts(893_257_000, 8727) .saturating_add(RocksDbWeight::get().reads(32_u64)) .saturating_add(RocksDbWeight::get().writes(16_u64)) } @@ -5073,8 +5180,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1979` // Estimated: `7919` - // Minimum execution time: 106_000_000 picoseconds. - Weight::from_parts(110_000_000, 7919) + // Minimum execution time: 231_404_000 picoseconds. + Weight::from_parts(233_587_000, 7919) .saturating_add(RocksDbWeight::get().reads(20_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -5134,8 +5241,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2142` // Estimated: `10557` - // Minimum execution time: 292_000_000 picoseconds. - Weight::from_parts(299_000_000, 10557) + // Minimum execution time: 640_842_000 picoseconds. + Weight::from_parts(660_131_000, 10557) .saturating_add(RocksDbWeight::get().reads(30_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } @@ -5193,8 +5300,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2176` // Estimated: `10591` - // Minimum execution time: 374_000_000 picoseconds. - Weight::from_parts(387_000_000, 10591) + // Minimum execution time: 854_380_000 picoseconds. + Weight::from_parts(871_364_000, 10591) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } @@ -5270,8 +5377,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2662` // Estimated: `11077` - // Minimum execution time: 457_000_000 picoseconds. - Weight::from_parts(484_000_000, 11077) + // Minimum execution time: 1_051_072_000 picoseconds. + Weight::from_parts(1_059_665_000, 11077) .saturating_add(RocksDbWeight::get().reads(49_u64)) .saturating_add(RocksDbWeight::get().writes(24_u64)) } @@ -5317,8 +5424,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2023` // Estimated: `7963` - // Minimum execution time: 134_000_000 picoseconds. - Weight::from_parts(142_000_000, 7963) + // Minimum execution time: 295_469_000 picoseconds. + Weight::from_parts(301_017_000, 7963) .saturating_add(RocksDbWeight::get().reads(21_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -5362,8 +5469,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2162` // Estimated: `8102` - // Minimum execution time: 141_000_000 picoseconds. - Weight::from_parts(146_000_000, 8102) + // Minimum execution time: 295_189_000 picoseconds. + Weight::from_parts(301_839_000, 8102) .saturating_add(RocksDbWeight::get().reads(24_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -5373,10 +5480,6 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMovingPrice` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetMovingPrice` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Alpha` (r:1 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaV2` (r:1 w:1) @@ -5389,6 +5492,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinerCollateral` (r:1 w:1) /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetMovingPrice` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetMovingPrice` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) @@ -5437,10 +5544,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_collateral() -> Weight { // Proof Size summary in bytes: - // Measured: `2602` - // Estimated: `8542` - // Minimum execution time: 351_000_000 picoseconds. - Weight::from_parts(371_000_000, 8542) + // Measured: `2635` + // Estimated: `8575` + // Minimum execution time: 1_029_640_000 picoseconds. + Weight::from_parts(1_038_523_000, 8575) .saturating_add(RocksDbWeight::get().reads(34_u64)) .saturating_add(RocksDbWeight::get().writes(17_u64)) } @@ -5450,16 +5557,18 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinerCollateral` (r:1 w:1) /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CollateralDrainRatio` (r:1 w:0) /// Proof: `SubtensorModule::CollateralDrainRatio` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_min_collateral() -> Weight { // Proof Size summary in bytes: - // Measured: `1015` - // Estimated: `4480` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 4480) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) + // Measured: `2104` + // Estimated: `5569` + // Minimum execution time: 50_105_000 picoseconds. + Weight::from_parts(51_417_000, 5569) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:2 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -5533,249 +5642,183 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2505` // Estimated: `10920` - // Minimum execution time: 371_000_000 picoseconds. - Weight::from_parts(388_000_000, 10920) + // Minimum execution time: 801_911_000 picoseconds. + Weight::from_parts(823_494_000, 10920) .saturating_add(RocksDbWeight::get().reads(49_u64)) .saturating_add(RocksDbWeight::get().writes(24_u64)) } - /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) + /// Storage: `SubtensorModule::WeightCommits` (r:255 w:255) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:255 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) + /// Storage: `SubtensorModule::MechanismCountCurrent` (r:255 w:0) /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) + /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:255 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:1 w:0) + /// Storage: `SubtensorModule::Uids` (r:255 w:0) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) + /// Storage: `SubtensorModule::LastUpdate` (r:255 w:255) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetEpochIndex` (r:255 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:1 w:0) + /// Storage: `SubtensorModule::Tempo` (r:255 w:0) /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) + /// Storage: `SubtensorModule::PendingEpochAt` (r:255 w:0) /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) + /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:255 w:0) /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) + /// Storage: `SubtensorModule::LastEpochBlock` (r:255 w:0) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightsSetRateLimit` (r:1 w:0) - /// Proof: `SubtensorModule::WeightsSetRateLimit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:1 w:0) + /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:255 w:0) /// Proof: `SubtensorModule::RevealPeriodEpochs` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn batch_commit_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1300` - // Estimated: `4765` - // Minimum execution time: 77_000_000 picoseconds. - Weight::from_parts(79_000_000, 4765) - .saturating_add(RocksDbWeight::get().reads(15_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetworkN` (r:255 w:0) + /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[1, 256]`. + fn batch_commit_weights(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1119 + b * (708 ±0)` + // Estimated: `2091 + b * (3184 ±0)` + // Minimum execution time: 83_064_000 picoseconds. + Weight::from_parts(51_165_232, 2091) + // Standard Error: 56_628 + .saturating_add(Weight::from_parts(52_908_198, 0).saturating_mul(b.into())) + .saturating_add(RocksDbWeight::get().reads((14_u64).saturating_mul(b.into()))) + .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into()))) + .saturating_add(Weight::from_parts(0, 3184).saturating_mul(b.into())) + } + /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:255 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) + /// Storage: `SubtensorModule::NetworksAdded` (r:255 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) + /// Storage: `SubtensorModule::MechanismCountCurrent` (r:255 w:0) /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetworkN` (r:255 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:1 w:0) + /// Storage: `SubtensorModule::Uids` (r:255 w:0) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:255 w:0) /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TaoWeight` (r:1 w:0) /// Proof: `SubtensorModule::TaoWeight` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:256 w:0) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ParentKeys` (r:1 w:0) + /// Storage: `SubtensorModule::ParentKeys` (r:255 w:0) /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ChildKeys` (r:1 w:0) + /// Storage: `SubtensorModule::ChildKeys` (r:255 w:0) /// Proof: `SubtensorModule::ChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakeThreshold` (r:1 w:0) /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) + /// Storage: `SubtensorModule::WeightsVersionKey` (r:255 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) + /// Storage: `SubtensorModule::LastUpdate` (r:255 w:255) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) + /// Storage: `SubtensorModule::MinAllowedWeights` (r:255 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Weights` (r:0 w:1) + /// Storage: `SubtensorModule::Weights` (r:0 w:255) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn batch_set_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1455` - // Estimated: `7395` - // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(54_000_000, 7395) - .saturating_add(RocksDbWeight::get().reads(16_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: `SubtensorModule::Owner` (r:1 w:0) - /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Delegates` (r:1 w:1) - /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinDelegateTake` (r:1 w:0) - /// Proof: `SubtensorModule::MinDelegateTake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:0 w:1) - /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn decrease_take() -> Weight { - // Proof Size summary in bytes: - // Measured: `830` - // Estimated: `4295` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 4295) + /// The range of component `b` is `[1, 256]`. + fn batch_set_weights(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1402 + b * (132 ±0)` + // Estimated: `4839 + b * (2608 ±0)` + // Minimum execution time: 93_839_000 picoseconds. + Weight::from_parts(67_055_248, 4839) + // Standard Error: 36_122 + .saturating_add(Weight::from_parts(52_400_699, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(RocksDbWeight::get().reads((13_u64).saturating_mul(b.into()))) + .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into()))) + .saturating_add(Weight::from_parts(0, 2608).saturating_mul(b.into())) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Delegates` (r:1 w:1) /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxDelegateTake` (r:1 w:0) - /// Proof: `SubtensorModule::MaxDelegateTake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:1) - /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TxDelegateTakeRateLimit` (r:1 w:0) - /// Proof: `SubtensorModule::TxDelegateTakeRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn increase_take() -> Weight { - // Proof Size summary in bytes: - // Measured: `923` - // Estimated: `4388` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_000_000, 4388) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: `SubtensorModule::Owner` (r:1 w:1) - /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationStartBlock` (r:1 w:0) - /// Proof: `SubtensorModule::NetworkRegistrationStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRateLimit` (r:1 w:0) - /// Proof: `SubtensorModule::NetworkRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:1) - /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetLimit` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:1) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) - /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:0) - /// Proof: `SubtensorModule::NetworkRegistrationQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:1) - /// Proof: `SubtensorModule::NetworkLastLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkMinLockCost` (r:1 w:0) - /// Proof: `SubtensorModule::NetworkMinLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkLockReductionInterval` (r:1 w:0) - /// Proof: `SubtensorModule::NetworkLockReductionInterval` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:0) - /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:1) - /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) - /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) - /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::SwapBalancer` (r:1 w:0) - /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:1) - /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Kappa` (r:1 w:1) - /// Proof: `SubtensorModule::Kappa` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ActivityCutoff` (r:1 w:1) - /// Proof: `SubtensorModule::ActivityCutoff` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegistrationsThisInterval` (r:1 w:1) - /// Proof: `SubtensorModule::RegistrationsThisInterval` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:1) - /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Active` (r:1 w:1) - /// Proof: `SubtensorModule::Active` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Emission` (r:1 w:1) - /// Proof: `SubtensorModule::Emission` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Consensus` (r:1 w:1) - /// Proof: `SubtensorModule::Consensus` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) - /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Incentive` (r:1 w:1) - /// Proof: `SubtensorModule::Incentive` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) - /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Dividends` (r:1 w:1) - /// Proof: `SubtensorModule::Dividends` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorTrust` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorTrust` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:1) - /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RegisteredSubnetCounter` (r:1 w:1) - /// Proof: `SubtensorModule::RegisteredSubnetCounter` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) - /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) - /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:1) - /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Burn` (r:0 w:1) - /// Proof: `SubtensorModule::Burn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RAORecycledForRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::RAORecycledForRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetLocked` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegisteredAt` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegisteredAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetVolume` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlockAtRegistration` (r:0 w:1) - /// Proof: `SubtensorModule::BlockAtRegistration` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinAllowedWeights` (r:0 w:1) - /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedValidators` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedValidators` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:0 w:1) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaOut` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:0 w:1) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:0 w:1) - /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ImmunityPeriod` (r:0 w:1) - /// Proof: `SubtensorModule::ImmunityPeriod` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEmissionEnabled` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetEmissionEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworkRegistrationAllowed` (r:0 w:1) - /// Proof: `SubtensorModule::NetworkRegistrationAllowed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Yuma3On` (r:0 w:1) - /// Proof: `SubtensorModule::Yuma3On` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:1) - /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MaxAllowedUids` (r:0 w:1) - /// Proof: `SubtensorModule::MaxAllowedUids` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn register_network_with_identity() -> Weight { + /// Storage: `SubtensorModule::MinDelegateTake` (r:1 w:0) + /// Proof: `SubtensorModule::MinDelegateTake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:0 w:1) + /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn decrease_take() -> Weight { + // Proof Size summary in bytes: + // Measured: `830` + // Estimated: `4295` + // Minimum execution time: 28_212_000 picoseconds. + Weight::from_parts(29_064_000, 4295) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: `SubtensorModule::Owner` (r:1 w:0) + /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Delegates` (r:1 w:1) + /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MaxDelegateTake` (r:1 w:0) + /// Proof: `SubtensorModule::MaxDelegateTake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:1) + /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TxDelegateTakeRateLimit` (r:1 w:0) + /// Proof: `SubtensorModule::TxDelegateTakeRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn increase_take() -> Weight { // Proof Size summary in bytes: - // Measured: `1468` - // Estimated: `9883` - // Minimum execution time: 143_000_000 picoseconds. - Weight::from_parts(148_000_000, 9883) - .saturating_add(RocksDbWeight::get().reads(40_u64)) - .saturating_add(RocksDbWeight::get().writes(47_u64)) + // Measured: `923` + // Estimated: `4388` + // Minimum execution time: 32_959_000 picoseconds. + Weight::from_parts(34_201_000, 4388) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: `SubtensorModule::Owner` (r:1 w:0) + /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworkRegistrationStartBlock` (r:1 w:0) + /// Proof: `SubtensorModule::NetworkRegistrationStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworkRateLimit` (r:1 w:0) + /// Proof: `SubtensorModule::NetworkRateLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:1 w:0) + /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetLimit` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:4097 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) + /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworkRegistrationQueue` (r:1 w:1) + /// Proof: `SubtensorModule::NetworkRegistrationQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworkLastLockCost` (r:1 w:0) + /// Proof: `SubtensorModule::NetworkLastLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworkMinLockCost` (r:1 w:0) + /// Proof: `SubtensorModule::NetworkMinLockCost` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworkLockReductionInterval` (r:1 w:0) + /// Proof: `SubtensorModule::NetworkLockReductionInterval` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:0) + /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworkRegistrationLockId` (r:1 w:1) + /// Proof: `SubtensorModule::NetworkRegistrationLockId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(899), added: 3374, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(499), added: 2974, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:4095 w:0) + /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:1 w:0) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// The range of component `i` is `[1, 6400]`. + fn register_network_with_identity(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `26140` + // Estimated: `10167205` + // Minimum execution time: 24_776_080_000 picoseconds. + Weight::from_parts(25_143_120_245, 10167205) + // Standard Error: 5_405 + .saturating_add(Weight::from_parts(9_577, 0).saturating_mul(i.into())) + .saturating_add(RocksDbWeight::get().reads(8209_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -5785,14 +5828,19 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ServingRateLimit` (r:1 w:0) /// Proof: `SubtensorModule::ServingRateLimit` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn serve_axon_tls() -> Weight { + /// Storage: `SubtensorModule::NeuronCertificates` (r:0 w:1) + /// Proof: `SubtensorModule::NeuronCertificates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `c` is `[1, 65]`. + fn serve_axon_tls(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `799` // Estimated: `4264` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 4264) + // Minimum execution time: 37_305_000 picoseconds. + Weight::from_parts(38_740_250, 4264) + // Standard Error: 1_545 + .saturating_add(Weight::from_parts(2_366, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:0) /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -5800,12 +5848,15 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IdentitiesV2` (r:0 w:1) /// Proof: `SubtensorModule::IdentitiesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_identity() -> Weight { + /// The range of component `i` is `[1, 4096]`. + fn set_identity(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `889` // Estimated: `6829` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 6829) + // Minimum execution time: 29_864_000 picoseconds. + Weight::from_parts(31_701_058, 6829) + // Standard Error: 26 + .saturating_add(Weight::from_parts(994, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -5815,21 +5866,20 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetIdentitiesV3` (r:0 w:1) /// Proof: `SubtensorModule::SubnetIdentitiesV3` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_subnet_identity() -> Weight { + /// The range of component `i` is `[1, 6400]`. + fn set_subnet_identity(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `738` // Estimated: `4203` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 4203) + // Minimum execution time: 20_361_000 picoseconds. + Weight::from_parts(21_260_801, 4203) + // Standard Error: 13 + .saturating_add(Weight::from_parts(991, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:2 w:2) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:18 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinerCollateral` (r:17 w:0) - /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:18 w:34) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimable` (r:2 w:2) @@ -5842,6 +5892,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaV2` (r:2547 w:2546) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:18 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:17 w:0) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:2 w:5) /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ChildKeys` (r:34 w:34) @@ -5896,16 +5950,20 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Delegates` (r:1 w:0) /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeyRoot` (r:16 w:16) + /// Proof: `SubtensorModule::HotkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Keys` (r:0 w:16) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:32) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) fn swap_hotkey() -> Weight { // Proof Size summary in bytes: // Measured: `219071` // Estimated: `6523886` - // Minimum execution time: 83_390_000_000 picoseconds. - Weight::from_parts(87_695_000_000, 6523886) - .saturating_add(RocksDbWeight::get().reads(6928_u64)) - .saturating_add(RocksDbWeight::get().writes(4111_u64)) + // Minimum execution time: 180_055_982_000 picoseconds. + Weight::from_parts(180_361_786_000, 6523886) + .saturating_add(RocksDbWeight::get().reads(6944_u64)) + .saturating_add(RocksDbWeight::get().writes(4159_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:1) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -5917,72 +5975,125 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `818` // Estimated: `4283` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 4283) + // Minimum execution time: 23_314_000 picoseconds. + Weight::from_parts(24_026_000, 4283) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } + /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:0) + /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Storage: `SubtensorModule::NetworksAdded` (r:257 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubtokenEnabled` (r:2 w:0) + /// Storage: `SubtensorModule::SubtokenEnabled` (r:256 w:0) /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn unstake_all() -> Weight { - // Proof Size summary in bytes: - // Measured: `774` - // Estimated: `9189` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 9189) - .saturating_add(RocksDbWeight::get().reads(6_u64)) + /// Storage: `SubtensorModule::Alpha` (r:255 w:0) + /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::AlphaV2` (r:255 w:255) + /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:255 w:255) + /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:255 w:0) + /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:255 w:255) + /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetMechanism` (r:255 w:0) + /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetTAO` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::FeeRate` (r:1 w:0) + /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) + /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:0) + /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Lock` (r:255 w:0) + /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:255 w:0) + /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:255 w:0) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetAlphaOut` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) + /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetVolume` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:256 w:256) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `AlphaAssets::AlphaBurned` (r:1 w:1) + /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetTaoFlow` (r:255 w:255) + /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) + /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:0 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 256]`. + fn unstake_all(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1400 + n * (216 ±0)` + // Estimated: `7381 + n * (2692 ±0)` + // Minimum execution time: 652_356_000 picoseconds. + Weight::from_parts(659_517_000, 7381) + // Standard Error: 303_806 + .saturating_add(Weight::from_parts(328_544_863, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().reads((17_u64).saturating_mul(n.into()))) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + .saturating_add(RocksDbWeight::get().writes((9_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2692).saturating_mul(n.into())) } + /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:0) + /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Owner` (r:1 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) + /// Storage: `SubtensorModule::NetworksAdded` (r:257 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubtokenEnabled` (r:2 w:0) + /// Storage: `SubtensorModule::SubtokenEnabled` (r:256 w:0) /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:2 w:0) + /// Storage: `SubtensorModule::Alpha` (r:256 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:2 w:2) + /// Storage: `SubtensorModule::AlphaV2` (r:256 w:256) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:256 w:0) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:2) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:2 w:0) + /// Storage: `SubtensorModule::SubnetMechanism` (r:256 w:0) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTAO` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetTAO` (r:256 w:256) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Swap::FeeRate` (r:1 w:0) /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::SubnetAlphaIn` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:256 w:256) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::PalSwapInitialized` (r:1 w:0) + /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) - /// Storage: `Swap::SwapBalancer` (r:1 w:0) - /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Lock` (r:2 w:0) + /// Storage: `SubtensorModule::Lock` (r:256 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:1 w:0) + /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:255 w:0) /// Proof: `SubtensorModule::ColdkeyMinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinerCollateral` (r:1 w:0) + /// Storage: `SubtensorModule::MinerCollateral` (r:255 w:0) /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetAlphaOut` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetAlphaOut` (r:256 w:256) /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetVolume` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetVolume` (r:256 w:256) /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:4 w:3) + /// Storage: `System::Account` (r:258 w:257) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// Storage: `AlphaAssets::AlphaBurned` (r:1 w:1) /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetTaoFlow` (r:2 w:2) + /// Storage: `SubtensorModule::SubnetTaoFlow` (r:256 w:256) /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimable` (r:1 w:0) /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -5994,14 +6105,22 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn unstake_all_alpha() -> Weight { - // Proof Size summary in bytes: - // Measured: `2235` - // Estimated: `11306` - // Minimum execution time: 380_000_000 picoseconds. - Weight::from_parts(384_000_000, 11306) - .saturating_add(RocksDbWeight::get().reads(45_u64)) - .saturating_add(RocksDbWeight::get().writes(25_u64)) + /// Storage: `Swap::SwapBalancer` (r:0 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 256]`. + fn unstake_all_alpha(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1436 + n * (216 ±0)` + // Estimated: `8727 + n * (2692 ±0)` + // Minimum execution time: 815_200_000 picoseconds. + Weight::from_parts(209_875_996, 8727) + // Standard Error: 254_399 + .saturating_add(Weight::from_parts(340_296_632, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(28_u64)) + .saturating_add(RocksDbWeight::get().reads((17_u64).saturating_mul(n.into()))) + .saturating_add(RocksDbWeight::get().writes(18_u64)) + .saturating_add(RocksDbWeight::get().writes((9_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2692).saturating_mul(n.into())) } /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -6057,8 +6176,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2176` // Estimated: `10591` - // Minimum execution time: 388_000_000 picoseconds. - Weight::from_parts(415_000_000, 10591) + // Minimum execution time: 857_213_000 picoseconds. + Weight::from_parts(875_579_000, 10591) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } @@ -6070,7 +6189,7 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::NextSubnetLeaseId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:503 w:503) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) - /// Storage: `SubtensorModule::Owner` (r:1 w:1) + /// Storage: `SubtensorModule::Owner` (r:65 w:1) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworkRegistrationStartBlock` (r:1 w:0) /// Proof: `SubtensorModule::NetworkRegistrationStartBlock` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -6080,7 +6199,7 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetLimit` (r:1 w:0) /// Proof: `SubtensorModule::SubnetLimit` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:3 w:1) + /// Storage: `SubtensorModule::NetworksAdded` (r:4098 w:1) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -6094,13 +6213,13 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::NetworkLockReductionInterval` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:0) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetMechanism` (r:1 w:1) + /// Storage: `SubtensorModule::SubnetMechanism` (r:4096 w:1) /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::SwapBalancer` (r:1 w:0) + /// Storage: `Swap::SwapBalancer` (r:2 w:0) /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::TotalNetworks` (r:1 w:1) /// Proof: `SubtensorModule::TotalNetworks` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -6124,6 +6243,8 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Incentive` (r:1 w:1) /// Proof: `SubtensorModule::Incentive` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:1) + /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Dividends` (r:1 w:1) @@ -6134,13 +6255,27 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RegisteredSubnetCounter` (r:1 w:1) /// Proof: `SubtensorModule::RegisteredSubnetCounter` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) + /// Storage: `SubtensorModule::TokenSymbol` (r:4097 w:1) /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:1 w:1) + /// Storage: `SubtensorModule::Keys` (r:65 w:1) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:3 w:1) + /// Storage: `SubtensorModule::AutoParentDelegationEnabled` (r:64 w:0) + /// Proof: `SubtensorModule::AutoParentDelegationEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TransactionKeyLastBlock` (r:64 w:64) + /// Proof: `SubtensorModule::TransactionKeyLastBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ChildKeys` (r:64 w:64) + /// Proof: `SubtensorModule::ChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ParentKeys` (r:65 w:65) + /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:262208 w:0) + /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakeThreshold` (r:1 w:0) + /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubtokenEnabled` (r:1 w:0) + /// Proof: `SubtensorModule::SubtokenEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwner` (r:2 w:1) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Proxy::Proxies` (r:1 w:1) /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(789), added: 3264, mode: `MaxEncodedLen`) @@ -6176,8 +6311,6 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastEpochBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:0 w:1) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Uids` (r:0 w:1) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ImmunityPeriod` (r:0 w:1) @@ -6190,6 +6323,8 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::NetworkRegistrationAllowed` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Yuma3On` (r:0 w:1) /// Proof: `SubtensorModule::Yuma3On` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:1) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MaxAllowedUids` (r:0 w:1) @@ -6197,15 +6332,15 @@ impl WeightInfo for () { /// The range of component `k` is `[2, 500]`. fn register_leased_network(k: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1835 + k * (44 ±0)` - // Estimated: `10256 + k * (2579 ±0)` - // Minimum execution time: 259_000_000 picoseconds. - Weight::from_parts(171_942_062, 10256) - // Standard Error: 74_270 - .saturating_add(Weight::from_parts(29_141_808, 0).saturating_mul(k.into())) - .saturating_add(RocksDbWeight::get().reads(50_u64)) + // Measured: `67249 + k * (44 ±0)` + // Estimated: `649033047 + k * (2579 ±0)` + // Minimum execution time: 1_927_714_663_000 picoseconds. + Weight::from_parts(1_988_707_555_887, 649033047) + // Standard Error: 30_155_939 + .saturating_add(Weight::from_parts(75_339_439, 0).saturating_mul(k.into())) + .saturating_add(RocksDbWeight::get().reads(274930_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(k.into()))) - .saturating_add(RocksDbWeight::get().writes(53_u64)) + .saturating_add(RocksDbWeight::get().writes(247_u64)) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(k.into()))) .saturating_add(Weight::from_parts(0, 2579).saturating_mul(k.into())) } @@ -6248,17 +6383,29 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TokenSymbol` (r:3 w:1) + /// Storage: `SubtensorModule::TokenSymbol` (r:441 w:1) /// Proof: `SubtensorModule::TokenSymbol` (`max_values`: None, `max_size`: None, mode: `Measured`) fn update_symbol() -> Weight { // Proof Size summary in bytes: - // Measured: `762` - // Estimated: `9177` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 9177) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Measured: `4822` + // Estimated: `1097287` + // Minimum execution time: 1_234_524_000 picoseconds. + Weight::from_parts(1_246_181_000, 1097287) + .saturating_add(RocksDbWeight::get().reads(443_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } + /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Tempo` (r:1 w:0) + /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) + /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) + /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) + /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -6273,26 +6420,20 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:1 w:0) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) - /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) - /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_timelocked_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `1248` - // Estimated: `4713` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(51_000_000, 4713) + /// The range of component `c` is `[1, 5000]`. + /// The range of component `q` is `[0, 256]`. + fn commit_timelocked_weights(c: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1326` + // Estimated: `4782` + // Minimum execution time: 87_861_000 picoseconds. + Weight::from_parts(87_193_676, 4782) + // Standard Error: 62 + .saturating_add(Weight::from_parts(1_846, 0).saturating_mul(c.into())) + // Standard Error: 1_218 + .saturating_add(Weight::from_parts(12_137, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -6302,16 +6443,24 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AutoStakeDestination` (r:1 w:1) /// Proof: `SubtensorModule::AutoStakeDestination` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:1 w:1) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:2 w:2) /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_coldkey_auto_stake_hotkey() -> Weight { - // Proof Size summary in bytes: - // Measured: `809` - // Estimated: `4274` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 4274) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + /// The range of component `o` is `[1, 256]`. + /// The range of component `n` is `[1, 256]`. + fn set_coldkey_auto_stake_hotkey(o: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1057 + n * (32 ±0) + o * (32 ±0)` + // Estimated: `6994 + n * (32 ±0) + o * (32 ±0)` + // Minimum execution time: 53_840_000 picoseconds. + Weight::from_parts(48_773_245, 6994) + // Standard Error: 1_088 + .saturating_add(Weight::from_parts(29_048, 0).saturating_mul(o.into())) + // Standard Error: 1_088 + .saturating_add(Weight::from_parts(32_888, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(o.into())) } /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:1) /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -6321,47 +6470,90 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::RootClaimType` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:0 w:1) /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn set_root_claim_type() -> Weight { + /// The range of component `s` is `[1, 256]`. + fn set_root_claim_type(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `476` // Estimated: `3941` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 3941) + // Minimum execution time: 15_903_000 picoseconds. + Weight::from_parts(17_442_349, 3941) + // Standard Error: 441 + .saturating_add(Weight::from_parts(43_853, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } - /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:0) - /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:0) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::StakingColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NumStakingColdkeys` (r:1 w:1) + /// Proof: `SubtensorModule::NumStakingColdkeys` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimType` (r:1 w:0) /// Proof: `SubtensorModule::RootClaimType` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimable` (r:1 w:0) + /// Storage: `SubtensorModule::RootClaimable` (r:256 w:0) /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DissolveCleanupQueue` (r:1 w:0) /// Proof: `SubtensorModule::DissolveCleanupQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:2 w:0) + /// Storage: `SubtensorModule::Alpha` (r:256 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:2 w:1) + /// Storage: `SubtensorModule::AlphaV2` (r:256 w:256) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:2 w:1) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:2 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:256 w:0) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:2 w:1) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:256 w:256) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimed` (r:1 w:1) + /// Storage: `SubtensorModule::RootClaimed` (r:1280 w:1280) /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::RootClaimableThreshold` (r:1 w:0) + /// Storage: `SubtensorModule::RootClaimableThreshold` (r:5 w:0) /// Proof: `SubtensorModule::RootClaimableThreshold` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn claim_root() -> Weight { - // Proof Size summary in bytes: - // Measured: `1969` - // Estimated: `7909` - // Minimum execution time: 66_000_000 picoseconds. - Weight::from_parts(70_000_000, 7909) - .saturating_add(RocksDbWeight::get().reads(17_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) + /// Storage: `SubtensorModule::SubnetMechanism` (r:5 w:0) + /// Proof: `SubtensorModule::SubnetMechanism` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetTAO` (r:6 w:6) + /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetAlphaIn` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::PalSwapInitialized` (r:5 w:5) + /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetAlphaOut` (r:6 w:6) + /// Proof: `SubtensorModule::SubnetAlphaOut` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TotalStake` (r:1 w:1) + /// Proof: `SubtensorModule::TotalStake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetVolume` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetVolume` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:6 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:6 w:6) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `SubtensorModule::SubnetRootSellTao` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetRootSellTao` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetProtocolFlow` (r:5 w:5) + /// Proof: `SubtensorModule::SubnetProtocolFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::StakingColdkeysByIndex` (r:0 w:1) + /// Proof: `SubtensorModule::StakingColdkeysByIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:0 w:5) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// The range of component `h` is `[1, 256]`. + /// The range of component `s` is `[1, 5]`. + fn claim_root(h: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + h * (453 ±0) + s * (4941 ±0)` + // Estimated: `18636 + h * (5340 ±1) + s * (200971 ±99)` + // Minimum execution time: 1_654_578_000 picoseconds. + Weight::from_parts(1_665_985_000, 18636) + // Standard Error: 29_564_732 + .saturating_add(Weight::from_parts(563_045_949, 0).saturating_mul(h.into())) + // Standard Error: 1_519_828_563 + .saturating_add(Weight::from_parts(24_042_963_573, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(76_u64)) + .saturating_add(RocksDbWeight::get().reads((8_u64).saturating_mul(h.into()))) + .saturating_add(RocksDbWeight::get().reads((83_u64).saturating_mul(s.into()))) + .saturating_add(RocksDbWeight::get().writes(60_u64)) + .saturating_add(RocksDbWeight::get().writes((5_u64).saturating_mul(h.into()))) + .saturating_add(RocksDbWeight::get().writes((83_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 5340).saturating_mul(h.into())) + .saturating_add(Weight::from_parts(0, 200971).saturating_mul(s.into())) } /// Storage: `SubtensorModule::NumRootClaim` (r:0 w:1) /// Proof: `SubtensorModule::NumRootClaim` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -6369,8 +6561,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 1_943_000 picoseconds. + Weight::from_parts(2_203_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -6381,8 +6573,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `652` // Estimated: `4117` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(7_000_000, 4117) + // Minimum execution time: 13_390_000 picoseconds. + Weight::from_parts(13_871_000, 4117) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -6396,8 +6588,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `899` // Estimated: `4364` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 4364) + // Minimum execution time: 24_907_000 picoseconds. + Weight::from_parts(25_968_000, 4364) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -6473,8 +6665,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2307` // Estimated: `8727` - // Minimum execution time: 459_000_000 picoseconds. - Weight::from_parts(477_000_000, 8727) + // Minimum execution time: 1_043_049_000 picoseconds. + Weight::from_parts(1_050_651_000, 8727) .saturating_add(RocksDbWeight::get().reads(35_u64)) .saturating_add(RocksDbWeight::get().writes(17_u64)) } @@ -6484,8 +6676,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 2_063_000 picoseconds. + Weight::from_parts(2_364_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -6528,8 +6720,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1830` // Estimated: `7770` - // Minimum execution time: 61_000_000 picoseconds. - Weight::from_parts(63_000_000, 7770) + // Minimum execution time: 120_930_000 picoseconds. + Weight::from_parts(122_642_000, 7770) .saturating_add(RocksDbWeight::get().reads(18_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -6561,8 +6753,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1515` // Estimated: `7455` - // Minimum execution time: 80_000_000 picoseconds. - Weight::from_parts(84_000_000, 7455) + // Minimum execution time: 161_830_000 picoseconds. + Weight::from_parts(163_964_000, 7455) .saturating_add(RocksDbWeight::get().reads(15_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -6578,10 +6770,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::AssociatedUidsByEvmAddress` (`max_values`: None, `max_size`: None, mode: `Measured`) fn associate_evm_key() -> Weight { // Proof Size summary in bytes: - // Measured: `1157` - // Estimated: `4622` - // Minimum execution time: 378_000_000 picoseconds. - Weight::from_parts(395_000_000, 4622) + // Measured: `2028` + // Estimated: `5493` + // Minimum execution time: 754_240_000 picoseconds. + Weight::from_parts(770_985_000, 5493) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -6618,8 +6810,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `733` // Estimated: `4198` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 4198) + // Minimum execution time: 16_882_000 picoseconds. + Weight::from_parts(17_523_000, 4198) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) @@ -6646,8 +6838,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1731` // Estimated: `7671` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 7671) + // Minimum execution time: 51_777_000 picoseconds. + Weight::from_parts(53_138_000, 7671) .saturating_add(RocksDbWeight::get().reads(11_u64)) } /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) @@ -6668,8 +6860,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1019` // Estimated: `4484` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 4484) + // Minimum execution time: 34_031_000 picoseconds. + Weight::from_parts(35_063_000, 4484) .saturating_add(RocksDbWeight::get().reads(7_u64)) } /// Storage: `SubtensorModule::MinDelegateTake` (r:1 w:0) @@ -6696,8 +6888,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `647` // Estimated: `4112` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 4112) + // Minimum execution time: 18_865_000 picoseconds. + Weight::from_parts(19_356_000, 4112) .saturating_add(RocksDbWeight::get().reads(3_u64)) } /// Storage: `SubtensorModule::Uids` (r:1 w:0) @@ -6736,7 +6928,7 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::StakeThreshold` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::WeightsVersionKey` (r:1 w:0) /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:4096 w:0) + /// Storage: `SubtensorModule::Keys` (r:255 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -6746,20 +6938,22 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[1, 4096]`. + /// The range of component `n` is `[1, 256]`. fn set_mechanism_weights(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `4079 + n * (45 ±0)` - // Estimated: `9373 + n * (2520 ±0)` - // Minimum execution time: 53_000_000 picoseconds. - Weight::from_parts(56_000_000, 9373) - // Standard Error: 3_996 - .saturating_add(Weight::from_parts(1_961_926, 0).saturating_mul(n.into())) + // Measured: `1958 + n * (47 ±0)` + // Estimated: `7755 + n * (2523 ±0)` + // Minimum execution time: 98_967_000 picoseconds. + Weight::from_parts(104_968_496, 7755) + // Standard Error: 10_821 + .saturating_add(Weight::from_parts(3_078_694, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(16_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 2523).saturating_mul(n.into())) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -6782,27 +6976,29 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RevealPeriodEpochs` (r:1 w:0) /// Proof: `SubtensorModule::RevealPeriodEpochs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_mechanism_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `37406` - // Estimated: `40871` - // Minimum execution time: 116_000_000 picoseconds. - Weight::from_parts(124_000_000, 40871) + /// The range of component `q` is `[0, 9]`. + fn commit_mechanism_weights(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `5117 + q * (56 ±0)` + // Estimated: `8581 + q * (56 ±0)` + // Minimum execution time: 106_728_000 picoseconds. + Weight::from_parts(119_844_770, 8581) + // Standard Error: 92_814 + .saturating_add(Weight::from_parts(502_577, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 56).saturating_mul(q.into())) } + /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) /// Proof: `SubtensorModule::CommitRevealWeightsEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Tempo` (r:1 w:0) @@ -6831,26 +7027,42 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::WeightsVersionKey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ValidatorPermit` (r:1 w:0) /// Proof: `SubtensorModule::ValidatorPermit` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:4096 w:0) + /// Storage: `SubtensorModule::Keys` (r:256 w:0) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MinAllowedWeights` (r:1 w:0) /// Proof: `SubtensorModule::MinAllowedWeights` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Weights` (r:0 w:1) /// Proof: `SubtensorModule::Weights` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[1, 4096]`. - fn reveal_mechanism_weights(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `4835 + n * (37 ±0)` - // Estimated: `10114 + n * (2512 ±0)` - // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(61_000_000, 10114) - // Standard Error: 4_010 - .saturating_add(Weight::from_parts(2_031_383, 0).saturating_mul(n.into())) + /// The range of component `n` is `[1, 256]`. + /// The range of component `q` is `[1, 10]`. + fn reveal_mechanism_weights(n: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2202 + n * (39 ±0) + q * (56 ±0)` + // Estimated: `7938 + n * (2515 ±0) + q * (64 ±2)` + // Minimum execution time: 118_376_000 picoseconds. + Weight::from_parts(120_360_699, 7938) + // Standard Error: 6_088 + .saturating_add(Weight::from_parts(3_166_185, 0).saturating_mul(n.into())) + // Standard Error: 162_218 + .saturating_add(Weight::from_parts(789_994, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(19_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 2512).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 2515).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(q.into())) } + /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Tempo` (r:1 w:0) + /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) + /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) + /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) + /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) + /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -6865,6 +7077,23 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `c` is `[1, 5000]`. + /// The range of component `q` is `[0, 256]`. + fn commit_crv3_mechanism_weights(c: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `5142` + // Estimated: `8598` + // Minimum execution time: 119_888_000 picoseconds. + Weight::from_parts(126_488_582, 8598) + // Standard Error: 242 + .saturating_add(Weight::from_parts(699, 0).saturating_mul(c.into())) + // Standard Error: 4_730 + .saturating_add(Weight::from_parts(27_620, 0).saturating_mul(q.into())) + .saturating_add(RocksDbWeight::get().reads(14_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Tempo` (r:1 w:0) @@ -6877,17 +7106,6 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_crv3_mechanism_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `36927` - // Estimated: `40392` - // Minimum execution time: 117_000_000 picoseconds. - Weight::from_parts(132_000_000, 40392) - .saturating_add(RocksDbWeight::get().reads(14_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::MechanismCountCurrent` (r:1 w:0) @@ -6902,111 +7120,109 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastUpdate` (r:1 w:1) /// Proof: `SubtensorModule::LastUpdate` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetEpochIndex` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetEpochIndex` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Tempo` (r:1 w:0) - /// Proof: `SubtensorModule::Tempo` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingEpochAt` (r:1 w:0) - /// Proof: `SubtensorModule::PendingEpochAt` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::BlocksSinceLastStep` (r:1 w:0) - /// Proof: `SubtensorModule::BlocksSinceLastStep` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastEpochBlock` (r:1 w:0) - /// Proof: `SubtensorModule::LastEpochBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TimelockedWeightCommits` (r:1 w:1) - /// Proof: `SubtensorModule::TimelockedWeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetworkN` (r:1 w:0) /// Proof: `SubtensorModule::SubnetworkN` (`max_values`: None, `max_size`: None, mode: `Measured`) - fn commit_timelocked_mechanism_weights() -> Weight { - // Proof Size summary in bytes: - // Measured: `36927` - // Estimated: `40392` - // Minimum execution time: 113_000_000 picoseconds. - Weight::from_parts(130_000_000, 40392) + /// The range of component `c` is `[1, 5000]`. + /// The range of component `q` is `[0, 256]`. + fn commit_timelocked_mechanism_weights(c: u32, q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `5142` + // Estimated: `8598` + // Minimum execution time: 117_545_000 picoseconds. + Weight::from_parts(120_035_444, 8598) + // Standard Error: 164 + .saturating_add(Weight::from_parts(2_011, 0).saturating_mul(c.into())) + // Standard Error: 3_201 + .saturating_add(Weight::from_parts(20_382, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::Owner` (r:2 w:2) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NetworksAdded` (r:4098 w:0) - /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MinerCollateral` (r:4097 w:0) - /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::IsNetworkMember` (r:4098 w:8194) + /// Storage: `SubtensorModule::IsNetworkMember` (r:4097 w:8192) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimable` (r:2 w:2) /// Proof: `SubtensorModule::RootClaimable` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:8193 w:8192) + /// Storage: `SubtensorModule::TotalHotkeyAlpha` (r:8191 w:8190) /// Proof: `SubtensorModule::TotalHotkeyAlpha` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::RootClaimed` (r:1 w:0) /// Proof: `SubtensorModule::RootClaimed` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Alpha` (r:8193 w:0) + /// Storage: `SubtensorModule::Alpha` (r:8191 w:0) /// Proof: `SubtensorModule::Alpha` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaV2` (r:8193 w:8192) + /// Storage: `SubtensorModule::AlphaV2` (r:8191 w:8190) /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::NetworksAdded` (r:4097 w:0) + /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MinerCollateral` (r:4096 w:0) + /// Proof: `SubtensorModule::MinerCollateral` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastRateLimitedBlock` (r:2 w:5) /// Proof: `SubtensorModule::LastRateLimitedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ChildKeys` (r:8194 w:8194) + /// Storage: `SubtensorModule::ChildKeys` (r:8192 w:8192) /// Proof: `SubtensorModule::ChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LastHotkeySwapOnNetuid` (r:4096 w:4096) + /// Storage: `SubtensorModule::LastHotkeySwapOnNetuid` (r:4095 w:4095) /// Proof: `SubtensorModule::LastHotkeySwapOnNetuid` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalIssuance` (r:1 w:1) /// Proof: `SubtensorModule::TotalIssuance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:4097 w:0) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:4096 w:0) /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:4097 w:0) + /// Storage: `SubtensorModule::HotkeyLock` (r:4096 w:0) /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:4097 w:0) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:4096 w:0) /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::OwnedHotkeys` (r:1 w:1) /// Proof: `SubtensorModule::OwnedHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ChildkeyTake` (r:4097 w:0) + /// Storage: `SubtensorModule::ChildkeyTake` (r:4096 w:0) /// Proof: `SubtensorModule::ChildkeyTake` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::ParentKeys` (r:8194 w:8194) + /// Storage: `SubtensorModule::ParentKeys` (r:8192 w:8192) /// Proof: `SubtensorModule::ParentKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::PendingChildKeys` (r:8194 w:0) + /// Storage: `SubtensorModule::PendingChildKeys` (r:8192 w:0) /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:4097 w:0) + /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:4096 w:0) /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (r:8194 w:4097) + /// Storage: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (r:8192 w:4096) /// Proof: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:8194 w:8194) + /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:8192 w:8192) /// Proof: `SubtensorModule::AlphaDividendsPerSubnet` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::VotingPower` (r:4097 w:0) + /// Storage: `SubtensorModule::VotingPower` (r:4096 w:0) /// Proof: `SubtensorModule::VotingPower` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AutoParentDelegationEnabled` (r:1 w:0) /// Proof: `SubtensorModule::AutoParentDelegationEnabled` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Uids` (r:4096 w:8192) + /// Storage: `SubtensorModule::Uids` (r:4095 w:8190) /// Proof: `SubtensorModule::Uids` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Prometheus` (r:4096 w:0) + /// Storage: `SubtensorModule::Prometheus` (r:4095 w:0) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Axons` (r:4096 w:0) + /// Storage: `SubtensorModule::Axons` (r:4095 w:0) /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::MechanismCountCurrent` (r:4096 w:0) + /// Storage: `SubtensorModule::MechanismCountCurrent` (r:4095 w:0) /// Proof: `SubtensorModule::MechanismCountCurrent` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::WeightCommits` (r:4096 w:0) + /// Storage: `SubtensorModule::WeightCommits` (r:4095 w:0) /// Proof: `SubtensorModule::WeightCommits` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::LoadedEmission` (r:4096 w:0) + /// Storage: `SubtensorModule::LoadedEmission` (r:4095 w:0) /// Proof: `SubtensorModule::LoadedEmission` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::NeuronCertificates` (r:4096 w:0) + /// Storage: `SubtensorModule::NeuronCertificates` (r:4095 w:0) /// Proof: `SubtensorModule::NeuronCertificates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeyShares` (r:8192 w:0) + /// Storage: `SubtensorModule::TotalHotkeyShares` (r:8190 w:0) /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:8192 w:8192) + /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:8190 w:8190) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingHotkeys` (r:1 w:1) /// Proof: `SubtensorModule::StakingHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Delegates` (r:1 w:0) /// Proof: `SubtensorModule::Delegates` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Keys` (r:0 w:4096) + /// Storage: `SubtensorModule::HotkeyRoot` (r:4095 w:4095) + /// Proof: `SubtensorModule::HotkeyRoot` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::Keys` (r:0 w:4095) /// Proof: `SubtensorModule::Keys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:8190) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) fn swap_hotkey_v2() -> Weight { // Proof Size summary in bytes: - // Measured: `542010` - // Estimated: `20823150` - // Minimum execution time: 572_681_000_000 picoseconds. - Weight::from_parts(594_286_000_000, 20823150) - .saturating_add(RocksDbWeight::get().reads(151588_u64)) - .saturating_add(RocksDbWeight::get().writes(77845_u64)) + // Measured: `562991` + // Estimated: `20839181` + // Minimum execution time: 1_280_853_785_000 picoseconds. + Weight::from_parts(1_295_934_332_000, 20839181) + .saturating_add(RocksDbWeight::get().reads(155646_u64)) + .saturating_add(RocksDbWeight::get().writes(90111_u64)) } /// Storage: `SubtensorModule::MinChildkeyTake` (r:0 w:1) /// Proof: `SubtensorModule::MinChildkeyTake` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -7014,8 +7230,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 5_239_000 picoseconds. + Weight::from_parts(5_440_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::MaxChildkeyTake` (r:0 w:1) @@ -7024,8 +7240,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 5_239_000 picoseconds. + Weight::from_parts(5_620_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:1) @@ -7103,12 +7319,14 @@ impl WeightInfo for () { /// Storage: `SubtensorModule::PendingChildKeys` (r:0 w:1) /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `c` is `[1, 5]`. - fn set_children(_c: u32, ) -> Weight { + fn set_children(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1536` // Estimated: `9951` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(55_660_572, 9951) + // Minimum execution time: 98_717_000 picoseconds. + Weight::from_parts(100_617_442, 9951) + // Standard Error: 127_751 + .saturating_add(Weight::from_parts(585_332, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -7116,8 +7334,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_000_000, 0) + // Minimum execution time: 1_793_000 picoseconds. + Weight::from_parts(2_003_000, 0) } /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -7131,8 +7349,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `738` // Estimated: `4203` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 4203) + // Minimum execution time: 22_203_000 picoseconds. + Weight::from_parts(23_314_000, 4203) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -7148,8 +7366,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `799` // Estimated: `4264` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 4264) + // Minimum execution time: 28_673_000 picoseconds. + Weight::from_parts(29_495_000, 4264) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -7161,8 +7379,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `619` // Estimated: `4084` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 4084) + // Minimum execution time: 17_296_000 picoseconds. + Weight::from_parts(18_137_000, 4084) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -7212,10 +7430,12 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::MinNonImmuneUids` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetAlphaIn` (r:1 w:1) /// Proof: `SubtensorModule::SubnetAlphaIn` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::FeeRate` (r:1 w:0) - /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetTAO` (r:1 w:1) /// Proof: `SubtensorModule::SubnetTAO` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Swap::SwapBalancer` (r:1 w:1) + /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) + /// Storage: `Swap::FeeRate` (r:1 w:0) + /// Proof: `Swap::FeeRate` (`max_values`: None, `max_size`: Some(12), added: 2487, mode: `MaxEncodedLen`) /// Storage: `Swap::PalSwapInitialized` (r:1 w:1) /// Proof: `Swap::PalSwapInitialized` (`max_values`: None, `max_size`: Some(11), added: 2486, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::SubnetAlphaOut` (r:1 w:1) @@ -7238,6 +7458,8 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::AlphaV2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:1 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::ColdkeyCollateralHotkeys` (r:1 w:1) + /// Proof: `SubtensorModule::ColdkeyCollateralHotkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::CollateralDrainRatio` (r:1 w:0) /// Proof: `SubtensorModule::CollateralDrainRatio` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeyMinerCollateral` (r:1 w:1) @@ -7282,20 +7504,20 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::Axons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Prometheus` (r:0 w:1) /// Proof: `SubtensorModule::Prometheus` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::HotkeySuccessor` (r:0 w:1) + /// Proof: `SubtensorModule::HotkeySuccessor` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::IsNetworkMember` (r:0 w:2) /// Proof: `SubtensorModule::IsNetworkMember` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (r:0 w:1) /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Swap::SwapBalancer` (r:0 w:1) - /// Proof: `Swap::SwapBalancer` (`max_values`: None, `max_size`: Some(18), added: 2493, mode: `MaxEncodedLen`) fn register_limit() -> Weight { // Proof Size summary in bytes: // Measured: `289796` // Estimated: `926861` - // Minimum execution time: 2_829_000_000 picoseconds. - Weight::from_parts(345_012_000, 6148) - .saturating_add(RocksDbWeight::get().reads(34_u64)) - .saturating_add(RocksDbWeight::get().writes(29_u64)) + // Minimum execution time: 5_566_279_000 picoseconds. + Weight::from_parts(5_599_105_000, 926861) + .saturating_add(RocksDbWeight::get().reads(825_u64)) + .saturating_add(RocksDbWeight::get().writes(300_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) /// Proof: `SubtensorModule::NetworksAdded` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -7323,8 +7545,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1226` // Estimated: `7166` - // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(54_000_000, 7166) + // Minimum execution time: 108_622_000 picoseconds. + Weight::from_parts(109_934_000, 7166) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -7332,15 +7554,15 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 783_000 picoseconds. - Weight::from_parts(887_000, 0) + // Minimum execution time: 1_693_000 picoseconds. + Weight::from_parts(1_893_000, 0) } fn set_activity_cutoff_factor() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 803_000 picoseconds. - Weight::from_parts(891_000, 0) + // Minimum execution time: 1_683_000 picoseconds. + Weight::from_parts(1_862_000, 0) } /// Storage: `SubtensorModule::AccountFlags` (r:1 w:1) /// Proof: `SubtensorModule::AccountFlags` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -7348,8 +7570,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `562` // Estimated: `4027` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 4027) + // Minimum execution time: 14_066_000 picoseconds. + Weight::from_parts(14_467_000, 4027) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index cf01824b5a..6f894d420d 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -323,6 +323,7 @@ impl pallet_subtensor::Config for Test { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = MaxEpochsPerBlock; type WeightInfo = (); + type MaxTransactionExtensionWeight = (); } parameter_types! { diff --git a/precompiles/src/mock.rs b/precompiles/src/mock.rs index d42fb253eb..1ecef9a082 100644 --- a/precompiles/src/mock.rs +++ b/precompiles/src/mock.rs @@ -80,6 +80,8 @@ const EVM_DECIMALS_FACTOR: u64 = 1_000_000_000; parameter_types! { pub const BlockHashCount: u64 = 250; pub const SS58Prefix: u8 = 42; + pub MaxTransactionExtensionWeight: Weight = + <() as pallet_subtensor::weights::WeightInfo>::check_coldkey_swap_extension(); pub BlockWeights: limits::BlockWeights = limits::BlockWeights::with_sensible_defaults( Weight::from_parts(2_000_000_000_000, u64::MAX), Perbill::from_percent(75), @@ -525,6 +527,7 @@ impl pallet_subtensor::Config for Runtime { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = MaxEpochsPerBlock; type WeightInfo = (); + type MaxTransactionExtensionWeight = MaxTransactionExtensionWeight; } impl frame_support::traits::InstanceFilter for ProxyType { diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 95eaca16ee..9ea95b1c31 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -62,7 +62,7 @@ use sp_runtime::{ AccountId32, ApplyExtrinsicResult, ConsensusEngineId, Cow, Percent, generic, impl_opaque_keys, traits::{ AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, DispatchInfoOf, - Dispatchable, One, PostDispatchInfoOf, UniqueSaturatedInto, Verify, + Dispatchable, One, PostDispatchInfoOf, TransactionExtension, UniqueSaturatedInto, Verify, }, transaction_validity::{ TransactionPriority, TransactionSource, TransactionValidity, TransactionValidityError, @@ -235,10 +235,10 @@ 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: 440, + spec_version: 442, impl_version: 1, apis: RUNTIME_API_VERSIONS, - transaction_version: 1, + transaction_version: 2, system_version: 1, }; @@ -943,6 +943,7 @@ impl pallet_subtensor::Config for Runtime { type BurnAccountId = BurnAccountId; type InitialMaxEpochsPerBlock = SubtensorMaxEpochsPerBlock; type WeightInfo = pallet_subtensor::weights::SubstrateWeight; + type MaxTransactionExtensionWeight = MaxSubtensorTransactionExtensionWeight; } parameter_types! { @@ -1475,18 +1476,76 @@ pub type SystemTxExtension = ( frame_system::CheckWeight, ); pub type CustomTxExtension = ( - ChargeTransactionPaymentWrapper, SudoTransactionExtension, pallet_shield::CheckShieldedTxValidity, pallet_subtensor::SubtensorTransactionExtension, pallet_drand::drand_priority::DrandPriority, + ChargeTransactionPaymentWrapper, ); pub type TxExtension = ( SystemTxExtension, CustomTxExtension, frame_metadata_hash_extension::CheckMetadataHash, + // CheckWeight runs before the custom extensions during post-dispatch. + // Reclaim once more at the end so the block meter sees their refunds. + frame_system::WeightReclaim, ); +pub struct MaxSubtensorTransactionExtensionWeight; + +impl Get for MaxSubtensorTransactionExtensionWeight { + fn get() -> Weight { + // Use a fixed-weight call so calculating this static ceiling cannot + // recurse through the Subtensor extension's top-level dispatch reserve. + let call = RuntimeCall::System(frame_system::Call::remark { + remark: Default::default(), + }); + let call_subtensor_extension_weight = + pallet_subtensor::SubtensorTransactionExtension::::validation_weight(&call); + let maximum_subtensor_extension_weight = + pallet_subtensor::SubtensorTransactionExtension::::maximum_weight(); + let non_subtensor_extension_weight = |era| { + let extensions: TxExtension = ( + ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + check_mortality::CheckMortality::::from(era), + check_nonce::CheckNonce::::from(0), + frame_system::CheckWeight::::new(), + ), + ( + SudoTransactionExtension::::new(), + pallet_shield::CheckShieldedTxValidity::::new(), + pallet_subtensor::SubtensorTransactionExtension::::new(), + pallet_drand::drand_priority::DrandPriority::::new(), + ChargeTransactionPaymentWrapper::::new(TaoBalance::ZERO), + ), + frame_metadata_hash_extension::CheckMetadataHash::::new(true), + frame_system::WeightReclaim::::new(), + ); + extensions + .weight(&call) + .saturating_sub(call_subtensor_extension_weight) + }; + let mortal = non_subtensor_extension_weight(generic::Era::mortal(64, 0)); + let immortal = non_subtensor_extension_weight(generic::Era::Immortal); + let non_subtensor_extension_weight = Weight::from_parts( + mortal.ref_time().max(immortal.ref_time()), + mortal.proof_size().max(immortal.proof_size()), + ); + + // FRAME's pallet dispatch extensions are accrued to the call weight by + // `GetDispatchInfo`. SubtensorTransactionExtension mirrors that same + // guard set in the signed transaction extension tuple. Account for the + // call-independent maximum once for each layer. + non_subtensor_extension_weight + .saturating_add(maximum_subtensor_extension_weight) + .saturating_add(maximum_subtensor_extension_weight) + } +} + type Migrations = ( // Leave this migration in the runtime, so every runtime upgrade tiny rounding errors (fractions of fractions // of a cent) are cleaned up. These tiny rounding errors occur due to floating point coversion. diff --git a/runtime/src/proxy_filters/call_groups.rs b/runtime/src/proxy_filters/call_groups.rs index 213b9be332..b60708fcff 100644 --- a/runtime/src/proxy_filters/call_groups.rs +++ b/runtime/src/proxy_filters/call_groups.rs @@ -581,6 +581,8 @@ call_filter_group!( RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_min_non_immune_uids), RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_tao_flow_cutoff), RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_tao_flow_normalization_exponent), + RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_emission_bar_quantile), + RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_emission_gate_exponent), RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_tao_flow_smoothing_factor), RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_net_tao_flow_enabled), RuntimeCall::AdminUtils(AdminUtilsCall::sudo_set_max_mechanism_count), diff --git a/runtime/tests/claim_root_weight.rs b/runtime/tests/claim_root_weight.rs index fe91ccdde1..4e3f9d8544 100644 --- a/runtime/tests/claim_root_weight.rs +++ b/runtime/tests/claim_root_weight.rs @@ -1,18 +1,43 @@ use frame_support::dispatch::{DispatchClass, GetDispatchInfo}; use node_subtensor_runtime::{ - BlockWeights, Runtime, RuntimeCall, TxExtension, check_mortality, check_nonce, sudo_wrapper, + BlockWeights, MaxSubtensorTransactionExtensionWeight, Runtime, RuntimeCall, TxExtension, + check_mortality, check_nonce, sudo_wrapper, transaction_payment_wrapper::ChargeTransactionPaymentWrapper, }; +use sp_core::Get; use sp_runtime::{generic::Era, traits::TransactionExtension}; use std::collections::BTreeSet; use subtensor_runtime_common::{NetUid, TaoBalance}; #[test] -fn claim_root_with_extensions_fits_normal_extrinsic_limit() { - let call = RuntimeCall::SubtensorModule(pallet_subtensor::Call::claim_root { - subnets: BTreeSet::from([NetUid::from(1)]), - }); - let extensions: TxExtension = ( +fn weight_reclaim_is_the_final_transaction_extension() { + let identifiers = >::metadata() + .into_iter() + .map(|metadata| metadata.identifier) + .collect::>(); + + let Some(reclaim) = identifiers + .iter() + .position(|identifier| *identifier == "WeightReclaim") + else { + panic!("final weight-reclaim extension is configured"); + }; + + assert_eq!(reclaim, identifiers.len() - 1); +} + +fn checked_add_weight( + left: frame_support::weights::Weight, + right: frame_support::weights::Weight, +) -> frame_support::weights::Weight { + match left.checked_add(&right) { + Some(weight) => weight, + None => panic!("dispatch and transaction-extension weights must not overflow"), + } +} + +fn tx_extensions() -> TxExtension { + ( ( frame_system::CheckNonZeroSender::::new(), frame_system::CheckSpecVersion::::new(), @@ -23,21 +48,30 @@ fn claim_root_with_extensions_fits_normal_extrinsic_limit() { frame_system::CheckWeight::::new(), ), ( - ChargeTransactionPaymentWrapper::::new(TaoBalance::new(0)), sudo_wrapper::SudoTransactionExtension::::new(), pallet_shield::CheckShieldedTxValidity::::new(), pallet_subtensor::SubtensorTransactionExtension::::new(), pallet_drand::drand_priority::DrandPriority::::new(), + ChargeTransactionPaymentWrapper::::new(TaoBalance::new(0)), ), frame_metadata_hash_extension::CheckMetadataHash::::new(true), - ); + frame_system::WeightReclaim::::new(), + ) +} + +#[test] +fn claim_root_with_extensions_fits_normal_extrinsic_limit() { + let call = RuntimeCall::SubtensorModule(pallet_subtensor::Call::claim_root { + subnets: BTreeSet::from([NetUid::from(1)]), + }); + let extensions = tx_extensions(); let mut dispatch_info = call.get_dispatch_info(); - dispatch_info.extension_weight = extensions.weight(&call); - let max_extrinsic = BlockWeights::get() - .get(DispatchClass::Normal) - .max_extrinsic - .expect("normal extrinsics have a configured maximum"); + dispatch_info.extension_weight = + checked_add_weight(dispatch_info.extension_weight, extensions.weight(&call)); + let Some(max_extrinsic) = BlockWeights::get().get(DispatchClass::Normal).max_extrinsic else { + panic!("normal extrinsics must have a configured maximum"); + }; assert!( dispatch_info.total_weight().all_lte(max_extrinsic), @@ -45,3 +79,90 @@ fn claim_root_with_extensions_fits_normal_extrinsic_limit() { dispatch_info.total_weight() ); } + +#[test] +fn nested_variable_work_calls_keep_the_maximum_declaration() { + let maximum_dispatch_weight = pallet_subtensor::Pallet::::max_normal_dispatch_weight(); + let calls = [ + RuntimeCall::SubtensorModule(pallet_subtensor::Call::claim_root { + subnets: BTreeSet::from([NetUid::from(1)]), + }), + RuntimeCall::SubtensorModule(pallet_subtensor::Call::swap_coldkey { + old_coldkey: sp_runtime::AccountId32::new([1; 32]), + new_coldkey: sp_runtime::AccountId32::new([2; 32]), + swap_cost: TaoBalance::new(0), + }), + RuntimeCall::SubtensorModule(pallet_subtensor::Call::swap_coldkey_announced { + new_coldkey: sp_runtime::AccountId32::new([3; 32]), + }), + ]; + + for inner_call in calls { + assert!( + maximum_dispatch_weight.all_lte(inner_call.get_dispatch_info().call_weight), + "state-dependent call must carry its reserve in dispatch metadata" + ); + + let wrapper = RuntimeCall::Utility(pallet_subtensor_utility::Call::batch { + calls: vec![inner_call], + }); + assert!( + maximum_dispatch_weight.all_lte(wrapper.get_dispatch_info().call_weight), + "utility must inherit the inner call's maximum declaration" + ); + } +} + +#[test] +fn register_network_with_extensions_fits_normal_extrinsic_limit() { + let call = RuntimeCall::SubtensorModule(pallet_subtensor::Call::register_network { + hotkey: sp_runtime::AccountId32::new([1; 32]), + }); + let extensions = tx_extensions(); + + let mut dispatch_info = call.get_dispatch_info(); + dispatch_info.extension_weight = + checked_add_weight(dispatch_info.extension_weight, extensions.weight(&call)); + let Some(max_extrinsic) = BlockWeights::get().get(DispatchClass::Normal).max_extrinsic else { + panic!("normal extrinsics must have a configured maximum"); + }; + + assert!( + dispatch_info.total_weight().all_lte(max_extrinsic), + "register_network total weight {:?} exceeds normal max extrinsic {max_extrinsic:?}", + dispatch_info.total_weight() + ); +} + +#[test] +fn maximum_reserve_covers_call_dependent_subtensor_extensions() { + let call = RuntimeCall::SubtensorModule(pallet_subtensor::Call::set_weights { + netuid: NetUid::from(1), + dests: vec![0], + weights: vec![u16::MAX], + version_key: 0, + }); + let extensions = tx_extensions(); + let call_extension_weight = + pallet_subtensor::SubtensorTransactionExtension::::validation_weight(&call); + let maximum_extension_weight = + pallet_subtensor::SubtensorTransactionExtension::::maximum_weight(); + let mut dispatch_info = call.get_dispatch_info(); + dispatch_info.extension_weight = + checked_add_weight(dispatch_info.extension_weight, extensions.weight(&call)); + let Some(max_extrinsic) = BlockWeights::get().get(DispatchClass::Normal).max_extrinsic else { + panic!("normal extrinsics must have a configured maximum"); + }; + + assert!( + call_extension_weight.all_lte(maximum_extension_weight), + "set_weights extension weight {call_extension_weight:?} exceeds reserved maximum \ + {maximum_extension_weight:?}" + ); + assert!( + dispatch_info.total_weight().all_lte(max_extrinsic), + "set_weights total weight {:?} exceeds normal max extrinsic {max_extrinsic:?}; reserve {:?}", + dispatch_info.total_weight(), + MaxSubtensorTransactionExtensionWeight::get(), + ); +}