diff --git a/chain-extensions/src/mock.rs b/chain-extensions/src/mock.rs index 9c4b3bd4a6..37c6d4fb47 100644 --- a/chain-extensions/src/mock.rs +++ b/chain-extensions/src/mock.rs @@ -311,6 +311,7 @@ parameter_types! { pub const InitialTxChildKeyTakeRateLimit: u64 = 1; // 1 block take rate limit for testing pub const InitialBurn: u64 = 0; pub const InitialMinBurn: u64 = 500_000; + pub const InitialMinStake: u64 = 2_000_000; pub const InitialMaxBurn: u64 = 1_000_000_000; pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO @@ -398,6 +399,7 @@ impl pallet_subtensor::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type InitialMinStake = InitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; diff --git a/contract-tests/package-lock.json b/contract-tests/package-lock.json index 06c722a6de..52b74f2bf8 100644 --- a/contract-tests/package-lock.json +++ b/contract-tests/package-lock.json @@ -35,7 +35,7 @@ }, ".papi/descriptors": { "name": "@polkadot-api/descriptors", - "version": "0.1.0-autogenerated.5063582544821983772", + "version": "0.1.0-autogenerated.9947536328969970535", "peerDependencies": { "polkadot-api": ">=1.21.0" } diff --git a/contract-tests/test/alphaPool.test.ts b/contract-tests/test/alphaPool.test.ts index f3ec5dde66..d8ecdc8a00 100644 --- a/contract-tests/test/alphaPool.test.ts +++ b/contract-tests/test/alphaPool.test.ts @@ -1,18 +1,17 @@ -import * as assert from "assert"; -import * as chai from "chai"; +import { devnet } from "@polkadot-api/descriptors"; import { u8aToHex } from "@polkadot/util"; -import { getDevnetApi, getRandomSubstrateKeypair } from "../src/substrate" -import { generateRandomEthersWallet, getPublicClient } from "../src/utils"; -import { ETH_LOCAL_URL } from "../src/config"; -import { devnet } from "@polkadot-api/descriptors" -import { PublicClient } from "viem"; +import * as assert from "assert"; +import { ethers } from "ethers"; import { TypedApi } from "polkadot-api"; -import { ALPHA_POOL_CONTRACT_ABI, ALPHA_POOL_CONTRACT_BYTECODE } from "../src/contracts/alphaPool"; +import { PublicClient } from "viem"; import { convertH160ToPublicKey, convertH160ToSS58, convertPublicKeyToSs58, toViemAddress } from "../src/address-utils"; -import { forceSetBalanceToEthAddress, disableWhiteListCheck, addNewSubnetwork, forceSetBalanceToSs58Address, startCall, burnedRegister, getStake } from "../src/subtensor"; -import { ethers } from "ethers" import { tao } from "../src/balance-math"; +import { ETH_LOCAL_URL } from "../src/config"; +import { ALPHA_POOL_CONTRACT_ABI, ALPHA_POOL_CONTRACT_BYTECODE } from "../src/contracts/alphaPool"; import { ISTAKING_V2_ADDRESS, IStakingV2ABI } from "../src/contracts/staking"; +import { getDevnetApi, getRandomSubstrateKeypair } from "../src/substrate"; +import { addNewSubnetwork, burnedRegister, disableWhiteListCheck, forceSetBalanceToEthAddress, forceSetBalanceToSs58Address, getStake, startCall } from "../src/subtensor"; +import { generateRandomEthersWallet, getPublicClient } from "../src/utils"; // import { KeyPair } from "@polkadot-labs/hdkd-helpers"; describe("bridge token contract deployment", () => { // init eth part @@ -29,6 +28,8 @@ describe("bridge token contract deployment", () => { publicClient = await getPublicClient(ETH_LOCAL_URL) api = await getDevnetApi() + let value = await api.constants.SubtensorModule.InitialMinStake; + await forceSetBalanceToSs58Address(api, convertPublicKeyToSs58(hotkey.publicKey)) await forceSetBalanceToSs58Address(api, convertPublicKeyToSs58(coldkey.publicKey)) await addNewSubnetwork(api, hotkey, coldkey) diff --git a/contract-tests/yarn.lock b/contract-tests/yarn.lock index 080ecb1325..037e0a53ce 100644 --- a/contract-tests/yarn.lock +++ b/contract-tests/yarn.lock @@ -38,10 +38,10 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@esbuild/darwin-arm64@0.25.12": +"@esbuild/linux-x64@0.25.12": version "0.25.12" - resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz" - integrity sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg== + resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz" + integrity sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw== "@ethereumjs/rlp@^10.0.0": version "10.1.0" @@ -255,7 +255,7 @@ integrity sha512-cgA9fh8dfBai9b46XaaQmj9vwzyHStQjc/xrAvQksgF6SqvZ0yAfxVqLvGrsz/Xi3dsAdKLg09PybC7MUAMv9w== "@polkadot-api/descriptors@file:.papi/descriptors": - version "0.1.0-autogenerated.5063582544821983772" + version "0.1.0-autogenerated.9947536328969970535" resolved "file:.papi/descriptors" "@polkadot-api/ink-contracts@^0.4.1", "@polkadot-api/ink-contracts@>=0.4.0", "@polkadot-api/ink-contracts@0.4.3": @@ -950,10 +950,15 @@ tslib "^2.8.0" ws "^8.18.0" -"@rollup/rollup-darwin-arm64@4.53.3": +"@rollup/rollup-linux-x64-gnu@4.53.3": version "4.53.3" - resolved "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz" - integrity sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA== + resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz" + integrity sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w== + +"@rollup/rollup-linux-x64-musl@4.53.3": + version "4.53.3" + resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz" + integrity sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q== "@rx-state/core@^0.1.4": version "0.1.4" @@ -1655,11 +1660,6 @@ fs.promises.exists@^1.1.4: resolved "https://registry.npmjs.org/fs.promises.exists/-/fs.promises.exists-1.1.4.tgz" integrity sha512-lJzUGWbZn8vhGWBedA+RYjB/BeJ+3458ljUfmplqhIeb6ewzTFWNPCR1HCiYCkXV9zxcHz9zXkJzMsEgDLzh3Q== -fsevents@~2.3.2: - version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" diff --git a/eco-tests/src/mock.rs b/eco-tests/src/mock.rs index 9ab48c12a7..aba98da9b5 100644 --- a/eco-tests/src/mock.rs +++ b/eco-tests/src/mock.rs @@ -194,6 +194,7 @@ parameter_types! { pub const InitialTxChildKeyTakeRateLimit: u64 = 1; // 1 block take rate limit for testing pub const InitialBurn: u64 = 0; pub const InitialMinBurn: u64 = 500_000; + pub const InitialMinStake: u64 = 2_000_000; pub const InitialMaxBurn: u64 = 1_000_000_000; pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO @@ -281,6 +282,7 @@ impl pallet_subtensor::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type InitialMinStake = InitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index 9faf870cbe..37b4e06aa5 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -119,6 +119,7 @@ parameter_types! { pub const InitialTxChildKeyTakeRateLimit: u64 = 0; // Disable rate limit for testing pub const InitialBurn: TaoBalance = TaoBalance::new(0); pub const InitialMinBurn: TaoBalance = TaoBalance::new(500_000); + pub const InitialMinStake: TaoBalance = TaoBalance::new(2_000_000); pub const InitialMaxBurn: TaoBalance = TaoBalance::new(1_000_000_000); pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO @@ -205,6 +206,7 @@ impl pallet_subtensor::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type InitialMinStake = InitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; diff --git a/pallets/crowdloan/README.md b/pallets/crowdloan/README.md index 9977c782c3..5b57be6b12 100644 --- a/pallets/crowdloan/README.md +++ b/pallets/crowdloan/README.md @@ -2,23 +2,25 @@ ## Overview -A pallet that enables the creation and management of generic crowdloans for transferring funds and executing an arbitrary call. +A pallet that enables the creation and management of generic crowdloans for transferring funds or executing an arbitrary call. -Users of this pallet can create a crowdloan by providing a deposit, a cap, an end block, an optional target address and an optional call. +Users of this pallet can create a crowdloan by providing a deposit, a cap, an end block, and exactly one of a target address or a call. Users can contribute to a crowdloan by providing funds to the crowdloan they choose to support. The contribution can be withdrawn while the crowdloan is not finalized. -Once the crowdloan is finalized, the funds will be transferred to the target address if provided; otherwise, the end user is expected to transfer them manually on-chain if the call is a pallet extrinsic. The call will be dispatched with the current crowdloan ID stored as a temporary item. +Once the crowdloan is finalized, it follows the single configured finalization route. If a target address was provided, the raised funds are transferred to that account. If a call was provided, the call is dispatched with the creator origin and the current crowdloan ID stored as a temporary item. + +Crowdloans cannot be created with both a target address and a call, or with neither. Finalization also checks this invariant before transferring funds or dispatching a call, which protects any invalid legacy or manually-written storage state. If the crowdloan fails to reach the cap, the creator can decide to refund all contributors and dissolve the crowdloan. The initial deposit will be refunded. -*The call or target address provided when creating the crowdloan is guaranteed to never change. Only the minimum contribution, end block and cap can be updated from the crowdloan creator.* +*The call or target address provided when creating the crowdloan is guaranteed to never change. Only the minimum contribution, maximum contribution, end block and cap can be updated from the crowdloan creator.* ## Interface -- `create`: Create a crowdloan that will raise funds up to a maximum cap and if successful, will transfer funds to the target address if provided and/or dispatch the call (using creator origin). The initial deposit will be transfered to the crowdloan account and will be refunded in case the crowdloan fails to raise the cap. Additionally, the creator will pay for the execution of the call. +- `create`: Create a crowdloan that will raise funds up to a maximum cap and if successful, will transfer funds to the target address or dispatch the call (using creator origin). Exactly one of target address or call must be provided; both and neither are invalid. The initial deposit will be transferred to the crowdloan account and will be refunded in case the crowdloan fails to raise the cap. Additionally, the creator will pay for the execution of the call. -- `contribute`: Contribute to an active crowdloan. The contribution will be transfered to the crowdloan account and will be refunded if the crowdloan fails to raise the cap. If the contribution would raise the amount above the cap, the contribution will be set to the amount that is left to be raised. +- `contribute`: Contribute to an active crowdloan. The contribution will be transferred to the crowdloan account and will be refunded if the crowdloan fails to raise the cap. If the contribution would raise the amount above the cap, the contribution will be set to the amount that is left to be raised. - `withdraw`: Withdraw a contribution from an active (not yet finalized or dissolved) crowdloan. Only contributions over the deposit can be withdrawn by the creator. @@ -26,16 +28,18 @@ If the crowdloan fails to reach the cap, the creator can decide to refund all co The following functions are only callable by the creator of the crowdloan: -- `finalize`: Finalize a successful crowdloan. The call will transfer the raised amount to the target address if it was provided when the crowdloan was created and dispatch the call that was provided using the creator origin. +- `finalize`: Finalize a successful crowdloan. Finalization uses exactly one route: it transfers the raised amount to the target address if one was configured, otherwise it dispatches the configured call using the creator origin. Invalid configurations with both or neither fail before side effects. - `dissolve`: Dissolve a crowdloan. The crowdloan will be removed from the storage. All contributions must have been refunded before the crowdloan can be dissolved (except the creator's one). -- `update_min_contribution`: Update the minimum contribution of a non-finalized crowdloan. +- `update_min_contribution`: Update the minimum contribution of a non-finalized crowdloan. If a maximum contribution is configured, the new minimum contribution must not exceed it. - `update_end`: Update the end block of a non-finalized crowdloan. - `update_cap`: Update the cap of a non-finalized crowdloan. +- `set_max_contribution`: Set or clear the maximum cumulative contribution allowed per contributor for a non-finalized crowdloan. + ## Integration with subnet leasing (from the subtensor pallet) The `crowdloan` pallet can be used to create a crowdloan that will be used to register a new leased network through a crowdloan using the `register_leased_network` extrinsic from the `subtensor` pallet as a call parameter to the crowdloan pallet `create` extrinsic. A new subnet will be registered paying the lock cost using the crowdloan funds and a proxy will be created for the beneficiary to operate the subnet. diff --git a/pallets/crowdloan/src/benchmarking.rs b/pallets/crowdloan/src/benchmarking.rs index 84283a09c7..f7cbc6eb31 100644 --- a/pallets/crowdloan/src/benchmarking.rs +++ b/pallets/crowdloan/src/benchmarking.rs @@ -3,17 +3,20 @@ #![allow( clippy::arithmetic_side_effects, clippy::indexing_slicing, - clippy::unwrap_used + clippy::unwrap_used, + clippy::expect_used )] use crate::{BalanceOf, CrowdloanId, CrowdloanInfo, CurrencyOf, pallet::*}; +use codec::Encode; use frame_benchmarking::{account, v2::*}; -use frame_support::traits::{Get, StorePreimage, fungible::*}; +use frame_support::traits::{Get, QueryPreimage, StorePreimage, fungible::*}; use frame_system::{RawOrigin, pallet_prelude::BlockNumberFor}; use subtensor_runtime_common::{TaoBalance, Token}; extern crate alloc; const SEED: u32 = 0; +const INLINE_PREIMAGE_LIMIT: usize = 128; use alloc::{boxed::Box, vec}; @@ -39,7 +42,6 @@ mod benchmarks { let cap = deposit + deposit; let now = frame_system::Pallet::::block_number(); let end = now + T::MaximumBlockDuration::get(); - let target_address = account::("target_address", 0, SEED); let call: Box<::RuntimeCall> = Box::new(frame_system::Call::::remark { remark: vec![] }.into()); let _ = CurrencyOf::::set_balance(&creator, deposit); @@ -52,7 +54,7 @@ mod benchmarks { cap, end, Some(call.clone()), - Some(target_address.clone()), + None, ); // ensure the crowdloan is stored correctly @@ -68,7 +70,7 @@ mod benchmarks { end, funds_account: funds_account.clone(), raised: deposit, - target_address: Some(target_address.clone()), + target_address: None, call: Some(T::Preimages::bound(*call).unwrap()), finalized: false, contributors_count: 1, @@ -108,7 +110,6 @@ mod benchmarks { let cap = deposit + deposit; let now = frame_system::Pallet::::block_number(); let end = now + T::MaximumBlockDuration::get(); - let target_address: T::AccountId = account::("target_address", 0, SEED); let call: Box<::RuntimeCall> = Box::new(frame_system::Call::::remark { remark: vec![] }.into()); let _ = CurrencyOf::::set_balance(&creator, deposit); @@ -119,7 +120,7 @@ mod benchmarks { cap, end, Some(call), - Some(target_address), + None, ); // setup contributor @@ -165,7 +166,6 @@ mod benchmarks { let cap = deposit + deposit; let now = frame_system::Pallet::::block_number(); let end = now + T::MaximumBlockDuration::get(); - let target_address: T::AccountId = account::("target_address", 0, SEED); let call: Box<::RuntimeCall> = Box::new(frame_system::Call::::remark { remark: vec![] }.into()); let _ = CurrencyOf::::set_balance(&creator, deposit); @@ -176,7 +176,7 @@ mod benchmarks { cap, end, Some(call), - Some(target_address), + None, ); // create contribution @@ -227,9 +227,14 @@ mod benchmarks { let cap = deposit + deposit; let now = frame_system::Pallet::::block_number(); let end = now + T::MaximumBlockDuration::get(); - let target_address: T::AccountId = account::("target_address", 0, SEED); - let call: Box<::RuntimeCall> = - Box::new(frame_system::Call::::remark { remark: vec![] }.into()); + // Force the call through preimage storage instead of the inline bounded path. + let call: Box<::RuntimeCall> = Box::new( + frame_system::Call::::remark { + remark: vec![0; 256], + } + .into(), + ); + assert!(call.encode().len() > INLINE_PREIMAGE_LIMIT); let _ = CurrencyOf::::set_balance(&creator, deposit); let _ = Pallet::::create( RawOrigin::Signed(creator.clone()).into(), @@ -238,11 +243,17 @@ mod benchmarks { cap, end, Some(call), - Some(target_address.clone()), + None, ); // create contribution fullfilling the cap let crowdloan_id: CrowdloanId = 0; + let stored_call = Crowdloans::::get(crowdloan_id) + .and_then(|crowdloan| crowdloan.call) + .expect("benchmark crowdloan should store a finalization call"); + assert!(stored_call.lookup_needed()); + assert!(T::Preimages::have(&stored_call)); + let contributor: T::AccountId = account::("contributor", 0, SEED); let amount: BalanceOf = cap - deposit; let _ = CurrencyOf::::set_balance(&contributor, amount); @@ -258,10 +269,10 @@ mod benchmarks { #[extrinsic_call] _(RawOrigin::Signed(creator.clone()), crowdloan_id); - // ensure the target address has received the raised amount - assert_eq!(CurrencyOf::::balance(&target_address), deposit + amount); // ensure the crowdloan has been finalized assert!(Crowdloans::::get(crowdloan_id).is_some_and(|c| c.finalized)); + // ensure the temporary finalization storage has been cleared + assert!(CurrentCrowdloanId::::get().is_none()); // ensure the event is emitted assert_last_event::(Event::::Finalized { crowdloan_id }.into()); } @@ -275,7 +286,6 @@ mod benchmarks { let cap = deposit + deposit; let now = frame_system::Pallet::::block_number(); let end = now + T::MaximumBlockDuration::get(); - let target_address: T::AccountId = account::("target_address", 0, SEED); let call: Box<::RuntimeCall> = Box::new(frame_system::Call::::remark { remark: vec![] }.into()); let _ = CurrencyOf::::set_balance(&creator, deposit); @@ -286,7 +296,7 @@ mod benchmarks { cap, end, Some(call), - Some(target_address), + None, ); let crowdloan_id: CrowdloanId = 0; @@ -342,7 +352,6 @@ mod benchmarks { let cap = deposit + deposit; let now = frame_system::Pallet::::block_number(); let end = now + T::MaximumBlockDuration::get(); - let target_address: T::AccountId = account::("target_address", 0, SEED); let call: Box<::RuntimeCall> = Box::new(frame_system::Call::::remark { remark: vec![] }.into()); let _ = CurrencyOf::::set_balance(&creator, deposit); @@ -353,7 +362,7 @@ mod benchmarks { cap, end, Some(call), - Some(target_address), + None, ); // run to the end of the contribution period @@ -497,5 +506,50 @@ mod benchmarks { ); } + #[benchmark] + fn set_max_contribution() { + // create a crowdloan + let creator: T::AccountId = account::("creator", 0, SEED); + let deposit = T::MinimumDeposit::get(); + let min_contribution = T::AbsoluteMinimumContribution::get(); + let cap = deposit + deposit; + let end = frame_system::Pallet::::block_number() + T::MaximumBlockDuration::get(); + let call: Box<::RuntimeCall> = + Box::new(frame_system::Call::::remark { remark: vec![] }.into()); + let _ = CurrencyOf::::set_balance(&creator, deposit); + let _ = Pallet::::create( + RawOrigin::Signed(creator.clone()).into(), + deposit, + min_contribution, + cap, + end, + Some(call), + None, + ); + + let crowdloan_id: CrowdloanId = 0; + let new_max_contribution: BalanceOf = cap; + + #[extrinsic_call] + _( + RawOrigin::Signed(creator.clone()), + crowdloan_id, + Some(new_max_contribution), + ); + + // ensure the max contribution is updated correctly + assert!( + MaxContributions::::get(crowdloan_id).is_some_and(|c| c == new_max_contribution) + ); + // ensure the event is emitted + assert_last_event::( + Event::::MaxContributionUpdated { + crowdloan_id, + new_max_contribution: Some(new_max_contribution), + } + .into(), + ); + } + impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test); } diff --git a/pallets/crowdloan/src/lib.rs b/pallets/crowdloan/src/lib.rs index ae8c8742a0..8be80c0cc7 100644 --- a/pallets/crowdloan/src/lib.rs +++ b/pallets/crowdloan/src/lib.rs @@ -1,8 +1,9 @@ //! # Crowdloan Pallet //! //! A pallet allowing users to create generic crowdloans and contribute to them, -//! the raised funds are then transferred to a target address and an extrinsic -//! is dispatched, making it reusable for any crowdloan type. +//! then finalize them through exactly one configured route: transfer the raised +//! funds to a target address or dispatch an extrinsic, making it reusable for any +//! crowdloan type. #![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; @@ -167,6 +168,11 @@ pub mod pallet { OptionQuery, >; + /// A map of crowdloan ids to their optional maximum cumulative contribution per contributor. + #[pallet::storage] + pub type MaxContributions = + StorageMap<_, Twox64Concat, CrowdloanId, BalanceOf, OptionQuery>; + /// The current crowdloan id that will be set during the finalize call, making it /// temporarily accessible to the dispatched call. #[pallet::storage] @@ -222,6 +228,11 @@ pub mod pallet { crowdloan_id: CrowdloanId, new_cap: BalanceOf, }, + /// The maximum contribution was updated. + MaxContributionUpdated { + crowdloan_id: CrowdloanId, + new_max_contribution: Option>, + }, } #[pallet::error] @@ -270,6 +281,14 @@ pub mod pallet { DepositCannotBeWithdrawn, /// The maximum number of contributors has been reached. MaxContributorsReached, + /// Exactly one of call or target address must be provided. + InvalidFinalizationConfig, + /// The contributor has already reached the maximum contribution. + MaxContributionReached, + /// The maximum contribution is too low. + MaximumContributionTooLow, + /// The minimum contribution is too high. + MinimumContributionTooHigh, } #[pallet::hooks] @@ -290,10 +309,11 @@ pub mod pallet { #![deny(clippy::expect_used)] /// Create a crowdloan that will raise funds up to a maximum cap and if successful, - /// will transfer funds to the target address if provided and dispatch the call - /// (using creator origin). + /// will either transfer funds to the target address or dispatch the call + /// (using creator origin). Exactly one of call or target address must be provided. + /// Providing both, or providing neither, is rejected. /// - /// The initial deposit will be transfered to the crowdloan account and will be refunded + /// The initial deposit will be transferred to the crowdloan account and will be refunded /// in case the crowdloan fails to raise the cap. Additionally, the creator will pay for /// the execution of the call. /// @@ -305,7 +325,7 @@ pub mod pallet { /// - `cap`: The maximum amount of funds that can be raised. /// - `end`: The block number at which the crowdloan will end. /// - `call`: The call to dispatch when the crowdloan is finalized. - /// - `target_address`: The address to transfer the raised funds to if provided. + /// - `target_address`: The address to transfer the raised funds to. #[pallet::call_index(0)] #[pallet::weight({ let di = call.as_ref().map(|c| c.get_dispatch_info()); @@ -339,6 +359,10 @@ pub mod pallet { min_contribution >= T::AbsoluteMinimumContribution::get(), Error::::MinimumContributionTooLow ); + ensure!( + call.is_some() != target_address.is_some(), + Error::::InvalidFinalizationConfig + ); Self::ensure_valid_end(now, end)?; @@ -400,7 +424,7 @@ pub mod pallet { /// Contribute to an active crowdloan. /// - /// The contribution will be transfered to the crowdloan account and will be refunded + /// The contribution will be transferred to the crowdloan account and will be refunded /// if the crowdloan fails to raise the cap. If the contribution would raise the amount above the cap, /// the contribution will be set to the amount that is left to be raised. /// @@ -437,16 +461,30 @@ pub mod pallet { Error::::MaxContributorsReached ); - // Ensure contribution does not overflow the actual raised amount - // and it does not exceed the cap + // Compute how much room is left before the crowdloan reaches its cap. let left_to_raise = crowdloan .cap .checked_sub(&crowdloan.raised) .ok_or(Error::::Underflow)?; - // If the contribution would raise the amount above the cap, - // set the contribution to the amount that is left to be raised - let amount = amount.min(left_to_raise); + // The requested contribution must meet the minimum contribution, but + // the accepted amount may be lower when only a smaller remainder can + // be accepted before reaching the crowdloan cap or the contributor's + // maximum contribution. + let amount = if let Some(max_contribution) = MaxContributions::::get(crowdloan_id) { + let current_contribution = + Contributions::::get(crowdloan_id, &contributor).unwrap_or_else(Zero::zero); + ensure!( + current_contribution < max_contribution, + Error::::MaxContributionReached + ); + let left_to_contribute = max_contribution + .checked_sub(¤t_contribution) + .ok_or(Error::::Underflow)?; + amount.min(left_to_contribute).min(left_to_raise) + } else { + amount.min(left_to_raise) + }; // Ensure contribution does not overflow the actual raised amount crowdloan.raised = crowdloan @@ -553,9 +591,13 @@ pub mod pallet { /// Finalize crowdloan that has reached the cap. /// - /// The call will transfer the raised amount to the target address if it was provided when the crowdloan was created - /// and dispatch the call that was provided using the creator origin. The CurrentCrowdloanId will be set to the - /// crowdloan id being finalized so the dispatched call can access it temporarily by accessing + /// The call will either transfer the raised amount to the configured target address + /// or dispatch the configured call using the creator origin. The stored crowdloan + /// must contain exactly one of target address or call; if both or neither are set, + /// finalization fails before transfer or dispatch. + /// + /// When dispatching a call, the CurrentCrowdloanId will be set to the crowdloan id + /// being finalized so the dispatched call can access it temporarily by accessing /// the `CurrentCrowdloanId` storage item. /// /// The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. @@ -578,41 +620,43 @@ pub mod pallet { ensure!(crowdloan.raised == crowdloan.cap, Error::::CapNotRaised); ensure!(!crowdloan.finalized, Error::::AlreadyFinalized); - // If the target address is provided, transfer the raised amount to it. - if let Some(ref target_address) = crowdloan.target_address { - CurrencyOf::::transfer( - &crowdloan.funds_account, - target_address, - crowdloan.raised, - Preservation::Expendable, - )?; - } - - // If the call is provided, dispatch it. - if let Some(ref call) = crowdloan.call { - // Set the current crowdloan id so the dispatched call - // can access it temporarily - CurrentCrowdloanId::::put(crowdloan_id); - - // Retrieve the call from the preimage storage - let stored_call = match T::Preimages::peek(call) { - Ok((call, _)) => call, - Err(_) => { - // If the call is not found, we drop it from the preimage storage - // because it's not needed anymore - T::Preimages::drop(call); - return Err(Error::::CallUnavailable)?; - } - }; - - // Dispatch the call with creator origin - stored_call - .dispatch(frame_system::RawOrigin::Signed(who).into()) - .map(|_| ()) - .map_err(|e| e.error)?; - - // Clear the current crowdloan id - CurrentCrowdloanId::::kill(); + match (&crowdloan.call, &crowdloan.target_address) { + (Some(call), None) => { + // Set the current crowdloan id so the dispatched call + // can access it temporarily + CurrentCrowdloanId::::put(crowdloan_id); + + // Retrieve the call from the preimage storage + let stored_call = match T::Preimages::peek(call) { + Ok((call, _)) => call, + Err(_) => { + // If the call is not found, we drop it from the preimage storage + // because it's not needed anymore + T::Preimages::drop(call); + return Err(Error::::CallUnavailable)?; + } + }; + + // Dispatch the call with creator origin + stored_call + .dispatch(frame_system::RawOrigin::Signed(who).into()) + .map(|_| ()) + .map_err(|e| e.error)?; + + // Clear the current crowdloan id + CurrentCrowdloanId::::kill(); + } + (None, Some(target_address)) => { + CurrencyOf::::transfer( + &crowdloan.funds_account, + target_address, + crowdloan.raised, + Preservation::Expendable, + )?; + } + (_, _) => { + return Err(Error::::InvalidFinalizationConfig)?; + } } crowdloan.finalized = true; @@ -748,6 +792,7 @@ pub mod pallet { // Remove the crowdloan let _ = frame_system::Pallet::::dec_providers(&crowdloan.funds_account).defensive(); Crowdloans::::remove(crowdloan_id); + MaxContributions::::remove(crowdloan_id); Self::deposit_event(Event::::Dissolved { crowdloan_id }); Ok(()) @@ -755,6 +800,9 @@ pub mod pallet { /// Update the minimum contribution of a non-finalized crowdloan. /// + /// If a maximum contribution is configured, the new minimum contribution + /// must not exceed it. + /// /// The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. /// /// Parameters: @@ -780,6 +828,12 @@ pub mod pallet { new_min_contribution >= T::AbsoluteMinimumContribution::get(), Error::::MinimumContributionTooLow ); + if let Some(max_contribution) = MaxContributions::::get(crowdloan_id) { + ensure!( + new_min_contribution <= max_contribution, + Error::::MinimumContributionTooHigh + ); + } crowdloan.min_contribution = new_min_contribution; Crowdloans::::insert(crowdloan_id, &crowdloan); @@ -861,6 +915,50 @@ pub mod pallet { }); Ok(()) } + + /// Set or clear the maximum cumulative contribution allowed per contributor + /// for a non-finalized crowdloan. + /// + /// The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. + /// + /// Parameters: + /// - `crowdloan_id`: The id of the crowdloan to update the maximum contribution of. + /// - `new_max_contribution`: The new optional maximum contribution. + #[pallet::call_index(9)] + #[pallet::weight(T::WeightInfo::set_max_contribution())] + pub fn set_max_contribution( + origin: OriginFor, + #[pallet::compact] crowdloan_id: CrowdloanId, + new_max_contribution: Option>, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + let crowdloan = Self::ensure_crowdloan_exists(crowdloan_id)?; + ensure!(!crowdloan.finalized, Error::::AlreadyFinalized); + + // Only the creator can update the max contribution. + ensure!(who == crowdloan.creator, Error::::InvalidOrigin); + + if let Some(max_contribution) = new_max_contribution { + let creator_contribution = + Contributions::::get(crowdloan_id, &crowdloan.creator) + .unwrap_or_else(Zero::zero); + ensure!( + max_contribution >= crowdloan.min_contribution + && max_contribution >= creator_contribution, + Error::::MaximumContributionTooLow + ); + MaxContributions::::insert(crowdloan_id, max_contribution); + } else { + MaxContributions::::remove(crowdloan_id); + } + + Self::deposit_event(Event::::MaxContributionUpdated { + crowdloan_id, + new_max_contribution, + }); + Ok(()) + } } } diff --git a/pallets/crowdloan/src/mock.rs b/pallets/crowdloan/src/mock.rs index 1cc0929325..486bb4e71c 100644 --- a/pallets/crowdloan/src/mock.rs +++ b/pallets/crowdloan/src/mock.rs @@ -100,6 +100,9 @@ impl WeightInfo for TestWeightInfo { fn update_cap() -> Weight { Weight::zero() } + fn set_max_contribution() -> Weight { + Weight::zero() + } } parameter_types! { diff --git a/pallets/crowdloan/src/tests.rs b/pallets/crowdloan/src/tests.rs index 8a706ece29..a23de52198 100644 --- a/pallets/crowdloan/src/tests.rs +++ b/pallets/crowdloan/src/tests.rs @@ -201,6 +201,92 @@ fn test_create_fails_if_min_contribution_is_too_low() { }); } +#[test] +fn test_create_fails_if_call_and_target_address_are_provided() { + TestState::default() + .with_balance(U256::from(1), 100.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let cap: BalanceOf = 300.into(); + let end: BlockNumberFor = 50; + let target_address: AccountOf = U256::from(42); + + assert_err!( + Crowdloan::create( + RuntimeOrigin::signed(creator), + deposit, + min_contribution, + cap, + end, + Some(noop_call()), + Some(target_address), + ), + pallet_crowdloan::Error::::InvalidFinalizationConfig + ); + }); +} + +#[test] +fn test_create_fails_if_call_and_target_address_are_missing() { + TestState::default() + .with_balance(U256::from(1), 100.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let cap: BalanceOf = 300.into(); + let end: BlockNumberFor = 50; + + assert_err!( + Crowdloan::create( + RuntimeOrigin::signed(creator), + deposit, + min_contribution, + cap, + end, + None, + None, + ), + pallet_crowdloan::Error::::InvalidFinalizationConfig + ); + }); +} + +#[test] +fn test_set_max_contribution_fails_if_max_contribution_is_too_low() { + TestState::default() + .with_balance(U256::from(1), 100.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let max_contribution: BalanceOf = 40.into(); + let cap: BalanceOf = 300.into(); + let end: BlockNumberFor = 50; + + assert_ok!(Crowdloan::create( + RuntimeOrigin::signed(creator), + deposit, + min_contribution, + cap, + end, + Some(noop_call()), + None + )); + + assert_err!( + Crowdloan::set_max_contribution( + RuntimeOrigin::signed(creator), + 0, + Some(max_contribution) + ), + pallet_crowdloan::Error::::MaximumContributionTooLow + ); + }); +} + #[test] fn test_create_fails_if_end_is_in_the_past() { let current_block_number: BlockNumberFor = 10; @@ -531,6 +617,202 @@ fn test_contribute_succeeds_if_contribution_will_make_the_raised_amount_exceed_t }); } +#[test] +fn test_contribute_caps_amount_at_max_contribution() { + TestState::default() + .with_balance(U256::from(1), 200.into()) + .with_balance(U256::from(2), 500.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let initial_deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let max_contribution: BalanceOf = 120.into(); + let cap: BalanceOf = 300.into(); + let end: BlockNumberFor = 50; + + assert_ok!(Crowdloan::create( + RuntimeOrigin::signed(creator), + initial_deposit, + min_contribution, + cap, + end, + Some(noop_call()), + None + )); + + run_to_block(10); + + let crowdloan_id: CrowdloanId = 0; + assert_ok!(Crowdloan::set_max_contribution( + RuntimeOrigin::signed(creator), + crowdloan_id, + Some(max_contribution) + )); + + let contributor: AccountOf = U256::from(2); + let amount: BalanceOf = 200.into(); + assert_ok!(Crowdloan::contribute( + RuntimeOrigin::signed(contributor), + crowdloan_id, + amount + )); + assert_eq!( + last_event(), + pallet_crowdloan::Event::::Contributed { + crowdloan_id, + contributor, + amount: max_contribution, + } + .into() + ); + assert_eq!( + pallet_crowdloan::Contributions::::get(crowdloan_id, contributor), + Some(max_contribution) + ); + assert_eq!( + Balances::free_balance(contributor), + TaoBalance::from(500) - max_contribution + ); + assert!( + pallet_crowdloan::Crowdloans::::get(crowdloan_id) + .is_some_and(|c| c.raised == initial_deposit + max_contribution) + ); + + assert_err!( + Crowdloan::contribute( + RuntimeOrigin::signed(contributor), + crowdloan_id, + min_contribution + ), + pallet_crowdloan::Error::::MaxContributionReached + ); + }); +} + +#[test] +fn test_contribute_can_be_capped_below_minimum_when_filling_cap() { + TestState::default() + .with_balance(U256::from(1), 200.into()) + .with_balance(U256::from(2), 100.into()) + .with_balance(U256::from(3), 100.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let initial_deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let cap: BalanceOf = 115.into(); + let end: BlockNumberFor = 50; + + assert_ok!(Crowdloan::create( + RuntimeOrigin::signed(creator), + initial_deposit, + min_contribution, + cap, + end, + Some(noop_call()), + None + )); + + run_to_block(10); + + let crowdloan_id: CrowdloanId = 0; + let first_contributor: AccountOf = U256::from(2); + assert_ok!(Crowdloan::contribute( + RuntimeOrigin::signed(first_contributor), + crowdloan_id, + 60.into() + )); + + let final_contributor: AccountOf = U256::from(3); + assert_ok!(Crowdloan::contribute( + RuntimeOrigin::signed(final_contributor), + crowdloan_id, + min_contribution + )); + + assert_eq!( + last_event(), + pallet_crowdloan::Event::::Contributed { + crowdloan_id, + contributor: final_contributor, + amount: 5.into(), + } + .into() + ); + assert_eq!( + pallet_crowdloan::Contributions::::get(crowdloan_id, final_contributor), + Some(5.into()) + ); + assert!( + pallet_crowdloan::Crowdloans::::get(crowdloan_id) + .is_some_and(|c| c.raised == cap) + ); + }); +} + +#[test] +fn test_contribute_can_be_capped_below_minimum_when_reaching_max_contribution() { + TestState::default() + .with_balance(U256::from(1), 200.into()) + .with_balance(U256::from(2), 500.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let initial_deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let max_contribution: BalanceOf = 105.into(); + let cap: BalanceOf = 300.into(); + let end: BlockNumberFor = 50; + + assert_ok!(Crowdloan::create( + RuntimeOrigin::signed(creator), + initial_deposit, + min_contribution, + cap, + end, + Some(noop_call()), + None + )); + + run_to_block(10); + + let crowdloan_id: CrowdloanId = 0; + assert_ok!(Crowdloan::set_max_contribution( + RuntimeOrigin::signed(creator), + crowdloan_id, + Some(max_contribution) + )); + + let contributor: AccountOf = U256::from(2); + assert_ok!(Crowdloan::contribute( + RuntimeOrigin::signed(contributor), + crowdloan_id, + 100.into() + )); + assert_ok!(Crowdloan::contribute( + RuntimeOrigin::signed(contributor), + crowdloan_id, + min_contribution + )); + + assert_eq!( + last_event(), + pallet_crowdloan::Event::::Contributed { + crowdloan_id, + contributor, + amount: 5.into(), + } + .into() + ); + assert_eq!( + pallet_crowdloan::Contributions::::get(crowdloan_id, contributor), + Some(max_contribution) + ); + assert!( + pallet_crowdloan::Crowdloans::::get(crowdloan_id) + .is_some_and(|c| c.raised == initial_deposit + max_contribution) + ); + }); +} + #[test] fn test_contribute_fails_if_bad_origin() { TestState::default().build_and_execute(|| { @@ -1202,9 +1484,6 @@ fn test_finalize_succeeds_with_target_address() { let cap: BalanceOf = 100.into(); let end: BlockNumberFor = 50; let target_address: AccountOf = U256::from(42); - let call = Box::new(RuntimeCall::TestPallet( - pallet_test::Call::::set_passed_crowdloan_id {}, - )); assert_ok!(Crowdloan::create( RuntimeOrigin::signed(creator), @@ -1212,7 +1491,7 @@ fn test_finalize_succeeds_with_target_address() { min_contribution, cap, end, - Some(call), + None, Some(target_address), )); @@ -1256,13 +1535,113 @@ fn test_finalize_succeeds_with_target_address() { last_event(), pallet_crowdloan::Event::::Finalized { crowdloan_id }.into() ); + }) +} + +#[test] +fn test_finalize_fails_if_call_and_target_address_are_provided() { + TestState::default() + .with_balance(U256::from(1), 100.into()) + .with_balance(U256::from(2), 100.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let cap: BalanceOf = 100.into(); + let end: BlockNumberFor = 50; + + assert_ok!(Crowdloan::create( + RuntimeOrigin::signed(creator), + deposit, + min_contribution, + cap, + end, + Some(noop_call()), + None, + )); + + run_to_block(10); + + let crowdloan_id: CrowdloanId = 0; + let contributor: AccountOf = U256::from(2); + let amount: BalanceOf = 50.into(); + assert_ok!(Crowdloan::contribute( + RuntimeOrigin::signed(contributor), + crowdloan_id, + amount + )); + + let target_address: AccountOf = U256::from(42); + pallet_crowdloan::Crowdloans::::mutate(crowdloan_id, |crowdloan| { + crowdloan.as_mut().unwrap().target_address = Some(target_address); + }); + + run_to_block(60); + + assert_err!( + Crowdloan::finalize(RuntimeOrigin::signed(creator), crowdloan_id), + pallet_crowdloan::Error::::InvalidFinalizationConfig + ); - // ensure the current crowdloan id was accessible from the dispatched call assert_eq!( - pallet_test::PassedCrowdloanId::::get(), - Some(crowdloan_id) + pallet_balances::Pallet::::free_balance(target_address), + 0.into() ); - }) + assert!( + pallet_crowdloan::Crowdloans::::get(crowdloan_id) + .is_some_and(|c| !c.finalized) + ); + }); +} + +#[test] +fn test_finalize_fails_if_call_and_target_address_are_missing() { + TestState::default() + .with_balance(U256::from(1), 100.into()) + .with_balance(U256::from(2), 100.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let cap: BalanceOf = 100.into(); + let end: BlockNumberFor = 50; + + assert_ok!(Crowdloan::create( + RuntimeOrigin::signed(creator), + deposit, + min_contribution, + cap, + end, + Some(noop_call()), + None, + )); + + run_to_block(10); + + let crowdloan_id: CrowdloanId = 0; + let contributor: AccountOf = U256::from(2); + let amount: BalanceOf = 50.into(); + assert_ok!(Crowdloan::contribute( + RuntimeOrigin::signed(contributor), + crowdloan_id, + amount + )); + + pallet_crowdloan::Crowdloans::::mutate(crowdloan_id, |crowdloan| { + crowdloan.as_mut().unwrap().call = None; + }); + + run_to_block(60); + + assert_err!( + Crowdloan::finalize(RuntimeOrigin::signed(creator), crowdloan_id), + pallet_crowdloan::Error::::InvalidFinalizationConfig + ); + assert!( + pallet_crowdloan::Crowdloans::::get(crowdloan_id) + .is_some_and(|c| !c.finalized) + ); + }); } #[test] @@ -1712,11 +2091,16 @@ fn test_dissolve_succeeds() { None, )); + let crowdloan_id: CrowdloanId = 0; + assert_ok!(Crowdloan::set_max_contribution( + RuntimeOrigin::signed(creator), + crowdloan_id, + Some(cap) + )); + // run some blocks past end run_to_block(60); - let crowdloan_id: CrowdloanId = 0; - // ensure the contributor count is correct assert!( pallet_crowdloan::Crowdloans::::get(crowdloan_id) @@ -1737,6 +2121,9 @@ fn test_dissolve_succeeds() { crowdloan_id )); + // ensure the maximum contribution is removed + assert!(pallet_crowdloan::MaxContributions::::get(crowdloan_id).is_none()); + // ensure the event is emitted assert_eq!( last_event(), @@ -2119,6 +2506,46 @@ fn test_update_min_contribution_fails_if_new_min_contribution_is_too_low() { }); } +#[test] +fn test_update_min_contribution_fails_if_new_min_contribution_exceeds_max_contribution() { + TestState::default() + .with_balance(U256::from(1), 200.into()) + .build_and_execute(|| { + let creator: AccountOf = U256::from(1); + let deposit: BalanceOf = 50.into(); + let min_contribution: BalanceOf = 10.into(); + let max_contribution: BalanceOf = 60.into(); + let cap: BalanceOf = 300.into(); + let end: BlockNumberFor = 50; + + assert_ok!(Crowdloan::create( + RuntimeOrigin::signed(creator), + deposit, + min_contribution, + cap, + end, + Some(noop_call()), + None, + )); + + let crowdloan_id: CrowdloanId = 0; + assert_ok!(Crowdloan::set_max_contribution( + RuntimeOrigin::signed(creator), + crowdloan_id, + Some(max_contribution) + )); + + assert_err!( + Crowdloan::update_min_contribution( + RuntimeOrigin::signed(creator), + crowdloan_id, + 70.into() + ), + pallet_crowdloan::Error::::MinimumContributionTooHigh + ); + }); +} + #[test] fn test_update_end_succeeds() { TestState::default() diff --git a/pallets/crowdloan/src/weights.rs b/pallets/crowdloan/src/weights.rs index dab2e434e5..b639a42a8b 100644 --- a/pallets/crowdloan/src/weights.rs +++ b/pallets/crowdloan/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for `pallet_crowdloan` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 -//! DATE: 2026-05-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runnervmeorf1`, CPU: `AMD EPYC 7763 64-Core Processor` +//! HOSTNAME: `runnervm3jyl0`, CPU: `AMD EPYC 9V74 80-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -22,7 +22,7 @@ // --no-storage-info // --no-min-squares // --no-median-slopes -// --output=/tmp/tmp.uRtOhCuCrh +// --output=/tmp/tmp.QLzNE9hOoG // --template=/home/runner/work/subtensor/subtensor/.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -45,6 +45,7 @@ pub trait WeightInfo { fn update_min_contribution() -> Weight; fn update_end() -> Weight; fn update_cap() -> Weight; + fn set_max_contribution() -> Weight; } /// Weights for `pallet_crowdloan` using the Substrate node and recommended hardware. @@ -62,24 +63,26 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `119` // Estimated: `6148` - // Minimum execution time: 60_213_000 picoseconds. - Weight::from_parts(61_646_000, 6148) + // Minimum execution time: 58_307_000 picoseconds. + Weight::from_parts(59_829_000, 6148) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:1 w:0) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) /// Storage: `Crowdloan::Contributions` (r:1 w:1) /// Proof: `Crowdloan::Contributions` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) fn contribute() -> Weight { // Proof Size summary in bytes: - // Measured: `480` + // Measured: `448` // Estimated: `6148` - // Minimum execution time: 64_140_000 picoseconds. - Weight::from_parts(65_774_000, 6148) - .saturating_add(T::DbWeight::get().reads(4_u64)) + // Minimum execution time: 65_557_000 picoseconds. + Weight::from_parts(66_609_000, 6148) + .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) @@ -90,17 +93,17 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) fn withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `440` + // Measured: `408` // Estimated: `6148` - // Minimum execution time: 60_343_000 picoseconds. - Weight::from_parts(61_576_000, 6148) + // Minimum execution time: 59_438_000 picoseconds. + Weight::from_parts(60_259_000, 6148) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:1 w:0) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) /// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:0) @@ -109,12 +112,12 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Crowdloan::CurrentCrowdloanId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn finalize() -> Weight { // Proof Size summary in bytes: - // Measured: `856` - // Estimated: `6148` - // Minimum execution time: 69_961_000 picoseconds. - Weight::from_parts(71_855_000, 6148) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) + // Measured: `1181` + // Estimated: `4197809` + // Minimum execution time: 30_264_000 picoseconds. + Weight::from_parts(31_507_000, 4197809) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) @@ -125,12 +128,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `k` is `[3, 50]`. fn refund(k: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `356 + k * (46 ±0)` + // Measured: `324 + k * (46 ±0)` // Estimated: `3747 + k * (2579 ±0)` - // Minimum execution time: 109_755_000 picoseconds. - Weight::from_parts(110_628_000, 3747) - // Standard Error: 87_643 - .saturating_add(Weight::from_parts(37_690_888, 0).saturating_mul(k.into())) + // Minimum execution time: 108_910_000 picoseconds. + Weight::from_parts(110_703_000, 3747) + // Standard Error: 96_515 + .saturating_add(Weight::from_parts(39_503_253, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(k.into()))) @@ -142,24 +145,28 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Crowdloan::Contributions` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:0 w:1) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) fn dissolve() -> Weight { // Proof Size summary in bytes: - // Measured: `402` + // Measured: `370` // Estimated: `6148` - // Minimum execution time: 65_793_000 picoseconds. - Weight::from_parts(66_815_000, 6148) + // Minimum execution time: 66_138_000 picoseconds. + Weight::from_parts(66_939_000, 6148) .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:1 w:0) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) fn update_min_contribution() -> Weight { // Proof Size summary in bytes: // Measured: `229` // Estimated: `3747` - // Minimum execution time: 13_606_000 picoseconds. - Weight::from_parts(14_076_000, 3747) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 12_639_000 picoseconds. + Weight::from_parts(13_259_000, 3747) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) @@ -168,8 +175,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `229` // Estimated: `3747` - // Minimum execution time: 13_996_000 picoseconds. - Weight::from_parts(14_557_000, 3747) + // Minimum execution time: 11_637_000 picoseconds. + Weight::from_parts(12_048_000, 3747) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -179,11 +186,26 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `229` // Estimated: `3747` - // Minimum execution time: 13_705_000 picoseconds. - Weight::from_parts(14_537_000, 3747) + // Minimum execution time: 11_026_000 picoseconds. + Weight::from_parts(11_357_000, 3747) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + /// Storage: `Crowdloan::Crowdloans` (r:1 w:0) + /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::Contributions` (r:1 w:0) + /// Proof: `Crowdloan::Contributions` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:0 w:1) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) + fn set_max_contribution() -> Weight { + // Proof Size summary in bytes: + // Measured: `293` + // Estimated: `3747` + // Minimum execution time: 15_263_000 picoseconds. + Weight::from_parts(16_024_000, 3747) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } // For backwards compatibility and tests. @@ -200,24 +222,26 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `119` // Estimated: `6148` - // Minimum execution time: 60_213_000 picoseconds. - Weight::from_parts(61_646_000, 6148) + // Minimum execution time: 58_307_000 picoseconds. + Weight::from_parts(59_829_000, 6148) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:1 w:0) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) /// Storage: `Crowdloan::Contributions` (r:1 w:1) /// Proof: `Crowdloan::Contributions` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) fn contribute() -> Weight { // Proof Size summary in bytes: - // Measured: `480` + // Measured: `448` // Estimated: `6148` - // Minimum execution time: 64_140_000 picoseconds. - Weight::from_parts(65_774_000, 6148) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Minimum execution time: 65_557_000 picoseconds. + Weight::from_parts(66_609_000, 6148) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) @@ -228,17 +252,17 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) fn withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `440` + // Measured: `408` // Estimated: `6148` - // Minimum execution time: 60_343_000 picoseconds. - Weight::from_parts(61_576_000, 6148) + // Minimum execution time: 59_438_000 picoseconds. + Weight::from_parts(60_259_000, 6148) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:1 w:0) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) /// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:0) @@ -247,12 +271,12 @@ impl WeightInfo for () { /// Proof: `Crowdloan::CurrentCrowdloanId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn finalize() -> Weight { // Proof Size summary in bytes: - // Measured: `856` - // Estimated: `6148` - // Minimum execution time: 69_961_000 picoseconds. - Weight::from_parts(71_855_000, 6148) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) + // Measured: `1181` + // Estimated: `4197809` + // Minimum execution time: 30_264_000 picoseconds. + Weight::from_parts(31_507_000, 4197809) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) @@ -263,12 +287,12 @@ impl WeightInfo for () { /// The range of component `k` is `[3, 50]`. fn refund(k: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `356 + k * (46 ±0)` + // Measured: `324 + k * (46 ±0)` // Estimated: `3747 + k * (2579 ±0)` - // Minimum execution time: 109_755_000 picoseconds. - Weight::from_parts(110_628_000, 3747) - // Standard Error: 87_643 - .saturating_add(Weight::from_parts(37_690_888, 0).saturating_mul(k.into())) + // Minimum execution time: 108_910_000 picoseconds. + Weight::from_parts(110_703_000, 3747) + // Standard Error: 96_515 + .saturating_add(Weight::from_parts(39_503_253, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(k.into()))) @@ -280,24 +304,28 @@ impl WeightInfo for () { /// Proof: `Crowdloan::Contributions` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:0 w:1) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) fn dissolve() -> Weight { // Proof Size summary in bytes: - // Measured: `402` + // Measured: `370` // Estimated: `6148` - // Minimum execution time: 65_793_000 picoseconds. - Weight::from_parts(66_815_000, 6148) + // Minimum execution time: 66_138_000 picoseconds. + Weight::from_parts(66_939_000, 6148) .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:1 w:0) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) fn update_min_contribution() -> Weight { // Proof Size summary in bytes: // Measured: `229` // Estimated: `3747` - // Minimum execution time: 13_606_000 picoseconds. - Weight::from_parts(14_076_000, 3747) - .saturating_add(RocksDbWeight::get().reads(1_u64)) + // Minimum execution time: 12_639_000 picoseconds. + Weight::from_parts(13_259_000, 3747) + .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `Crowdloan::Crowdloans` (r:1 w:1) @@ -306,8 +334,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `229` // Estimated: `3747` - // Minimum execution time: 13_996_000 picoseconds. - Weight::from_parts(14_557_000, 3747) + // Minimum execution time: 11_637_000 picoseconds. + Weight::from_parts(12_048_000, 3747) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -317,9 +345,24 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `229` // Estimated: `3747` - // Minimum execution time: 13_705_000 picoseconds. - Weight::from_parts(14_537_000, 3747) + // Minimum execution time: 11_026_000 picoseconds. + Weight::from_parts(11_357_000, 3747) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } + /// Storage: `Crowdloan::Crowdloans` (r:1 w:0) + /// Proof: `Crowdloan::Crowdloans` (`max_values`: None, `max_size`: Some(282), added: 2757, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::Contributions` (r:1 w:0) + /// Proof: `Crowdloan::Contributions` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Crowdloan::MaxContributions` (r:0 w:1) + /// Proof: `Crowdloan::MaxContributions` (`max_values`: None, `max_size`: Some(20), added: 2495, mode: `MaxEncodedLen`) + fn set_max_contribution() -> Weight { + // Proof Size summary in bytes: + // Measured: `293` + // Estimated: `3747` + // Minimum execution time: 15_263_000 picoseconds. + Weight::from_parts(16_024_000, 3747) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } } diff --git a/pallets/proxy/src/weights.rs b/pallets/proxy/src/weights.rs index 93650912fe..38ae8c69ac 100644 --- a/pallets/proxy/src/weights.rs +++ b/pallets/proxy/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for `pallet_subtensor_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 -//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runnervmg397c`, CPU: `AMD EPYC 7763 64-Core Processor` +//! HOSTNAME: `runnervm3jyl0`, CPU: `AMD EPYC 9V74 80-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -22,7 +22,7 @@ // --no-storage-info // --no-min-squares // --no-median-slopes -// --output=/tmp/tmp.qXOiQkaCNn +// --output=/tmp/tmp.dW1NaIslV8 // --template=/home/runner/work/subtensor/subtensor/.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -66,10 +66,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `637 + p * (37 ±0)` // Estimated: `4254 + p * (37 ±0)` - // Minimum execution time: 26_600_000 picoseconds. - Weight::from_parts(27_477_037, 4254) - // Standard Error: 3_197 - .saturating_add(Weight::from_parts(80_343, 0).saturating_mul(p.into())) + // Minimum execution time: 23_374_000 picoseconds. + Weight::from_parts(24_151_161, 4254) + // Standard Error: 3_337 + .saturating_add(Weight::from_parts(96_756, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) @@ -92,12 +92,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `894 + a * (68 ±0) + p * (37 ±0)` // Estimated: `8615 + a * (68 ±0) + p * (37 ±0)` - // Minimum execution time: 51_786_000 picoseconds. - Weight::from_parts(52_295_376, 8615) - // Standard Error: 1_674 - .saturating_add(Weight::from_parts(216_153, 0).saturating_mul(a.into())) - // Standard Error: 6_704 - .saturating_add(Weight::from_parts(34_685, 0).saturating_mul(p.into())) + // Minimum execution time: 47_420_000 picoseconds. + Weight::from_parts(48_607_796, 8615) + // Standard Error: 1_429 + .saturating_add(Weight::from_parts(261_812, 0).saturating_mul(a.into())) + // Standard Error: 5_727 + .saturating_add(Weight::from_parts(54_276, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 68).saturating_mul(a.into())) @@ -109,14 +109,16 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 74]`. /// The range of component `p` is `[1, 19]`. - fn remove_announcement(a: u32, _p: u32, ) -> Weight { + fn remove_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `299 + a * (68 ±0)` // Estimated: `8615` - // Minimum execution time: 24_796_000 picoseconds. - Weight::from_parts(25_411_516, 8615) - // Standard Error: 1_174 - .saturating_add(Weight::from_parts(204_601, 0).saturating_mul(a.into())) + // Minimum execution time: 23_295_000 picoseconds. + Weight::from_parts(24_193_917, 8615) + // Standard Error: 886 + .saturating_add(Weight::from_parts(211_445, 0).saturating_mul(a.into())) + // Standard Error: 3_552 + .saturating_add(Weight::from_parts(20_637, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -126,14 +128,16 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 74]`. /// The range of component `p` is `[1, 19]`. - fn reject_announcement(a: u32, _p: u32, ) -> Weight { + fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `299 + a * (68 ±0)` // Estimated: `8615` - // Minimum execution time: 25_307_000 picoseconds. - Weight::from_parts(25_315_553, 8615) - // Standard Error: 1_296 - .saturating_add(Weight::from_parts(211_641, 0).saturating_mul(a.into())) + // Minimum execution time: 23_334_000 picoseconds. + Weight::from_parts(24_226_028, 8615) + // Standard Error: 891 + .saturating_add(Weight::from_parts(211_311, 0).saturating_mul(a.into())) + // Standard Error: 3_572 + .saturating_add(Weight::from_parts(19_850, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -149,12 +153,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `308 + a * (68 ±0) + p * (37 ±0)` // Estimated: `8615` - // Minimum execution time: 32_200_000 picoseconds. - Weight::from_parts(32_309_059, 8615) - // Standard Error: 1_376 - .saturating_add(Weight::from_parts(204_544, 0).saturating_mul(a.into())) - // Standard Error: 5_511 - .saturating_add(Weight::from_parts(50_671, 0).saturating_mul(p.into())) + // Minimum execution time: 30_775_000 picoseconds. + Weight::from_parts(29_900_605, 8615) + // Standard Error: 2_656 + .saturating_add(Weight::from_parts(245_681, 0).saturating_mul(a.into())) + // Standard Error: 10_638 + .saturating_add(Weight::from_parts(108_442, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -165,10 +169,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 23_754_000 picoseconds. - Weight::from_parts(24_570_196, 4254) - // Standard Error: 2_399 - .saturating_add(Weight::from_parts(76_851, 0).saturating_mul(p.into())) + // Minimum execution time: 22_393_000 picoseconds. + Weight::from_parts(23_099_598, 4254) + // Standard Error: 1_922 + .saturating_add(Weight::from_parts(76_038, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -181,10 +185,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 25_447_000 picoseconds. - Weight::from_parts(26_347_745, 4254) - // Standard Error: 3_273 - .saturating_add(Weight::from_parts(71_881, 0).saturating_mul(p.into())) + // Minimum execution time: 23_635_000 picoseconds. + Weight::from_parts(24_761_635, 4254) + // Standard Error: 2_310 + .saturating_add(Weight::from_parts(58_413, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -195,10 +199,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 25_096_000 picoseconds. - Weight::from_parts(26_267_829, 4254) - // Standard Error: 2_981 - .saturating_add(Weight::from_parts(52_495, 0).saturating_mul(p.into())) + // Minimum execution time: 23_715_000 picoseconds. + Weight::from_parts(24_632_652, 4254) + // Standard Error: 2_253 + .saturating_add(Weight::from_parts(48_858, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -209,10 +213,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `139` // Estimated: `4254` - // Minimum execution time: 25_438_000 picoseconds. - Weight::from_parts(26_407_271, 4254) - // Standard Error: 3_133 - .saturating_add(Weight::from_parts(42_843, 0).saturating_mul(p.into())) + // Minimum execution time: 23_865_000 picoseconds. + Weight::from_parts(24_892_331, 4254) + // Standard Error: 2_007 + .saturating_add(Weight::from_parts(21_649, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -223,10 +227,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `156 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 24_515_000 picoseconds. - Weight::from_parts(25_539_027, 4254) - // Standard Error: 2_827 - .saturating_add(Weight::from_parts(25_081, 0).saturating_mul(p.into())) + // Minimum execution time: 22_854_000 picoseconds. + Weight::from_parts(23_802_763, 4254) + // Standard Error: 2_166 + .saturating_add(Weight::from_parts(41_019, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -240,8 +244,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `412` // Estimated: `8615` - // Minimum execution time: 43_011_000 picoseconds. - Weight::from_parts(43_712_000, 8615) + // Minimum execution time: 42_413_000 picoseconds. + Weight::from_parts(43_264_000, 8615) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -254,10 +258,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 13_636_000 picoseconds. - Weight::from_parts(14_306_938, 4254) - // Standard Error: 2_079 - .saturating_add(Weight::from_parts(36_366, 0).saturating_mul(p.into())) + // Minimum execution time: 11_487_000 picoseconds. + Weight::from_parts(12_050_045, 4254) + // Standard Error: 1_620 + .saturating_add(Weight::from_parts(45_828, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -278,10 +282,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `637 + p * (37 ±0)` // Estimated: `4254 + p * (37 ±0)` - // Minimum execution time: 26_600_000 picoseconds. - Weight::from_parts(27_477_037, 4254) - // Standard Error: 3_197 - .saturating_add(Weight::from_parts(80_343, 0).saturating_mul(p.into())) + // Minimum execution time: 23_374_000 picoseconds. + Weight::from_parts(24_151_161, 4254) + // Standard Error: 3_337 + .saturating_add(Weight::from_parts(96_756, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(p.into())) @@ -304,12 +308,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `894 + a * (68 ±0) + p * (37 ±0)` // Estimated: `8615 + a * (68 ±0) + p * (37 ±0)` - // Minimum execution time: 51_786_000 picoseconds. - Weight::from_parts(52_295_376, 8615) - // Standard Error: 1_674 - .saturating_add(Weight::from_parts(216_153, 0).saturating_mul(a.into())) - // Standard Error: 6_704 - .saturating_add(Weight::from_parts(34_685, 0).saturating_mul(p.into())) + // Minimum execution time: 47_420_000 picoseconds. + Weight::from_parts(48_607_796, 8615) + // Standard Error: 1_429 + .saturating_add(Weight::from_parts(261_812, 0).saturating_mul(a.into())) + // Standard Error: 5_727 + .saturating_add(Weight::from_parts(54_276, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 68).saturating_mul(a.into())) @@ -321,14 +325,16 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 74]`. /// The range of component `p` is `[1, 19]`. - fn remove_announcement(a: u32, _p: u32, ) -> Weight { + fn remove_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `299 + a * (68 ±0)` // Estimated: `8615` - // Minimum execution time: 24_796_000 picoseconds. - Weight::from_parts(25_411_516, 8615) - // Standard Error: 1_174 - .saturating_add(Weight::from_parts(204_601, 0).saturating_mul(a.into())) + // Minimum execution time: 23_295_000 picoseconds. + Weight::from_parts(24_193_917, 8615) + // Standard Error: 886 + .saturating_add(Weight::from_parts(211_445, 0).saturating_mul(a.into())) + // Standard Error: 3_552 + .saturating_add(Weight::from_parts(20_637, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -338,14 +344,16 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(104), added: 2579, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 74]`. /// The range of component `p` is `[1, 19]`. - fn reject_announcement(a: u32, _p: u32, ) -> Weight { + fn reject_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `299 + a * (68 ±0)` // Estimated: `8615` - // Minimum execution time: 25_307_000 picoseconds. - Weight::from_parts(25_315_553, 8615) - // Standard Error: 1_296 - .saturating_add(Weight::from_parts(211_641, 0).saturating_mul(a.into())) + // Minimum execution time: 23_334_000 picoseconds. + Weight::from_parts(24_226_028, 8615) + // Standard Error: 891 + .saturating_add(Weight::from_parts(211_311, 0).saturating_mul(a.into())) + // Standard Error: 3_572 + .saturating_add(Weight::from_parts(19_850, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -361,12 +369,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `308 + a * (68 ±0) + p * (37 ±0)` // Estimated: `8615` - // Minimum execution time: 32_200_000 picoseconds. - Weight::from_parts(32_309_059, 8615) - // Standard Error: 1_376 - .saturating_add(Weight::from_parts(204_544, 0).saturating_mul(a.into())) - // Standard Error: 5_511 - .saturating_add(Weight::from_parts(50_671, 0).saturating_mul(p.into())) + // Minimum execution time: 30_775_000 picoseconds. + Weight::from_parts(29_900_605, 8615) + // Standard Error: 2_656 + .saturating_add(Weight::from_parts(245_681, 0).saturating_mul(a.into())) + // Standard Error: 10_638 + .saturating_add(Weight::from_parts(108_442, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -377,10 +385,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 23_754_000 picoseconds. - Weight::from_parts(24_570_196, 4254) - // Standard Error: 2_399 - .saturating_add(Weight::from_parts(76_851, 0).saturating_mul(p.into())) + // Minimum execution time: 22_393_000 picoseconds. + Weight::from_parts(23_099_598, 4254) + // Standard Error: 1_922 + .saturating_add(Weight::from_parts(76_038, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -393,10 +401,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 25_447_000 picoseconds. - Weight::from_parts(26_347_745, 4254) - // Standard Error: 3_273 - .saturating_add(Weight::from_parts(71_881, 0).saturating_mul(p.into())) + // Minimum execution time: 23_635_000 picoseconds. + Weight::from_parts(24_761_635, 4254) + // Standard Error: 2_310 + .saturating_add(Weight::from_parts(58_413, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -407,10 +415,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 25_096_000 picoseconds. - Weight::from_parts(26_267_829, 4254) - // Standard Error: 2_981 - .saturating_add(Weight::from_parts(52_495, 0).saturating_mul(p.into())) + // Minimum execution time: 23_715_000 picoseconds. + Weight::from_parts(24_632_652, 4254) + // Standard Error: 2_253 + .saturating_add(Weight::from_parts(48_858, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -421,10 +429,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `139` // Estimated: `4254` - // Minimum execution time: 25_438_000 picoseconds. - Weight::from_parts(26_407_271, 4254) - // Standard Error: 3_133 - .saturating_add(Weight::from_parts(42_843, 0).saturating_mul(p.into())) + // Minimum execution time: 23_865_000 picoseconds. + Weight::from_parts(24_892_331, 4254) + // Standard Error: 2_007 + .saturating_add(Weight::from_parts(21_649, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -435,10 +443,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `156 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 24_515_000 picoseconds. - Weight::from_parts(25_539_027, 4254) - // Standard Error: 2_827 - .saturating_add(Weight::from_parts(25_081, 0).saturating_mul(p.into())) + // Minimum execution time: 22_854_000 picoseconds. + Weight::from_parts(23_802_763, 4254) + // Standard Error: 2_166 + .saturating_add(Weight::from_parts(41_019, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -452,8 +460,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `412` // Estimated: `8615` - // Minimum execution time: 43_011_000 picoseconds. - Weight::from_parts(43_712_000, 8615) + // Minimum execution time: 42_413_000 picoseconds. + Weight::from_parts(43_264_000, 8615) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -466,10 +474,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `119 + p * (37 ±0)` // Estimated: `4254` - // Minimum execution time: 13_636_000 picoseconds. - Weight::from_parts(14_306_938, 4254) - // Standard Error: 2_079 - .saturating_add(Weight::from_parts(36_366, 0).saturating_mul(p.into())) + // Minimum execution time: 11_487_000 picoseconds. + Weight::from_parts(12_050_045, 4254) + // Standard Error: 1_620 + .saturating_add(Weight::from_parts(45_828, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/pallets/subtensor/rpc/src/lib.rs b/pallets/subtensor/rpc/src/lib.rs index f3123d1195..e00729151f 100644 --- a/pallets/subtensor/rpc/src/lib.rs +++ b/pallets/subtensor/rpc/src/lib.rs @@ -304,6 +304,7 @@ where } } + #[allow(deprecated)] fn get_subnet_hyperparams( &self, netuid: NetUid, @@ -318,6 +319,7 @@ where } } + #[allow(deprecated)] fn get_subnet_hyperparams_v2( &self, netuid: NetUid, diff --git a/pallets/subtensor/runtime-api/src/lib.rs b/pallets/subtensor/runtime-api/src/lib.rs index 6efd548120..4c05f487d3 100644 --- a/pallets/subtensor/runtime-api/src/lib.rs +++ b/pallets/subtensor/runtime-api/src/lib.rs @@ -9,7 +9,9 @@ use pallet_subtensor::rpc_info::{ neuron_info::{NeuronInfo, NeuronInfoLite}, show_subnet::SubnetState, stake_info::StakeInfo, - subnet_info::{SubnetHyperparams, SubnetHyperparamsV2, SubnetInfo, SubnetInfov2}, + subnet_info::{ + SubnetHyperparams, SubnetHyperparamsV2, SubnetHyperparamsV3, SubnetInfo, SubnetInfov2, + }, }; use pallet_subtensor::staking::lock::LockState; use sp_runtime::AccountId32; @@ -37,8 +39,12 @@ sp_api::decl_runtime_apis! { fn get_subnets_info() -> Vec>>; fn get_subnet_info_v2(netuid: NetUid) -> Option>; fn get_subnets_info_v2() -> Vec>>; + #[deprecated(note = "Use `get_subnet_hyperparams_v3` instead.")] fn get_subnet_hyperparams(netuid: NetUid) -> Option; + #[deprecated(note = "Use `get_subnet_hyperparams_v3` instead.")] fn get_subnet_hyperparams_v2(netuid: NetUid) -> Option; + #[api_version(2)] + fn get_subnet_hyperparams_v3(netuid: NetUid) -> Option; fn get_all_dynamic_info() -> Vec>>; fn get_all_metagraphs() -> Vec>>; fn get_metagraph(netuid: NetUid) -> Option>; diff --git a/pallets/subtensor/src/coinbase/run_coinbase.rs b/pallets/subtensor/src/coinbase/run_coinbase.rs index e3e98c7a88..a6c988feea 100644 --- a/pallets/subtensor/src/coinbase/run_coinbase.rs +++ b/pallets/subtensor/src/coinbase/run_coinbase.rs @@ -107,7 +107,9 @@ impl Pallet { if let Ok(buy_swap_result_ok) = buy_swap_result { let bought_alpha: AlphaBalance = buy_swap_result_ok.amount_paid_out.into(); - Self::recycle_subnet_alpha(*netuid_i, bought_alpha); + SubnetProtocolAlpha::::mutate(*netuid_i, |total| { + *total = total.saturating_add(bought_alpha); + }); // Record actual excess TAO that entered pool. let actual_excess: TaoBalance = buy_swap_result_ok.amount_paid_in; diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index c54afd101d..d5aee84243 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -998,7 +998,7 @@ pub mod pallet { /// Default minimum stake. #[pallet::type_value] pub fn DefaultMinStake() -> TaoBalance { - 2_000_000.into() + T::InitialMinStake::get().into() } /// Default unicode vector for tau symbol. @@ -1385,6 +1385,10 @@ pub mod pallet { #[pallet::storage] pub type SubnetAlphaOut = StorageMap<_, Identity, NetUid, AlphaBalance, ValueQuery, DefaultZeroAlpha>; + /// --- MAP ( netuid ) --> protocol_alpha | Returns the protocol-owned alpha cached for the subnet. + #[pallet::storage] + pub type SubnetProtocolAlpha = + StorageMap<_, Identity, NetUid, AlphaBalance, ValueQuery, DefaultZeroAlpha>; /// --- MAP ( cold ) --> Vec | Maps coldkey to hotkeys that stake to it #[pallet::storage] diff --git a/pallets/subtensor/src/macros/config.rs b/pallets/subtensor/src/macros/config.rs index 8eec97a5be..7b94866b52 100644 --- a/pallets/subtensor/src/macros/config.rs +++ b/pallets/subtensor/src/macros/config.rs @@ -111,6 +111,9 @@ mod config { /// Initial Min Burn. #[pallet::constant] type InitialMinBurn: Get; + /// Initial minimum stake. + #[pallet::constant] + type InitialMinStake: Get; /// Min burn upper bound. #[pallet::constant] type MinBurnUpperBound: Get; diff --git a/pallets/subtensor/src/rpc_info/subnet_info.rs b/pallets/subtensor/src/rpc_info/subnet_info.rs index db595eb98e..7446e4f6fc 100644 --- a/pallets/subtensor/src/rpc_info/subnet_info.rs +++ b/pallets/subtensor/src/rpc_info/subnet_info.rs @@ -3,7 +3,7 @@ use frame_support::pallet_prelude::{Decode, Encode}; use frame_support::storage::IterableStorageMap; extern crate alloc; use codec::Compact; -use substrate_fixed::types::I32F32; +use substrate_fixed::types::{I32F32, U64F64}; use subtensor_runtime_common::{NetUid, TaoBalance}; #[freeze_struct("f691073111c39620")] @@ -123,6 +123,55 @@ pub struct SubnetHyperparamsV2 { user_liquidity_enabled: bool, } +/// Tagged value for a single hyperparameter in [`SubnetHyperparamsV3`]. +/// +/// Clients decode by matching on the SCALE variant tag (resolved through +/// runtime metadata). Adding a new hyperparam whose value already fits an +/// existing variant is purely additive. Introducing a brand-new value type +/// requires a new variant *and* a coordinated client update, since that +/// changes the variant tag space. +#[derive(Decode, Encode, PartialEq, Eq, Clone, Debug, TypeInfo)] +pub enum HyperparamValue { + Bool(bool), + U16(Compact), + U32(Compact), + U64(Compact), + U128(Compact), + TaoBalance(Compact), + I32F32(I32F32), + U64F64(U64F64), +} + +/// One named hyperparameter and its typed value. +/// +/// `name` is the ASCII identifier (e.g. `b"rho"`), matching the field names +/// used in [`SubnetHyperparamsV2`]. Clients should look up params by name +/// and treat unknown names as forward-compatible additions. +#[freeze_struct("3fee3576c33e216c")] +#[derive(Decode, Encode, PartialEq, Eq, Clone, Debug, TypeInfo)] +pub struct HyperparamEntry { + pub name: Vec, + pub value: HyperparamValue, +} + +impl From<(&str, HyperparamValue)> for HyperparamEntry { + fn from((name, value): (&str, HyperparamValue)) -> Self { + Self { + name: name.as_bytes().to_vec(), + value, + } + } +} + +/// Dynamic, forward-compatible view of subnet hyperparameters. +/// +/// Unlike [`SubnetHyperparamsV2`], the wire shape never changes when a new +/// hyperparam is added — callers receive a flat list of +/// [`HyperparamEntry`] and look up values by name. The order in which +/// entries appear is stable insertion order from the runtime getter, but +/// clients should not rely on it for semantics. +pub type SubnetHyperparamsV3 = Vec; + impl Pallet { pub fn get_subnet_info(netuid: NetUid) -> Option> { if !Self::if_subnet_exist(netuid) { @@ -410,4 +459,169 @@ impl Pallet { ) -> Option { AutoStakeDestination::::get(coldkey, netuid) } + + /// Returns every hyperparameter for `netuid` as a flat + /// [`SubnetHyperparamsV3`] list, or `None` if the subnet does not exist. + /// + /// Adding a new hyperparameter is a single `(name, value).into()` push + /// below — no struct edit and no V4 required, provided the value's type + /// already has a [`HyperparamValue`] variant. + pub fn get_subnet_hyperparams_v3(netuid: NetUid) -> Option { + if !Self::if_subnet_exist(netuid) { + return None; + } + + let (alpha_low, alpha_high): (u16, u16) = Self::get_alpha_values(netuid); + let yuma_version: u16 = if Self::get_yuma3_enabled(netuid) { + 3 + } else { + 2 + }; + + Some(alloc::vec![ + ( + "kappa", + HyperparamValue::U16(Self::get_kappa(netuid).into()) + ) + .into(), + ( + "immunity_period", + HyperparamValue::U16(Self::get_immunity_period(netuid).into()), + ) + .into(), + ( + "min_allowed_weights", + HyperparamValue::U16(Self::get_min_allowed_weights(netuid).into()), + ) + .into(), + ( + "max_weights_limit", + HyperparamValue::U16(Self::get_max_weight_limit(netuid).into()), + ) + .into(), + ( + "tempo", + HyperparamValue::U16(Self::get_tempo(netuid).into()) + ) + .into(), + ( + "weights_version", + HyperparamValue::U64(Self::get_weights_version_key(netuid).into()), + ) + .into(), + ( + "weights_rate_limit", + HyperparamValue::U64(Self::get_weights_set_rate_limit(netuid).into()), + ) + .into(), + ( + "activity_cutoff", + HyperparamValue::U16(Self::get_activity_cutoff(netuid).into()), + ) + .into(), + ( + "registration_allowed", + HyperparamValue::Bool(Self::get_network_registration_allowed(netuid)), + ) + .into(), + ( + "target_regs_per_interval", + HyperparamValue::U16(Self::get_target_registrations_per_interval(netuid).into()), + ) + .into(), + ( + "min_burn", + HyperparamValue::TaoBalance(Self::get_min_burn(netuid).into()), + ) + .into(), + ( + "max_burn", + HyperparamValue::TaoBalance(Self::get_max_burn(netuid).into()), + ) + .into(), + ( + "burn_half_life", + HyperparamValue::U16(BurnHalfLife::::get(netuid).into()), + ) + .into(), + ( + "burn_increase_mult", + HyperparamValue::U64F64(BurnIncreaseMult::::get(netuid)), + ) + .into(), + ( + "bonds_moving_avg", + HyperparamValue::U64(Self::get_bonds_moving_average(netuid).into()), + ) + .into(), + ( + "max_regs_per_block", + HyperparamValue::U16(Self::get_max_registrations_per_block(netuid).into()), + ) + .into(), + ( + "serving_rate_limit", + HyperparamValue::U64(Self::get_serving_rate_limit(netuid).into()), + ) + .into(), + ( + "max_validators", + HyperparamValue::U16(Self::get_max_allowed_validators(netuid).into()), + ) + .into(), + ( + "commit_reveal_period", + HyperparamValue::U64(Self::get_reveal_period(netuid).into()), + ) + .into(), + ( + "commit_reveal_weights_enabled", + HyperparamValue::Bool(Self::get_commit_reveal_weights_enabled(netuid)), + ) + .into(), + ("alpha_high", HyperparamValue::U16(alpha_high.into())).into(), + ("alpha_low", HyperparamValue::U16(alpha_low.into())).into(), + ( + "liquid_alpha_enabled", + HyperparamValue::Bool(Self::get_liquid_alpha_enabled(netuid)), + ) + .into(), + ( + "alpha_sigmoid_steepness", + HyperparamValue::I32F32(Self::get_alpha_sigmoid_steepness(netuid)), + ) + .into(), + ("yuma_version", HyperparamValue::U16(Compact(yuma_version)),).into(), + ( + "subnet_is_active", + HyperparamValue::Bool(Self::get_subtoken_enabled(netuid)), + ) + .into(), + ( + "transfers_enabled", + HyperparamValue::Bool(Self::get_transfer_toggle(netuid)), + ) + .into(), + ( + "bonds_reset_enabled", + HyperparamValue::Bool(Self::get_bonds_reset(netuid)), + ) + .into(), + ( + "user_liquidity_enabled", + HyperparamValue::Bool(Self::is_user_liquidity_enabled(netuid)), + ) + .into(), + ( + "owner_cut_enabled", + HyperparamValue::Bool(Self::get_owner_cut_enabled(netuid)), + ) + .into(), + ( + "owner_cut_auto_lock_enabled", + HyperparamValue::Bool(Self::get_owner_cut_auto_lock_enabled(netuid)), + ) + .into(), + ]) + } } diff --git a/pallets/subtensor/src/staking/remove_stake.rs b/pallets/subtensor/src/staking/remove_stake.rs index f2d07189a4..c3ed9e1b74 100644 --- a/pallets/subtensor/src/staking/remove_stake.rs +++ b/pallets/subtensor/src/staking/remove_stake.rs @@ -473,7 +473,11 @@ impl Pallet { // - track hotkeys to clear pool totals. let mut keys_to_remove: Vec<(T::AccountId, T::AccountId)> = Vec::new(); let mut stakers: Vec<(T::AccountId, T::AccountId, u128)> = Vec::new(); - let mut total_alpha_value_u128: u128 = 0; + let protocol_alpha_value_u128: u128 = SubnetAlphaIn::::get(netuid) + .saturating_add(SubnetProtocolAlpha::::get(netuid)) + .to_u64() as u128; + let mut total_alpha_value_u128: u128 = protocol_alpha_value_u128; + let mut protocol_tao_share = TaoBalance::ZERO; let hotkeys_in_subnet: Vec = TotalHotkeyAlpha::::iter_keys() .filter(|(_, this_netuid)| *this_netuid == netuid) @@ -517,16 +521,18 @@ impl Pallet { // 6) Pro‑rata distribution of the pot by α value (largest‑remainder), // **credited directly to each staker's COLDKEY free balance**. - if pot_u64 > 0 && total_alpha_value_u128 > 0 && !stakers.is_empty() { + if pot_u64 > 0 && total_alpha_value_u128 > 0 { struct Portion { _hot: A, cold: C, + is_protocol: bool, share: u64, // TAO to credit to coldkey balance rem: u128, // remainder for largest‑remainder method } let pot_u128: u128 = pot_u64 as u128; - let mut portions: Vec> = Vec::with_capacity(stakers.len()); + let mut portions: Vec> = + Vec::with_capacity(stakers.len().saturating_add(1)); let mut distributed: u128 = 0; for (hot, cold, alpha_val) in &stakers { @@ -539,6 +545,22 @@ impl Pallet { portions.push(Portion { _hot: hot.clone(), cold: cold.clone(), + is_protocol: false, + share: share_u64, + rem, + }); + } + + if protocol_alpha_value_u128 > 0 { + let prod: u128 = pot_u128.saturating_mul(protocol_alpha_value_u128); + let share_u128: u128 = prod.checked_div(total_alpha_value_u128).unwrap_or_default(); + let share_u64: u64 = share_u128.min(u128::from(u64::MAX)) as u64; + distributed = distributed.saturating_add(u128::from(share_u64)); + let rem: u128 = prod.checked_rem(total_alpha_value_u128).unwrap_or_default(); + portions.push(Portion { + _hot: owner_coldkey.clone(), + cold: owner_coldkey.clone(), + is_protocol: true, share: share_u64, rem, }); @@ -555,7 +577,9 @@ impl Pallet { // Credit each share directly to coldkey free balance. for p in portions { - if p.share > 0 { + if p.is_protocol { + protocol_tao_share = protocol_tao_share.saturating_add(p.share.into()); + } else if p.share > 0 { // Cannot fail the whole transaction if this transfer fails let _ = Self::transfer_tao_from_subnet(netuid, &p.cold, p.share.into()); } @@ -578,6 +602,7 @@ impl Pallet { SubnetAlphaIn::::remove(netuid); SubnetAlphaInProvided::::remove(netuid); SubnetAlphaOut::::remove(netuid); + SubnetProtocolAlpha::::remove(netuid); // Clear the locked balance on the subnet. Self::set_subnet_locked_balance(netuid, TaoBalance::ZERO); @@ -596,7 +621,8 @@ impl Pallet { && let Some(subnet_account) = Self::get_subnet_account_id(netuid) { // Transfer maximum transferrable up to refund to owner - let transferrable = Self::get_coldkey_balance(&subnet_account); + let transferrable = + Self::get_coldkey_balance(&subnet_account).saturating_sub(protocol_tao_share); // We do our best effort to refund owner to as full amount of refund as possible, but // we cannot fail new subnet registration, so the result is ignored. let _ = Self::transfer_tao(&subnet_account, &owner_coldkey, refund.min(transferrable)); diff --git a/pallets/subtensor/src/tests/coinbase.rs b/pallets/subtensor/src/tests/coinbase.rs index b89041c98c..45260ef8fc 100644 --- a/pallets/subtensor/src/tests/coinbase.rs +++ b/pallets/subtensor/src/tests/coinbase.rs @@ -822,6 +822,13 @@ fn test_coinbase_alpha_issuance_with_cap_trigger_and_block_emission() { // Run coinbase SubtensorModule::run_coinbase(emission_credit); + // New behavior: chain-bought alpha is cached instead of recycled. + // The cached amount remains part of outstanding alpha supply. + assert!( + !SubnetProtocolAlpha::::get(netuid1).is_zero() + || !SubnetProtocolAlpha::::get(netuid2).is_zero() + ); + // Get the prices after the run_coinbase let price_1_after = ::SwapInterface::current_alpha_price(netuid1); let price_2_after = ::SwapInterface::current_alpha_price(netuid2); @@ -831,11 +838,13 @@ fn test_coinbase_alpha_issuance_with_cap_trigger_and_block_emission() { assert_eq!( u64::from(SubnetAlphaOut::::get(netuid2)), 21_000_000_000_000_000_u64 + .saturating_add(u64::from(SubnetProtocolAlpha::::get(netuid2))) ); assert!(u64::from(SubnetAlphaIn::::get(netuid2)) < initial_alpha); assert_eq!( u64::from(SubnetAlphaOut::::get(netuid2)), 21_000_000_000_000_000_u64 + .saturating_add(u64::from(SubnetProtocolAlpha::::get(netuid2))) ); assert!(price_1_after > price_1_before); diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index 8c553e3ee8..277162dde4 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -210,6 +210,7 @@ parameter_types! { pub const InitialTxChildKeyTakeRateLimit: u64 = 1; // 1 block take rate limit for testing pub const InitialBurn: u64 = 0; pub const InitialMinBurn: u64 = 500_000; + pub const InitialMinStake: u64 = 2_000_000; pub const InitialMaxBurn: u64 = 1_000_000_000; pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO @@ -297,6 +298,7 @@ impl crate::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type InitialMinStake = InitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; diff --git a/pallets/subtensor/src/tests/mock_high_ed.rs b/pallets/subtensor/src/tests/mock_high_ed.rs index 0f0d818c38..5f19edf455 100644 --- a/pallets/subtensor/src/tests/mock_high_ed.rs +++ b/pallets/subtensor/src/tests/mock_high_ed.rs @@ -170,6 +170,7 @@ parameter_types! { pub const InitialTxChildKeyTakeRateLimit: u64 = 1; // 1 block take rate limit for testing pub const InitialBurn: u64 = 0; pub const InitialMinBurn: u64 = 500_000; + pub const InitialMinStake: u64 = 2_000_000; pub const InitialMaxBurn: u64 = 1_000_000_000; pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO @@ -257,6 +258,7 @@ impl crate::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type InitialMinStake = InitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; diff --git a/pallets/subtensor/src/tests/mod.rs b/pallets/subtensor/src/tests/mod.rs index 91a89129a6..be37a9227b 100644 --- a/pallets/subtensor/src/tests/mod.rs +++ b/pallets/subtensor/src/tests/mod.rs @@ -27,6 +27,7 @@ mod staking; mod staking2; mod subnet; mod subnet_emissions; +mod subnet_info; mod swap_coldkey; mod swap_hotkey; mod swap_hotkey_with_subnet; diff --git a/pallets/subtensor/src/tests/networks.rs b/pallets/subtensor/src/tests/networks.rs index d236ea0c8a..2707f2998f 100644 --- a/pallets/subtensor/src/tests/networks.rs +++ b/pallets/subtensor/src/tests/networks.rs @@ -111,6 +111,8 @@ fn dissolve_single_alpha_out_staker_gets_all_tao() { let owner_hot = U256::from(20); let net = add_dynamic_network(&owner_hot, &owner_cold); remove_owner_registration_stake(net); + SubnetAlphaIn::::insert(net, AlphaBalance::ZERO); + SubnetProtocolAlpha::::insert(net, AlphaBalance::ZERO); // 2. Single α-out staker let (s_hot, s_cold) = (U256::from(100), U256::from(200)); @@ -147,6 +149,8 @@ fn dissolve_two_stakers_pro_rata_distribution() { let oh = U256::from(51); let net = add_dynamic_network(&oh, &oc); remove_owner_registration_stake(net); + SubnetAlphaIn::::insert(net, AlphaBalance::ZERO); + SubnetProtocolAlpha::::insert(net, AlphaBalance::ZERO); // Mark this subnet as *legacy* so owner refund path is enabled. let reg_at = NetworkRegisteredAt::::get(net); @@ -367,6 +371,7 @@ fn dissolve_clears_all_per_subnet_storages() { // Items now REMOVED (not zeroed) by dissolution SubnetAlphaIn::::insert(net, AlphaBalance::from(2)); SubnetAlphaOut::::insert(net, AlphaBalance::from(3)); + SubnetProtocolAlpha::::insert(net, AlphaBalance::from(4)); // Prefix / double-map collections Keys::::insert(net, 0u16, owner_hot); @@ -523,6 +528,7 @@ fn dissolve_clears_all_per_subnet_storages() { // These are now REMOVED assert!(!SubnetAlphaIn::::contains_key(net)); assert!(!SubnetAlphaOut::::contains_key(net)); + assert!(!SubnetProtocolAlpha::::contains_key(net)); // Collections fully cleared assert!(Keys::::iter_prefix(net).next().is_none()); @@ -691,6 +697,8 @@ fn dissolve_rounding_remainder_distribution() { let oh = U256::from(62); let net = add_dynamic_network(&oh, &oc); remove_owner_registration_stake(net); + SubnetAlphaIn::::insert(net, AlphaBalance::ZERO); + SubnetProtocolAlpha::::insert(net, AlphaBalance::ZERO); let (s1h, s1c) = (U256::from(63), U256::from(64)); let (s2h, s2c) = (U256::from(65), U256::from(66)); @@ -724,6 +732,40 @@ fn dissolve_rounding_remainder_distribution() { }); } +#[test] +fn dissolve_protocol_alpha_share_is_not_paid_to_users() { + new_test_ext(0).execute_with(|| { + let owner_cold = U256::from(610); + let owner_hot = U256::from(620); + let net = add_dynamic_network(&owner_hot, &owner_cold); + remove_owner_registration_stake(net); + SubtensorModule::set_subnet_locked_balance(net, TaoBalance::ZERO); + + // Protocol owns both alpha-in and cached chain-buy alpha on dereg. + SubnetAlphaIn::::insert(net, AlphaBalance::from(100u64)); + SubnetProtocolAlpha::::insert(net, AlphaBalance::from(50u64)); + + let staker_hot = U256::from(630); + let staker_cold = U256::from(640); + AlphaV2::::insert((staker_hot, staker_cold, net), sf_from_u64(50u64)); + TotalHotkeyAlpha::::insert(staker_hot, net, AlphaBalance::from(50u64)); + + let pot: u64 = 200; + SubnetTAO::::insert(net, TaoBalance::from(pot)); + + let staker_before = SubtensorModule::get_coldkey_balance(&staker_cold); + assert_ok!(SubtensorModule::do_dissolve_network(net)); + + // User gets 50 / (100 alpha-in + 50 cached protocol alpha + 50 user alpha) + // of the TAO pot. The protocol share is withheld from user/owner payout. + assert_eq!( + SubtensorModule::get_coldkey_balance(&staker_cold), + staker_before + 50.into() + ); + assert!(!SubnetProtocolAlpha::::contains_key(net)); + }); +} + #[test] fn destroy_alpha_out_multiple_stakers_pro_rata() { new_test_ext(0).execute_with(|| { @@ -766,6 +808,9 @@ fn destroy_alpha_out_multiple_stakers_pro_rata() { )); // 4. α-out snapshot + + SubnetAlphaIn::::insert(netuid, AlphaBalance::ZERO); + SubnetProtocolAlpha::::insert(netuid, AlphaBalance::ZERO); let a1: u128 = sf_to_u128(&AlphaV2::::get((h1, c1, netuid))); let a2: u128 = sf_to_u128(&AlphaV2::::get((h2, c2, netuid))); let atotal = a1 + a2; @@ -899,6 +944,9 @@ fn destroy_alpha_out_many_stakers_complex_distribution() { let owner_before = SubtensorModule::get_coldkey_balance(&owner_cold); // ── 5) expected τ share per pallet algorithm (incl. remainder) ───── + + SubnetAlphaIn::::insert(netuid, AlphaBalance::ZERO); + SubnetProtocolAlpha::::insert(netuid, AlphaBalance::ZERO); let mut share = [0u64; N]; let mut rem = [0u128; N]; let mut paid: u128 = 0; @@ -1970,6 +2018,11 @@ fn massive_dissolve_refund_and_reregistration_flow_is_lossless_and_cleans_state( // 5) Compute Hamilton-apportionment BASE shares per cold and total leftover // from the **pair-level** pre‑LP α snapshot; also count pairs per cold. // ──────────────────────────────────────────────────────────────────── + for &net in nets.iter() { + SubnetAlphaIn::::insert(net, AlphaBalance::ZERO); + SubnetProtocolAlpha::::insert(net, AlphaBalance::ZERO); + } + let mut base_share_cold: BTreeMap = cold_lps.iter().copied().map(|c| (c, 0_u64)).collect(); let mut pair_count_cold: BTreeMap = diff --git a/pallets/subtensor/src/tests/subnet_info.rs b/pallets/subtensor/src/tests/subnet_info.rs new file mode 100644 index 0000000000..fcf597f4ff --- /dev/null +++ b/pallets/subtensor/src/tests/subnet_info.rs @@ -0,0 +1,285 @@ +#![allow(clippy::expect_used, clippy::unwrap_used)] + +use super::mock::*; +use crate::rpc_info::subnet_info::{HyperparamEntry, HyperparamValue, SubnetHyperparamsV3}; +use crate::{BurnHalfLife, BurnIncreaseMult}; +use codec::{Compact, Decode, Encode}; +use std::collections::BTreeSet; +use substrate_fixed::types::{I32F32, U64F64}; +use subtensor_runtime_common::{NetUid, TaoBalance}; + +/// Names that must always appear in V3. Adding a new hyperparam = add its +/// name here AND in the getter. Removing one = decide whether that's a +/// breaking change for clients. +const EXPECTED_V3_NAMES: &[&[u8]] = &[ + b"kappa", + b"immunity_period", + b"min_allowed_weights", + b"max_weights_limit", + b"tempo", + b"weights_version", + b"weights_rate_limit", + b"activity_cutoff", + b"registration_allowed", + b"target_regs_per_interval", + b"min_burn", + b"max_burn", + b"burn_half_life", + b"burn_increase_mult", + b"bonds_moving_avg", + b"max_regs_per_block", + b"serving_rate_limit", + b"max_validators", + b"commit_reveal_period", + b"commit_reveal_weights_enabled", + b"alpha_high", + b"alpha_low", + b"liquid_alpha_enabled", + b"alpha_sigmoid_steepness", + b"yuma_version", + b"subnet_is_active", + b"transfers_enabled", + b"bonds_reset_enabled", + b"user_liquidity_enabled", + b"owner_cut_enabled", + b"owner_cut_auto_lock_enabled", +]; + +fn find<'a>(params: &'a [HyperparamEntry], name: &[u8]) -> &'a HyperparamValue { + ¶ms + .iter() + .find(|e| e.name == name) + .unwrap_or_else(|| panic!("missing hyperparam {:?}", std::str::from_utf8(name))) + .value +} + +#[test] +fn test_get_subnet_hyperparams_v3_returns_none_for_nonexistent_subnet() { + new_test_ext(1).execute_with(|| { + let netuid = NetUid::from(7); + assert!(SubtensorModule::get_subnet_hyperparams_v3(netuid).is_none()); + }); +} + +#[test] +fn test_get_subnet_hyperparams_v3_contains_all_expected_names_exactly_once() { + new_test_ext(1).execute_with(|| { + let netuid = NetUid::from(1); + add_network(netuid, 1, 0); + + let result = SubtensorModule::get_subnet_hyperparams_v3(netuid) + .expect("subnet exists, V3 should be Some"); + + let returned: Vec<&[u8]> = result.iter().map(|e| e.name.as_slice()).collect(); + let returned_set: BTreeSet<&[u8]> = returned.iter().copied().collect(); + + // No duplicates. + assert_eq!( + returned.len(), + returned_set.len(), + "duplicate hyperparam name in V3 output" + ); + + // Exact-name match with the expected set — catches accidental drops + // and accidental additions that weren't reviewed. + let expected_set: BTreeSet<&[u8]> = EXPECTED_V3_NAMES.iter().copied().collect(); + assert_eq!( + returned_set, expected_set, + "V3 hyperparam name set drifted from EXPECTED_V3_NAMES" + ); + }); +} + +#[test] +fn test_get_subnet_hyperparams_v3_values_reflect_storage() { + new_test_ext(1).execute_with(|| { + let netuid = NetUid::from(1); + add_network(netuid, 1, 0); + + // Distinct, easy-to-spot values for each storage we touch. + SubtensorModule::set_kappa(netuid, 12); + SubtensorModule::set_immunity_period(netuid, 13); + SubtensorModule::set_min_allowed_weights(netuid, 14); + SubtensorModule::set_tempo(netuid, 16); + SubtensorModule::set_weights_version_key(netuid, 19); + SubtensorModule::set_weights_set_rate_limit(netuid, 20); + SubtensorModule::set_activity_cutoff(netuid, 22); + SubtensorModule::set_network_registration_allowed(netuid, false); + SubtensorModule::set_target_registrations_per_interval(netuid, 24); + SubtensorModule::set_min_burn(netuid, TaoBalance::from(25u64)); + SubtensorModule::set_max_burn(netuid, TaoBalance::from(26u64)); + BurnHalfLife::::insert(netuid, 33u16); + BurnIncreaseMult::::insert(netuid, U64F64::saturating_from_num(2)); + SubtensorModule::set_bonds_moving_average(netuid, 27); + SubtensorModule::set_max_registrations_per_block(netuid, 28); + SubtensorModule::set_serving_rate_limit(netuid, 29); + SubtensorModule::set_max_allowed_validators(netuid, 30); + SubtensorModule::set_commit_reveal_weights_enabled(netuid, true); + SubtensorModule::set_liquid_alpha_enabled(netuid, true); + SubtensorModule::set_alpha_sigmoid_steepness(netuid, 5i16); + SubtensorModule::set_yuma3_enabled(netuid, true); + SubtensorModule::set_bonds_reset(netuid, true); + SubtensorModule::set_owner_cut_enabled_flag(netuid, true); + SubtensorModule::set_owner_cut_auto_lock_enabled(netuid, true); + + let result = SubtensorModule::get_subnet_hyperparams_v3(netuid).unwrap(); + let p = &result; + + // Bool variants + assert_eq!( + find(p, b"registration_allowed"), + &HyperparamValue::Bool(false) + ); + assert_eq!( + find(p, b"commit_reveal_weights_enabled"), + &HyperparamValue::Bool(true) + ); + assert_eq!( + find(p, b"liquid_alpha_enabled"), + &HyperparamValue::Bool(true) + ); + assert_eq!( + find(p, b"bonds_reset_enabled"), + &HyperparamValue::Bool(true) + ); + assert_eq!(find(p, b"owner_cut_enabled"), &HyperparamValue::Bool(true)); + assert_eq!( + find(p, b"owner_cut_auto_lock_enabled"), + &HyperparamValue::Bool(true) + ); + + // U16 variants + assert_eq!(find(p, b"kappa"), &HyperparamValue::U16(Compact(12))); + assert_eq!( + find(p, b"immunity_period"), + &HyperparamValue::U16(Compact(13)) + ); + assert_eq!( + find(p, b"min_allowed_weights"), + &HyperparamValue::U16(Compact(14)) + ); + assert_eq!(find(p, b"tempo"), &HyperparamValue::U16(Compact(16))); + assert_eq!( + find(p, b"activity_cutoff"), + &HyperparamValue::U16(Compact(22)) + ); + assert_eq!( + find(p, b"target_regs_per_interval"), + &HyperparamValue::U16(Compact(24)) + ); + assert_eq!( + find(p, b"burn_half_life"), + &HyperparamValue::U16(Compact(33)) + ); + assert_eq!( + find(p, b"max_regs_per_block"), + &HyperparamValue::U16(Compact(28)) + ); + assert_eq!( + find(p, b"max_validators"), + &HyperparamValue::U16(Compact(30)) + ); + assert_eq!(find(p, b"yuma_version"), &HyperparamValue::U16(Compact(3))); + + // U64 variants + assert_eq!( + find(p, b"weights_version"), + &HyperparamValue::U64(Compact(19)) + ); + assert_eq!( + find(p, b"weights_rate_limit"), + &HyperparamValue::U64(Compact(20)) + ); + assert_eq!( + find(p, b"bonds_moving_avg"), + &HyperparamValue::U64(Compact(27)) + ); + assert_eq!( + find(p, b"serving_rate_limit"), + &HyperparamValue::U64(Compact(29)) + ); + + // TaoBalance variants + assert_eq!( + find(p, b"min_burn"), + &HyperparamValue::TaoBalance(Compact(TaoBalance::from(25u64))) + ); + assert_eq!( + find(p, b"max_burn"), + &HyperparamValue::TaoBalance(Compact(TaoBalance::from(26u64))) + ); + + // I32F32 variant + assert_eq!( + find(p, b"alpha_sigmoid_steepness"), + &HyperparamValue::I32F32(I32F32::saturating_from_num(5)) + ); + + // U64F64 variant + assert_eq!( + find(p, b"burn_increase_mult"), + &HyperparamValue::U64F64(U64F64::saturating_from_num(2)) + ); + }); +} + +#[test] +fn test_get_subnet_hyperparams_v3_yuma_version_reflects_flag() { + new_test_ext(1).execute_with(|| { + let netuid = NetUid::from(1); + add_network(netuid, 1, 0); + + SubtensorModule::set_yuma3_enabled(netuid, false); + assert_eq!( + find( + &SubtensorModule::get_subnet_hyperparams_v3(netuid).unwrap(), + b"yuma_version", + ), + &HyperparamValue::U16(Compact(2)) + ); + + SubtensorModule::set_yuma3_enabled(netuid, true); + assert_eq!( + find( + &SubtensorModule::get_subnet_hyperparams_v3(netuid).unwrap(), + b"yuma_version", + ), + &HyperparamValue::U16(Compact(3)) + ); + }); +} + +#[test] +fn test_get_subnet_hyperparams_v3_scale_round_trip() { + new_test_ext(1).execute_with(|| { + let netuid = NetUid::from(1); + add_network(netuid, 1, 0); + + let original = SubtensorModule::get_subnet_hyperparams_v3(netuid).unwrap(); + let bytes = original.encode(); + let decoded = + SubnetHyperparamsV3::decode(&mut &bytes[..]).expect("V3 must SCALE-round-trip cleanly"); + assert_eq!(original, decoded); + }); +} + +#[test] +fn test_hyperparam_value_variants_round_trip() { + let cases = [ + HyperparamValue::Bool(true), + HyperparamValue::Bool(false), + HyperparamValue::U16(Compact(u16::MAX)), + HyperparamValue::U32(Compact(u32::MAX)), + HyperparamValue::U64(Compact(u64::MAX)), + HyperparamValue::U128(Compact(u128::MAX)), + HyperparamValue::TaoBalance(Compact(TaoBalance::from(123_456_789u64))), + HyperparamValue::I32F32(I32F32::saturating_from_num(-7)), + HyperparamValue::U64F64(U64F64::saturating_from_num(42)), + ]; + for original in &cases { + let bytes = original.encode(); + let decoded = HyperparamValue::decode(&mut &bytes[..]) + .expect("HyperparamValue variant must round-trip"); + assert_eq!(original, &decoded); + } +} diff --git a/pallets/subtensor/src/weights.rs b/pallets/subtensor/src/weights.rs index 5090ea6b90..6d536dadaa 100644 --- a/pallets/subtensor/src/weights.rs +++ b/pallets/subtensor/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for `pallet_subtensor` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 -//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runnervmg397c`, CPU: `AMD EPYC 7763 64-Core Processor` +//! HOSTNAME: `runnervm3jyl0`, CPU: `AMD EPYC 9V74 80-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -22,7 +22,7 @@ // --no-storage-info // --no-min-squares // --no-median-slopes -// --output=/tmp/tmp.lgtaB2SecD +// --output=/tmp/tmp.iVvhDcFf4i // --template=/home/runner/work/subtensor/subtensor/.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -195,8 +195,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1716` // Estimated: `13600` - // Minimum execution time: 355_373_000 picoseconds. - Weight::from_parts(359_110_000, 13600) + // Minimum execution time: 374_002_000 picoseconds. + Weight::from_parts(380_312_000, 13600) .saturating_add(T::DbWeight::get().reads(48_u64)) .saturating_add(T::DbWeight::get().writes(40_u64)) } @@ -238,8 +238,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `188792` // Estimated: `10327382` - // Minimum execution time: 15_014_102_000 picoseconds. - Weight::from_parts(15_388_200_000, 10327382) + // Minimum execution time: 16_598_698_000 picoseconds. + Weight::from_parts(16_897_861_000, 10327382) .saturating_add(T::DbWeight::get().reads(4112_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -293,27 +293,33 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingOperationRateLimiter` (r:0 w:1) /// Proof: `SubtensorModule::StakingOperationRateLimiter` (`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 add_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2640` + // Measured: `2633` // Estimated: `8727` - // Minimum execution time: 438_658_000 picoseconds. - Weight::from_parts(458_155_000, 8727) - .saturating_add(T::DbWeight::get().reads(35_u64)) + // Minimum execution time: 459_249_000 picoseconds. + Weight::from_parts(476_173_000, 8727) + .saturating_add(T::DbWeight::get().reads(38_u64)) .saturating_add(T::DbWeight::get().writes(18_u64)) } /// Storage: `SubtensorModule::IsNetworkMember` (r:2 w:0) @@ -326,8 +332,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `801` // Estimated: `6741` - // Minimum execution time: 33_773_000 picoseconds. - Weight::from_parts(34_705_000, 6741) + // Minimum execution time: 32_538_000 picoseconds. + Weight::from_parts(33_289_000, 6741) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -341,8 +347,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `774` // Estimated: `6714` - // Minimum execution time: 29_576_000 picoseconds. - Weight::from_parts(30_557_000, 6714) + // Minimum execution time: 29_163_000 picoseconds. + Weight::from_parts(29_784_000, 6714) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -444,8 +450,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1649` // Estimated: `13600` - // Minimum execution time: 365_763_000 picoseconds. - Weight::from_parts(368_327_000, 13600) + // Minimum execution time: 362_295_000 picoseconds. + Weight::from_parts(368_123_000, 13600) .saturating_add(T::DbWeight::get().reads(48_u64)) .saturating_add(T::DbWeight::get().writes(40_u64)) } @@ -497,8 +503,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1445` // Estimated: `4910` - // Minimum execution time: 99_325_000 picoseconds. - Weight::from_parts(101_459_000, 4910) + // Minimum execution time: 102_751_000 picoseconds. + Weight::from_parts(104_294_000, 4910) .saturating_add(T::DbWeight::get().reads(19_u64)) .saturating_add(T::DbWeight::get().writes(16_u64)) } @@ -620,8 +626,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1459` // Estimated: `9874` - // Minimum execution time: 264_674_000 picoseconds. - Weight::from_parts(271_215_000, 9874) + // Minimum execution time: 277_470_000 picoseconds. + Weight::from_parts(282_297_000, 9874) .saturating_add(T::DbWeight::get().reads(42_u64)) .saturating_add(T::DbWeight::get().writes(49_u64)) } @@ -649,8 +655,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1071` // Estimated: `4536` - // Minimum execution time: 59_551_000 picoseconds. - Weight::from_parts(60_783_000, 4536) + // Minimum execution time: 60_340_000 picoseconds. + Weight::from_parts(61_421_000, 4536) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -694,8 +700,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1589` // Estimated: `7529` - // Minimum execution time: 106_459_000 picoseconds. - Weight::from_parts(107_931_000, 7529) + // Minimum execution time: 108_541_000 picoseconds. + Weight::from_parts(110_183_000, 7529) .saturating_add(T::DbWeight::get().reads(18_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -705,8 +711,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_310_000 picoseconds. - Weight::from_parts(5_631_000, 0) + // Minimum execution time: 4_076_000 picoseconds. + Weight::from_parts(4_647_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -727,8 +733,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `999` // Estimated: `4464` - // Minimum execution time: 52_067_000 picoseconds. - Weight::from_parts(52_989_000, 4464) + // Minimum execution time: 52_278_000 picoseconds. + Weight::from_parts(53_209_000, 4464) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -744,8 +750,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `694` // Estimated: `4159` - // Minimum execution time: 44_454_000 picoseconds. - Weight::from_parts(45_224_000, 4159) + // Minimum execution time: 43_995_000 picoseconds. + Weight::from_parts(45_167_000, 4159) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -775,6 +781,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`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::UnlockRate` (r:1 w:0) + /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) + /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) @@ -785,9 +795,9 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2175` // Estimated: `13065` - // Minimum execution time: 262_129_000 picoseconds. - Weight::from_parts(265_496_000, 13065) - .saturating_add(T::DbWeight::get().reads(33_u64)) + // Minimum execution time: 286_653_000 picoseconds. + Weight::from_parts(294_536_000, 13065) + .saturating_add(T::DbWeight::get().reads(35_u64)) .saturating_add(T::DbWeight::get().writes(15_u64)) } /// Storage: `System::Account` (r:2 w:2) @@ -818,6 +828,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`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::UnlockRate` (r:1 w:0) + /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) + /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:0 w:1) @@ -830,9 +844,9 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2231` // Estimated: `13121` - // Minimum execution time: 286_364_000 picoseconds. - Weight::from_parts(288_679_000, 13121) - .saturating_add(T::DbWeight::get().reads(33_u64)) + // Minimum execution time: 310_339_000 picoseconds. + Weight::from_parts(313_503_000, 13121) + .saturating_add(T::DbWeight::get().reads(35_u64)) .saturating_add(T::DbWeight::get().writes(19_u64)) } /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:0) @@ -843,8 +857,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `665` // Estimated: `4130` - // Minimum execution time: 22_462_000 picoseconds. - Weight::from_parts(23_103_000, 4130) + // Minimum execution time: 20_290_000 picoseconds. + Weight::from_parts(21_452_000, 4130) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -856,8 +870,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `613` // Estimated: `4078` - // Minimum execution time: 18_715_000 picoseconds. - Weight::from_parts(19_206_000, 4078) + // Minimum execution time: 16_995_000 picoseconds. + Weight::from_parts(17_505_000, 4078) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -869,8 +883,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_376_000 picoseconds. - Weight::from_parts(8_856_000, 0) + // Minimum execution time: 6_830_000 picoseconds. + Weight::from_parts(7_271_000, 0) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) @@ -913,8 +927,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2094` // Estimated: `8034` - // Minimum execution time: 389_868_000 picoseconds. - Weight::from_parts(407_990_000, 8034) + // Minimum execution time: 429_484_000 picoseconds. + Weight::from_parts(443_415_000, 8034) .saturating_add(T::DbWeight::get().reads(18_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -948,8 +962,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1873` // Estimated: `5338` - // Minimum execution time: 163_986_000 picoseconds. - Weight::from_parts(166_641_000, 5338) + // Minimum execution time: 176_220_000 picoseconds. + Weight::from_parts(178_253_000, 5338) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -981,8 +995,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1873` // Estimated: `5338` - // Minimum execution time: 160_249_000 picoseconds. - Weight::from_parts(163_325_000, 5338) + // Minimum execution time: 172_335_000 picoseconds. + Weight::from_parts(174_197_000, 5338) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -1002,8 +1016,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1118` // Estimated: `4583` - // Minimum execution time: 38_332_000 picoseconds. - Weight::from_parts(39_093_000, 4583) + // Minimum execution time: 37_836_000 picoseconds. + Weight::from_parts(38_907_000, 4583) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -1057,27 +1071,33 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingOperationRateLimiter` (r:0 w:1) /// Proof: `SubtensorModule::StakingOperationRateLimiter` (`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 add_stake_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `2640` + // Measured: `2633` // Estimated: `8727` - // Minimum execution time: 473_202_000 picoseconds. - Weight::from_parts(494_572_000, 8727) - .saturating_add(T::DbWeight::get().reads(35_u64)) + // Minimum execution time: 499_258_000 picoseconds. + Weight::from_parts(516_242_000, 8727) + .saturating_add(T::DbWeight::get().reads(38_u64)) .saturating_add(T::DbWeight::get().writes(18_u64)) } /// Storage: `SubtensorModule::Alpha` (r:2 w:0) @@ -1110,10 +1130,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn move_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2027` - // Estimated: `7967` - // Minimum execution time: 207_417_000 picoseconds. - Weight::from_parts(209_791_000, 7967) + // Measured: `2060` + // Estimated: `8000` + // Minimum execution time: 222_999_000 picoseconds. + Weight::from_parts(227_526_000, 8000) .saturating_add(T::DbWeight::get().reads(19_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -1179,8 +1199,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2564` // Estimated: `10979` - // Minimum execution time: 412_629_000 picoseconds. - Weight::from_parts(419_953_000, 10979) + // Minimum execution time: 435_183_000 picoseconds. + Weight::from_parts(444_777_000, 10979) .saturating_add(T::DbWeight::get().reads(35_u64)) .saturating_add(T::DbWeight::get().writes(15_u64)) } @@ -1242,10 +1262,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_stake_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `2564` - // Estimated: `10979` - // Minimum execution time: 445_501_000 picoseconds. - Weight::from_parts(451_852_000, 10979) + // Measured: `2598` + // Estimated: `11013` + // Minimum execution time: 475_352_000 picoseconds. + Weight::from_parts(478_116_000, 11013) .saturating_add(T::DbWeight::get().reads(34_u64)) .saturating_add(T::DbWeight::get().writes(15_u64)) } @@ -1303,25 +1323,31 @@ impl WeightInfo for SubstrateWeight { /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTaoFlow` (r:2 w:2) /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`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 swap_stake_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `3012` - // Estimated: `11427` - // Minimum execution time: 653_168_000 picoseconds. - Weight::from_parts(675_150_000, 11427) - .saturating_add(T::DbWeight::get().reads(51_u64)) + // Measured: `3108` + // Estimated: `11523` + // Minimum execution time: 688_567_000 picoseconds. + Weight::from_parts(707_234_000, 11523) + .saturating_add(T::DbWeight::get().reads(54_u64)) .saturating_add(T::DbWeight::get().writes(26_u64)) } /// Storage: `SubtensorModule::Alpha` (r:2 w:0) @@ -1358,10 +1384,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn transfer_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2021` - // Estimated: `7961` - // Minimum execution time: 236_792_000 picoseconds. - Weight::from_parts(239_797_000, 7961) + // Measured: `2054` + // Estimated: `7994` + // Minimum execution time: 254_636_000 picoseconds. + Weight::from_parts(258_541_000, 7994) .saturating_add(T::DbWeight::get().reads(18_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -1419,25 +1445,31 @@ impl WeightInfo for SubstrateWeight { /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTaoFlow` (r:2 w:2) /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`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 swap_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2858` - // Estimated: `11273` - // Minimum execution time: 597_504_000 picoseconds. - Weight::from_parts(618_804_000, 11273) - .saturating_add(T::DbWeight::get().reads(51_u64)) + // Measured: `2951` + // Estimated: `11366` + // Minimum execution time: 633_996_000 picoseconds. + Weight::from_parts(655_699_000, 11366) + .saturating_add(T::DbWeight::get().reads(54_u64)) .saturating_add(T::DbWeight::get().writes(26_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -1466,8 +1498,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1122` // Estimated: `4587` - // Minimum execution time: 122_068_000 picoseconds. - Weight::from_parts(124_231_000, 4587) + // Minimum execution time: 127_058_000 picoseconds. + Weight::from_parts(129_030_000, 4587) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -1507,8 +1539,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1426` // Estimated: `7366` - // Minimum execution time: 99_356_000 picoseconds. - Weight::from_parts(101_709_000, 7366) + // Minimum execution time: 101_319_000 picoseconds. + Weight::from_parts(102_992_000, 7366) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -1524,8 +1556,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `793` // Estimated: `4258` - // Minimum execution time: 28_253_000 picoseconds. - Weight::from_parts(29_094_000, 4258) + // Minimum execution time: 25_969_000 picoseconds. + Weight::from_parts(27_160_000, 4258) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -1543,8 +1575,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `886` // Estimated: `4351` - // Minimum execution time: 35_737_000 picoseconds. - Weight::from_parts(36_198_000, 4351) + // Minimum execution time: 33_360_000 picoseconds. + Weight::from_parts(34_381_000, 4351) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -1666,8 +1698,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1343` // Estimated: `9758` - // Minimum execution time: 262_941_000 picoseconds. - Weight::from_parts(270_434_000, 9758) + // Minimum execution time: 271_161_000 picoseconds. + Weight::from_parts(278_281_000, 9758) .saturating_add(T::DbWeight::get().reads(41_u64)) .saturating_add(T::DbWeight::get().writes(48_u64)) } @@ -1681,8 +1713,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `772` // Estimated: `6712` - // Minimum execution time: 32_971_000 picoseconds. - Weight::from_parts(34_043_000, 6712) + // Minimum execution time: 31_877_000 picoseconds. + Weight::from_parts(32_949_000, 6712) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1696,8 +1728,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `852` // Estimated: `6792` - // Minimum execution time: 30_457_000 picoseconds. - Weight::from_parts(31_158_000, 6792) + // Minimum execution time: 28_833_000 picoseconds. + Weight::from_parts(29_874_000, 6792) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1709,8 +1741,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `595` // Estimated: `4060` - // Minimum execution time: 17_673_000 picoseconds. - Weight::from_parts(18_244_000, 4060) + // Minimum execution time: 15_502_000 picoseconds. + Weight::from_parts(16_184_000, 4060) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1734,6 +1766,8 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::AlphaV2` (`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: `SubtensorModule::SubnetOwnerHotkey` (r:5 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::HotkeyLock` (r:5 w:0) /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:5 w:0) @@ -1748,8 +1782,6 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:5 w:0) /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:5 w:0) - /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (r:10 w:5) /// Proof: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:10 w:10) @@ -1786,8 +1818,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `3026` // Estimated: `28766` - // Minimum execution time: 1_114_799_000 picoseconds. - Weight::from_parts(1_123_425_000, 28766) + // Minimum execution time: 1_201_334_000 picoseconds. + Weight::from_parts(1_208_365_000, 28766) .saturating_add(T::DbWeight::get().reads(171_u64)) .saturating_add(T::DbWeight::get().writes(95_u64)) } @@ -1801,8 +1833,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `745` // Estimated: `4210` - // Minimum execution time: 23_865_000 picoseconds. - Weight::from_parts(24_475_000, 4210) + // Minimum execution time: 22_373_000 picoseconds. + Weight::from_parts(23_134_000, 4210) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -1816,8 +1848,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `740` // Estimated: `9155` - // Minimum execution time: 26_870_000 picoseconds. - Weight::from_parts(27_361_000, 9155) + // Minimum execution time: 25_017_000 picoseconds. + Weight::from_parts(25_658_000, 9155) .saturating_add(T::DbWeight::get().reads(6_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -1888,8 +1920,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `2642` // Estimated: `11306` - // Minimum execution time: 546_189_000 picoseconds. - Weight::from_parts(551_489_000, 11306) + // Minimum execution time: 583_803_000 picoseconds. + Weight::from_parts(599_485_000, 11306) .saturating_add(T::DbWeight::get().reads(50_u64)) .saturating_add(T::DbWeight::get().writes(27_u64)) } @@ -1951,10 +1983,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_stake_full_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `2564` - // Estimated: `10979` - // Minimum execution time: 467_822_000 picoseconds. - Weight::from_parts(478_552_000, 10979) + // Measured: `2598` + // Estimated: `11013` + // Minimum execution time: 497_956_000 picoseconds. + Weight::from_parts(503_033_000, 11013) .saturating_add(T::DbWeight::get().reads(34_u64)) .saturating_add(T::DbWeight::get().writes(15_u64)) } @@ -2095,10 +2127,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1762 + k * (44 ±0)` // Estimated: `10183 + k * (2579 ±0)` - // Minimum execution time: 460_900_000 picoseconds. - Weight::from_parts(284_422_033, 10183) - // Standard Error: 28_051 - .saturating_add(Weight::from_parts(43_690_535, 0).saturating_mul(k.into())) + // Minimum execution time: 488_121_000 picoseconds. + Weight::from_parts(306_068_429, 10183) + // Standard Error: 24_263 + .saturating_add(Weight::from_parts(48_393_644, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(51_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes(54_u64)) @@ -2128,10 +2160,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1468 + k * (53 ±0)` // Estimated: `6148 + k * (2514 ±0)` - // Minimum execution time: 91_781_000 picoseconds. - Weight::from_parts(72_937_060, 6148) - // Standard Error: 7_499 - .saturating_add(Weight::from_parts(1_672_052, 0).saturating_mul(k.into())) + // Minimum execution time: 91_385_000 picoseconds. + Weight::from_parts(96_646_996, 6148) + // Standard Error: 5_309 + .saturating_add(Weight::from_parts(1_570_386, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes(7_u64)) @@ -2146,8 +2178,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `659` // Estimated: `9074` - // Minimum execution time: 27_120_000 picoseconds. - Weight::from_parts(28_123_000, 9074) + // Minimum execution time: 24_486_000 picoseconds. + Weight::from_parts(25_798_000, 9074) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -2175,8 +2207,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1070` // Estimated: `4535` - // Minimum execution time: 74_078_000 picoseconds. - Weight::from_parts(74_980_000, 4535) + // Minimum execution time: 72_186_000 picoseconds. + Weight::from_parts(73_359_000, 4535) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -2192,8 +2224,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `809` // Estimated: `4274` - // Minimum execution time: 33_022_000 picoseconds. - Weight::from_parts(33_913_000, 4274) + // Minimum execution time: 31_566_000 picoseconds. + Weight::from_parts(32_979_000, 4274) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -2209,8 +2241,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `476` // Estimated: `3941` - // Minimum execution time: 17_613_000 picoseconds. - Weight::from_parts(18_094_000, 3941) + // Minimum execution time: 15_613_000 picoseconds. + Weight::from_parts(16_064_000, 3941) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -2240,8 +2272,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1929` // Estimated: `7869` - // Minimum execution time: 134_861_000 picoseconds. - Weight::from_parts(136_855_000, 7869) + // Minimum execution time: 140_608_000 picoseconds. + Weight::from_parts(142_310_000, 7869) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -2251,8 +2283,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_685_000 picoseconds. - Weight::from_parts(3_006_000, 0) + // Minimum execution time: 1_883_000 picoseconds. + Weight::from_parts(2_083_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::RootClaimableThreshold` (r:0 w:1) @@ -2261,8 +2293,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_390_000 picoseconds. - Weight::from_parts(6_001_000, 0) + // Minimum execution time: 4_136_000 picoseconds. + Weight::from_parts(4_747_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -2275,8 +2307,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `862` // Estimated: `4327` - // Minimum execution time: 26_600_000 picoseconds. - Weight::from_parts(27_432_000, 4327) + // Minimum execution time: 23_675_000 picoseconds. + Weight::from_parts(25_277_000, 4327) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -2330,16 +2362,22 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) - /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `AlphaAssets::AlphaBurned` (r:1 w:1) /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingOperationRateLimiter` (r:0 w:1) @@ -2348,12 +2386,12 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_stake_burn() -> Weight { // Proof Size summary in bytes: - // Measured: `2570` + // Measured: `2636` // Estimated: `8727` - // Minimum execution time: 565_736_000 picoseconds. - Weight::from_parts(586_314_000, 8727) - .saturating_add(T::DbWeight::get().reads(36_u64)) - .saturating_add(T::DbWeight::get().writes(18_u64)) + // Minimum execution time: 630_852_000 picoseconds. + Weight::from_parts(646_565_000, 8727) + .saturating_add(T::DbWeight::get().reads(39_u64)) + .saturating_add(T::DbWeight::get().writes(19_u64)) } /// Storage: `SubtensorModule::PendingChildKeyCooldown` (r:0 w:1) /// Proof: `SubtensorModule::PendingChildKeyCooldown` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -2361,8 +2399,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_735_000 picoseconds. - Weight::from_parts(3_056_000, 0) + // Minimum execution time: 1_963_000 picoseconds. + Weight::from_parts(2_083_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -2379,44 +2417,60 @@ impl WeightInfo for SubstrateWeight { /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:1 w:0) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Lock` (r:1 w:1) + /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:1) + /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:0) /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) + /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn lock_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `1651` - // Estimated: `5116` - // Minimum execution time: 95_959_000 picoseconds. - Weight::from_parts(98_204_000, 5116) - .saturating_add(T::DbWeight::get().reads(11_u64)) + // Measured: `1644` + // Estimated: `7584` + // Minimum execution time: 111_775_000 picoseconds. + Weight::from_parts(114_028_000, 7584) + .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::Owner` (r:2 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:2) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:2 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:2 w:2) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:2 w:2) - /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn move_lock() -> Weight { // Proof Size summary in bytes: // Measured: `1366` // Estimated: `7306` - // Minimum execution time: 109_825_000 picoseconds. - Weight::from_parts(111_929_000, 7306) - .saturating_add(T::DbWeight::get().reads(10_u64)) + // Minimum execution time: 146_897_000 picoseconds. + Weight::from_parts(148_699_000, 7306) + .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } } @@ -2521,8 +2575,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1716` // Estimated: `13600` - // Minimum execution time: 355_373_000 picoseconds. - Weight::from_parts(359_110_000, 13600) + // Minimum execution time: 374_002_000 picoseconds. + Weight::from_parts(380_312_000, 13600) .saturating_add(RocksDbWeight::get().reads(48_u64)) .saturating_add(RocksDbWeight::get().writes(40_u64)) } @@ -2564,8 +2618,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `188792` // Estimated: `10327382` - // Minimum execution time: 15_014_102_000 picoseconds. - Weight::from_parts(15_388_200_000, 10327382) + // Minimum execution time: 16_598_698_000 picoseconds. + Weight::from_parts(16_897_861_000, 10327382) .saturating_add(RocksDbWeight::get().reads(4112_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -2619,27 +2673,33 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingOperationRateLimiter` (r:0 w:1) /// Proof: `SubtensorModule::StakingOperationRateLimiter` (`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 add_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2640` + // Measured: `2633` // Estimated: `8727` - // Minimum execution time: 438_658_000 picoseconds. - Weight::from_parts(458_155_000, 8727) - .saturating_add(RocksDbWeight::get().reads(35_u64)) + // Minimum execution time: 459_249_000 picoseconds. + Weight::from_parts(476_173_000, 8727) + .saturating_add(RocksDbWeight::get().reads(38_u64)) .saturating_add(RocksDbWeight::get().writes(18_u64)) } /// Storage: `SubtensorModule::IsNetworkMember` (r:2 w:0) @@ -2652,8 +2712,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `801` // Estimated: `6741` - // Minimum execution time: 33_773_000 picoseconds. - Weight::from_parts(34_705_000, 6741) + // Minimum execution time: 32_538_000 picoseconds. + Weight::from_parts(33_289_000, 6741) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -2667,8 +2727,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `774` // Estimated: `6714` - // Minimum execution time: 29_576_000 picoseconds. - Weight::from_parts(30_557_000, 6714) + // Minimum execution time: 29_163_000 picoseconds. + Weight::from_parts(29_784_000, 6714) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -2770,8 +2830,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1649` // Estimated: `13600` - // Minimum execution time: 365_763_000 picoseconds. - Weight::from_parts(368_327_000, 13600) + // Minimum execution time: 362_295_000 picoseconds. + Weight::from_parts(368_123_000, 13600) .saturating_add(RocksDbWeight::get().reads(48_u64)) .saturating_add(RocksDbWeight::get().writes(40_u64)) } @@ -2823,8 +2883,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1445` // Estimated: `4910` - // Minimum execution time: 99_325_000 picoseconds. - Weight::from_parts(101_459_000, 4910) + // Minimum execution time: 102_751_000 picoseconds. + Weight::from_parts(104_294_000, 4910) .saturating_add(RocksDbWeight::get().reads(19_u64)) .saturating_add(RocksDbWeight::get().writes(16_u64)) } @@ -2946,8 +3006,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1459` // Estimated: `9874` - // Minimum execution time: 264_674_000 picoseconds. - Weight::from_parts(271_215_000, 9874) + // Minimum execution time: 277_470_000 picoseconds. + Weight::from_parts(282_297_000, 9874) .saturating_add(RocksDbWeight::get().reads(42_u64)) .saturating_add(RocksDbWeight::get().writes(49_u64)) } @@ -2975,8 +3035,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1071` // Estimated: `4536` - // Minimum execution time: 59_551_000 picoseconds. - Weight::from_parts(60_783_000, 4536) + // Minimum execution time: 60_340_000 picoseconds. + Weight::from_parts(61_421_000, 4536) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3020,8 +3080,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1589` // Estimated: `7529` - // Minimum execution time: 106_459_000 picoseconds. - Weight::from_parts(107_931_000, 7529) + // Minimum execution time: 108_541_000 picoseconds. + Weight::from_parts(110_183_000, 7529) .saturating_add(RocksDbWeight::get().reads(18_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3031,8 +3091,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_310_000 picoseconds. - Weight::from_parts(5_631_000, 0) + // Minimum execution time: 4_076_000 picoseconds. + Weight::from_parts(4_647_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -3053,8 +3113,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `999` // Estimated: `4464` - // Minimum execution time: 52_067_000 picoseconds. - Weight::from_parts(52_989_000, 4464) + // Minimum execution time: 52_278_000 picoseconds. + Weight::from_parts(53_209_000, 4464) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3070,8 +3130,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `694` // Estimated: `4159` - // Minimum execution time: 44_454_000 picoseconds. - Weight::from_parts(45_224_000, 4159) + // Minimum execution time: 43_995_000 picoseconds. + Weight::from_parts(45_167_000, 4159) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -3101,6 +3161,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`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::UnlockRate` (r:1 w:0) + /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) + /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Account` (r:2 w:2) @@ -3111,9 +3175,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2175` // Estimated: `13065` - // Minimum execution time: 262_129_000 picoseconds. - Weight::from_parts(265_496_000, 13065) - .saturating_add(RocksDbWeight::get().reads(33_u64)) + // Minimum execution time: 286_653_000 picoseconds. + Weight::from_parts(294_536_000, 13065) + .saturating_add(RocksDbWeight::get().reads(35_u64)) .saturating_add(RocksDbWeight::get().writes(15_u64)) } /// Storage: `System::Account` (r:2 w:2) @@ -3144,6 +3208,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`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::UnlockRate` (r:1 w:0) + /// Proof: `SubtensorModule::UnlockRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::MaturityRate` (r:1 w:0) + /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:0) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:0 w:1) @@ -3156,9 +3224,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2231` // Estimated: `13121` - // Minimum execution time: 286_364_000 picoseconds. - Weight::from_parts(288_679_000, 13121) - .saturating_add(RocksDbWeight::get().reads(33_u64)) + // Minimum execution time: 310_339_000 picoseconds. + Weight::from_parts(313_503_000, 13121) + .saturating_add(RocksDbWeight::get().reads(35_u64)) .saturating_add(RocksDbWeight::get().writes(19_u64)) } /// Storage: `SubtensorModule::ColdkeySwapAnnouncements` (r:1 w:0) @@ -3169,8 +3237,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `665` // Estimated: `4130` - // Minimum execution time: 22_462_000 picoseconds. - Weight::from_parts(23_103_000, 4130) + // Minimum execution time: 20_290_000 picoseconds. + Weight::from_parts(21_452_000, 4130) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -3182,8 +3250,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `613` // Estimated: `4078` - // Minimum execution time: 18_715_000 picoseconds. - Weight::from_parts(19_206_000, 4078) + // Minimum execution time: 16_995_000 picoseconds. + Weight::from_parts(17_505_000, 4078) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -3195,8 +3263,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_376_000 picoseconds. - Weight::from_parts(8_856_000, 0) + // Minimum execution time: 6_830_000 picoseconds. + Weight::from_parts(7_271_000, 0) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::CommitRevealWeightsEnabled` (r:1 w:0) @@ -3239,8 +3307,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2094` // Estimated: `8034` - // Minimum execution time: 389_868_000 picoseconds. - Weight::from_parts(407_990_000, 8034) + // Minimum execution time: 429_484_000 picoseconds. + Weight::from_parts(443_415_000, 8034) .saturating_add(RocksDbWeight::get().reads(18_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3274,8 +3342,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1873` // Estimated: `5338` - // Minimum execution time: 163_986_000 picoseconds. - Weight::from_parts(166_641_000, 5338) + // Minimum execution time: 176_220_000 picoseconds. + Weight::from_parts(178_253_000, 5338) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -3307,8 +3375,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1873` // Estimated: `5338` - // Minimum execution time: 160_249_000 picoseconds. - Weight::from_parts(163_325_000, 5338) + // Minimum execution time: 172_335_000 picoseconds. + Weight::from_parts(174_197_000, 5338) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -3328,8 +3396,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1118` // Estimated: `4583` - // Minimum execution time: 38_332_000 picoseconds. - Weight::from_parts(39_093_000, 4583) + // Minimum execution time: 37_836_000 picoseconds. + Weight::from_parts(38_907_000, 4583) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3383,27 +3451,33 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingOperationRateLimiter` (r:0 w:1) /// Proof: `SubtensorModule::StakingOperationRateLimiter` (`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 add_stake_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `2640` + // Measured: `2633` // Estimated: `8727` - // Minimum execution time: 473_202_000 picoseconds. - Weight::from_parts(494_572_000, 8727) - .saturating_add(RocksDbWeight::get().reads(35_u64)) + // Minimum execution time: 499_258_000 picoseconds. + Weight::from_parts(516_242_000, 8727) + .saturating_add(RocksDbWeight::get().reads(38_u64)) .saturating_add(RocksDbWeight::get().writes(18_u64)) } /// Storage: `SubtensorModule::Alpha` (r:2 w:0) @@ -3436,10 +3510,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn move_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2027` - // Estimated: `7967` - // Minimum execution time: 207_417_000 picoseconds. - Weight::from_parts(209_791_000, 7967) + // Measured: `2060` + // Estimated: `8000` + // Minimum execution time: 222_999_000 picoseconds. + Weight::from_parts(227_526_000, 8000) .saturating_add(RocksDbWeight::get().reads(19_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -3505,8 +3579,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2564` // Estimated: `10979` - // Minimum execution time: 412_629_000 picoseconds. - Weight::from_parts(419_953_000, 10979) + // Minimum execution time: 435_183_000 picoseconds. + Weight::from_parts(444_777_000, 10979) .saturating_add(RocksDbWeight::get().reads(35_u64)) .saturating_add(RocksDbWeight::get().writes(15_u64)) } @@ -3568,10 +3642,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_stake_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `2564` - // Estimated: `10979` - // Minimum execution time: 445_501_000 picoseconds. - Weight::from_parts(451_852_000, 10979) + // Measured: `2598` + // Estimated: `11013` + // Minimum execution time: 475_352_000 picoseconds. + Weight::from_parts(478_116_000, 11013) .saturating_add(RocksDbWeight::get().reads(34_u64)) .saturating_add(RocksDbWeight::get().writes(15_u64)) } @@ -3629,25 +3703,31 @@ impl WeightInfo for () { /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTaoFlow` (r:2 w:2) /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`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 swap_stake_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `3012` - // Estimated: `11427` - // Minimum execution time: 653_168_000 picoseconds. - Weight::from_parts(675_150_000, 11427) - .saturating_add(RocksDbWeight::get().reads(51_u64)) + // Measured: `3108` + // Estimated: `11523` + // Minimum execution time: 688_567_000 picoseconds. + Weight::from_parts(707_234_000, 11523) + .saturating_add(RocksDbWeight::get().reads(54_u64)) .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// Storage: `SubtensorModule::Alpha` (r:2 w:0) @@ -3684,10 +3764,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn transfer_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2021` - // Estimated: `7961` - // Minimum execution time: 236_792_000 picoseconds. - Weight::from_parts(239_797_000, 7961) + // Measured: `2054` + // Estimated: `7994` + // Minimum execution time: 254_636_000 picoseconds. + Weight::from_parts(258_541_000, 7994) .saturating_add(RocksDbWeight::get().reads(18_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -3745,25 +3825,31 @@ impl WeightInfo for () { /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::SubnetTaoFlow` (r:2 w:2) /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:1) - /// Proof: `SubtensorModule::HotkeyLock` (`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 swap_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `2858` - // Estimated: `11273` - // Minimum execution time: 597_504_000 picoseconds. - Weight::from_parts(618_804_000, 11273) - .saturating_add(RocksDbWeight::get().reads(51_u64)) + // Measured: `2951` + // Estimated: `11366` + // Minimum execution time: 633_996_000 picoseconds. + Weight::from_parts(655_699_000, 11366) + .saturating_add(RocksDbWeight::get().reads(54_u64)) .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// Storage: `SubtensorModule::NetworksAdded` (r:1 w:0) @@ -3792,8 +3878,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1122` // Estimated: `4587` - // Minimum execution time: 122_068_000 picoseconds. - Weight::from_parts(124_231_000, 4587) + // Minimum execution time: 127_058_000 picoseconds. + Weight::from_parts(129_030_000, 4587) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3833,8 +3919,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1426` // Estimated: `7366` - // Minimum execution time: 99_356_000 picoseconds. - Weight::from_parts(101_709_000, 7366) + // Minimum execution time: 101_319_000 picoseconds. + Weight::from_parts(102_992_000, 7366) .saturating_add(RocksDbWeight::get().reads(16_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3850,8 +3936,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `793` // Estimated: `4258` - // Minimum execution time: 28_253_000 picoseconds. - Weight::from_parts(29_094_000, 4258) + // Minimum execution time: 25_969_000 picoseconds. + Weight::from_parts(27_160_000, 4258) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3869,8 +3955,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `886` // Estimated: `4351` - // Minimum execution time: 35_737_000 picoseconds. - Weight::from_parts(36_198_000, 4351) + // Minimum execution time: 33_360_000 picoseconds. + Weight::from_parts(34_381_000, 4351) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -3992,8 +4078,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1343` // Estimated: `9758` - // Minimum execution time: 262_941_000 picoseconds. - Weight::from_parts(270_434_000, 9758) + // Minimum execution time: 271_161_000 picoseconds. + Weight::from_parts(278_281_000, 9758) .saturating_add(RocksDbWeight::get().reads(41_u64)) .saturating_add(RocksDbWeight::get().writes(48_u64)) } @@ -4007,8 +4093,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `772` // Estimated: `6712` - // Minimum execution time: 32_971_000 picoseconds. - Weight::from_parts(34_043_000, 6712) + // Minimum execution time: 31_877_000 picoseconds. + Weight::from_parts(32_949_000, 6712) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4022,8 +4108,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `852` // Estimated: `6792` - // Minimum execution time: 30_457_000 picoseconds. - Weight::from_parts(31_158_000, 6792) + // Minimum execution time: 28_833_000 picoseconds. + Weight::from_parts(29_874_000, 6792) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4035,8 +4121,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `595` // Estimated: `4060` - // Minimum execution time: 17_673_000 picoseconds. - Weight::from_parts(18_244_000, 4060) + // Minimum execution time: 15_502_000 picoseconds. + Weight::from_parts(16_184_000, 4060) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4060,6 +4146,8 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::AlphaV2` (`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: `SubtensorModule::SubnetOwnerHotkey` (r:5 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::HotkeyLock` (r:5 w:0) /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:5 w:0) @@ -4074,8 +4162,6 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::PendingChildKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AutoStakeDestinationColdkeys` (r:5 w:0) /// Proof: `SubtensorModule::AutoStakeDestinationColdkeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:5 w:0) - /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (r:10 w:5) /// Proof: `SubtensorModule::TotalHotkeyAlphaLastEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::AlphaDividendsPerSubnet` (r:10 w:10) @@ -4112,8 +4198,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `3026` // Estimated: `28766` - // Minimum execution time: 1_114_799_000 picoseconds. - Weight::from_parts(1_123_425_000, 28766) + // Minimum execution time: 1_201_334_000 picoseconds. + Weight::from_parts(1_208_365_000, 28766) .saturating_add(RocksDbWeight::get().reads(171_u64)) .saturating_add(RocksDbWeight::get().writes(95_u64)) } @@ -4127,8 +4213,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `745` // Estimated: `4210` - // Minimum execution time: 23_865_000 picoseconds. - Weight::from_parts(24_475_000, 4210) + // Minimum execution time: 22_373_000 picoseconds. + Weight::from_parts(23_134_000, 4210) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -4142,8 +4228,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `740` // Estimated: `9155` - // Minimum execution time: 26_870_000 picoseconds. - Weight::from_parts(27_361_000, 9155) + // Minimum execution time: 25_017_000 picoseconds. + Weight::from_parts(25_658_000, 9155) .saturating_add(RocksDbWeight::get().reads(6_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -4214,8 +4300,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `2642` // Estimated: `11306` - // Minimum execution time: 546_189_000 picoseconds. - Weight::from_parts(551_489_000, 11306) + // Minimum execution time: 583_803_000 picoseconds. + Weight::from_parts(599_485_000, 11306) .saturating_add(RocksDbWeight::get().reads(50_u64)) .saturating_add(RocksDbWeight::get().writes(27_u64)) } @@ -4277,10 +4363,10 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn remove_stake_full_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `2564` - // Estimated: `10979` - // Minimum execution time: 467_822_000 picoseconds. - Weight::from_parts(478_552_000, 10979) + // Measured: `2598` + // Estimated: `11013` + // Minimum execution time: 497_956_000 picoseconds. + Weight::from_parts(503_033_000, 11013) .saturating_add(RocksDbWeight::get().reads(34_u64)) .saturating_add(RocksDbWeight::get().writes(15_u64)) } @@ -4421,10 +4507,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1762 + k * (44 ±0)` // Estimated: `10183 + k * (2579 ±0)` - // Minimum execution time: 460_900_000 picoseconds. - Weight::from_parts(284_422_033, 10183) - // Standard Error: 28_051 - .saturating_add(Weight::from_parts(43_690_535, 0).saturating_mul(k.into())) + // Minimum execution time: 488_121_000 picoseconds. + Weight::from_parts(306_068_429, 10183) + // Standard Error: 24_263 + .saturating_add(Weight::from_parts(48_393_644, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(51_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes(54_u64)) @@ -4454,10 +4540,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1468 + k * (53 ±0)` // Estimated: `6148 + k * (2514 ±0)` - // Minimum execution time: 91_781_000 picoseconds. - Weight::from_parts(72_937_060, 6148) - // Standard Error: 7_499 - .saturating_add(Weight::from_parts(1_672_052, 0).saturating_mul(k.into())) + // Minimum execution time: 91_385_000 picoseconds. + Weight::from_parts(96_646_996, 6148) + // Standard Error: 5_309 + .saturating_add(Weight::from_parts(1_570_386, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes(7_u64)) @@ -4472,8 +4558,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `659` // Estimated: `9074` - // Minimum execution time: 27_120_000 picoseconds. - Weight::from_parts(28_123_000, 9074) + // Minimum execution time: 24_486_000 picoseconds. + Weight::from_parts(25_798_000, 9074) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4501,8 +4587,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1070` // Estimated: `4535` - // Minimum execution time: 74_078_000 picoseconds. - Weight::from_parts(74_980_000, 4535) + // Minimum execution time: 72_186_000 picoseconds. + Weight::from_parts(73_359_000, 4535) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -4518,8 +4604,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `809` // Estimated: `4274` - // Minimum execution time: 33_022_000 picoseconds. - Weight::from_parts(33_913_000, 4274) + // Minimum execution time: 31_566_000 picoseconds. + Weight::from_parts(32_979_000, 4274) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -4535,8 +4621,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `476` // Estimated: `3941` - // Minimum execution time: 17_613_000 picoseconds. - Weight::from_parts(18_094_000, 3941) + // Minimum execution time: 15_613_000 picoseconds. + Weight::from_parts(16_064_000, 3941) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -4566,8 +4652,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1929` // Estimated: `7869` - // Minimum execution time: 134_861_000 picoseconds. - Weight::from_parts(136_855_000, 7869) + // Minimum execution time: 140_608_000 picoseconds. + Weight::from_parts(142_310_000, 7869) .saturating_add(RocksDbWeight::get().reads(16_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -4577,8 +4663,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_685_000 picoseconds. - Weight::from_parts(3_006_000, 0) + // Minimum execution time: 1_883_000 picoseconds. + Weight::from_parts(2_083_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::RootClaimableThreshold` (r:0 w:1) @@ -4587,8 +4673,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_390_000 picoseconds. - Weight::from_parts(6_001_000, 0) + // Minimum execution time: 4_136_000 picoseconds. + Weight::from_parts(4_747_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -4601,8 +4687,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `862` // Estimated: `4327` - // Minimum execution time: 26_600_000 picoseconds. - Weight::from_parts(27_432_000, 4327) + // Minimum execution time: 23_675_000 picoseconds. + Weight::from_parts(25_277_000, 4327) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -4656,16 +4742,22 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::SubnetTaoFlow` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) - /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `AlphaAssets::AlphaBurned` (r:1 w:1) /// Proof: `AlphaAssets::AlphaBurned` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::StakingOperationRateLimiter` (r:0 w:1) @@ -4674,12 +4766,12 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::LastColdkeyHotkeyStakeBlock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn add_stake_burn() -> Weight { // Proof Size summary in bytes: - // Measured: `2570` + // Measured: `2636` // Estimated: `8727` - // Minimum execution time: 565_736_000 picoseconds. - Weight::from_parts(586_314_000, 8727) - .saturating_add(RocksDbWeight::get().reads(36_u64)) - .saturating_add(RocksDbWeight::get().writes(18_u64)) + // Minimum execution time: 630_852_000 picoseconds. + Weight::from_parts(646_565_000, 8727) + .saturating_add(RocksDbWeight::get().reads(39_u64)) + .saturating_add(RocksDbWeight::get().writes(19_u64)) } /// Storage: `SubtensorModule::PendingChildKeyCooldown` (r:0 w:1) /// Proof: `SubtensorModule::PendingChildKeyCooldown` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -4687,8 +4779,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_735_000 picoseconds. - Weight::from_parts(3_056_000, 0) + // Minimum execution time: 1_963_000 picoseconds. + Weight::from_parts(2_083_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `SubtensorModule::Owner` (r:1 w:0) @@ -4705,44 +4797,60 @@ impl WeightInfo for () { /// Proof: `SubtensorModule::TotalHotkeyShares` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::TotalHotkeySharesV2` (r:1 w:0) /// Proof: `SubtensorModule::TotalHotkeySharesV2` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::Lock` (r:1 w:1) + /// Storage: `SubtensorModule::Lock` (r:2 w:1) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:1 w:1) + /// Storage: `SubtensorModule::HotkeyLock` (r:1 w:0) /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:1 w:1) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) + /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn lock_stake() -> Weight { // Proof Size summary in bytes: - // Measured: `1651` - // Estimated: `5116` - // Minimum execution time: 95_959_000 picoseconds. - Weight::from_parts(98_204_000, 5116) - .saturating_add(RocksDbWeight::get().reads(11_u64)) + // Measured: `1644` + // Estimated: `7584` + // Minimum execution time: 111_775_000 picoseconds. + Weight::from_parts(114_028_000, 7584) + .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `SubtensorModule::Owner` (r:2 w:0) /// Proof: `SubtensorModule::Owner` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `SubtensorModule::Lock` (r:2 w:2) /// Proof: `SubtensorModule::Lock` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::SubnetOwner` (r:1 w:0) - /// Proof: `SubtensorModule::SubnetOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::SubnetOwnerHotkey` (r:1 w:0) + /// Proof: `SubtensorModule::SubnetOwnerHotkey` (`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::HotkeyLock` (r:2 w:0) + /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingHotkeyLock` (r:2 w:2) + /// Proof: `SubtensorModule::DecayingHotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::OwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::OwnerLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `SubtensorModule::DecayingOwnerLock` (r:1 w:0) + /// Proof: `SubtensorModule::DecayingOwnerLock` (`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) /// Proof: `SubtensorModule::MaturityRate` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `SubtensorModule::HotkeyLock` (r:2 w:2) - /// Proof: `SubtensorModule::HotkeyLock` (`max_values`: None, `max_size`: None, mode: `Measured`) fn move_lock() -> Weight { // Proof Size summary in bytes: // Measured: `1366` // Estimated: `7306` - // Minimum execution time: 109_825_000 picoseconds. - Weight::from_parts(111_929_000, 7306) - .saturating_add(RocksDbWeight::get().reads(10_u64)) + // Minimum execution time: 146_897_000 picoseconds. + Weight::from_parts(148_699_000, 7306) + .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } } diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index 3607fd3dfa..343decb8a8 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -191,6 +191,7 @@ parameter_types! { pub const InitialTxChildKeyTakeRateLimit: u64 = 0; // Disable rate limit for testing pub const InitialBurn: TaoBalance = TaoBalance::new(0); pub const InitialMinBurn: TaoBalance = TaoBalance::new(500_000); + pub const InitialMinStake: TaoBalance = TaoBalance::new(2_000_000); pub const InitialMaxBurn: TaoBalance = TaoBalance::new(1_000_000_000); pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO @@ -277,6 +278,7 @@ impl pallet_subtensor::Config for Test { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type InitialMinStake = InitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; diff --git a/pallets/utility/src/weights.rs b/pallets/utility/src/weights.rs index 191c044e2d..0287a464fe 100644 --- a/pallets/utility/src/weights.rs +++ b/pallets/utility/src/weights.rs @@ -2,9 +2,9 @@ //! Autogenerated weights for `pallet_subtensor_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 49.1.0 -//! DATE: 2026-05-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2026-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runnervmg397c`, CPU: `AMD EPYC 7763 64-Core Processor` +//! HOSTNAME: `runnervm3jyl0`, CPU: `AMD EPYC 9V74 80-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -22,7 +22,7 @@ // --no-storage-info // --no-min-squares // --no-median-slopes -// --output=/tmp/tmp.2M827i01ht +// --output=/tmp/tmp.wsE00cetaq // --template=/home/runner/work/subtensor/subtensor/.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -57,10 +57,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 4_890_000 picoseconds. - Weight::from_parts(31_041_787, 3983) - // Standard Error: 3_736 - .saturating_add(Weight::from_parts(5_317_513, 0).saturating_mul(c.into())) + // Minimum execution time: 4_006_000 picoseconds. + Weight::from_parts(12_108_520, 3983) + // Standard Error: 3_458 + .saturating_add(Weight::from_parts(5_277_918, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) @@ -71,8 +71,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 14_577_000 picoseconds. - Weight::from_parts(15_178_000, 3983) + // Minimum execution time: 13_480_000 picoseconds. + Weight::from_parts(13_830_000, 3983) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) @@ -84,18 +84,18 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 4_889_000 picoseconds. - Weight::from_parts(30_365_384, 3983) - // Standard Error: 3_742 - .saturating_add(Weight::from_parts(5_542_677, 0).saturating_mul(c.into())) + // Minimum execution time: 3_825_000 picoseconds. + Weight::from_parts(15_244_012, 3983) + // Standard Error: 2_052 + .saturating_add(Weight::from_parts(5_505_817, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_672_000 picoseconds. - Weight::from_parts(6_863_000, 0) + // Minimum execution time: 5_398_000 picoseconds. + Weight::from_parts(5_768_000, 0) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) /// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -106,18 +106,18 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 4_768_000 picoseconds. - Weight::from_parts(30_889_962, 3983) - // Standard Error: 3_691 - .saturating_add(Weight::from_parts(5_322_546, 0).saturating_mul(c.into())) + // Minimum execution time: 3_896_000 picoseconds. + Weight::from_parts(1_067_442, 3983) + // Standard Error: 4_142 + .saturating_add(Weight::from_parts(5_312_644, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) } fn dispatch_as_fallible() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_592_000 picoseconds. - Weight::from_parts(6_943_000, 0) + // Minimum execution time: 5_498_000 picoseconds. + Weight::from_parts(5_708_000, 0) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) /// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -127,8 +127,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 20_969_000 picoseconds. - Weight::from_parts(21_671_000, 3983) + // Minimum execution time: 18_757_000 picoseconds. + Weight::from_parts(19_459_000, 3983) .saturating_add(T::DbWeight::get().reads(2_u64)) } } @@ -144,10 +144,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 4_890_000 picoseconds. - Weight::from_parts(31_041_787, 3983) - // Standard Error: 3_736 - .saturating_add(Weight::from_parts(5_317_513, 0).saturating_mul(c.into())) + // Minimum execution time: 4_006_000 picoseconds. + Weight::from_parts(12_108_520, 3983) + // Standard Error: 3_458 + .saturating_add(Weight::from_parts(5_277_918, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) @@ -158,8 +158,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 14_577_000 picoseconds. - Weight::from_parts(15_178_000, 3983) + // Minimum execution time: 13_480_000 picoseconds. + Weight::from_parts(13_830_000, 3983) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) @@ -171,18 +171,18 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 4_889_000 picoseconds. - Weight::from_parts(30_365_384, 3983) - // Standard Error: 3_742 - .saturating_add(Weight::from_parts(5_542_677, 0).saturating_mul(c.into())) + // Minimum execution time: 3_825_000 picoseconds. + Weight::from_parts(15_244_012, 3983) + // Standard Error: 2_052 + .saturating_add(Weight::from_parts(5_505_817, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_672_000 picoseconds. - Weight::from_parts(6_863_000, 0) + // Minimum execution time: 5_398_000 picoseconds. + Weight::from_parts(5_768_000, 0) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) /// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -193,18 +193,18 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 4_768_000 picoseconds. - Weight::from_parts(30_889_962, 3983) - // Standard Error: 3_691 - .saturating_add(Weight::from_parts(5_322_546, 0).saturating_mul(c.into())) + // Minimum execution time: 3_896_000 picoseconds. + Weight::from_parts(1_067_442, 3983) + // Standard Error: 4_142 + .saturating_add(Weight::from_parts(5_312_644, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) } fn dispatch_as_fallible() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_592_000 picoseconds. - Weight::from_parts(6_943_000, 0) + // Minimum execution time: 5_498_000 picoseconds. + Weight::from_parts(5_708_000, 0) } /// Storage: `SafeMode::EnteredUntil` (r:1 w:0) /// Proof: `SafeMode::EnteredUntil` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -214,8 +214,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `518` // Estimated: `3983` - // Minimum execution time: 20_969_000 picoseconds. - Weight::from_parts(21_671_000, 3983) + // Minimum execution time: 18_757_000 picoseconds. + Weight::from_parts(19_459_000, 3983) .saturating_add(RocksDbWeight::get().reads(2_u64)) } } diff --git a/precompiles/src/crowdloan.rs b/precompiles/src/crowdloan.rs index d32dd4ab35..c474ab9405 100644 --- a/precompiles/src/crowdloan.rs +++ b/precompiles/src/crowdloan.rs @@ -374,6 +374,7 @@ mod tests { fn crowdloan_precompile_reads_existing_pallet_crowdloan() { new_test_ext().execute_with(|| { let creator = AccountId::from([0x11; 32]); + let target = AccountId::from([0x12; 32]); let caller = addr_from_index(0x7001); let crowdloan_id = pallet_crowdloan::NextCrowdloanId::::get(); @@ -385,7 +386,7 @@ mod tests { CAP.into(), END.into(), None, - None, + Some(target), ) .expect("direct crowdloan create should work"); @@ -470,6 +471,7 @@ mod tests { fn crowdloan_precompile_contributes_and_withdraws_from_pallet_crowdloan() { new_test_ext().execute_with(|| { let creator = AccountId::from([0x22; 32]); + let target = AccountId::from([0x23; 32]); let contributor = addr_from_index(0x7016); let contributor_account = mapped_account(contributor); let crowdloan_id = pallet_crowdloan::NextCrowdloanId::::get(); @@ -484,7 +486,7 @@ mod tests { CAP.into(), END.into(), None, - None, + Some(target), ) .expect("direct crowdloan create should work"); diff --git a/precompiles/src/mock.rs b/precompiles/src/mock.rs index d82422bf51..037e02d864 100644 --- a/precompiles/src/mock.rs +++ b/precompiles/src/mock.rs @@ -113,6 +113,7 @@ parameter_types! { pub const InitialTxChildKeyTakeRateLimit: u64 = 0; pub const InitialBurn: TaoBalance = TaoBalance::new(0); pub const InitialMinBurn: TaoBalance = TaoBalance::new(500_000); + pub const InitialMinStake: TaoBalance = TaoBalance::new(2_000_000); pub const InitialMaxBurn: TaoBalance = TaoBalance::new(1_000_000_000); pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); @@ -457,6 +458,7 @@ impl pallet_subtensor::Config for Runtime { type InitialBurn = InitialBurn; type InitialMaxBurn = InitialMaxBurn; type InitialMinBurn = InitialMinBurn; + type InitialMinStake = InitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialRAORecycledForRegistration = InitialRAORecycledForRegistration; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 56dd452dbd..fb2083e13e 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -39,7 +39,9 @@ use pallet_subtensor::rpc_info::{ neuron_info::{NeuronInfo, NeuronInfoLite}, show_subnet::SubnetState, stake_info::StakeInfo, - subnet_info::{SubnetHyperparams, SubnetHyperparamsV2, SubnetInfo, SubnetInfov2}, + subnet_info::{ + SubnetHyperparams, SubnetHyperparamsV2, SubnetHyperparamsV3, SubnetInfo, SubnetInfov2, + }, }; use pallet_subtensor::{CommitmentsInterface, ProxyInterface}; use pallet_subtensor_proxy as pallet_proxy; @@ -274,7 +276,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 411, + spec_version: 413, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -1105,6 +1107,7 @@ parameter_types! { pub const SubtensorInitialServingRateLimit: u64 = 50; pub const SubtensorInitialBurn: TaoBalance = TaoBalance::new(100_000_000); // 0.1 tao pub const SubtensorInitialMinBurn: TaoBalance = TaoBalance::new(500_000); // 500k RAO + pub const SubtensorInitialMinStake: TaoBalance = TaoBalance::new(2_000_000); // 0.002 tao pub const SubtensorInitialMaxBurn: TaoBalance = TaoBalance::new(100_000_000_000); // 100 tao pub const MinBurnUpperBound: TaoBalance = TaoBalance::new(1_000_000_000); // 1 TAO pub const MaxBurnLowerBound: TaoBalance = TaoBalance::new(100_000_000); // 0.1 TAO @@ -1179,6 +1182,7 @@ impl pallet_subtensor::Config for Runtime { type InitialBurn = SubtensorInitialBurn; type InitialMaxBurn = SubtensorInitialMaxBurn; type InitialMinBurn = SubtensorInitialMinBurn; + type InitialMinStake = SubtensorInitialMinStake; type MinBurnUpperBound = MinBurnUpperBound; type MaxBurnLowerBound = MaxBurnLowerBound; type InitialTxRateLimit = SubtensorInitialTxRateLimit; @@ -2459,6 +2463,7 @@ impl_runtime_apis! { } } + #[api_version(2)] impl subtensor_custom_rpc_runtime_api::SubnetInfoRuntimeApi for Runtime { fn get_subnet_info(netuid: NetUid) -> Option> { SubtensorModule::get_subnet_info(netuid) @@ -2476,14 +2481,20 @@ impl_runtime_apis! { SubtensorModule::get_subnets_info_v2() } + #[allow(deprecated)] fn get_subnet_hyperparams(netuid: NetUid) -> Option { SubtensorModule::get_subnet_hyperparams(netuid) } + #[allow(deprecated)] fn get_subnet_hyperparams_v2(netuid: NetUid) -> Option { SubtensorModule::get_subnet_hyperparams_v2(netuid) } + fn get_subnet_hyperparams_v3(netuid: NetUid) -> Option { + SubtensorModule::get_subnet_hyperparams_v3(netuid) + } + fn get_dynamic_info(netuid: NetUid) -> Option> { SubtensorModule::get_dynamic_info(netuid) } diff --git a/scripts/benchmark_all.sh b/scripts/benchmark_all.sh index 6432c3d5a7..d73af7cdc4 100755 --- a/scripts/benchmark_all.sh +++ b/scripts/benchmark_all.sh @@ -27,8 +27,8 @@ die() { echo "ERROR: $1" >&2; exit 1; } # ── Auto-discover pallets ──────────────────────────────────────────────────── typeset -A PALLET_OUTPUTS -while read -r name path; do - PALLET_OUTPUTS[$name]="$path" +while read -r name output_path; do + PALLET_OUTPUTS[$name]="$output_path" done < <("$SCRIPT_DIR/discover_pallets.sh") (( ${#PALLET_OUTPUTS} > 0 )) || die "no benchmarked pallets found"