diff --git a/.maintain/zombienet.toml b/.maintain/zombienet.toml index bb98bcf47..cefd00530 100644 --- a/.maintain/zombienet.toml +++ b/.maintain/zombienet.toml @@ -17,28 +17,18 @@ validator = true chain = "koi-genesis" force_decorator = "generic-evm" id = 2105 -[parachains.collator] +[[parachains.collators]] args = ["--database=paritydb", "--force-authoring", "-lparachain=debug"] command = "tmp/darwinia" -name = "C1" +name = "c1" rpc_port = 10000 - -[[parachains]] -chain = "koi-genesis" -force_decorator = "generic-evm" -id = 2105 -[parachains.collator] +[[parachains.collators]] args = ["--database=paritydb", "--force-authoring", "-lparachain=debug"] command = "tmp/darwinia" -name = "C2" +name = "c2" rpc_port = 10001 - -[[parachains]] -chain = "koi-genesis" -force_decorator = "generic-evm" -id = 2105 -[parachains.collator] +[[parachains.collators]] args = ["--database=paritydb", "--force-authoring", "-lparachain=debug"] command = "tmp/darwinia" -name = "C3" +name = "c3" rpc_port = 10002 diff --git a/Cargo.lock b/Cargo.lock index 29542ef76..01fd4d89d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1630,8 +1630,6 @@ dependencies = [ "darwinia-deposit", "darwinia-ethtx-forwarder", "darwinia-precompile-assets", - "darwinia-precompile-deposit", - "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", "dc-primitives", @@ -2710,7 +2708,6 @@ version = "6.7.2" dependencies = [ "array-bytes 6.2.3", "darwinia-deposit", - "darwinia-staking", "dc-primitives", "frame-benchmarking", "frame-support", @@ -2775,8 +2772,6 @@ name = "darwinia-deposit" version = "6.7.2" dependencies = [ "darwinia-ethtx-forwarder", - "darwinia-staking-traits", - "dc-inflation", "dc-types", "ethabi", "fp-evm", @@ -2784,7 +2779,6 @@ dependencies = [ "frame-support", "frame-system", "log", - "pallet-assets", "pallet-balances", "pallet-timestamp", "parity-scale-codec", @@ -2845,48 +2839,6 @@ dependencies = [ "sp-std 14.0.0 (git+https://github.com/darwinia-network/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] -[[package]] -name = "darwinia-precompile-deposit" -version = "6.7.2" -dependencies = [ - "darwinia-deposit", - "fp-evm", - "frame-support", - "frame-system", - "pallet-balances", - "pallet-evm", - "pallet-timestamp", - "parity-scale-codec", - "precompile-utils 0.1.0", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/darwinia-network/polkadot-sdk?branch=release-polkadot-v1.7.2)", -] - -[[package]] -name = "darwinia-precompile-staking" -version = "6.7.2" -dependencies = [ - "darwinia-deposit", - "darwinia-staking", - "dc-primitives", - "fp-evm", - "frame-support", - "frame-system", - "pallet-balances", - "pallet-evm", - "pallet-timestamp", - "parity-scale-codec", - "precompile-utils 0.1.0", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/darwinia-network/polkadot-sdk?branch=release-polkadot-v1.7.2)", -] - [[package]] name = "darwinia-precompile-state-storage" version = "6.7.2" @@ -2926,8 +2878,6 @@ dependencies = [ "darwinia-deposit", "darwinia-ethtx-forwarder", "darwinia-precompile-assets", - "darwinia-precompile-deposit", - "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", "dc-inflation", @@ -3011,9 +2961,7 @@ dependencies = [ name = "darwinia-staking" version = "6.7.2" dependencies = [ - "darwinia-deposit", "darwinia-ethtx-forwarder", - "darwinia-staking-traits", "dc-inflation", "dc-types", "ethabi", @@ -3037,15 +2985,6 @@ dependencies = [ "sp-std 14.0.0 (git+https://github.com/darwinia-network/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] -[[package]] -name = "darwinia-staking-traits" -version = "6.7.2" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-runtime", -] - [[package]] name = "data-encoding" version = "2.6.0" @@ -3077,7 +3016,6 @@ name = "dc-inflation" version = "6.7.2" dependencies = [ "dc-types", - "primitive-types", "sp-arithmetic", "substrate-fixed", ] @@ -5769,8 +5707,6 @@ dependencies = [ "darwinia-deposit", "darwinia-ethtx-forwarder", "darwinia-precompile-assets", - "darwinia-precompile-deposit", - "darwinia-precompile-staking", "darwinia-precompile-state-storage", "darwinia-staking", "dc-primitives", diff --git a/Cargo.toml b/Cargo.toml index ec224432a..b64a85b4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ members = [ "core/*", "node", "pallet/*", - "pallet/*/traits", "precompile/*", "runtime/*", ] @@ -40,12 +39,9 @@ darwinia-common-runtime = { path = "runtime/common", default-features darwinia-deposit = { path = "pallet/deposit", default-features = false } darwinia-ethtx-forwarder = { path = "pallet/ethtx-forwarder", default-features = false } darwinia-precompile-assets = { path = "precompile/assets", default-features = false } -darwinia-precompile-deposit = { path = "precompile/deposit", default-features = false } -darwinia-precompile-staking = { path = "precompile/staking", default-features = false } darwinia-precompile-state-storage = { path = "precompile/state-storage", default-features = false } darwinia-runtime = { path = "runtime/darwinia" } darwinia-staking = { path = "pallet/staking", default-features = false } -darwinia-staking-traits = { path = "pallet/staking/traits", default-features = false } dc-inflation = { path = "core/inflation", default-features = false } dc-primitives = { path = "core/primitives", default-features = false } dc-types = { path = "core/types" } diff --git a/Makefile.toml b/Makefile.toml index 1febb6aa5..156b51da5 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,9 +1,9 @@ [config] default_to_workspace = false -# skip_core_tasks = true -# skip_git_env_info = true -# skip_rust_env_info = true -# skip_crate_env_info = true +skip_core_tasks = true +skip_git_env_info = true +skip_rust_env_info = true +skip_crate_env_info = true [env] CHAIN = "all" @@ -19,7 +19,7 @@ args = ["fmt"] [tasks.clippy] env = { "SKIP_WASM_BUILD" = "1" } command = "cargo" -args = ["clippy"] +args = ["clippy", "--all-features"] [tasks.c] alias = "clippy" diff --git a/core/inflation/Cargo.toml b/core/inflation/Cargo.toml index 20ac24271..5c20a8dce 100644 --- a/core/inflation/Cargo.toml +++ b/core/inflation/Cargo.toml @@ -7,9 +7,6 @@ readme = "README.md" version.workspace = true [dependencies] -# crates.io -primitive-types = { version = "0.12", default-features = false } - # darwinia dc-types = { workspace = true } @@ -22,9 +19,6 @@ sp-arithmetic = { workspace = true, features = ["std"] } [features] default = ["std"] std = [ - # crates.io - "primitive-types/std", - # github "substrate-fixed/std", ] diff --git a/core/inflation/src/lib.rs b/core/inflation/src/lib.rs index 90b69e751..bfb800d48 100644 --- a/core/inflation/src/lib.rs +++ b/core/inflation/src/lib.rs @@ -24,8 +24,6 @@ #[cfg(test)] mod test; -// crates.io -use primitive_types::U256; // darwinia use dc_types::{Balance, Moment}; // github @@ -148,33 +146,3 @@ pub fn issuing_in_period(period: Moment, elapsed: Moment) -> Option { Some(to_issue_per_millisecs.checked_mul(U94F34::checked_from_num(period)?)?.floor().to_num()) } - -/// Calculate the reward of a deposit. -/// -/// Reference(s): -/// - -pub fn deposit_interest(amount: Balance, months: u8) -> Balance { - // The result of `((quot - 1) * precision + rem * precision / d)` is `197` when months is - // `12`. - // - // The default interest is `1_000`. - // So, we directly use `1_970_000` here instead `interest * 197 * 10^7`. - fn f(amount: U256, precision: U256, quot: U256, rem: U256, d: U256) -> Option { - Some( - (amount.checked_mul( - precision.checked_mul(quot.checked_sub(1_u8.into())?)? + precision * rem / d, - )? / 1_970_000_u32) - .as_u128(), - ) - } - - let amount = U256::from(amount); - let months = U256::from(months); - let n = U256::from(67_u8).pow(months); - let d = U256::from(66_u8).pow(months); - let quot = n / d; - let rem = n % d; - let precision = U256::from(1_000_u16); - - f(amount, precision, quot, rem, d).unwrap_or_default() -} diff --git a/core/inflation/src/test.rs b/core/inflation/src/test.rs index 7827161e2..a72178bcf 100644 --- a/core/inflation/src/test.rs +++ b/core/inflation/src/test.rs @@ -81,23 +81,3 @@ fn issuing_map_should_work() { unissued -= issued; }); } - -#[test] -fn deposit_interest_should_work() { - let precision = 10_000_f64; - - for (&expect_interest, months) in [ - 0.0761_f64, 0.1522, 0.2335, 0.3096, 0.3959, 0.4771, 0.5634, 0.6446, 0.7309, 0.8223, 0.9086, - 1.0000, 1.0913, 1.1878, 1.2842, 1.3807, 1.4771, 1.5736, 1.6751, 1.7766, 1.8832, 1.9898, - 2.0964, 2.2030, 2.3147, 2.4263, 2.5380, 2.6548, 2.7715, 2.8934, 3.0101, 3.1370, 3.2588, - 3.3857, 3.5126, 3.6446, - ] - .iter() - .zip(1_u8..) - { - let interest = deposit_interest(10_000_u128 * UNIT, months) as f64 / UNIT as f64; - let interest = (interest * precision).floor() / precision; - - assert_eq!(interest, expect_interest); - } -} diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index cb5a05ca2..6f8bdc09e 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -64,9 +64,7 @@ pub fn development_config() -> ChainSpec { "darwiniaStaking": { "now": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), "elapsedTime": 0, - "rateLimit": 20_000_000 * UNIT, - "collatorCount": collators.len(), - "collators": collators.iter().map(|(a, _)| (a, UNIT)).collect::>() + "collatorCount": collators.len() }, "session": { "keys": collators.into_iter().map(|(a, sks)| (a, a, sks)).collect::>() @@ -222,9 +220,7 @@ pub fn genesis_config() -> ChainSpec { "darwiniaStaking": { "now": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), "elapsedTime": 0, - "rateLimit": 20_000_000 * UNIT, - "collatorCount": 6, - "collators": collators.iter().map(|(a, _)| (a, 1_000 * UNIT)).collect::>() + "collatorCount": 6 }, "session": { "keys": collators.iter().map(|(a, sks)| (a, a, sks)).collect::>() diff --git a/node/src/chain_spec/darwinia.rs b/node/src/chain_spec/darwinia.rs index ff40c5080..7b1864277 100644 --- a/node/src/chain_spec/darwinia.rs +++ b/node/src/chain_spec/darwinia.rs @@ -64,9 +64,7 @@ pub fn development_config() -> ChainSpec { "darwiniaStaking": { "now": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), "elapsedTime": 0, - "rateLimit": 20_000_000 * UNIT, - "collatorCount": collators.len(), - "collators": collators.iter().map(|(a, _)| (a, UNIT)).collect::>() + "collatorCount": collators.len() }, "session": { "keys": collators.into_iter().map(|(a, sks)| (a, a, sks)).collect::>() @@ -211,9 +209,7 @@ pub fn genesis_config() -> ChainSpec { "darwiniaStaking": { "now": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), "elapsedTime": 0, - "rateLimit": 20_000_000 * UNIT, - "collatorCount": 5, - "collators": collators.iter().map(|(a, _)| (a, 1_000 * UNIT)).collect::>() + "collatorCount": 5 }, "session": { "keys": collators.iter().map(|(a, sks)| (a, a, sks)).collect::>() diff --git a/node/src/chain_spec/koi.rs b/node/src/chain_spec/koi.rs index 46d331d8d..3fba03545 100644 --- a/node/src/chain_spec/koi.rs +++ b/node/src/chain_spec/koi.rs @@ -61,9 +61,7 @@ pub fn development_config() -> ChainSpec { "darwiniaStaking": { "now": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), "elapsedTime": 0, - "rateLimit": 20_000_000 * UNIT, - "collatorCount": collators.len(), - "collators": collators.iter().map(|(a, _)| (a, UNIT)).collect::>() + "collatorCount": collators.len() }, "session": { "keys": collators.into_iter().map(|(a, sks)| (a, a, sks)).collect::>() @@ -166,9 +164,7 @@ pub fn genesis_config() -> ChainSpec { "darwiniaStaking": { "now": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(), "elapsedTime": 0, - "rateLimit": 20_000_000 * UNIT, - "collatorCount": 3, - "collators": collators.iter().map(|(a, _)| (a, UNIT)).collect::>() + "collatorCount": 3 }, "session": { "keys": collators.iter().map(|(a, sks)| (a, a, sks)).collect::>() diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index a6ddf4513..332d8a4ab 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -398,12 +398,14 @@ where ); // Create a mocked parachain inherent data provider to pass all validations in the - // parachain system. Without this, the pending functionality will fail. - let mut state_proof_builder = - cumulus_test_relay_sproof_builder::RelayStateSproofBuilder::default(); - state_proof_builder.para_id = para_id; - state_proof_builder.current_slot = relay_chain_slot; - state_proof_builder.included_para_head = Some(polkadot_primitives::HeadData(vec![])); + // parachain system. + // Without this, the pending functionality will fail. + let state_proof_builder = cumulus_test_relay_sproof_builder::RelayStateSproofBuilder { + para_id, + current_slot: relay_chain_slot, + included_para_head: Some(polkadot_primitives::HeadData(vec![])), + ..Default::default() + }; let (relay_parent_storage_root, relay_chain_state) = state_proof_builder.into_state_root_and_proof(); let parachain_inherent_data = @@ -924,12 +926,14 @@ where SlotDuration::from_millis(RELAY_CHAIN_SLOT_DURATION_MILLIS as u64), ); // Create a mocked parachain inherent data provider to pass all validations in the - // parachain system. Without this, the pending functionality will fail. - let mut state_proof_builder = - cumulus_test_relay_sproof_builder::RelayStateSproofBuilder::default(); - state_proof_builder.para_id = para_id; - state_proof_builder.current_slot = relay_chain_slot; - state_proof_builder.included_para_head = Some(polkadot_primitives::HeadData(vec![])); + // parachain system. + // Without this, the pending functionality will fail. + let state_proof_builder = cumulus_test_relay_sproof_builder::RelayStateSproofBuilder { + para_id, + current_slot: relay_chain_slot, + included_para_head: Some(polkadot_primitives::HeadData(vec![])), + ..Default::default() + }; let (relay_parent_storage_root, relay_chain_state) = state_proof_builder.into_state_root_and_proof(); let parachain_inherent_data = diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 9a8b9aa02..6a8f5896e 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -14,7 +14,6 @@ scale-info = { workspace = true } # darwinia darwinia-deposit = { workspace = true } -darwinia-staking = { workspace = true } dc-primitives = { workspace = true } # polkadot-sdk @@ -43,7 +42,6 @@ std = [ # darwinia "darwinia-deposit/std", - "darwinia-staking/std", "dc-primitives/std", # polkadot-sdk @@ -62,7 +60,6 @@ std = [ runtime-benchmarks = [ # darwinia "darwinia-deposit/runtime-benchmarks", - "darwinia-staking/runtime-benchmarks", # polkadot-sdk "frame-benchmarking/runtime-benchmarks", @@ -76,7 +73,6 @@ runtime-benchmarks = [ try-runtime = [ # darwinia "darwinia-deposit/try-runtime", - "darwinia-staking/try-runtime", # polkadot-sdk "frame-support/try-runtime", diff --git a/pallet/account-migration/src/benchmarking.rs b/pallet/account-migration/src/benchmarking.rs index 6dce09416..a1275851a 100644 --- a/pallet/account-migration/src/benchmarking.rs +++ b/pallet/account-migration/src/benchmarking.rs @@ -79,18 +79,14 @@ mod benchmarks { expired_time: Default::default(), in_use: Default::default(), }; - ::MaxDeposits::get() as usize + 512 ], ); >::insert( from, OldLedger { staked_ring: 1, - staked_deposits: BoundedVec::truncate_from(vec![ - Default::default(); - ::MaxDeposits::get() - as usize - ]), + staked_deposits: BoundedVec::truncate_from(vec![Default::default(); 512]), unstaking_ring: BoundedVec::truncate_from(vec![ ( Default::default(), diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 337f9b19d..a4810d202 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -24,7 +24,7 @@ //! These two algorithm are not compatible. //! Thus, an account migration is required. //! -//! ## Technical detail +//! ## Technical Detail //! //! Users must send an extrinsic themselves to migrate their account(s). //! This extrinsic should be unsigned, the reason is the same as `pallet-claims`. @@ -56,7 +56,6 @@ pub use weights::WeightInfo; // darwinia use darwinia_deposit::{Deposit, DepositId}; -use darwinia_staking::Ledger; use dc_primitives::{AccountId as AccountId20, AssetId, Balance, BlockNumber, Nonce}; // polkadot-sdk use frame_support::{ @@ -90,14 +89,11 @@ pub mod pallet { pub(crate) const E_ACCOUNT_NOT_FOUND: u8 = 1; /// Invalid signature. pub(crate) const E_INVALID_SIGNATURE: u8 = 2; - /// Duplicative submission. - pub(crate) const E_DUPLICATIVE_SUBMISSION: u8 = 3; + /// Duplicated submission. + pub(crate) const E_DUPLICATED_SUBMISSION: u8 = 3; /// The account is not a member of the multisig. pub(crate) const E_NOT_MULTISIG_MEMBER: u8 = 4; - #[pallet::pallet] - pub struct Pallet(_); - #[pallet::config] pub trait Config: frame_system::Config< @@ -108,15 +104,11 @@ pub mod pallet { > + pallet_assets::Config + pallet_balances::Config + darwinia_deposit::Config - + darwinia_staking::Config< - Deposit = darwinia_deposit::Pallet, - MaxDeposits = ConstU32<512>, - > { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From + IsType<::RuntimeEvent>; - /// Weight information for extrinsics in this pallet. + /// Weight information for extrinsic in this pallet. type WeightInfo: WeightInfo; } @@ -161,7 +153,7 @@ pub mod pallet { #[pallet::getter(fn deposit_of)] pub type Deposits = StorageMap<_, Blake2_128Concat, AccountId32, Vec>; - /// [`darwinia_staking::migration::v2::OldLedger`] data. + /// Old ledger data. #[pallet::storage] #[pallet::getter(fn ledger_of)] pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, OldLedger>; @@ -172,6 +164,41 @@ pub mod pallet { #[pallet::getter(fn multisig_of)] pub type Multisigs = StorageMap<_, Identity, AccountId32, MultisigMigrationDetail>; + #[pallet::pallet] + pub struct Pallet(_); + #[pallet::hooks] + impl Hooks> for Pallet { + fn on_idle(_: BlockNumberFor, mut remaining_weight: Weight) -> Weight { + const MAX_TASKS: usize = 10; + + #[cfg(test)] + let wt = Weight::zero().add_ref_time(1); + #[cfg(not(test))] + let wt = T::DbWeight::get().writes(1); + let mut consumer = >::iter().drain(); + + for i in 0..MAX_TASKS { + if i >= MAX_TASKS { + break; + } + + if let Some(rw) = remaining_weight.checked_sub(&wt) { + remaining_weight = rw; + } else { + break; + } + + if consumer.next().is_none() { + // There is nothing to do; add the weight back. + remaining_weight += wt; + + break; + } + } + + remaining_weight + } + } #[pallet::call] impl Pallet { /// Migrate all the account data under the `from` to `to`. @@ -317,7 +344,7 @@ pub mod pallet { if who == submitter { // Reject duplicative submission. if *ok { - return InvalidTransaction::Custom(E_DUPLICATIVE_SUBMISSION).into(); + return InvalidTransaction::Custom(E_DUPLICATED_SUBMISSION).into(); } is_member = true; @@ -356,7 +383,7 @@ pub mod pallet { fn pre_check_duplicative(multisig: &AccountId32) -> Result<(), TransactionValidityError> { if >::contains_key(multisig) { - Err(InvalidTransaction::Custom(E_DUPLICATIVE_SUBMISSION))? + Err(InvalidTransaction::Custom(E_DUPLICATED_SUBMISSION))? } else { Ok(()) } @@ -420,32 +447,16 @@ pub mod pallet { asset_details, ); } - if let Some(l) = >::take(from) { - if l.staked_ring > 0 { - as Currency<_>>::transfer( - to, - &darwinia_staking::account_id(), - l.staked_ring, - AllowDeath, - )?; - } - - if let Some(ds) = >::take(from) { - as Currency<_>>::transfer( - to, - &darwinia_deposit::account_id(), - ds.iter().map(|d| d.value).sum(), - AllowDeath, - )?; - >::insert( - to, - BoundedVec::try_from(ds).map_err(|_| >::ExceedMaxDeposits)?, - ); - } - - >::insert( + if let Some(ds) = >::take(from) { + as Currency<_>>::transfer( + to, + &darwinia_deposit::account_id(), + ds.iter().map(|d| d.value).sum(), + AllowDeath, + )?; + >::insert( to, - Ledger { ring: l.staked_ring, deposits: l.staked_deposits }, + BoundedVec::try_from(ds).map_err(|_| >::ExceedMaxDeposits)?, ); } } diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index d9ed8a89c..99b3dea39 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -23,31 +23,6 @@ use frame_support::derive_impl; use sp_io::TestExternalities; use sp_runtime::BuildStorage; -pub struct Dummy; -impl darwinia_deposit::SimpleAsset for Dummy { - type AccountId = AccountId; - - fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } - - fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } -} -impl darwinia_staking::Stake for Dummy { - type AccountId = AccountId; - type Item = Balance; - - fn stake(_: &Self::AccountId, _: Self::Item) -> sp_runtime::DispatchResult { - Ok(()) - } - - fn unstake(_: &Self::AccountId, _: Self::Item) -> sp_runtime::DispatchResult { - Ok(()) - } -} - #[sp_version::runtime_version] pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { spec_name: sp_runtime::create_runtime_str!("Darwinia2"), @@ -125,31 +100,12 @@ frame_support::parameter_types! { impl darwinia_deposit::Config for Runtime { type DepositMigrator = (); - type Kton = Dummy; - type MaxDeposits = frame_support::traits::ConstU32<512>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type Treasury = (); type WeightInfo = (); } -impl darwinia_staking::Config for Runtime { - type Currency = Balances; - type Deposit = Deposit; - type IssuingManager = (); - type KtonStaking = (); - type MaxDeposits = frame_support::traits::ConstU32<512>; - type Ring = Dummy; - type RingStaking = (); - type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = (); - type Treasury = (); - type UnixTime = Timestamp; - type WeightInfo = (); -} -#[cfg(not(feature = "runtime-benchmarks"))] -impl darwinia_staking::DepositConfig for Runtime {} - impl crate::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = (); @@ -162,7 +118,6 @@ frame_support::construct_runtime! { Balances: pallet_balances, Assets: pallet_assets, Deposit: darwinia_deposit, - Staking: darwinia_staking, AccountMigration: crate, } } diff --git a/pallet/account-migration/src/tests.rs b/pallet/account-migration/src/tests.rs index be73f4779..5b12496b2 100644 --- a/pallet/account-migration/src/tests.rs +++ b/pallet/account-migration/src/tests.rs @@ -19,9 +19,10 @@ // darwinia use crate::{mock::*, *}; // polkadot-sdk -use frame_support::{assert_noop, assert_ok}; +use frame_support::{assert_noop, assert_ok, traits::OnIdle}; use frame_system::AccountInfo; use pallet_balances::AccountData; +use sp_core::H256; use sp_keyring::{ed25519::Keyring as Ek, sr25519::Keyring as Sk}; use sp_runtime::{ traits::ValidateUnsigned, @@ -139,7 +140,7 @@ fn migrate_multisig_should_work() { signature: signature.0, new_multisig_params: None }), - TransactionValidityError::Invalid(InvalidTransaction::Custom(E_DUPLICATIVE_SUBMISSION)) + TransactionValidityError::Invalid(InvalidTransaction::Custom(E_DUPLICATED_SUBMISSION)) ); assert!(>::get(&multisig).is_some()); @@ -176,3 +177,22 @@ fn migrate_multisig_should_work() { assert_eq!(>::get(to).consumers, 1); }); } + +#[test] +fn on_idle_should_work() { + new_test_ext().execute_with(|| { + (0..1_024).for_each(|i| { + >::insert( + AccountId32::from(H256::from_low_u64_le(i).0), + OldLedger::default(), + ); + }); + assert_eq!(>::iter().count(), 1_024); + + >::on_idle(0, Weight::zero().add_ref_time(5)); + assert_eq!(>::iter().count(), 1_019); + + >::on_idle(0, Weight::MAX); + assert_eq!(>::iter().count(), 1_009); + }); +} diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index f355eb2a2..be7df7233 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -15,8 +15,6 @@ scale-info = { workspace = true } # darwinia darwinia-ethtx-forwarder = { workspace = true } -darwinia-staking-traits = { workspace = true } -dc-inflation = { workspace = true } dc-types = { workspace = true } # frontier @@ -34,7 +32,6 @@ frame-benchmarking = { workspace = true, optional = true } [dev-dependencies] # polkadot-sdk -pallet-assets = { workspace = true, features = ["std"] } pallet-balances = { workspace = true, features = ["std"] } sp-io = { workspace = true, features = ["std"] } @@ -49,8 +46,6 @@ std = [ # darwinia "darwinia-ethtx-forwarder/std", - "darwinia-staking-traits/std", - "dc-inflation/std", # frontier "fp-evm/std", @@ -69,7 +64,6 @@ std = [ runtime-benchmarks = [ # darwinia "darwinia-ethtx-forwarder/runtime-benchmarks", - "darwinia-staking-traits/runtime-benchmarks", # polkadot-sdk "frame-support/runtime-benchmarks", diff --git a/pallet/deposit/src/benchmarking.rs b/pallet/deposit/src/benchmarking.rs index 34fb0165b..70a1df34e 100644 --- a/pallet/deposit/src/benchmarking.rs +++ b/pallet/deposit/src/benchmarking.rs @@ -17,12 +17,10 @@ // along with Darwinia. If not, see . // darwinia -use crate::*; -use dc_types::UNIT; +use crate::{Deposit, *}; // polkadot-sdk use frame_benchmarking::v2; use frame_system::RawOrigin; -use sp_runtime::SaturatedConversion; use sp_std::prelude::*; #[v2::benchmarks] @@ -31,106 +29,33 @@ mod benchmarks { use super::*; #[benchmark] - fn lock() { - let a = frame_benchmarking::whitelisted_caller(); - let max_deposits = T::MaxDeposits::get(); - - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - T::Ring::make_free_balance_be(&a, max_deposits as Balance * UNIT + 1); - - // Worst-case scenario: - // - // Calculate the last deposit's id. - (0..max_deposits - 1).for_each(|_| { - >::lock(RawOrigin::Signed(a.clone()).into(), UNIT, MAX_LOCKING_MONTHS) - .unwrap() - }); - - #[extrinsic_call] - _(RawOrigin::Signed(a), UNIT, MAX_LOCKING_MONTHS); - } - - #[benchmark] - fn claim() { - let a = frame_benchmarking::whitelisted_caller(); - let max_deposits = T::MaxDeposits::get(); - - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - T::Ring::make_free_balance_be(&a, max_deposits as Balance * UNIT + 1); - - (0..max_deposits).for_each(|_| { - >::lock(RawOrigin::Signed(a.clone()).into(), UNIT, MAX_LOCKING_MONTHS) - .unwrap() - }); - - // Worst-case scenario: - // - // Let all locks be expired. - >::set_timestamp( - >::now() - + (MAX_LOCKING_MONTHS as Moment * MILLISECS_PER_MONTH).saturated_into(), - ); - - assert_eq!(>::deposit_of(&a).unwrap().len(), max_deposits as usize); - - #[extrinsic_call] - _(RawOrigin::Signed(a.clone())); - - assert!(>::deposit_of(&a).is_none()); - } - - #[benchmark] - fn claim_with_penalty() { - let a = frame_benchmarking::whitelisted_caller(); - let max_deposits = T::MaxDeposits::get(); - - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - T::Ring::make_free_balance_be(&a, max_deposits as Balance * UNIT + 1); - T::Kton::mint(&a, UNIT).unwrap(); - - (0..max_deposits).for_each(|_| { - >::lock(RawOrigin::Signed(a.clone()).into(), UNIT, MAX_LOCKING_MONTHS) - .unwrap() - }); - - // Worst-case scenario: - // - // Remove the head item from a 'full-size' bounded vector. - { - let ds = >::deposit_of(&a).unwrap(); - - assert_eq!(ds.len(), max_deposits as usize); - assert_eq!(ds[0].id, 0); - } - - #[extrinsic_call] - _(RawOrigin::Signed(a.clone()), 0); - - { - let ds = >::deposit_of(&a).unwrap(); - - assert_eq!(ds.len(), max_deposits as usize - 1); - assert_eq!(ds[0].id, 1); - } - } - - #[benchmark] - fn migrate() { + fn migrate_for() { let a = frame_benchmarking::whitelisted_caller::(); let a_ = a.clone(); - let max_deposits = T::MaxDeposits::get(); >::set_deposit_contract(RawOrigin::Root.into(), a.clone()).unwrap(); - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - T::Ring::make_free_balance_be(&a, max_deposits as Balance * UNIT + 1); + T::Ring::make_free_balance_be(&account_id(), 2 << 126); + T::Ring::make_free_balance_be(&T::Treasury::get(), 2 << 126); // Worst-case scenario: // // Max deposit items to be migrated. - (0..max_deposits).for_each(|_| { - >::lock(RawOrigin::Signed(a.clone()).into(), UNIT, MAX_LOCKING_MONTHS) - .unwrap() + >::insert(&a, { + let mut v = BoundedVec::new(); + + (0..512).for_each(|id| { + v.try_push(Deposit { + id, + value: 1, + start_time: 0, + expired_time: Moment::MAX, + in_use: false, + }) + .unwrap(); + }); + + v }); #[extrinsic_call] diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 006542232..e3980b825 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -38,16 +38,11 @@ mod weights; pub use weights::WeightInfo; // core -use core::{ - cmp::Ordering::{Equal, Greater, Less}, - marker::PhantomData, - ops::ControlFlow::{Break, Continue}, -}; +use core::marker::PhantomData; // crates.io use codec::FullCodec; use ethabi::{Function, Param, ParamType, StateMutability, Token}; // darwinia -use dc_inflation::MILLISECS_PER_YEAR; use dc_types::{Balance, Moment}; // frontier use fp_evm::{CallOrCreateInfo, ExitReason}; @@ -72,72 +67,34 @@ pub mod pallet { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Weight information for extrinsics in this pallet. + /// Weight information for extrinsic in this pallet. type WeightInfo: WeightInfo; /// RING asset. type Ring: Currency; - /// KTON asset. - type Kton: SimpleAsset; - /// Deposit contract migrator. type DepositMigrator: MigrateToContract; /// Treasury account. #[pallet::constant] type Treasury: Get; - - /// Maximum deposit count. - /// - /// In currently design, this should not be greater than `u16::MAX`. - #[pallet::constant] - type MaxDeposits: Get; } #[allow(missing_docs)] #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// A new deposit has been created. - DepositCreated { - owner: T::AccountId, - deposit_id: DepositId, - value: Balance, - start_time: Moment, - expired_time: Moment, - kton_reward: Balance, - }, /// Expired deposits have been claimed. DepositsClaimed { owner: T::AccountId, deposits: Vec }, - /// An unexpired deposit has been claimed by paying the KTON penalty. - DepositClaimedWithPenalty { - owner: T::AccountId, - deposit_id: DepositId, - kton_penalty: Balance, - }, /// Deposits have been migrated. DepositsMigrated { owner: T::AccountId, deposits: Vec }, } #[pallet::error] pub enum Error { - /// Lock at least for a specific amount. - LockAtLeastSome, - /// Lock at least for one month. - LockAtLeastOneMonth, - /// Lock at most for thirty-six months. - LockAtMostThirtySixMonths, - /// Exceed maximum deposit count. - ExceedMaxDeposits, - /// Deposit not found. - DepositNotFound, - /// Deposit is in use. - DepositInUse, - /// Deposit is not in use. - DepositNotInUse, - /// Deposit is already expired. - DepositAlreadyExpired, + /// No deposit. + NoDeposit, /// Invalid deposit contract. InvalidDepositContract, /// Migration interaction with deposit contract failed. @@ -150,7 +107,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn deposit_of)] pub type Deposits = - StorageMap<_, Blake2_128Concat, T::AccountId, BoundedVec>; + StorageMap<_, Blake2_128Concat, T::AccountId, BoundedVec>>; // Deposit contract address. #[pallet::storage] @@ -159,205 +116,54 @@ pub mod pallet { #[pallet::pallet] pub struct Pallet(_); - #[pallet::call] - impl Pallet { - /// Lock the RING for some KTON profit/interest. - #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::lock())] - pub fn lock(origin: OriginFor, amount: Balance, months: u8) -> DispatchResult { - let who = ensure_signed(origin)?; - - if amount == 0 { - Err(>::LockAtLeastSome)?; + #[pallet::hooks] + impl Hooks> for Pallet { + fn on_idle(_: BlockNumberFor, mut remaining_weight: Weight) -> Weight { + #[cfg(test)] + let wt = Weight::zero().add_ref_time(10); + #[cfg(not(test))] + let wt = ::WeightInfo::migrate_for(); + + if let Some(rw) = remaining_weight.checked_sub(&wt) { + remaining_weight = rw; + } else { + return remaining_weight; } - if months == 0 { - Err(>::LockAtLeastOneMonth)?; - } - if months > MAX_LOCKING_MONTHS { - Err(>::LockAtMostThirtySixMonths)?; - } - if >::decode_len(&who).unwrap_or_default() as u32 >= T::MaxDeposits::get() { - Err(>::ExceedMaxDeposits)?; - } - - let (deposit_id, start_time, expired_time) = >::try_mutate(&who, |ds| { - let ds = if let Some(ds) = ds { - ds - } else { - >::inc_consumers(&who)?; - - *ds = Some(Default::default()); - - ds.as_mut().expect("[pallet::deposit] `ds` must be some; qed") - }; - - // Keep the list sorted in increasing order. - // And find the missing id. - let id = match ds.iter().map(|d| d.id).try_fold(0, |i, id| match i.cmp(&id) { - // `Greater` never occurs, as this list is always sorted. - // But it's a good practice to handle it instead of marking as `unreachable!`. - Less | Greater => Break(i), - Equal => Continue(i + 1), - }) { - Continue(c) => c, - Break(b) => b, - }; - let start_time = Self::now(); - let expired_time = start_time + MILLISECS_PER_MONTH * months as Moment; - - ds.try_insert( - id as _, - Deposit { id, value: amount, start_time, expired_time, in_use: false }, - ) - .map_err(|_| >::ExceedMaxDeposits)?; - - >::Ok((id, start_time, expired_time)) - })?; - - T::Ring::transfer(&who, &account_id(), amount, AllowDeath)?; - - let kton_reward = dc_inflation::deposit_interest(amount, months); - - T::Kton::mint(&who, kton_reward)?; - - Self::deposit_event(Event::DepositCreated { - owner: who, - deposit_id, - value: amount, - start_time, - expired_time, - kton_reward, - }); - - Ok(()) - } - - /// Claim the expired-locked RING. - #[pallet::call_index(1)] - #[pallet::weight(::WeightInfo::claim())] - pub fn claim(origin: OriginFor) -> DispatchResult { - let who = ensure_signed(origin)?; - let now = Self::now(); - let mut to_claim = (0, Vec::new()); - let _ = >::try_mutate(&who, |maybe_ds| { - let ds = maybe_ds.as_mut().ok_or(())?; - - ds.retain(|d| { - if d.expired_time <= now && !d.in_use { - to_claim.0 += d.value; - to_claim.1.push(d.id); - - false - } else { - true - } - }); - - if ds.is_empty() { - >::dec_consumers(&who); - - *maybe_ds = None; - } - - >::Ok(()) - }); - - T::Ring::transfer(&account_id(), &who, to_claim.0, AllowDeath)?; - Self::deposit_event(Event::DepositsClaimed { owner: who, deposits: to_claim.1 }); - Ok(()) - } + let Some((k, v)) = >::iter().drain().next() else { + // There is nothing to do; add the weight back. + remaining_weight += wt; - /// Claim the unexpired-locked RING by paying the KTON penalty. - #[pallet::call_index(2)] - #[pallet::weight(::WeightInfo::claim_with_penalty())] - pub fn claim_with_penalty(origin: OriginFor, id: DepositId) -> DispatchResult { - let who = ensure_signed(origin)?; - let d = >::try_mutate(&who, |maybe_ds| { - let ds = maybe_ds.as_mut().ok_or(>::DepositNotFound)?; - let d = ds - .remove(ds.iter().position(|d| d.id == id).ok_or(>::DepositNotFound)?); - - if d.in_use { - Err(>::DepositInUse)?; - } - if ds.is_empty() { - >::dec_consumers(&who); + return remaining_weight; + }; - *maybe_ds = None; + if let Ok(remaining_deposits) = Self::migrate_for_inner(&k, v.clone()) { + if !remaining_deposits.is_empty() { + // There are still some deposits left for this account. + >::insert(&k, remaining_deposits); } - - Ok::<_, DispatchError>(d) - })?; - let now = Self::now(); - - if d.expired_time <= now { - Err(>::DepositAlreadyExpired)?; + } else { + // Put the deposits back if migration failed. + >::insert(&k, v); } - let promise_m = (d.expired_time - d.start_time) / MILLISECS_PER_MONTH; - let elapsed_m = (now - d.start_time) / MILLISECS_PER_MONTH; - let kton_penalty = dc_inflation::deposit_interest(d.value, promise_m as _) - .saturating_sub(dc_inflation::deposit_interest(d.value, elapsed_m as _)) - .max(1) * 3; - - T::Kton::burn(&who, kton_penalty)?; - T::Ring::transfer(&account_id(), &who, d.value, AllowDeath)?; - Self::deposit_event(Event::DepositClaimedWithPenalty { - owner: who, - deposit_id: id, - kton_penalty, - }); - - Ok(()) + remaining_weight } - + } + #[pallet::call] + impl Pallet { /// Migrate the specified account's data to deposit contract. #[pallet::call_index(3)] - #[pallet::weight(::WeightInfo::migrate())] - pub fn migrate(origin: OriginFor, who: T::AccountId) -> DispatchResult { + #[pallet::weight(::WeightInfo::migrate_for())] + pub fn migrate_for(origin: OriginFor, who: T::AccountId) -> DispatchResult { ensure_signed(origin)?; - let Some(ds) = >::take(&who) else { return Ok(()) }; - let now = Self::now(); - let mut ds = ds.into_iter(); - let mut to_claim = (0, Vec::new()); - let mut to_migrate = (0, Vec::new(), Vec::new()); + let deposits = >::take(&who).ok_or(>::NoDeposit)?; + let deposits = Self::migrate_for_inner(&who, deposits)?; - // Take 0~10 deposits to migrate. - for d in ds.by_ref().take(10) { - if d.in_use { - Err(>::DepositInUse)?; - } - - if d.expired_time <= now { - to_claim.0 += d.value; - to_claim.1.push(d.id); - } else { - to_migrate.0 += d.value; - to_migrate.1.push(d.id); - to_migrate.2.push((d.value, d.start_time / 1_000, d.expired_time / 1_000)); - } - } - - T::Ring::transfer(&account_id(), &who, to_claim.0, AllowDeath)?; - T::Ring::transfer(&account_id(), &T::Treasury::get(), to_migrate.0, AllowDeath)?; - T::DepositMigrator::migrate(who.clone(), to_migrate.0, to_migrate.2)?; - - Self::deposit_event(Event::DepositsClaimed { - owner: who.clone(), - deposits: to_claim.1, - }); - Self::deposit_event(Event::DepositsMigrated { - owner: who.clone(), - deposits: to_migrate.1, - }); - - let ds = ds.collect::>(); - - if !ds.is_empty() { - // Put the rest deposits back. - >::insert(&who, BoundedVec::truncate_from(ds)); + // Put the rest deposits back. + if !deposits.is_empty() { + >::insert(&who, deposits); } Ok(()) @@ -384,56 +190,48 @@ pub mod pallet { fn now() -> Moment { as UnixTime>::now().as_millis() } - } - impl darwinia_staking_traits::Stake for Pallet - where - T: Config, - { - type AccountId = T::AccountId; - type Item = DepositId; - fn stake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { - >::try_mutate(who, |ds| { - let ds = ds.as_mut().ok_or(>::DepositNotFound)?; - let d = ds.iter_mut().find(|d| d.id == item).ok_or(>::DepositNotFound)?; + fn migrate_for_inner( + who: &T::AccountId, + deposits: I, + ) -> Result>, DispatchError> + where + I: IntoIterator, + { + let now = Self::now(); + let mut deposits = deposits.into_iter(); + let mut to_claim = (0, Vec::new()); + let mut to_migrate = (0, Vec::new(), Vec::new()); - if d.in_use { - Err(>::DepositInUse)? + // Take 0~10 deposits to migrate. + for d in deposits.by_ref().take(10) { + if d.expired_time <= now { + to_claim.0 += d.value; + to_claim.1.push(d.id); } else { - d.in_use = true; - - Ok(()) + to_migrate.0 += d.value; + to_migrate.1.push(d.id); + to_migrate.2.push((d.value, d.start_time / 1_000, d.expired_time / 1_000)); } - }) - } - - fn unstake(who: &Self::AccountId, item: Self::Item) -> DispatchResult { - >::try_mutate(who, |ds| { - let ds = ds.as_mut().ok_or(>::DepositNotFound)?; - let d = ds.iter_mut().find(|d| d.id == item).ok_or(>::DepositNotFound)?; + } - if d.in_use { - d.in_use = false; + if to_claim.0 != 0 { + T::Ring::transfer(&account_id(), who, to_claim.0, AllowDeath)?; + Self::deposit_event(Event::DepositsClaimed { + owner: who.clone(), + deposits: to_claim.1, + }); + } + if to_migrate.0 != 0 { + T::Ring::transfer(&account_id(), &T::Treasury::get(), to_migrate.0, AllowDeath)?; + T::DepositMigrator::migrate(who.clone(), to_migrate.0, to_migrate.2)?; + Self::deposit_event(Event::DepositsMigrated { + owner: who.clone(), + deposits: to_migrate.1, + }); + } - Ok(()) - } else { - Err(>::DepositNotInUse)? - } - }) - } - } - impl darwinia_staking_traits::StakeExt for Pallet - where - T: Config, - { - type Amount = Balance; - - fn amount(who: &Self::AccountId, item: Self::Item) -> Result { - Ok(>::get(who) - .and_then(|ds| { - ds.into_iter().find_map(|d| if d.id == item { Some(d.value) } else { None }) - }) - .ok_or(>::DepositNotFound)?) + Ok(BoundedVec::truncate_from(deposits.collect())) } } } @@ -441,29 +239,6 @@ pub use pallet::*; /// Deposit identifier. pub type DepositId = u16; -// https://github.com/polkadot-js/apps/issues/8591 -// Max deposits in Darwinia is 322. -// Max deposits in Crab is 220. -// Maybe we will use `WeakBoundedVec` later. -// pub type DepositId = u8; - -/// Milliseconds per month. -pub const MILLISECS_PER_MONTH: Moment = MILLISECS_PER_YEAR / 12; - -/// The maximum locking period for a deposit. -pub const MAX_LOCKING_MONTHS: u8 = 36; - -/// Simple asset APIs. -pub trait SimpleAsset { - /// Account type. - type AccountId; - - /// Mint API. - fn mint(beneficiary: &Self::AccountId, amount: Balance) -> DispatchResult; - - /// Burn API. - fn burn(who: &Self::AccountId, amount: Balance) -> DispatchResult; -} /// Migrate to contract trait. pub trait MigrateToContract diff --git a/pallet/deposit/src/mock.rs b/pallet/deposit/src/mock.rs index 597aa70f3..195437844 100644 --- a/pallet/deposit/src/mock.rs +++ b/pallet/deposit/src/mock.rs @@ -24,8 +24,6 @@ use frame_support::derive_impl; use sp_io::TestExternalities; use sp_runtime::BuildStorage; -pub type AssetId = u32; - #[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)] impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; @@ -45,51 +43,8 @@ impl pallet_balances::Config for Runtime { type ExistentialDeposit = (); } -impl pallet_assets::Config for Runtime { - type ApprovalDeposit = (); - type AssetAccountDeposit = (); - type AssetDeposit = (); - type AssetId = AssetId; - type AssetIdParameter = codec::Compact; - type Balance = Balance; - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); - type CallbackHandle = (); - type CreateOrigin = frame_support::traits::AsEnsureOriginWithArg< - frame_system::EnsureSignedBy, Self::AccountId>, - >; - type Currency = Balances; - type Extra = (); - type ForceOrigin = frame_system::EnsureRoot; - type Freezer = (); - type MetadataDepositBase = (); - type MetadataDepositPerByte = (); - type RemoveItemsLimit = (); - type RuntimeEvent = RuntimeEvent; - type StringLimit = frame_support::traits::ConstU32<4>; - type WeightInfo = (); -} - -pub enum KtonMinting {} -impl crate::SimpleAsset for KtonMinting { - type AccountId = ::AccountId; - - fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint(RuntimeOrigin::signed(0), 0.into(), *beneficiary, amount) - } - - fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - if Assets::balance(0, who) < amount { - Err(>::BalanceLow)?; - } - - Assets::burn(RuntimeOrigin::signed(0), 0.into(), *who, amount) - } -} impl crate::Config for Runtime { type DepositMigrator = (); - type Kton = KtonMinting; - type MaxDeposits = frame_support::traits::ConstU32<16>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type Treasury = (); @@ -101,7 +56,6 @@ frame_support::construct_runtime! { System: frame_system, Timestamp: pallet_timestamp, Balances: pallet_balances, - Assets: pallet_assets, Deposit: crate, } } @@ -114,27 +68,6 @@ pub fn new_test_ext() -> TestExternalities { } .assimilate_storage(&mut storage) .unwrap(); - pallet_assets::GenesisConfig:: { - assets: vec![(0, 0, true, 1)], - metadata: vec![(0, b"KTON".to_vec(), b"KTON".to_vec(), 18)], - ..Default::default() - } - .assimilate_storage(&mut storage) - .unwrap(); storage.into() } - -pub fn efflux(milli_secs: Moment) { - Timestamp::set_timestamp(Timestamp::now() + milli_secs); -} - -pub fn set_in_use(who: u64, in_use: bool) { - let _ = >::try_mutate(who, |maybe_ds| { - let ds = maybe_ds.as_mut().ok_or(())?; - - ds.iter_mut().for_each(|d| d.in_use = in_use); - - Ok::<_, ()>(()) - }); -} diff --git a/pallet/deposit/src/tests.rs b/pallet/deposit/src/tests.rs index 765073e23..f4e1fedf7 100644 --- a/pallet/deposit/src/tests.rs +++ b/pallet/deposit/src/tests.rs @@ -21,355 +21,80 @@ use crate::{ mock::{Deposit, *}, Deposit as DepositS, *, }; -use darwinia_staking_traits::Stake; -use dc_types::UNIT; // polkadot-sdk -use frame_support::{assert_noop, assert_ok}; -use sp_runtime::TokenError; +use frame_support::{assert_ok, traits::OnIdle}; #[test] -fn lock_should_work() { - new_test_ext().execute_with(|| { - assert_eq!(System::account(1).consumers, 0); - assert_eq!( - Balances::free_balance( - crate::account_id::<::AccountId>() - ), - 0 - ); - assert_eq!(Balances::free_balance(1), 1_000 * UNIT); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 10 * UNIT, 1)); - assert_eq!(System::account(1).consumers, 1); - assert_eq!( - Balances::free_balance( - crate::account_id::<::AccountId>() - ), - 10 * UNIT - ); - assert_eq!(Balances::free_balance(1), 990 * UNIT); - }); -} - -#[test] -fn deposit_interest_should_work() { - new_test_ext().execute_with(|| { - assert_eq!(Assets::balance(0, 1), 0); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert_eq!(Assets::balance(0, 1), 7_614_213_197_969); - - assert_eq!(Assets::balance(0, 2), 0); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(2), 1000 * UNIT, MAX_LOCKING_MONTHS)); - assert_eq!(Assets::balance(0, 2), 364_467_005_076_142_131); - }); -} - -#[test] -fn unique_identity_should_work() { - new_test_ext().execute_with(|| { - assert!(Deposit::deposit_of(1).is_none()); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 2 * UNIT, 2)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 3 * UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 4 * UNIT, 2)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 5 * UNIT, 1)); - assert_eq!( - Deposit::deposit_of(1).unwrap().as_slice(), - &[ - DepositS { - id: 0, - value: UNIT, - start_time: 0, - expired_time: MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 1, - value: 2 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 2, - value: 3 * UNIT, - start_time: 0, - expired_time: MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 3, - value: 4 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 4, - value: 5 * UNIT, - start_time: 0, - expired_time: MILLISECS_PER_MONTH, - in_use: false - } - ] - ); - - efflux(MILLISECS_PER_MONTH); - assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 6 * UNIT, 1)); - assert_eq!( - Deposit::deposit_of(1).unwrap().as_slice(), - &[ - DepositS { - id: 0, - value: 6 * UNIT, - start_time: MILLISECS_PER_MONTH, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 1, - value: 2 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 3, - value: 4 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - ] - ); - - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 7 * UNIT, 1)); - assert_eq!( - Deposit::deposit_of(1).unwrap().as_slice(), - &[ - DepositS { - id: 0, - value: 6 * UNIT, - start_time: MILLISECS_PER_MONTH, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 1, - value: 2 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 2, - value: 7 * UNIT, - start_time: MILLISECS_PER_MONTH, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 3, - value: 4 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - ] - ); - - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), 8 * UNIT, 1)); - assert_eq!( - Deposit::deposit_of(1).unwrap().as_slice(), - &[ - DepositS { - id: 0, - value: 6 * UNIT, - start_time: MILLISECS_PER_MONTH, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 1, - value: 2 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 2, - value: 7 * UNIT, - start_time: MILLISECS_PER_MONTH, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 3, - value: 4 * UNIT, - start_time: 0, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - DepositS { - id: 4, - value: 8 * UNIT, - start_time: MILLISECS_PER_MONTH, - expired_time: 2 * MILLISECS_PER_MONTH, - in_use: false - }, - ] - ); - }); -} - -#[test] -fn expire_time_should_work() { - new_test_ext().execute_with(|| { - (1..=8).for_each(|_| { - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - efflux(MILLISECS_PER_MONTH); - }); - assert_eq!( - Deposit::deposit_of(1).unwrap().as_slice(), - (1..=8) - .map(|i| DepositS { - id: i - 1, - value: UNIT, - start_time: (i - 1) as Moment * MILLISECS_PER_MONTH, - expired_time: i as Moment * MILLISECS_PER_MONTH, - in_use: false - }) - .collect::>() - .as_slice() - ); - }); -} - -#[test] -fn lock_should_fail() { +fn migrate_should_work() { new_test_ext().execute_with(|| { - assert_noop!( - Deposit::lock(RuntimeOrigin::signed(1), 0, 0), - >::LockAtLeastSome - ); - - assert_noop!( - Deposit::lock(RuntimeOrigin::signed(1), UNIT, 0), - >::LockAtLeastOneMonth - ); - - assert_noop!( - Deposit::lock(RuntimeOrigin::signed(1), UNIT, 37), - >::LockAtMostThirtySixMonths - ); - - (0..<::MaxDeposits as Get<_>>::get()).for_each(|_| { - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - }); - assert_noop!( - Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1), - >::ExceedMaxDeposits + let _ = Balances::deposit_creating(&account_id(), 2); + + >::insert( + 1, + BoundedVec::truncate_from(vec![ + DepositS { id: 0, value: 1, start_time: 0, expired_time: 0, in_use: false }, + DepositS { id: 0, value: 1, start_time: 0, expired_time: 0, in_use: true }, + ]), ); - assert_noop!( - Deposit::lock(RuntimeOrigin::signed(2), 2_001 * UNIT, 1), - TokenError::FundsUnavailable - ); - }); -} - -#[test] -fn claim_should_work() { - new_test_ext().execute_with(|| { - assert!(Deposit::deposit_of(1).is_none()); - assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert!(Deposit::deposit_of(1).is_none()); - - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert!(Deposit::deposit_of(1).is_some()); - - efflux(MILLISECS_PER_MONTH - 1); - assert_eq!(System::account(1).consumers, 1); - assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 1); assert!(Deposit::deposit_of(1).is_some()); - - efflux(MILLISECS_PER_MONTH); - assert_eq!(System::account(1).consumers, 1); - assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 0); - assert!(Deposit::deposit_of(1).is_none()); - - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert_ok!(Deposit::stake(&1, 0)); - efflux(2 * MILLISECS_PER_MONTH); - assert_eq!(System::account(1).consumers, 1); - assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 1); - assert!(Deposit::deposit_of(1).is_some()); - - assert_ok!(Deposit::unstake(&1, 0)); - assert_eq!(System::account(1).consumers, 1); - assert_ok!(Deposit::claim(RuntimeOrigin::signed(1))); - assert_eq!(System::account(1).consumers, 0); + assert_ok!(Deposit::migrate_for(RuntimeOrigin::signed(1), 1)); assert!(Deposit::deposit_of(1).is_none()); }); } #[test] -fn claim_with_penalty_should_work() { - new_test_ext().execute_with(|| { - assert_eq!(Balances::free_balance(1), 1_000 * UNIT); - assert!(Deposit::deposit_of(1).is_none()); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert_eq!(Balances::free_balance(1), 999 * UNIT); - assert!(Deposit::deposit_of(1).is_some()); - - assert_noop!( - Deposit::claim_with_penalty(RuntimeOrigin::signed(1), 0), - >::BalanceLow - ); +fn on_idle_should_work() { + fn mock_deposits(count: u16) -> BoundedVec> { + BoundedVec::truncate_from( + (0..count) + .map(|id| DepositS { id, value: 1, start_time: 0, expired_time: 0, in_use: false }) + .collect(), + ) + } - assert_ok!(KtonMinting::mint(&1, UNIT)); - mock::set_in_use(1, true); - - assert_noop!( - Deposit::claim_with_penalty(RuntimeOrigin::signed(1), 0), - >::DepositInUse - ); - - mock::set_in_use(1, false); - - assert_ok!(Deposit::claim_with_penalty(RuntimeOrigin::signed(1), 0)); - assert_eq!(Balances::free_balance(1), 1_000 * UNIT); - assert_eq!(Assets::balance(0, 1), 999_984_771_573_604_062); - assert!(Deposit::deposit_of(1).is_none()); - - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - efflux(MILLISECS_PER_MONTH); - assert!(Deposit::deposit_of(1).is_some()); - - assert_noop!( - Deposit::claim_with_penalty(RuntimeOrigin::signed(1), 0), - >::DepositAlreadyExpired - ); - }); -} - -#[test] -fn migrate_should_work() { new_test_ext().execute_with(|| { - assert_ok!(Deposit::lock(RuntimeOrigin::signed(1), UNIT, 1)); - assert!(Deposit::deposit_of(1).is_some()); - - mock::set_in_use(1, true); - - assert_noop!(Deposit::migrate(RuntimeOrigin::signed(1), 1), >::DepositInUse); + let _ = Balances::deposit_creating(&account_id(), 10_000); + + >::insert(1, mock_deposits(512)); + >::insert(2, mock_deposits(512)); + >::insert(3, mock_deposits(512)); + assert_eq!(Deposit::deposit_of(1).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(2).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(3).unwrap().len(), 512); + + >::on_idle(0, Weight::zero()); + assert_eq!(Deposit::deposit_of(1).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(2).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(3).unwrap().len(), 512); + >::on_idle(0, Weight::zero().add_ref_time(10)); + assert_eq!(Deposit::deposit_of(1).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(2).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(3).unwrap().len(), 502); + >::on_idle(0, Weight::MAX); + assert_eq!(Deposit::deposit_of(1).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(2).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(3).unwrap().len(), 492); + + (0..50).for_each(|_| { + >::on_idle(0, Weight::MAX); + }); + assert_eq!(Deposit::deposit_of(1).unwrap().len(), 512); + assert_eq!(Deposit::deposit_of(2).unwrap().len(), 512); + assert!(Deposit::deposit_of(3).is_none()); - mock::set_in_use(1, false); + (0..50).for_each(|_| { + >::on_idle(0, Weight::MAX); + }); + assert_eq!(Deposit::deposit_of(1).unwrap().len(), 12); + assert_eq!(Deposit::deposit_of(2).unwrap().len(), 512); + assert!(Deposit::deposit_of(3).is_none()); - assert_ok!(Deposit::migrate(RuntimeOrigin::signed(1), 1)); + (0..54).for_each(|_| { + >::on_idle(0, Weight::MAX); + }); assert!(Deposit::deposit_of(1).is_none()); + assert!(Deposit::deposit_of(2).is_none()); + assert!(Deposit::deposit_of(3).is_none()); }); } diff --git a/pallet/deposit/src/weights.rs b/pallet/deposit/src/weights.rs index cd6aeeb2e..586965b26 100644 --- a/pallet/deposit/src/weights.rs +++ b/pallet/deposit/src/weights.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for darwinia_deposit //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("koi-dev"), DB CACHE: 1024 @@ -52,72 +52,13 @@ use core::marker::PhantomData; /// Weight functions needed for darwinia_deposit. pub trait WeightInfo { - fn lock() -> Weight; - fn claim() -> Weight; - fn claim_with_penalty() -> Weight; - fn migrate() -> Weight; + fn migrate_for() -> Weight; fn set_deposit_contract() -> Weight; } /// Weights for darwinia_deposit using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - fn lock() -> Weight { - // Proof Size summary in bytes: - // Measured: `26812` - // Estimated: `29615` - // Minimum execution time: 92_000 nanoseconds. - Weight::from_parts(98_000_000, 0) - .saturating_add(Weight::from_parts(29615, 0)) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim() -> Weight { - // Proof Size summary in bytes: - // Measured: `26541` - // Estimated: `29615` - // Minimum execution time: 70_000 nanoseconds. - Weight::from_parts(82_000_000, 0) - .saturating_add(Weight::from_parts(29615, 0)) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim_with_penalty() -> Weight { - // Proof Size summary in bytes: - // Measured: `26863` - // Estimated: `29615` - // Minimum execution time: 92_000 nanoseconds. - Weight::from_parts(100_000_000, 0) - .saturating_add(Weight::from_parts(29615, 0)) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } /// Storage: `Deposit::Deposits` (r:1 w:1) /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -134,12 +75,12 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Ethereum::Pending` (r:1 w:1) /// Proof: `Ethereum::Pending` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn migrate() -> Weight { + fn migrate_for() -> Weight { // Proof Size summary in bytes: // Measured: `27516` // Estimated: `33456` - // Minimum execution time: 4_057_000 nanoseconds. - Weight::from_parts(4_577_000_000, 0) + // Minimum execution time: 220_000 nanoseconds. + Weight::from_parts(225_000_000, 0) .saturating_add(Weight::from_parts(33456, 0)) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) @@ -159,62 +100,6 @@ impl WeightInfo for SubstrateWeight { // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - fn lock() -> Weight { - // Proof Size summary in bytes: - // Measured: `26812` - // Estimated: `29615` - // Minimum execution time: 92_000 nanoseconds. - Weight::from_parts(98_000_000, 0) - .saturating_add(Weight::from_parts(29615, 0)) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim() -> Weight { - // Proof Size summary in bytes: - // Measured: `26541` - // Estimated: `29615` - // Minimum execution time: 70_000 nanoseconds. - Weight::from_parts(82_000_000, 0) - .saturating_add(Weight::from_parts(29615, 0)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim_with_penalty() -> Weight { - // Proof Size summary in bytes: - // Measured: `26863` - // Estimated: `29615` - // Minimum execution time: 92_000 nanoseconds. - Weight::from_parts(100_000_000, 0) - .saturating_add(Weight::from_parts(29615, 0)) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } /// Storage: `Deposit::Deposits` (r:1 w:1) /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -231,12 +116,12 @@ impl WeightInfo for () { /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Ethereum::Pending` (r:1 w:1) /// Proof: `Ethereum::Pending` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn migrate() -> Weight { + fn migrate_for() -> Weight { // Proof Size summary in bytes: // Measured: `27516` // Estimated: `33456` - // Minimum execution time: 4_057_000 nanoseconds. - Weight::from_parts(4_577_000_000, 0) + // Minimum execution time: 220_000 nanoseconds. + Weight::from_parts(225_000_000, 0) .saturating_add(Weight::from_parts(33456, 0)) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) diff --git a/pallet/ethtx-forwarder/src/lib.rs b/pallet/ethtx-forwarder/src/lib.rs index 6ff411df7..f73fb06c5 100644 --- a/pallet/ethtx-forwarder/src/lib.rs +++ b/pallet/ethtx-forwarder/src/lib.rs @@ -186,8 +186,8 @@ impl Pallet { action: request.action, value: request.value, input: request.input, - // copied from: - // https://github.com/rust-ethereum/ethereum/blob/24739cc8ba6e9d8ee30ada8ec92161e4c48d578e/src/transaction.rs#L798 + // Copied from: + // - https://github.com/rust-ethereum/ethereum/blob/24739cc8ba6e9d8ee30ada8ec92161e4c48d578e/src/transaction.rs#L798 signature: TransactionSignature::new( 38, H256([ @@ -211,8 +211,8 @@ impl Pallet { value: request.value, input: request.input, access_list: Default::default(), - // copied from: - // https://github.com/rust-ethereum/ethereum/blob/24739cc8ba6e9d8ee30ada8ec92161e4c48d578e/src/transaction.rs#L873-L875 + // Copied from: + // - https://github.com/rust-ethereum/ethereum/blob/24739cc8ba6e9d8ee30ada8ec92161e4c48d578e/src/transaction.rs#L873-L875 odd_y_parity: false, // 36b241b061a36a32ab7fe86c7aa9eb592dd59018cd0443adc0903590c16b02b0 r: H256([ @@ -237,8 +237,8 @@ impl Pallet { value: request.value, input: request.input, access_list: Default::default(), - // copied from: - // https://github.com/rust-ethereum/ethereum/blob/24739cc8ba6e9d8ee30ada8ec92161e4c48d578e/src/transaction.rs#L873-L875 + // Copied from: + // - https://github.com/rust-ethereum/ethereum/blob/24739cc8ba6e9d8ee30ada8ec92161e4c48d578e/src/transaction.rs#L873-L875 odd_y_parity: false, // 36b241b061a36a32ab7fe86c7aa9eb592dd59018cd0443adc0903590c16b02b0 r: H256([ @@ -280,7 +280,11 @@ impl Pallet { .validate_in_block_for(&who) .and_then(|v| v.with_base_fee()) .and_then(|v| v.with_balance_for(&who)) - .map_err(|e| >::ValidationError(e))?; + .map_err(|e| { + log::error!("transaction validation failed due to {e:?}"); + + >::ValidationError(e) + })?; Ok(transaction) } @@ -358,7 +362,7 @@ pub enum TxType { } // TODO: replace it with upstream error type -#[derive(Encode, Decode, TypeInfo, PalletError)] +#[derive(Debug, Encode, Decode, TypeInfo, PalletError)] pub enum TxErrorWrapper { GasLimitTooLow, GasLimitTooHigh, diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 07ac07172..9c20d6d35 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -15,11 +15,8 @@ scale-info = { workspace = true } # darwinia darwinia-ethtx-forwarder = { workspace = true } -darwinia-staking-traits = { workspace = true } dc-inflation = { workspace = true } dc-types = { workspace = true } -# darwinia optional -darwinia-deposit = { workspace = true, optional = true } # frontier fp-evm = { workspace = true } @@ -40,9 +37,6 @@ frame-benchmarking = { workspace = true, optional = true } pretty_env_logger = { version = "0.5" } serde = { version = "1.0", features = ["derive"] } -# darwinia -darwinia-deposit = { workspace = true, features = ["std"] } - # polkadot-sdk pallet-balances = { workspace = true, features = ["std"] } pallet-session = { workspace = true, features = ["std"] } @@ -61,10 +55,7 @@ std = [ # darwinia "darwinia-ethtx-forwarder/std", - "darwinia-staking-traits/std", "dc-inflation/std", - # darwinia optional - "darwinia-deposit?/std", # frontier "fp-evm/std", @@ -84,9 +75,7 @@ std = [ runtime-benchmarks = [ # darwinia - "darwinia-deposit", "darwinia-ethtx-forwarder/runtime-benchmarks", - "darwinia-staking-traits/runtime-benchmarks", # polkadot-sdk "frame-benchmarking/runtime-benchmarks", diff --git a/pallet/staking/src/benchmarking.rs b/pallet/staking/src/benchmarking.rs index 5a93666e8..ae388fc25 100644 --- a/pallet/staking/src/benchmarking.rs +++ b/pallet/staking/src/benchmarking.rs @@ -18,8 +18,6 @@ // darwinia use crate::*; -use darwinia_deposit::SimpleAsset; -use dc_types::UNIT; // polkadot-sdk use frame_benchmarking::v2; use frame_system::RawOrigin; @@ -29,142 +27,37 @@ use sp_std::prelude::*; mod benchmarks { // darwinia use super::*; - // polkadot-sdk - use frame_support::traits::Currency; - - fn deposit_for(who: &T::AccountId, count: u32) -> Vec> - where - T: Config + darwinia_deposit::Config, - { - (0..count.min(<::MaxDeposits>::get()) as u16) - .map(|x| { - >::lock( - RawOrigin::Signed(who.to_owned()).into(), - UNIT, - 1, - ) - .unwrap(); - - x.into() - }) - .collect() - } - - #[benchmark] - fn stake(x: Linear<0, 1_023>) { - let a = frame_benchmarking::whitelisted_caller(); - - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - ::Ring::make_free_balance_be(&a, 1_024 * UNIT + 1); - ::Kton::mint(&a, UNIT).unwrap(); - - let deposits = deposit_for::(&a, x); - - // Worst-case scenario: - // - // The total number of deposit items has reached `darwinia_deposits::Config::MaxDeposits`. - #[extrinsic_call] - _(RawOrigin::Signed(a), UNIT, deposits); - } - - #[benchmark] - fn unstake(x: Linear<0, 1_023>) { - let a = frame_benchmarking::whitelisted_caller(); - - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - ::Ring::make_free_balance_be(&a, 1_024 * UNIT + 1); - ::Kton::mint(&a, UNIT).unwrap(); - - let deposits = deposit_for::(&a, x); - - >::stake(RawOrigin::Signed(a.clone()).into(), UNIT, deposits.clone()).unwrap(); - - // Worst-case scenario: - // - // The total number of deposit items has reached `darwinia_deposits::Config::MaxDeposits`. - #[extrinsic_call] - _(RawOrigin::Signed(a), UNIT, deposits); - } #[benchmark] - fn collect() { - let a = frame_benchmarking::whitelisted_caller(); - - // Worst-case scenario: - // - // None. - #[extrinsic_call] - _(RawOrigin::Signed(a), Default::default()); - } - - #[benchmark] - fn nominate() { + fn unstake_all_for() { let a = frame_benchmarking::whitelisted_caller::(); let a_cloned = a.clone(); - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - ::Ring::make_free_balance_be(&a, UNIT + 1); - - >::stake(RawOrigin::Signed(a.clone()).into(), UNIT, Default::default()).unwrap(); - >::collect(RawOrigin::Signed(a.clone()).into(), Default::default()).unwrap(); + T::Currency::make_free_balance_be(&account_id(), 1); + >::insert(&a, Ledger { ring: 1, deposits: BoundedVec::new() }); - // Worst-case scenario: - // - // Nominate the target collator successfully. #[extrinsic_call] _(RawOrigin::Signed(a), a_cloned); } #[benchmark] - fn chill() { - let a = frame_benchmarking::whitelisted_caller::(); - - // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. - ::Ring::make_free_balance_be(&a, UNIT + 1); - - >::stake(RawOrigin::Signed(a.clone()).into(), UNIT, Default::default()).unwrap(); - >::collect(RawOrigin::Signed(a.clone()).into(), Default::default()).unwrap(); - >::nominate(RawOrigin::Signed(a.clone()).into(), a.clone()).unwrap(); - - // Worst-case scenario: - // - // Collect and nominate at the same time. - #[extrinsic_call] - _(RawOrigin::Signed(a)); - } - - #[benchmark] - fn payout() { + fn allocate_ring_staking_reward_of() { let a = frame_benchmarking::whitelisted_caller::(); let a_cloned = a.clone(); - call_on_cache_v1!(>::insert( - &a, - Exposure { - commission: Perbill::zero(), - vote: 32, - nominators: (0..32) - .map(|i| IndividualExposure { - who: frame_benchmarking::account("", i, i), - vote: 1, - }) - .collect(), - }, - )) - .unwrap(); - >::insert(&a, 500); + >::insert(&a, 1); #[extrinsic_call] _(RawOrigin::Signed(a), a_cloned); } #[benchmark] - fn set_rate_limit() { + fn set_ring_staking_contract() { // Worst-case scenario: // // Set successfully. #[extrinsic_call] - _(RawOrigin::Root, 1); + _(RawOrigin::Root, frame_benchmarking::whitelisted_caller::()); } #[benchmark] @@ -187,7 +80,7 @@ mod benchmarks { frame_benchmarking::impl_benchmark_test_suite!( Pallet, - crate::mock::ExtBuilder::default().build(), + crate::mock::ExtBuilder.build(), crate::mock::Runtime ); } diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index be6b32a8d..3a53e3c5f 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -16,23 +16,91 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -//! # Darwinia parachain staking pallet +//! # Darwinia Staking Pallet //! //! ## Overview //! -//! This is a completely specialized stake pallet designed only for Darwinia parachain. +//! This is a completely specialized stake pallet designed only for Darwinia. //! So, this pallet will eliminate the generic parameters as much as possible. -//! -//! ### Acceptable stakes: -//! - RING: Darwinia's native token -//! - Deposit: Locking RINGs' ticket -// TODO: check this after the migration is complete. -#![allow(clippy::needless_borrows_for_generic_args)] #![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] #![allow(clippy::needless_borrows_for_generic_args)] +#[allow(missing_docs)] +pub mod migration { + // darwinia + use crate::*; + // polkadot-sdk + use frame_support::migration; + + const PALLET: &[u8] = b"DarwiniaStaking"; + + pub fn migrate() -> (u64, u64) + where + T: Config, + { + fn clear(item: &[u8], r: &mut u64, w: &mut u64) { + let res = migration::clear_storage_prefix(PALLET, item, &[], None, None); + + *r += res.loops as u64; + *w += res.backend as u64; + } + + let rw @ (mut r, mut w) = (1, 1); + + clear(b"Collators", &mut r, &mut w); + clear(b"Nominators", &mut r, &mut w); + clear(b"ExposureCacheStates", &mut r, &mut w); + clear(b"ExposureCache0", &mut r, &mut w); + clear(b"ExposureCache1", &mut r, &mut w); + clear(b"ExposureCache2", &mut r, &mut w); + clear(b"CacheStates", &mut r, &mut w); + clear(b"CollatorsCache0", &mut r, &mut w); + clear(b"CollatorsCache1", &mut r, &mut w); + clear(b"CollatorsCache2", &mut r, &mut w); + clear(b"MigrationStartPoint", &mut r, &mut w); + clear(b"RateLimit", &mut r, &mut w); + clear(b"RateLimitState", &mut r, &mut w); + + if let Some(abc) = migration::take_storage_value::<( + BlockNumberFor, + BTreeMap>, + )>(PALLET, b"AuthoredBlocksCount", &[]) + { + >::put(abc); + } + + rw + } + + pub fn post_check() + where + T: Config, + { + fn assert_is_none(item: &[u8]) { + assert!(!migration::have_storage_value(PALLET, item, &[])); + } + + assert_is_none(b"Collators"); + assert_is_none(b"Nominators"); + assert_is_none(b"ExposureCacheStates"); + assert_is_none(b"ExposureCache0"); + assert_is_none(b"ExposureCache1"); + assert_is_none(b"ExposureCache2"); + assert_is_none(b"CacheStates"); + assert_is_none(b"CollatorsCache0"); + assert_is_none(b"CollatorsCache1"); + assert_is_none(b"CollatorsCache2"); + assert_is_none(b"MigrationStartPoint"); + assert_is_none(b"RateLimit"); + assert_is_none(b"RateLimitState"); + assert_is_none(b"AuthoredBlocksCount"); + + assert!(>::exists()); + } +} + #[cfg(test)] mod mock; #[cfg(test)] @@ -44,8 +112,6 @@ mod benchmarking; mod weights; pub use weights::WeightInfo; -pub use darwinia_staking_traits::*; - // crates.io use codec::FullCodec; use ethabi::{Function, Param, ParamType, StateMutability, Token}; @@ -54,83 +120,26 @@ use dc_types::{Balance, Moment}; // polkadot-sdk use frame_support::{ pallet_prelude::*, - traits::{Currency, UnixTime}, - DefaultNoBound, EqNoBound, PalletId, PartialEqNoBound, + traits::{Currency, ExistenceRequirement, UnixTime}, + DefaultNoBound, PalletId, }; -use frame_system::{pallet_prelude::*, RawOrigin}; -use pallet_session::ShouldEndSession as _; +use frame_system::pallet_prelude::*; use sp_core::H160; use sp_runtime::{ - traits::{AccountIdConversion, Convert, One, Zero}, + traits::{AccountIdConversion, Convert, One}, Perbill, }; use sp_std::{collections::btree_map::BTreeMap, prelude::*}; -/// Make it easier to call a function on a specific exposure storage. -#[macro_export] -macro_rules! call_on_cache_v1 { - ($s_e:expr, <$s:ident<$t:ident>>$($f:tt)*) => {{ - match $s_e { - ($crate::CacheState::$s, _, _) => Ok(<$crate::ExposureCache0<$t>>$($f)*), - (_, $crate::CacheState::$s, _) => Ok(<$crate::ExposureCache1<$t>>$($f)*), - (_, _, $crate::CacheState::$s) => Ok(<$crate::ExposureCache2<$t>>$($f)*), - _ => { - log::error!("exposure cache states must be correct; qed"); - - Err("[pallet::staking] exposure cache states must be correct; qed") - }, - } - }}; - (<$s:ident<$t:ident>>$($f:tt)*) => {{ - let s = <$crate::CacheStates<$t>>::get(); - - $crate::call_on_cache_v1!(s, <$s<$t>>$($f)*) - }}; -} -/// Make it easier to call a function on a specific collators storage. -#[macro_export] -macro_rules! call_on_cache_v2 { - ($s_e:expr, <$s:ident<$t:ident>>$($f:tt)*) => {{ - match $s_e { - ($crate::CacheState::$s, _, _) => Ok(<$crate::CollatorsCache0<$t>>$($f)*), - (_, $crate::CacheState::$s, _) => Ok(<$crate::CollatorsCache1<$t>>$($f)*), - (_, _, $crate::CacheState::$s) => Ok(<$crate::CollatorsCache2<$t>>$($f)*), - _ => { - log::error!("collators cache states must be correct; qed"); - - Err("[pallet::staking] collators cache states must be correct; qed") - }, - } - }}; - (<$s:ident<$t:ident>>$($f:tt)*) => {{ - let s = <$crate::CacheStates<$t>>::get(); - - $crate::call_on_cache_v2!(s, <$s<$t>>$($f)*) - }}; -} - -type DepositId = <::Deposit as Stake>::Item; - const PAYOUT_FRAC: Perbill = Perbill::from_percent(40); -const DAY_IN_MILLIS: Moment = 24 * 60 * 60 * 1_000; #[frame_support::pallet] pub mod pallet { // darwinia use crate::*; - // Deposit helper for runtime benchmark. - #[cfg(feature = "runtime-benchmarks")] - use darwinia_deposit::Config as DepositConfig; - - const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); - - /// Empty trait acts as a place holder to satisfy the `#[pallet::config]` macro. - #[cfg(not(feature = "runtime-benchmarks"))] - pub trait DepositConfig {} - #[pallet::config] - pub trait Config: frame_system::Config + DepositConfig { + pub trait Config: frame_system::Config { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -140,21 +149,12 @@ pub mod pallet { /// Unix time interface. type UnixTime: UnixTime; - /// Pass [`pallet_session::Config::ShouldEndSession`]'s result to here. - type ShouldEndSession: Get; - /// Currency interface to pay the reward. type Currency: Currency; /// Inflation and reward manager. type IssuingManager: IssuingManager; - /// RING [`Stake`] interface. - type Ring: Stake; - - /// Deposit [`StakeExt`] interface. - type Deposit: StakeExt; - /// RING staking interface. type RingStaking: Election + Reward; @@ -163,42 +163,26 @@ pub mod pallet { /// Treasury address. type Treasury: Get; - - /// Maximum deposit count. - #[pallet::constant] - type MaxDeposits: Get; } #[allow(missing_docs)] #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// An account has staked some assets. - Staked { who: T::AccountId, ring_amount: Balance, deposits: Vec> }, - /// An account has unstaked assets. - Unstaked { who: T::AccountId, ring_amount: Balance, deposits: Vec> }, - /// A collator has updated their commission. - CommissionUpdated { who: T::AccountId, commission: Perbill }, - /// A payout has been made for the staker. - Payout { who: T::AccountId, amount: Balance }, - /// Unable to pay the staker's reward. - Unpaid { who: T::AccountId, amount: Balance }, + /// Reward allocated to the account. + RewardAllocated { who: T::AccountId, amount: Balance }, + /// Fail to allocate the reward to the account. + RewardAllocationFailed { who: T::AccountId, amount: Balance }, + /// Unstake all stakes for the account. + UnstakeAllFor { who: T::AccountId }, } #[pallet::error] pub enum Error { - /// Exceed maximum deposit count. - ExceedMaxDeposits, - /// Exceed rate limit. - ExceedRateLimit, - /// Deposit not found. - DepositNotFound, - /// You are not a staker. - NotStaker, - /// Target is not a collator. - TargetNotCollator, /// Collator count mustn't be zero. ZeroCollatorCount, + /// No record for the account. + NoRecord, /// No reward to pay for this collator. NoReward, } @@ -206,82 +190,18 @@ pub mod pallet { /// All staking ledgers. #[pallet::storage] #[pallet::getter(fn ledger_of)] - pub type Ledgers = StorageMap<_, Blake2_128Concat, T::AccountId, Ledger>; - - /// The map from (wannabe) collator to the preferences of that collator. - #[pallet::storage] - #[pallet::getter(fn collator_of)] - pub type Collators = StorageMap<_, Twox64Concat, T::AccountId, Perbill>; - - /// Collator/Exposure cache states. - /// - /// To avoid extra DB RWs during new session, such as: - /// ```nocompile - /// previous = current; - /// current = next; - /// next = elect(); - /// ``` - /// - /// Now, with data: - /// ```nocompile - /// cache1 == previous; - /// cache2 == current; - /// cache3 == next; - /// ``` - /// Just need to shift the marker and write the storage map once: - /// ```nocompile - /// mark(cache3, current); - /// mark(cache2, previous); - /// mark(cache1, next); - /// cache1 = elect(); - /// ``` - #[pallet::storage] - #[pallet::getter(fn exposure_cache_states)] - pub type CacheStates = - StorageValue<_, (CacheState, CacheState, CacheState), ValueQuery, CacheStatesDefault>; - /// Default value for [`CacheStates`]. - #[pallet::type_value] - pub fn CacheStatesDefault() -> (CacheState, CacheState, CacheState) { - (CacheState::Previous, CacheState::Current, CacheState::Next) - } - - /// Exposure cache 0. - #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn exposure_cache_0_of)] - pub type ExposureCache0 = - StorageMap<_, Twox64Concat, T::AccountId, Exposure>; - - /// Exposure cache 1. - #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn exposure_cache_1_of)] - pub type ExposureCache1 = - StorageMap<_, Twox64Concat, T::AccountId, Exposure>; - - /// Exposure cache 2. - #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn exposure_cache_2_of)] - pub type ExposureCache2 = - StorageMap<_, Twox64Concat, T::AccountId, Exposure>; + pub type Ledgers = StorageMap<_, Blake2_128Concat, T::AccountId, Ledger>; /// The ideal number of active collators. #[pallet::storage] #[pallet::getter(fn collator_count)] pub type CollatorCount = StorageValue<_, u32, ValueQuery>; - /// The map from nominator to their nomination preferences, namely the collator that - /// they wish to support. - #[pallet::storage] - #[pallet::getter(fn nominator_of)] - pub type Nominators = StorageMap<_, Twox64Concat, T::AccountId, T::AccountId>; - /// Number of blocks authored by the collator within current session. #[pallet::storage] #[pallet::unbounded] #[pallet::getter(fn authored_block_count)] - pub type AuthoredBlocksCount = + pub type AuthoredBlockCount = StorageValue<_, (BlockNumberFor, BTreeMap>), ValueQuery>; /// All outstanding rewards since the last payment. @@ -300,20 +220,6 @@ pub mod pallet { #[pallet::getter(fn elapsed_time)] pub type ElapsedTime = StorageValue<_, Moment, ValueQuery>; - /// Rate limit. - /// - /// The maximum amount of RING that can be staked or unstaked in one session. - #[pallet::storage] - #[pallet::getter(fn rate_limit)] - pub type RateLimit = StorageValue<_, Balance, ValueQuery>; - - /// Rate limit state. - /// - /// Tracks the rate limit state in a session. - #[pallet::storage] - #[pallet::getter(fn rate_limit_state)] - pub type RateLimitState = StorageValue<_, RateLimiter, ValueQuery>; - /// RING staking contract address. #[pallet::storage] #[pallet::getter(fn ring_staking_contract)] @@ -323,30 +229,6 @@ pub mod pallet { #[pallet::getter(fn kton_staking_contract)] pub type KtonStakingContract = StorageValue<_, T::AccountId>; - /// Migration start point. - #[pallet::storage] - #[pallet::getter(fn migration_start_point)] - pub type MigrationStartPoint = StorageValue<_, Moment, ValueQuery>; - - // TODO: use `BoundedVec`. - /// Exposure cache 0. - #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn collators_cache_0)] - pub type CollatorsCache0 = StorageValue<_, Vec, ValueQuery>; - - /// Exposure cache 1. - #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn collators_cache_1)] - pub type CollatorsCache1 = StorageValue<_, Vec, ValueQuery>; - - /// Exposure cache 2. - #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn collators_cache_2)] - pub type CollatorsCache2 = StorageValue<_, Vec, ValueQuery>; - #[derive(DefaultNoBound)] #[pallet::genesis_config] pub struct GenesisConfig { @@ -354,12 +236,10 @@ pub mod pallet { pub now: Moment, /// The running time of Darwinia1. pub elapsed_time: Moment, - /// Rate limit. - pub rate_limit: Balance, /// Genesis collator count. pub collator_count: u32, - /// Genesis collator preferences. - pub collators: Vec<(T::AccountId, Balance)>, + #[allow(missing_docs)] + pub _marker: PhantomData, } #[pallet::genesis_build] @@ -371,231 +251,49 @@ pub mod pallet { >::put(self.now); >::put(self.elapsed_time); - >::put(self.rate_limit); >::put(self.collator_count); - - self.collators.iter().for_each(|(who, ring_amount)| { - >::stake( - RawOrigin::Signed(who.to_owned()).into(), - *ring_amount, - Vec::new(), - ) - .expect("[pallet::staking] 0, genesis must be built; qed"); - >::collect(RawOrigin::Signed(who.to_owned()).into(), Default::default()) - .expect("[pallet::staking] 1, genesis must be built; qed"); - >::nominate(RawOrigin::Signed(who.to_owned()).into(), who.to_owned()) - .expect("[pallet::staking] 2, genesis must be built; qed"); - }); } } #[pallet::pallet] - #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(_: BlockNumberFor) -> Weight { - // There are already plenty of tasks to handle during the new session, - // so refrain from assigning any additional ones here. - if !T::ShouldEndSession::get() { - let w2 = call_on_cache_v2!(>::get()) - .map(|cs| { - let mut cs = cs.into_iter(); - let w = cs - .by_ref() - // ? make this value adjustable. - .take(1) - .fold(Weight::zero(), |acc, c| { - acc + Self::payout_inner(c).unwrap_or(Zero::zero()) - }); - let _ = call_on_cache_v2!(>::put(cs.collect::>())); - - w - }) - .unwrap_or_default(); - let w1 = call_on_cache_v1!(>::iter_keys() - // ? make this value adjustable. - .take(1) - .fold(Weight::zero(), |acc, c| acc - + Self::payout_inner(c).unwrap_or(Zero::zero()))) - .unwrap_or_default(); - - w1 + w2 - } else { - Zero::zero() - } + fn on_idle(_: BlockNumberFor, mut remaining_weight: Weight) -> Weight { + Self::idle_allocate_ring_staking_reward(&mut remaining_weight); + Self::idle_unstake(&mut remaining_weight); + + remaining_weight } } #[pallet::call] impl Pallet { - /// Add stakes to the staking pool. - /// - /// This will transfer the stakes to a pallet/contact account. + /// Withdraw all stakes. #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::stake(deposits.len() as _))] - pub fn stake( - origin: OriginFor, - ring_amount: Balance, - deposits: Vec>, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - if ring_amount == 0 && deposits.is_empty() { - return Ok(()); - } - - let flow_in_amount = >::try_mutate(&who, |l| { - let l = if let Some(l) = l { - l - } else { - >::inc_consumers(&who)?; - - *l = Some(Ledger { ring: Default::default(), deposits: Default::default() }); - - l.as_mut().expect("[pallet::staking] `l` must be some; qed") - }; - let mut v = ring_amount; - - if ring_amount != 0 { - Self::stake_ring(&who, &mut l.ring, ring_amount)?; - } - - for d in deposits.clone() { - v = v.saturating_add(T::Deposit::amount(&who, d).unwrap_or_default()); - - Self::stake_deposit(&who, l, d)?; - } + #[pallet::weight(::WeightInfo::unstake_all_for())] + pub fn unstake_all_for(origin: OriginFor, who: T::AccountId) -> DispatchResult { + ensure_signed(origin)?; - >::Ok(v) - })?; + let leger = >::take(&who).ok_or(>::NoRecord)?; - if let Some(r) = - >::get().flow_in(flow_in_amount, >::get()) - { - >::put(r); - } else { - Err(>::ExceedRateLimit)?; - } - - Self::deposit_event(Event::Staked { who, ring_amount, deposits }); + Self::unstake_all_for_inner(who, leger)?; Ok(()) } - /// Withdraw stakes from the staking pool. + /// Allocate the RING staking rewards to the designated RING staking contract of a + /// particular collator. #[pallet::call_index(1)] - #[pallet::weight(::WeightInfo::unstake(deposits.len() as _))] - pub fn unstake( + #[pallet::weight(::WeightInfo::allocate_ring_staking_reward_of())] + pub fn allocate_ring_staking_reward_of( origin: OriginFor, - ring_amount: Balance, - deposits: Vec>, + who: T::AccountId, ) -> DispatchResult { - let who = ensure_signed(origin)?; - - if ring_amount == 0 && deposits.is_empty() { - return Ok(()); - } - - let flow_out_amount = >::try_mutate(&who, |l| { - let l = l.as_mut().ok_or(>::NotStaker)?; - let mut v = ring_amount; - - if ring_amount != 0 { - l.ring = l - .ring - .checked_sub(ring_amount) - .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; - - ::Ring::unstake(&who, ring_amount)?; - } - - for d in deposits { - v = v.saturating_add(T::Deposit::amount(&who, d).unwrap_or_default()); - - l.deposits.remove( - l.deposits - .iter() - .position(|d_| d_ == &d) - .ok_or(>::DepositNotFound)?, - ); - - T::Deposit::unstake(&who, d)?; - } - - >::Ok(v) - })?; - - if let Some(r) = - >::get().flow_out(flow_out_amount, >::get()) - { - >::put(r); - } else { - Err(>::ExceedRateLimit)?; - } - - Self::try_clean_ledger_of(&who); - - Ok(()) - } - - /// Declare the desire to collect. - /// - /// Effects will be felt at the beginning of the next session. - #[pallet::call_index(4)] - #[pallet::weight(::WeightInfo::collect())] - pub fn collect(origin: OriginFor, commission: Perbill) -> DispatchResult { - let who = ensure_signed(origin)?; - - >::mutate(&who, |c| *c = Some(commission)); - - Self::deposit_event(Event::CommissionUpdated { who, commission }); - - Ok(()) - } - - /// Declare the desire to nominate a collator. - /// - /// Effects will be felt at the beginning of the next session. - #[pallet::call_index(5)] - #[pallet::weight(::WeightInfo::nominate())] - pub fn nominate(origin: OriginFor, target: T::AccountId) -> DispatchResult { - let who = ensure_signed(origin)?; - - if !>::contains_key(&who) { - Err(>::NotStaker)? - } - if !>::contains_key(&target) { - Err(>::TargetNotCollator)?; - } - - >::mutate(&who, |n| *n = Some(target)); - - Ok(()) - } - - /// Declare no desire to either collect or nominate. - /// - /// Effects will be felt at the beginning of the next era. - /// - /// If the target is a collator, its nominators need to re-nominate. - #[pallet::call_index(6)] - #[pallet::weight(::WeightInfo::chill())] - pub fn chill(origin: OriginFor) -> DispatchResult { - let who = ensure_signed(origin)?; - - >::remove(&who); - >::remove(&who); - - Ok(()) - } - - /// Making the payout for the specified collators and its nominators. - #[pallet::call_index(8)] - #[pallet::weight(::WeightInfo::payout())] - pub fn payout(origin: OriginFor, who: T::AccountId) -> DispatchResult { ensure_signed(origin)?; - Self::payout_inner(who)?; + let amount = >::take(&who).ok_or(>::NoReward)?; + + Self::allocate_ring_staking_reward_of_inner(who, amount)?; Ok(()) } @@ -605,7 +303,7 @@ pub mod pallet { /// This will apply to the incoming session. /// /// Require root origin. - #[pallet::call_index(7)] + #[pallet::call_index(2)] #[pallet::weight(::WeightInfo::set_collator_count())] pub fn set_collator_count(origin: OriginFor, count: u32) -> DispatchResult { ensure_root(origin)?; @@ -619,19 +317,10 @@ pub mod pallet { Ok(()) } - /// Set the max unstake RING limit. - #[pallet::call_index(9)] - #[pallet::weight(::WeightInfo::set_rate_limit())] - pub fn set_rate_limit(origin: OriginFor, amount: Balance) -> DispatchResult { - ensure_root(origin)?; - - >::put(amount); - - Ok(()) - } - /// Set the RING reward distribution contract address. - #[pallet::call_index(11)] + /// + /// Require root origin. + #[pallet::call_index(3)] #[pallet::weight(::WeightInfo::set_ring_staking_contract())] pub fn set_ring_staking_contract( origin: OriginFor, @@ -645,7 +334,9 @@ pub mod pallet { } /// Set the KTON reward distribution contract address. - #[pallet::call_index(10)] + /// + /// Require root origin. + #[pallet::call_index(4)] #[pallet::weight(::WeightInfo::set_kton_staking_contract())] pub fn set_kton_staking_contract( origin: OriginFor, @@ -662,277 +353,144 @@ pub mod pallet { where T: Config, { - fn stake_ring(who: &T::AccountId, staked: &mut Balance, amount: Balance) -> DispatchResult { - ::Ring::stake(who, amount)?; - - *staked = staked - .checked_add(amount) - .ok_or("[pallet::staking] `u128` must not be overflowed; qed")?; - - Ok(()) - } - - fn stake_deposit( - who: &T::AccountId, - ledger: &mut Ledger, - deposit: DepositId, - ) -> DispatchResult { - T::Deposit::stake(who, deposit)?; - - ledger.deposits.try_push(deposit).map_err(|_| >::ExceedMaxDeposits)?; - - Ok(()) - } - - fn try_clean_ledger_of(who: &T::AccountId) { - let _ = >::try_mutate(who, |maybe_l| { - let l = maybe_l.as_mut().ok_or(())?; - - if l.is_empty() { - *maybe_l = None; - - >::dec_consumers(who); - - Ok(()) - } else { - Err(()) - } - }); - } - - /// Update the record of block production. - pub fn note_authors(authors: &[T::AccountId]) { - >::mutate(|(total, map)| { - authors.iter().cloned().for_each(|c| { - *total += One::one(); - - map.entry(c).and_modify(|p_| *p_ += One::one()).or_insert(One::one()); + pub(crate) fn note_authors(authors: &[T::AccountId]) { + >::mutate(|(total_block_count, author_map)| { + authors.iter().cloned().for_each(|who| { + author_map + .entry(who) + .and_modify(|authored_block_count| *authored_block_count += One::one()) + .or_insert(One::one()); + + *total_block_count += One::one(); }); }); } - /// Calculate the stakes of the given account. - pub fn stake_of(who: &T::AccountId) -> Balance { - >::get(who) - .map(|l| { - l.ring - + l.deposits - .into_iter() - // We don't care if the deposit exists here. - // It was guaranteed by the `stake`/`unstake`/`restake` functions. - .fold(0, |r, d| r + T::Deposit::amount(who, d).unwrap_or_default()) - }) - .unwrap_or_default() - } + /// Allocate the session reward. + pub fn allocate_session_reward(amount: Balance) { + let treasury = ::Treasury::get(); - /// Distribute the session reward to staking pot and update the stakers' reward record. - pub fn distribute_session_reward(amount: Balance) { - let who = ::Treasury::get(); - - if T::IssuingManager::reward(&who, amount).is_ok() { - Self::deposit_event(Event::Payout { who, amount }); + if T::IssuingManager::reward(amount).is_ok() { + Self::deposit_event(Event::RewardAllocated { who: treasury, amount }); } else { - Self::deposit_event(Event::Unpaid { who, amount }); + Self::deposit_event(Event::RewardAllocationFailed { who: treasury, amount }); } - let reward_r = amount.saturating_div(2); - let reward_k = amount.saturating_sub(reward_r); - let (b_total, map) = >::take(); + let reward_to_ring_staking = amount.saturating_div(2); + let reward_to_kton_staking = amount.saturating_sub(reward_to_ring_staking); + let (total_block_count, author_map) = >::take(); - map.into_iter().for_each(|(c, b)| { - let r = Perbill::from_rational(b, b_total).mul_floor(reward_r); + author_map.into_iter().for_each(|(who, authored_block_count)| { + let incoming_reward = + Perbill::from_rational(authored_block_count, total_block_count) + .mul_floor(reward_to_ring_staking); - >::mutate(c, |u| *u = u.map(|u| u + r).or(Some(r))); + >::mutate(who, |maybe_pending_reward| { + *maybe_pending_reward = maybe_pending_reward + .map(|pending_reward| pending_reward + incoming_reward) + .or(Some(incoming_reward)) + }); }); - T::KtonStaking::distribute(None, reward_k); + T::KtonStaking::allocate(None, reward_to_kton_staking); } - /// Pay the reward to the collator and its nominators. - pub fn payout_inner(collator: T::AccountId) -> Result { - // Pay to V2. - if call_on_cache_v2!(>::get()).unwrap_or_default().contains(&collator) { - T::RingStaking::distribute( - Some(collator.clone()), - >::take(&collator).ok_or(>::NoReward)?, - ); - } - // Pay to V1. - else if let Ok(Some(c_exposure)) = call_on_cache_v1!(>::take(&collator)) { - let c_total_payout = - >::take(&collator).ok_or(>::NoReward)?; - let mut c_payout = c_exposure.commission * c_total_payout; - let n_payout = c_total_payout - c_payout; - for n_exposure in c_exposure.nominators { - let n_payout = - Perbill::from_rational(n_exposure.vote, c_exposure.vote) * n_payout; - - if collator == n_exposure.who { - // If the collator nominated themselves. - - c_payout += n_payout; - } else if T::IssuingManager::reward(&n_exposure.who, n_payout).is_ok() { - Self::deposit_event(Event::Payout { - who: n_exposure.who, - amount: n_payout, - }); - } else { - Self::deposit_event(Event::Unpaid { - who: n_exposure.who, - amount: n_payout, - }); - } - } - - if T::IssuingManager::reward(&collator, c_payout).is_ok() { - Self::deposit_event(Event::Payout { who: collator, amount: c_payout }); - } else { - Self::deposit_event(Event::Unpaid { who: collator, amount: c_payout }); - } - } else { - // Impossible case. + pub(crate) fn allocate_ring_staking_reward_of_inner( + who: T::AccountId, + amount: Balance, + ) -> DispatchResult { + T::RingStaking::allocate(Some(who.clone()), amount); - Err(>::NoReward)?; - } + Self::deposit_event(Event::RewardAllocated { who, amount }); - Ok(::WeightInfo::payout()) + Ok(()) } - /// Prepare the session state. - pub fn prepare_new_session(index: u32) -> Option> { - >::kill(); - >::shift_cache_states(); - - #[allow(deprecated)] - call_on_cache_v1!(>::remove_all(None)).ok()?; - call_on_cache_v2!(>::kill()).ok()?; - + fn prepare_new_session(i: u32) -> Option> { let bn = >::block_number(); - log::info!("assembling new collators for new session {index} at #{bn:?}",); - - let (n1, n2) = Self::elect_ns(); - // TODO: update this once the migration is completed. - // let cs_from_contract = Self::elect_from_contract(n1)?; - // let cs_from_pallet = Self::elect(n2)?; - let cs_from_contract = Self::elect_from_contract(n1).unwrap_or_default(); - let cs_from_pallet = Self::elect(n2) - .unwrap_or_default() - .into_iter() - .filter(|c| !cs_from_contract.contains(c)) - .collect(); - - log::info!("collators from contract {cs_from_contract:?}"); - log::info!("collators from pallet {cs_from_pallet:?}"); + log::info!("assembling new collators for new session {i} at #{bn:?}",); - let cs = [cs_from_contract, cs_from_pallet].concat(); + let collators = T::RingStaking::elect(>::get()).unwrap_or_default(); - if cs.is_empty() { - // TODO: update this once the migration is completed. - // Possible case under the hybrid election mode. - - // Impossible case. - // - // But if there is an issue, retain the old collators; do not alter the session - // collators if any error occurs to prevent the chain from stalling. + if collators.is_empty() { None } else { - Some(cs) + Some(collators) } } - /// Shift the exposure cache states. - /// - /// Previous Current Next - /// Next Previous Current - /// Current Next Previous - /// - /// ```nocompile - /// loop { mutate(2, 0, 1) } - /// ``` - pub fn shift_cache_states() { - let (s0, s1, s2) = >::get(); - - >::put((s2, s0, s1)); - } - - /// Elect the new collators. - /// - /// This should only be called by the [`pallet_session::SessionManager::new_session`]. - pub fn elect(n: u32) -> Option> { - let nominators = >::iter().collect::>(); - let mut collators = >::iter() - .map(|(c, cm)| { - let scaler = Perbill::one() - cm; - let mut collator_v = 0; - let nominators = nominators - .iter() - .filter_map(|(n, c_)| { - if c_ == &c { - let nominator_v = scaler * Self::stake_of(n); - - collator_v += nominator_v; - - Some(IndividualExposure { who: n.to_owned(), vote: nominator_v }) - } else { - None - } - }) - .collect(); + fn idle_allocate_ring_staking_reward(remaining_weight: &mut Weight) { + const MAX_TASKS: usize = 10; - ((c, Exposure { commission: cm, vote: collator_v, nominators }), collator_v) - }) - .collect::>(); + #[cfg(test)] + let wt = Weight::zero().add_ref_time(1); + #[cfg(not(test))] + let wt = T::WeightInfo::allocate_ring_staking_reward_of(); + let mut consumer = >::iter().drain(); - collators.sort_by(|(_, a), (_, b)| b.cmp(a)); + for i in 0..MAX_TASKS { + if i >= MAX_TASKS { + break; + } - let cache_states = >::get(); + if let Some(rw) = remaining_weight.checked_sub(&wt) { + *remaining_weight = rw; + } else { + break; + } + if let Some((k, v)) = consumer.next() { + let _ = Self::allocate_ring_staking_reward_of_inner(k, v); + } else { + // There is nothing to do; add the weight back. + *remaining_weight += wt; - collators - .into_iter() - .take(n as _) - .map(|((c, e), _)| { - call_on_cache_v1!(cache_states, >::insert(&c, e)).map(|_| c).ok() - }) - .collect() + break; + } + } } - } - // Implementation part.2. - // - // After the migration is completed, - // the following implementation blocks will be merged into one. - impl Pallet - where - T: Config, - { - /// Elect the new collators. - pub fn elect_ns() -> (u32, u32) { - let n = >::get(); - let n1 = Self::migration_progress() * n; - let n2 = n - n1; - log::info!("election ns {n1} + {n2}"); + fn idle_unstake(remaining_weight: &mut Weight) { + const MAX_TASKS: usize = 10; - (n1, n2) - } + #[cfg(test)] + let wt = Weight::zero().add_ref_time(1); + #[cfg(not(test))] + let wt = T::WeightInfo::unstake_all_for(); + let mut consumer = >::iter().drain(); - fn migration_progress() -> Perbill { - const TOTAL: Moment = 30 * 2 * DAY_IN_MILLIS; - - let start = >::get(); - let prog = Perbill::from_rational(now::() - start, TOTAL); + for i in 0..MAX_TASKS { + if i >= MAX_TASKS { + break; + } - log::info!("migration progress {prog:?}"); + if let Some(rw) = remaining_weight.checked_sub(&wt) { + *remaining_weight = rw; + } else { + break; + } + if let Some((k, v)) = consumer.next() { + let _ = Self::unstake_all_for_inner(k, v); + } else { + // There is nothing to do; add the weight back. + *remaining_weight += wt; - prog + break; + } + } } - fn elect_from_contract(n: u32) -> Option> { - let winners = T::RingStaking::elect(n)?; + fn unstake_all_for_inner(who: T::AccountId, ledger: Ledger) -> DispatchResult { + T::Currency::transfer( + &account_id(), + &who, + ledger.ring, + ExistenceRequirement::AllowDeath, + )?; - call_on_cache_v2!(>::put(winners.clone())).ok()?; + Self::deposit_event(Event::UnstakeAllFor { who }); - Some(winners) + Ok(()) } } impl pallet_authorship::EventHandler> for Pallet @@ -953,11 +511,19 @@ pub mod pallet { fn start_session(_: u32) {} - fn new_session(index: u32) -> Option> { - let maybe_collators = Self::prepare_new_session(index); + // No election in genesis. + // Since RING contract isn't available at this time. + fn new_session_genesis(i: u32) -> Option> { + Self::prepare_new_session(i); + + None + } + + fn new_session(i: u32) -> Option> { + let maybe_collators = Self::prepare_new_session(i); if maybe_collators.is_none() { - log::error!("fail to elect collators for session {index}"); + log::error!("fail to elect collators for session {i}"); } maybe_collators @@ -966,6 +532,15 @@ pub mod pallet { } pub use pallet::*; +/// Election interface. +pub trait Election { + /// Elect the new collators. + fn elect(_: u32) -> Option> { + None + } +} +impl Election for () {} + /// Issuing and reward manager. pub trait IssuingManager where @@ -976,7 +551,7 @@ where let inflation = Self::inflate(); let reward = Self::calculate_reward(inflation); - >::distribute_session_reward(reward); + >::allocate_session_reward(reward); } /// Inflation settings. @@ -990,105 +565,14 @@ where } /// The reward function. - fn reward(_: &T::AccountId, _: Balance) -> DispatchResult { + fn reward(_: Balance) -> DispatchResult { Ok(()) } } impl IssuingManager for () where T: Config {} - -/// Election interface. -pub trait Election { - /// Elect the new collators. - fn elect(_: u32) -> Option> { - None - } -} -impl Election for () {} - -/// Distribute the reward to a contract. -pub trait Reward { - /// Distribute the reward. - fn distribute(_: Option, _: Balance) {} -} -impl Reward for () {} - -/// Staking rate limiter. -#[derive(Clone, Debug, PartialEq, Encode, Decode, MaxEncodedLen, TypeInfo)] -pub enum RateLimiter { - /// Positive balance. - Pos(Balance), - /// Negative balance. - Neg(Balance), -} -impl RateLimiter { - fn flow_in(self, amount: Balance, limit: Balance) -> Option { - match self { - Self::Pos(v) => v.checked_add(amount).filter(|&v| v <= limit).map(Self::Pos), - Self::Neg(v) => - if v >= amount { - Some(Self::Neg(v - amount)) - } else { - let v = amount - v; - - if v <= limit { - Some(Self::Pos(v)) - } else { - None - } - }, - } - } - - fn flow_out(self, amount: Balance, limit: Balance) -> Option { - match self { - Self::Pos(v) => - if v >= amount { - Some(Self::Pos(v - amount)) - } else { - let v = amount - v; - - if v <= limit { - Some(Self::Neg(v)) - } else { - None - } - }, - Self::Neg(v) => v.checked_add(amount).filter(|&new_v| new_v <= limit).map(Self::Neg), - } - } -} -impl Default for RateLimiter { - fn default() -> Self { - Self::Pos(0) - } -} - -/// Cache state. -#[allow(missing_docs)] -#[cfg_attr(any(test, feature = "runtime-benchmarks", feature = "try-runtime"), derive(PartialEq))] -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] -pub enum CacheState { - Previous, - Current, - Next, -} - -/// Session ending checker. -pub struct ShouldEndSession(PhantomData); -impl Get for ShouldEndSession -where - T: frame_system::Config + pallet_session::Config, -{ - fn get() -> bool { - ::ShouldEndSession::should_end_session( - >::block_number(), - ) - } -} - /// Issue new token from pallet-balances. -pub struct BalanceIssuing(PhantomData); -impl IssuingManager for BalanceIssuing +pub struct BalancesIssuing(PhantomData); +impl IssuingManager for BalancesIssuing where T: Config, { @@ -1110,13 +594,12 @@ where PAYOUT_FRAC * issued } - fn reward(who: &T::AccountId, amount: Balance) -> DispatchResult { - let _ = T::Currency::deposit_creating(who, amount); + fn reward(amount: Balance) -> DispatchResult { + let _ = T::Currency::deposit_creating(&T::Treasury::get(), amount); Ok(()) } } - /// Transfer issued token from pallet-treasury. pub struct TreasuryIssuing(PhantomData<(T, R)>); impl IssuingManager for TreasuryIssuing @@ -1127,25 +610,18 @@ where fn calculate_reward(_: Balance) -> Balance { R::get() } +} - fn reward(who: &T::AccountId, amount: Balance) -> DispatchResult { - let treasury = ::Treasury::get(); - - if who == &treasury { - Ok(()) - } else { - T::Currency::transfer( - &treasury, - who, - amount, - frame_support::traits::ExistenceRequirement::KeepAlive, - ) - } - } +/// Allocate the reward to a contract. +pub trait Reward { + /// Allocate the reward. + fn allocate(_: Option, _: Balance) {} } +impl Reward for () {} -/// A convertor from collators id. Since this pallet does not have stash/controller, this is -/// just identity. +/// A convertor from collators id. +/// +/// Since this pallet does not have stash/controller, this is just identity. pub struct IdentityCollator; impl Convert> for IdentityCollator { fn convert(t: T) -> Option { @@ -1154,57 +630,24 @@ impl Convert> for IdentityCollator { } /// Staking ledger. -#[derive(DebugNoBound, PartialEqNoBound, EqNoBound, Encode, Decode, MaxEncodedLen, TypeInfo)] -#[scale_info(skip_type_params(T))] -pub struct Ledger -where - T: Config, -{ +#[derive(Debug, PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo)] +pub struct Ledger { /// Staked RING. pub ring: Balance, /// Staked deposits. - pub deposits: BoundedVec, ::MaxDeposits>, -} -impl Ledger -where - T: Config, -{ - fn is_empty(&self) -> bool { - self.ring == 0 && self.deposits.is_empty() - } -} - -/// A snapshot of the stake backing a single collator in the system. -#[cfg_attr(test, derive(Clone))] -#[derive(Encode, Decode, TypeInfo, RuntimeDebug)] -pub struct Exposure { - /// The commission of this collator. - pub commission: Perbill, - /// The total vote backing this collator. - pub vote: Balance, - /// Nominator staking map. - pub nominators: Vec>, -} -/// A snapshot of the staker's state. -#[cfg_attr(test, derive(Clone))] -#[derive(Encode, Decode, TypeInfo, RuntimeDebug)] -pub struct IndividualExposure { - /// Nominator. - pub who: AccountId, - /// Nominator's staking vote. - pub vote: Balance, + pub deposits: BoundedVec>, } -/// RING staking interface. +/// RING staking contract interface. /// -/// .https://github.com/darwinia-network/DIP-7/blob/2249e3baa065b7e6c42427810b722fafa37628f1/src/collator/CollatorSet.sol#L27. +/// https://github.com/darwinia-network/DIP-7/blob/2249e3baa065b7e6c42427810b722fafa37628f1/src/collator/CollatorSet.sol#L27. pub struct RingStaking(PhantomData); impl Election for RingStaking where T: Config + darwinia_ethtx_forwarder::Config, T::AccountId: From + Into, { - fn elect(n: u32) -> Option> { + fn elect(x: u32) -> Option> { const ZERO: [u8; 20] = [0; 20]; let Some(rsc) = >::get() else { @@ -1230,7 +673,7 @@ where state_mutability: StateMutability::View, }; let input = function - .encode_input(&[Token::Uint(n.into())]) + .encode_input(&[Token::Uint(x.into())]) .map_err(|e| log::error!("failed to encode input due to {e:?}")) .ok()?; @@ -1244,7 +687,7 @@ where .map_err(|e| log::error!("failed to forward call due to {e:?}")) .ok() .and_then(|i| { - log::info!("getTopCollators({n})'s execution info {i:?}"); + log::info!("getTopCollators({x})'s execution info {i:?}"); function .decode_output(&i.value) @@ -1273,7 +716,7 @@ where T: Config + darwinia_ethtx_forwarder::Config, T::AccountId: Into, { - fn distribute(who: Option, amount: Balance) { + fn allocate(who: Option, amount: Balance) { let Some(who) = who else { log::error!("who must be some; qed"); @@ -1310,7 +753,7 @@ where } } -/// KTON staking interface. +/// KTON staking contract interface. pub struct KtonStaking(PhantomData); // Distribute the reward to KTON staking contract. // @@ -1320,7 +763,7 @@ where T: Config + darwinia_ethtx_forwarder::Config, T::AccountId: Into, { - fn distribute(_: Option, amount: Balance) { + fn allocate(_: Option, amount: Balance) { let Some(ksc) = >::get() else { log::error!("KTON staking contract must be some; qed"); diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index 8f788f7b4..b4c27d008 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -26,7 +26,10 @@ use serde::{Deserialize, Serialize}; use crate::*; use dc_types::UNIT; // polkadot-sdk -use frame_support::{assert_ok, derive_impl, traits::OnInitialize}; +use frame_support::{ + assert_ok, derive_impl, + traits::{OnFinalize, OnIdle, OnInitialize}, +}; use sp_core::H160; use sp_io::TestExternalities; use sp_runtime::{BuildStorage, RuntimeAppPublic}; @@ -90,28 +93,6 @@ impl pallet_balances::Config for Runtime { type ExistentialDeposit = (); } -pub enum KtonMinting {} -impl darwinia_deposit::SimpleAsset for KtonMinting { - type AccountId = AccountId; - - fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } - - fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } -} -impl darwinia_deposit::Config for Runtime { - type DepositMigrator = (); - type Kton = KtonMinting; - type MaxDeposits = frame_support::traits::ConstU32<16>; - type Ring = Balances; - type RuntimeEvent = RuntimeEvent; - type Treasury = TreasuryAcct; - type WeightInfo = (); -} - frame_support::parameter_types! { pub static SessionHandlerCollators: Vec = Vec::new(); pub static SessionChangeBlock: BlockNumber = 0; @@ -121,7 +102,7 @@ sp_runtime::impl_opaque_keys! { pub uint: SessionHandler, } } -pub type Period = frame_support::traits::ConstU64<3>; +pub type Period = frame_support::traits::ConstU64<5>; pub struct SessionHandler; impl pallet_session::SessionHandler for SessionHandler { const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = @@ -163,7 +144,7 @@ impl pallet_session::Config for Runtime { frame_support::parameter_types! { pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); - pub TreasuryAcct: AccountId = Treasury::account_id(); + pub TreasuryAccount: AccountId = Treasury::account_id(); } #[cfg(feature = "runtime-benchmarks")] pub struct DummyBenchmarkHelper; @@ -194,7 +175,7 @@ impl pallet_treasury::Config for Runtime { type MaxApprovals = (); type OnSlash = (); type PalletId = TreasuryPalletId; - type Paymaster = frame_support::traits::tokens::PayFromAccount; + type Paymaster = frame_support::traits::tokens::PayFromAccount; type PayoutPeriod = (); type ProposalBond = (); type ProposalBondMaximum = (); @@ -209,12 +190,13 @@ impl pallet_treasury::Config for Runtime { frame_support::parameter_types! { pub static InflationType: u8 = 0; + pub static NextCollatorId: u64 = 1; } pub enum StatedOnSessionEnd {} impl crate::IssuingManager for StatedOnSessionEnd { fn inflate() -> Balance { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - >::inflate() + >::inflate() } else { >>::inflate() } @@ -222,78 +204,60 @@ impl crate::IssuingManager for StatedOnSessionEnd { fn calculate_reward(issued: Balance) -> Balance { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - >::calculate_reward(issued) + >::calculate_reward(issued) } else { >>::calculate_reward(issued) } } - fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { + fn reward(amount: Balance) -> sp_runtime::DispatchResult { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - >::reward(who, amount) + >::reward(amount) } else { - >>::reward(who, amount) + >>::reward( amount) } } } pub enum RingStaking {} -impl crate::Stake for RingStaking { - type AccountId = AccountId; - type Item = Balance; +impl crate::Election for RingStaking { + fn elect(x: u32) -> Option> { + let start = NextCollatorId::get(); + let end = start + x as u64; - fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - who, - &crate::account_id(), - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } + assert!(end < 1_000); - fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - &crate::account_id(), - who, - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } -} -impl crate::Election for RingStaking { - fn elect(n: u32) -> Option> { Some( - (100..(100 + n) as u64) + (start..end) .map(|i| { let who = AccountId(i); - if Session::set_keys( + assert_ok!(Session::set_keys( RuntimeOrigin::signed(who), SessionKeys { uint: i.into() }, Vec::new(), - ) - .is_ok() - { - who - } else { - AccountId(0) - } + )); + + who }) .collect(), ) } } impl crate::Reward for RingStaking { - fn distribute(who: Option, amount: Balance) { + fn allocate(who: Option, amount: Balance) { let Some(who) = who else { return }; - let _ = - Balances::transfer_keep_alive(RuntimeOrigin::signed(TreasuryAcct::get()), who, amount); + let _ = Balances::transfer_keep_alive( + RuntimeOrigin::signed(Treasury::account_id()), + who, + amount, + ); } } pub enum KtonStaking {} impl crate::Reward for KtonStaking { - fn distribute(_: Option, amount: Balance) { + fn allocate(_: Option, amount: Balance) { let _ = Balances::transfer_keep_alive( - RuntimeOrigin::signed(TreasuryAcct::get()), + RuntimeOrigin::signed(TreasuryAccount::get()), >::get().unwrap(), amount, ); @@ -301,27 +265,20 @@ impl crate::Reward for KtonStaking { } impl crate::Config for Runtime { type Currency = Balances; - type Deposit = Deposit; type IssuingManager = StatedOnSessionEnd; type KtonStaking = KtonStaking; - type MaxDeposits = ::MaxDeposits; - type Ring = RingStaking; type RingStaking = RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = crate::ShouldEndSession; - type Treasury = TreasuryAcct; + type Treasury = TreasuryAccount; type UnixTime = Timestamp; type WeightInfo = (); } -#[cfg(not(feature = "runtime-benchmarks"))] -impl crate::DepositConfig for Runtime {} frame_support::construct_runtime! { pub enum Runtime { System: frame_system, Timestamp: pallet_timestamp, Balances: pallet_balances, - Deposit: darwinia_deposit, Session: pallet_session, Treasury: pallet_treasury, Staking: crate, @@ -344,10 +301,7 @@ impl Efflux { } } -pub struct ExtBuilder { - collator_count: u32, - genesis_collator: bool, -} +pub struct ExtBuilder; impl ExtBuilder { pub fn inflation_type(self, r#type: u8) -> Self { INFLATION_TYPE.with(|v| *v.borrow_mut() = r#type); @@ -355,115 +309,76 @@ impl ExtBuilder { self } - pub fn collator_count(mut self, collator_count: u32) -> Self { - self.collator_count = collator_count; - - self - } - - pub fn genesis_collator(mut self) -> Self { - self.genesis_collator = true; - - self - } - pub fn build(self) -> TestExternalities { - // let _ = pretty_env_logger::try_init(); + let _ = pretty_env_logger::try_init(); let mut storage = >::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { - balances: (1..=10) - .map(|i| (AccountId(i), 1_000 * UNIT)) - .chain([(TreasuryAcct::get(), 1_000_000 * UNIT)]) + balances: (1..=1_000) + .map(|i| (AccountId(i), 100)) + .chain([(Treasury::account_id(), 1 << 126), (account_id(), 1 << 126)]) .collect(), } .assimilate_storage(&mut storage) .unwrap(); - crate::GenesisConfig:: { - rate_limit: 100 * UNIT, - collator_count: self.collator_count, - collators: if self.genesis_collator { - (1..=self.collator_count as u64).map(|i| (AccountId(i), i as _)).collect() - } else { - Default::default() - }, - ..Default::default() + pallet_session::GenesisConfig:: { + keys: (1..=3) + .map(|i| (AccountId(i), AccountId(i), SessionKeys { uint: i.into() })) + .collect(), } .assimilate_storage(&mut storage) .unwrap(); - if self.genesis_collator { - pallet_session::GenesisConfig:: { - keys: (1..=self.collator_count as u64) - .map(|i| (AccountId(i), AccountId(i), SessionKeys { uint: i.into() })) - .collect(), - } + crate::GenesisConfig:: { collator_count: 3, ..Default::default() } .assimilate_storage(&mut storage) .unwrap(); - } let mut ext = TestExternalities::from(storage); ext.execute_with(|| { - >::put(AccountId(718)); - >::put(AccountId(719)); + >::put(AccountId(1_001)); + >::put(AccountId(1_002)); + preset_session_keys(); new_session(); }); ext } } -impl Default for ExtBuilder { - fn default() -> Self { - Self { collator_count: 1, genesis_collator: false } - } -} - -pub fn preset_collator_wait_list(n: u64) { - (10..10 + n).for_each(|i| { - let who = AccountId(i); - let _ = >::deposit_creating(&who, i as _); +pub fn preset_session_keys() { + (1..1_000).for_each(|i| { assert_ok!(Session::set_keys( - RuntimeOrigin::signed(who), + RuntimeOrigin::signed(AccountId(i)), SessionKeys { uint: i.into() }, Vec::new() )); - assert_ok!(Staking::stake(RuntimeOrigin::signed(who), i as _, Vec::new())); - assert_ok!(Staking::collect(RuntimeOrigin::signed(who), Perbill::zero())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(who), who)); - }); - (100..100 + n).for_each(|i| { - let who = AccountId(i); - let _ = >::deposit_creating(&who, i as _); }); } pub fn initialize_block(number: BlockNumber) { System::set_block_number(number); Efflux::time(1); - >::on_initialize(number); + AllPalletsWithSystem::on_initialize(number); } pub fn finalize_block(number: BlockNumber) { - >::on_finalize(number); + AllPalletsWithSystem::on_idle(number, Weight::MAX); + AllPalletsWithSystem::on_finalize(number); } pub fn new_session() { let now = System::block_number(); let target = now + >::get(); + let collators = Session::validators(); - (now..target).for_each(|_| Efflux::block(1)); + (now..target).zip(collators.into_iter().cycle()).for_each(|(_, who)| { + Staking::note_authors(&[who]); + Efflux::block(1); + }); } -pub fn payout() { - crate::call_on_cache_v2!(>::get().into_iter().for_each(|c| { - let _ = Staking::payout_inner(c); - })) - .unwrap(); - crate::call_on_cache_v1!(>::iter_keys().for_each(|c| { - let _ = Staking::payout_inner(c); - })) - .unwrap(); +pub fn events() -> Vec> { + System::read_events_for_pallet() } diff --git a/pallet/staking/src/tests.rs b/pallet/staking/src/tests.rs index ed5f097de..c14878ada 100644 --- a/pallet/staking/src/tests.rs +++ b/pallet/staking/src/tests.rs @@ -16,982 +16,308 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -// core -use core::time::Duration; // darwinia use crate::{mock::*, *}; -use darwinia_deposit::Error as DepositError; -use dc_types::UNIT; // polkadot-sdk -use frame_support::{assert_noop, assert_ok, BoundedVec}; -use sp_runtime::{assert_eq_error_rate, DispatchError, Perbill}; +use frame_support::{assert_noop, assert_ok, traits::OnIdle}; +use sp_runtime::DispatchError; #[test] -fn exposure_cache_states_should_work() { - ExtBuilder::default().build().execute_with(|| { - #[allow(deprecated)] - { - >::kill(); - >::remove_all(None); - >::remove_all(None); - >::remove_all(None); - - let e = Exposure { - commission: Default::default(), - vote: Default::default(), - nominators: Default::default(), - }; - - >::insert(AccountId(0), e.clone()); - >::insert(AccountId(1), e.clone()); - >::insert(AccountId(2), e); - } - - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_some()).unwrap()); - assert_eq!( - >::get(), - (CacheState::Previous, CacheState::Current, CacheState::Next) - ); +fn get_top_collators_should_work() { + const ZERO: [u8; 20] = [0; 20]; - Staking::shift_cache_states(); - - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert_eq!( - >::get(), - (CacheState::Next, CacheState::Previous, CacheState::Current) - ); + let data = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148, 244, 240, 74, 89, 79, 214, 144, 224, + 254, 164, 111, 40, 130, 165, 178, 97, 83, 167, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ]; + #[allow(deprecated)] + let function = Function { + name: "getTopCollators".to_owned(), + inputs: vec![Param { + name: "k".to_owned(), + kind: ParamType::Uint(256), + internal_type: None, + }], + outputs: vec![Param { + name: "collators".to_owned(), + kind: ParamType::Array(Box::new(ParamType::Address)), + internal_type: None, + }], + constant: None, + state_mutability: StateMutability::View, + }; + let output = function + .decode_output(&data) + .map(|o| { + let Some(Token::Array(addrs)) = o.into_iter().next() else { return Vec::new() }; - Staking::shift_cache_states(); - - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert_eq!( - >::get(), - (CacheState::Current, CacheState::Next, CacheState::Previous) - ); + addrs + .into_iter() + .filter_map(|addr| match addr { + Token::Address(addr) if addr.0 != ZERO => Some(addr.0), + _ => None, + }) + .collect() + }) + .unwrap(); - Staking::shift_cache_states(); - - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_some()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(0)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(1)).is_none()).unwrap()); - assert!(call_on_cache_v1!(>::get(AccountId(2)).is_some()).unwrap()); - assert_eq!( - >::get(), - (CacheState::Previous, CacheState::Current, CacheState::Next) - ); - }); + assert_eq!( + output, + [ + // 0x94f4f04a594fd690e0fea46f2882a5b26153a72f. + [ + 148, 244, 240, 74, 89, 79, 214, 144, 224, 254, 164, 111, 40, 130, 165, 178, 97, 83, + 167, 47 + ] + ] + ); } #[test] -fn stake_should_work() { - ExtBuilder::default().build().execute_with(|| { - assert_eq!(System::account(AccountId(1)).consumers, 0); - assert!(Staking::ledger_of(AccountId(1)).is_none()); - assert_eq!(Balances::free_balance(AccountId(1)), 1_000 * UNIT); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(0)); - - // Stake 1 RING. - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), UNIT, Vec::new())); - assert_eq!(System::account(AccountId(1)).consumers, 1); - assert_eq!( - Staking::ledger_of(AccountId(1)).unwrap(), - Ledger { ring: UNIT, deposits: Default::default() } - ); - assert_eq!(Balances::free_balance(AccountId(1)), 999 * UNIT); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(UNIT)); - - // Stake invalid deposit. - assert_noop!( - Staking::stake(RuntimeOrigin::signed(AccountId(1)), 0, vec![0]), - >::DepositNotFound - ); +fn elect_should_work() { + ExtBuilder.build().execute_with(|| { + NEXT_COLLATOR_ID.with(|v| *v.borrow_mut() = 4); - // Stake 1 deposit. - assert_eq!(System::account(AccountId(1)).consumers, 1); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), UNIT, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), 0, vec![0])); - assert_eq!( - Staking::ledger_of(AccountId(1)).unwrap(), - Ledger { ring: UNIT, deposits: BoundedVec::truncate_from(vec![0]) } - ); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(2 * UNIT)); - - // Stake 2 RING and 2 deposits. - assert_eq!(System::account(AccountId(1)).consumers, 2); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), UNIT, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), 2 * UNIT, vec![1, 2])); - assert_eq!(Balances::free_balance(AccountId(1)), 994 * UNIT); assert_eq!( - Staking::ledger_of(AccountId(1)).unwrap(), - Ledger { ring: 3 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } + ::RingStaking::elect(>::get()).unwrap(), + vec![AccountId(4), AccountId(5), AccountId(6)] ); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(6 * UNIT)); }); } #[test] -fn unstake_should_work() { - ExtBuilder::default().build().execute_with(|| { - assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), UNIT, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), 3 * UNIT, vec![0, 1, 2])); - assert_eq!(Balances::free_balance(AccountId(1)), 994 * UNIT); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(6 * UNIT)); - assert_eq!( - Staking::ledger_of(AccountId(1)).unwrap(), - Ledger { ring: 3 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } - ); - assert_eq!( - Deposit::deposit_of(AccountId(1)) - .unwrap() - .into_iter() - .map(|d| d.in_use) - .collect::>(), - [true, true, true] - ); +fn on_idle_allocate_ring_staking_reward_should_work() { + ExtBuilder.build().execute_with(|| { + (1..=512).for_each(|i| >::insert(AccountId(i), 1)); - // Unstake 1 RING. - assert_ok!(Staking::unstake(RuntimeOrigin::signed(AccountId(1)), UNIT, Vec::new())); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(5 * UNIT)); - assert_eq!(Balances::free_balance(AccountId(1)), 995 * UNIT); + System::reset_events(); + >::on_idle(0, Weight::zero().add_ref_time(5)); assert_eq!( - Staking::ledger_of(AccountId(1)).unwrap(), - Ledger { ring: 2 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } + events().into_iter().filter(|e| matches!(e, Event::RewardAllocated { .. })).count(), + 5 ); - // Unstake invalid deposit. - assert_noop!( - Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 0, vec![3]), - >::DepositNotFound - ); - - // Unstake 1 deposit. - Efflux::block(1); - assert_ok!(Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 0, vec![1])); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(4 * UNIT)); - assert_eq!( - Staking::ledger_of(AccountId(1)).unwrap(), - Ledger { ring: 2 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 2]) } - ); + System::reset_events(); + >::on_idle(0, Weight::MAX); assert_eq!( - Deposit::deposit_of(AccountId(1)) - .unwrap() - .into_iter() - .map(|d| d.in_use) - .collect::>(), - [true, false, true] + events().into_iter().filter(|e| matches!(e, Event::RewardAllocated { .. })).count(), + 10 ); - // Unstake 2 RING and 2 deposits. - Efflux::block(1); - assert_ok!(Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 2 * UNIT, vec![0, 2])); - assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(0)); - assert!(Staking::ledger_of(AccountId(1)).is_none()); + System::reset_events(); + while >::iter().count() != 0 { + >::on_idle(0, Weight::MAX); + } assert_eq!( - Deposit::deposit_of(AccountId(1)) - .unwrap() - .into_iter() - .map(|d| d.in_use) - .collect::>(), - [false, false, false] - ); - - // Prepare rate limit test data. - assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), 100 * UNIT + 1, 1)); - >::put(200 * UNIT + 2); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), 100 * UNIT + 1, vec![3])); - >::put(100 * UNIT); - >::kill(); - - // Unstake 100 UNIT + 1. - assert_noop!( - Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 100 * UNIT + 1, Vec::new()), - >::ExceedRateLimit - ); - - // Unstake 100 UNIT + 1. - assert_noop!( - Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 0, vec![3]), - >::ExceedRateLimit + events().into_iter().filter(|e| matches!(e, Event::RewardAllocated { .. })).count(), + 497 ); - - // Unstake RING(100 UNIT + 1) and deposit(100 UNIT + 1). - assert_noop!( - Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 100 * UNIT + 1, vec![3]), - >::ExceedRateLimit - ); - }); -} - -#[test] -fn collect_should_work() { - ExtBuilder::default().build().execute_with(|| { - assert!(Staking::collator_of(AccountId(1)).is_none()); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), UNIT, Vec::new())); - - (0..=99).for_each(|c| { - let c = Perbill::from_percent(c); - - assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(1)), c)); - assert_eq!(Staking::collator_of(AccountId(1)).unwrap(), c); - }); }); } #[test] -fn nominate_should_work() { - ExtBuilder::default().build().execute_with(|| { - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), UNIT, Vec::new())); - assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(1)), Perbill::zero())); - - (2..=10).for_each(|i| { - assert!(Staking::nominator_of(AccountId(i)).is_none()); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(i)), UNIT, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(1))); - assert_eq!(Staking::nominator_of(AccountId(i)).unwrap(), AccountId(1)); +fn on_idle_unstake_should_work() { + ExtBuilder.build().execute_with(|| { + // Skip 1 to 3 collators. + // Since they have session rewards which make calculation more complex. + (4..=515).for_each(|i| { + >::insert( + AccountId(i), + Ledger { ring: i as _, deposits: BoundedVec::new() }, + ) }); - }); -} -#[test] -fn chill_should_work() { - ExtBuilder::default().build().execute_with(|| { - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), UNIT, Vec::new())); - assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(1)), Perbill::zero())); - (2..=10).for_each(|i| { - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(i)), UNIT, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(1))); - }); - assert!(Staking::collator_of(AccountId(1)).is_some()); - (2..=10).for_each(|i| assert!(Staking::nominator_of(AccountId(i)).is_some())); + System::reset_events(); + >::on_idle(0, Weight::zero().add_ref_time(5)); + assert_eq!(>::iter().count(), 507); - (1..=10).for_each(|i| { - assert_ok!(Staking::chill(RuntimeOrigin::signed(AccountId(i)))); - }); - assert!(Staking::collator_of(AccountId(1)).is_none()); - (2..=10).for_each(|i| assert!(Staking::nominator_of(AccountId(i)).is_none())); - }); -} + System::reset_events(); + >::on_idle(0, Weight::MAX); + assert_eq!(>::iter().count(), 497); -#[test] -fn set_collator_count_should_work() { - ExtBuilder::default().build().execute_with(|| { - assert_noop!( - Staking::set_collator_count(RuntimeOrigin::signed(AccountId(1)), 1), - DispatchError::BadOrigin - ); - assert_noop!( - Staking::set_collator_count(RuntimeOrigin::root(), 0), - >::ZeroCollatorCount - ); - assert_ok!(Staking::set_collator_count(RuntimeOrigin::root(), 1)); - }); -} + while >::iter().count() != 0 { + >::on_idle(0, Weight::MAX); + } -#[test] -fn elect_should_work() { - ExtBuilder::default().collator_count(3).build().execute_with(|| { - (1..=5).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - i as Balance * UNIT, - Vec::new() - )); - assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(i)), Perbill::zero())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); + (4..515).for_each(|who| { + assert_eq!(Balances::free_balance(AccountId(who)), 100 + who as Balance); }); - (6..=10).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - i as Balance * UNIT, - Vec::new() - )); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 5))); - }); - - assert_eq!( - Staking::elect(Staking::collator_count()).unwrap(), - vec![AccountId(5), AccountId(4), AccountId(3)] - ); }); } #[test] -fn payout_should_work() { - ExtBuilder::default().collator_count(5).build().execute_with(|| { - (1..=5).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - i as Balance * UNIT, - Vec::new() - )); - assert_ok!(Staking::collect( - RuntimeOrigin::signed(AccountId(i)), - Perbill::from_percent(i as u32 * 10) - )); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); - }); - (6..=10).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - (11 - i as Balance) * UNIT, - Vec::new() - )); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 5))); - }); - new_session(); - (1..=10).for_each(|i| { - assert_eq!( - Balances::free_balance(AccountId(i)), - (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT - ) - }); - - let session_duration = Duration::new(12 * 600, 0).as_millis(); - let kton_staking_contract_balance = - Balances::free_balance(>::get().unwrap()); - Efflux::time(session_duration - >::get() as Moment); - Staking::note_authors(&[ - AccountId(1), - AccountId(2), - AccountId(3), - AccountId(4), - AccountId(5), - ]); - new_session(); - new_session(); - payout(); - - let rewards = [ - 182149362040072859745, - 340012143096539162113, - 473588342440801457194, - 582877959635701275045, - 667880995628415300546, - 546448087213114754098, - 388585306229508196721, - 255009107468123861566, - 145719489836065573771, - 60716453916211293261, - ]; - let half_reward = PAYOUT_FRAC - * dc_inflation::issuing_in_period(session_duration, Timestamp::now()).unwrap() - / 2; - assert_eq_error_rate!(half_reward, rewards.iter().sum::(), UNIT); - assert_eq_error_rate!( - half_reward, - Balances::free_balance(>::get().unwrap()) - - kton_staking_contract_balance, - UNIT - ); - assert_eq!( - rewards.as_slice(), - (1..=10) - .map(|i| Balances::free_balance(AccountId(i)) - - (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT) - .collect::>() - ); - }); - - ExtBuilder::default().inflation_type(1).collator_count(5).build().execute_with(|| { - (1..=5).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - i as Balance * UNIT, - Vec::new() - )); - assert_ok!(Staking::collect( - RuntimeOrigin::signed(AccountId(i)), - Perbill::from_percent(i as u32 * 10) - )); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); - }); - (6..=10).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - (11 - i as Balance) * UNIT, - Vec::new() - )); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 5))); - }); - new_session(); +fn on_new_session_should_work() { + ExtBuilder.inflation_type(0).build().execute_with(|| { new_session(); - (1..=10).for_each(|i| { - assert_eq!( - Balances::free_balance(AccountId(i)), - (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT - ) - }); - - let total_issuance = Balances::total_issuance(); - let session_duration = Duration::new(12 * 600, 0).as_millis(); - Efflux::time(session_duration - >::get() as Moment); - Staking::note_authors(&[ - AccountId(1), - AccountId(2), - AccountId(3), - AccountId(4), - AccountId(5), - ]); new_session(); - payout(); - - let rewards = [ - 499999998800000000000, - 933333332800000000000, - 1300000000000000000000, - 1599999999200000000000, - 1833333333000000000000, - 1499999999400000000000, - 1066666665600000000000, - 700000000000000000000, - 399999999600000000000, - 166666666000000000000, - ]; - assert_eq!( - rewards.as_slice(), - (1..=10) - .map(|i| Balances::free_balance(AccountId(i)) - - (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT) - .collect::>() - ); - assert_eq!(Balances::total_issuance(), total_issuance); + assert_eq!(Session::validators(), vec![AccountId(1), AccountId(2), AccountId(3)]); - assert_ok!(Balances::transfer_all( - RuntimeOrigin::signed(Treasury::account_id()), - AccountId(0), - false - )); - Staking::note_authors(&[AccountId(1)]); + NEXT_COLLATOR_ID.with(|v| *v.borrow_mut() = 4); System::reset_events(); new_session(); - payout(); - - assert_eq!( - System::events() - .into_iter() - .filter_map(|e| match e.event { - RuntimeEvent::Staking(e @ Event::Unpaid { .. }) => Some(e), - _ => None, - }) - .collect::>(), - vec![ - // Pay to collator failed. - Event::Unpaid { who: AccountId(6), amount: 7499999997000000000000 }, - // Pay to nominator failed. - Event::Unpaid { who: AccountId(1), amount: 2499999994000000000000 } - ] - ); - }); -} - -#[test] -fn auto_payout_should_work() { - ExtBuilder::default().collator_count(2).build().execute_with(|| { - (1..=2).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - i as Balance * UNIT, - Vec::new() - )); - assert_ok!(Staking::collect( - RuntimeOrigin::signed(AccountId(i)), - Perbill::from_percent(i as u32 * 10) - )); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); - }); - (3..=4).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(AccountId(i)), - (5 - i as Balance) * UNIT, - Vec::new() - )); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 2))); - }); new_session(); - new_session(); - - Efflux::time(>::get() as Moment); - Staking::note_authors(&[AccountId(1), AccountId(2)]); - new_session(); - (1..=4).for_each(|i| { - assert_eq!( - Balances::free_balance(AccountId(i)), - (1_000 - if i < 3 { i } else { 5 - i }) as Balance * UNIT - ) - }); - Efflux::block(1); + assert_eq!(Session::validators(), vec![AccountId(4), AccountId(5), AccountId(6)]); + // payout to treasury * 2 session + // + + // payout to collators * 2 session + // + // 1 * 2 + 3 * 2 = 8 assert_eq!( - [ - Balances::free_balance(AccountId(1)), - Balances::free_balance(AccountId(2)), - Balances::free_balance(AccountId(3)), - Balances::free_balance(AccountId(4)), - ], - [ - 999000607164541135398, - 998000000000000000000, - 998000910746811475409, - 999000000000000000000 - ] + events().into_iter().filter(|e| matches!(e, Event::RewardAllocated { .. })).count(), + 8 ); - - Efflux::block(1); assert_eq!( - [ - Balances::free_balance(AccountId(1)), - Balances::free_balance(AccountId(2)), - Balances::free_balance(AccountId(3)), - Balances::free_balance(AccountId(4)), - ], - [ - 999000607164541135398, - 998001113134992106860, - 998000910746811475409, - 999000404776360655738 - ] - ); - - Efflux::block(1); - assert_eq!( - [ - Balances::free_balance(AccountId(1)), - Balances::free_balance(AccountId(2)), - Balances::free_balance(AccountId(3)), - Balances::free_balance(AccountId(4)), - ], - [ - 999000607164541135398, - 998001113134992106860, - 998000910746811475409, - 999000404776360655738 - ] + (1..=3).map(|who| { Balances::free_balance(AccountId(who)) }).collect::>(), + vec![5059704513256525, 5059704513256525, 2529852256628310] ); - }); -} - -#[test] -fn on_new_session_should_work() { - ExtBuilder::default().collator_count(2).genesis_collator().build().execute_with(|| { - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(1), AccountId(2)] - ); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(1), AccountId(2)] - ); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(1), AccountId(2)] - ); - - assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(3)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(3)), 2, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(3)), AccountId(3))); - Staking::note_authors(&Session::validators()); + NEXT_COLLATOR_ID.with(|v| *v.borrow_mut() = 7); + System::reset_events(); new_session(); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(1), AccountId(2)] - ); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(1), AccountId(2)] - ); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(3), AccountId(2)] - ); - - assert_ok!(Staking::chill(RuntimeOrigin::signed(AccountId(3)))); - assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(4)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(4)), 2, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(4)), AccountId(4))); - Staking::note_authors(&Session::validators()); - new_session(); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(1), AccountId(2)] - ); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(3), AccountId(2)] - ); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(4), AccountId(2)] - ); - - assert_ok!(Staking::chill(RuntimeOrigin::signed(AccountId(4)))); - assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(5)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(5)), 2, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(5)), AccountId(5))); - Staking::note_authors(&Session::validators()); - new_session(); + assert_eq!(Session::validators(), vec![AccountId(7), AccountId(8), AccountId(9)]); + // payout to treasury * 2 session + // + + // payout to collators * 2 session + // + // 1 * 2 + 3 * 2 = 8 assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(3), AccountId(2)] + events().into_iter().filter(|e| matches!(e, Event::RewardAllocated { .. })).count(), + 8 ); assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(4), AccountId(2)] - ); - assert_eq!( - crate::call_on_cache_v1!(>::iter_keys().collect::>()).unwrap(), - [AccountId(5), AccountId(2)] + (1..=3).map(|who| { Balances::free_balance(AccountId(who)) }).collect::>(), + vec![5059704513256525, 5059704513256525, 2529852256628310] ); }); -} - -#[test] -fn rate_limiter_should_work() { - let r = RateLimiter::default(); - let r = r.flow_in(1, 3).unwrap(); - assert_eq!(r, RateLimiter::Pos(1)); - - let r = r.flow_in(2, 3).unwrap(); - assert_eq!(r, RateLimiter::Pos(3)); - assert!(r.clone().flow_in(1, 3).is_none()); - - let r = r.flow_out(1, 3).unwrap(); - assert_eq!(r, RateLimiter::Pos(2)); - - let r = r.flow_out(2, 3).unwrap(); - assert_eq!(r, RateLimiter::Pos(0)); - - let r = r.flow_out(1, 3).unwrap(); - assert_eq!(r, RateLimiter::Neg(1)); - - let r = r.flow_out(2, 3).unwrap(); - assert_eq!(r, RateLimiter::Neg(3)); - assert!(r.clone().flow_out(1, 3).is_none()); - - let r = r.flow_in(1, 3).unwrap(); - assert_eq!(r, RateLimiter::Neg(2)); - - let r = r.flow_in(2, 3).unwrap(); - assert_eq!(r, RateLimiter::Neg(0)); - let r = r.flow_in(1, 3).unwrap(); - assert_eq!(r, RateLimiter::Pos(1)); - - let r = RateLimiter::Pos(3); - assert_eq!(r.flow_out(6, 3).unwrap(), RateLimiter::Neg(3)); - - let r = RateLimiter::Neg(3); - assert_eq!(r.flow_in(6, 3).unwrap(), RateLimiter::Pos(3)); -} - -#[test] -fn elect_ns_should_work() { - ExtBuilder::default().collator_count(100).build().execute_with(|| { - [ - (0, 100), - (2, 98), - (3, 97), - (5, 95), - (7, 93), - (8, 92), - (10, 90), - (12, 88), - (13, 87), - (15, 85), - (17, 83), - (18, 82), - (20, 80), - (22, 78), - (23, 77), - (25, 75), - (27, 73), - (28, 72), - (30, 70), - (32, 68), - (33, 67), - (35, 65), - (37, 63), - (38, 62), - (40, 60), - (42, 58), - (43, 57), - (45, 55), - (47, 53), - (48, 52), - (50, 50), - (52, 48), - (53, 47), - (55, 45), - (57, 43), - (58, 42), - (60, 40), - (62, 38), - (63, 37), - (65, 35), - (67, 33), - (68, 32), - (70, 30), - (72, 28), - (73, 27), - (75, 25), - (77, 23), - (78, 22), - (80, 20), - (82, 18), - (83, 17), - (85, 15), - (87, 13), - (88, 12), - (90, 10), - (92, 8), - (93, 7), - (95, 5), - (97, 3), - (98, 2), - (100, 0), - (100, 0), - ] - .iter() - .for_each(|exp| { - assert_eq!(exp, &>::elect_ns()); - - Efflux::time(DAY_IN_MILLIS); - }); - }); -} + // Reset. + NEXT_COLLATOR_ID.with(|v| *v.borrow_mut() = 1); -#[test] -fn hybrid_election_should_work() { - ExtBuilder::default().collator_count(10).build().execute_with(|| { - mock::preset_collator_wait_list(10); + ExtBuilder.inflation_type(1).build().execute_with(|| { new_session(); new_session(); - assert_eq!( - (10..20).rev().map(AccountId).collect::>(), - >::get() - ); + assert_eq!(Session::validators(), vec![AccountId(1), AccountId(2), AccountId(3)]); - Timestamp::set_timestamp(15 * DAY_IN_MILLIS); + NEXT_COLLATOR_ID.with(|v| *v.borrow_mut() = 4); + System::reset_events(); new_session(); new_session(); + assert_eq!(Session::validators(), vec![AccountId(4), AccountId(5), AccountId(6)]); + // payout to treasury * 2 session + // + + // payout to collators * 2 session + // + // 1 * 2 + 3 * 2 = 8 assert_eq!( - (100..102).map(AccountId).chain((12..20).rev().map(AccountId)).collect::>(), - >::get() + events().into_iter().filter(|e| matches!(e, Event::RewardAllocated { .. })).count(), + 8 ); - - Timestamp::set_timestamp(30 * DAY_IN_MILLIS); - new_session(); - new_session(); - assert_eq!( - (100..105).map(AccountId).chain((15..20).rev().map(AccountId)).collect::>(), - >::get() + (1..=3).map(|who| { Balances::free_balance(AccountId(who)) }).collect::>(), + vec![20000000000000000000100, 20000000000000000000100, 10000000000000000000100] ); - Timestamp::set_timestamp(45 * DAY_IN_MILLIS); + NEXT_COLLATOR_ID.with(|v| *v.borrow_mut() = 7); + System::reset_events(); new_session(); new_session(); + assert_eq!(Session::validators(), vec![AccountId(7), AccountId(8), AccountId(9)]); + // payout to treasury * 2 session + // + + // payout to collators * 2 session + // + // 1 * 2 + 3 * 2 = 8 assert_eq!( - (100..107).map(AccountId).chain((17..20).rev().map(AccountId)).collect::>(), - >::get() + events().into_iter().filter(|e| matches!(e, Event::RewardAllocated { .. })).count(), + 8 ); - - Timestamp::set_timestamp(60 * DAY_IN_MILLIS); - new_session(); - new_session(); - assert_eq!( - (100..110).map(AccountId).collect::>(), - >::get() + (1..=3).map(|who| { Balances::free_balance(AccountId(who)) }).collect::>(), + vec![20000000000000000000100, 20000000000000000000100, 10000000000000000000100] ); }); } #[test] -fn dedup_election_should_work() { - ExtBuilder::default().collator_count(10).build().execute_with(|| { - let who = AccountId(100); - let _ = >::deposit_creating(&who, 100 as _); - - assert_ok!(Staking::stake(RuntimeOrigin::signed(who), 100 as _, Vec::new())); - assert_ok!(Staking::collect(RuntimeOrigin::signed(who), Perbill::zero())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(who), who)); - - Timestamp::set_timestamp(30 * DAY_IN_MILLIS); - new_session(); - new_session(); +fn unstake_all_for_should_work() { + ExtBuilder.build().execute_with(|| { + assert_noop!( + Staking::unstake_all_for(RuntimeOrigin::signed(AccountId(1)), AccountId(1)), + >::NoRecord + ); - assert_eq!(vec![who], >::get()); + >::insert(AccountId(1), Ledger { ring: 1, deposits: BoundedVec::new() }); + assert_ok!(Staking::unstake_all_for(RuntimeOrigin::signed(AccountId(1)), AccountId(1))); }); } #[test] -fn hybrid_payout_should_work() { - ExtBuilder::default().collator_count(10).inflation_type(1).build().execute_with(|| { - mock::preset_collator_wait_list(10); - Timestamp::set_timestamp(30 * DAY_IN_MILLIS); - new_session(); - new_session(); +fn allocate_ring_staking_reward_of_should_work() { + ExtBuilder.build().execute_with(|| { + let who = AccountId(1); - let collators = - (100..105).map(AccountId).chain((15..20).rev().map(AccountId)).collect::>(); - assert_eq!(collators, >::get()); + assert_noop!( + Staking::allocate_ring_staking_reward_of(RuntimeOrigin::signed(who), who), + >::NoReward + ); - let collators_balances = collators.iter().map(Balances::free_balance).collect::>(); - Staking::note_authors(&collators); - new_session(); - payout(); + >::insert(who, 1); + System::reset_events(); - assert_eq!( - [1_000 * UNIT; 10].as_slice(), - collators - .into_iter() - .map(Balances::free_balance) - .zip(collators_balances) - .map(|(a, b)| a - b) - .collect::>() - ); + assert_ok!(Staking::allocate_ring_staking_reward_of(RuntimeOrigin::signed(who), who)); + assert_eq!(events(), vec![Event::RewardAllocated { who, amount: 1 }]); }); } #[test] -fn hybrid_auto_payout_should_work() { - ExtBuilder::default().collator_count(4).inflation_type(1).build().execute_with(|| { - mock::preset_collator_wait_list(4); - Timestamp::set_timestamp(30 * DAY_IN_MILLIS); - new_session(); - new_session(); - - let collators = - (100..102).map(AccountId).chain((12..14).rev().map(AccountId)).collect::>(); - assert_eq!(collators, >::get()); - - let collators_balances = collators.iter().map(Balances::free_balance).collect::>(); - Staking::note_authors(&collators); - new_session(); - - assert_eq!( - vec![0, 0, 0, 0], - collators - .iter() - .map(Balances::free_balance) - .zip(collators_balances.clone()) - .map(|(a, b)| a - b) - .collect::>() +fn set_collator_count_should_work() { + ExtBuilder.build().execute_with(|| { + assert_noop!( + Staking::set_collator_count(RuntimeOrigin::signed(AccountId(1)), 1), + DispatchError::BadOrigin ); - - Efflux::block(1); - assert_eq!( - vec![2_500 * UNIT, 0, 0, 2_500 * UNIT], - collators - .iter() - .map(Balances::free_balance) - .zip(collators_balances.clone()) - .map(|(a, b)| a - b) - .collect::>() + assert_noop!( + Staking::set_collator_count(RuntimeOrigin::root(), 0), + >::ZeroCollatorCount ); - Efflux::block(1); - assert_eq!( - vec![2_500 * UNIT, 2_500 * UNIT, 2_500 * UNIT, 2_500 * UNIT], - collators - .iter() - .map(Balances::free_balance) - .zip(collators_balances.clone()) - .map(|(a, b)| a - b) - .collect::>() - ); + assert_ok!(Staking::set_collator_count(RuntimeOrigin::root(), 1)); + assert_eq!(Staking::collator_count(), 1); }); } #[test] -fn get_top_collators_should_work() { - const ZERO: [u8; 20] = [0; 20]; +fn set_ring_staking_contract_should_work() { + ExtBuilder.build().execute_with(|| { + assert_noop!( + Staking::set_ring_staking_contract(RuntimeOrigin::signed(AccountId(1)), AccountId(1)), + DispatchError::BadOrigin + ); - let data = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148, 244, 240, 74, 89, 79, 214, 144, 224, - 254, 164, 111, 40, 130, 165, 178, 97, 83, 167, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ]; - #[allow(deprecated)] - let function = Function { - name: "getTopCollators".to_owned(), - inputs: vec![Param { - name: "k".to_owned(), - kind: ParamType::Uint(256), - internal_type: None, - }], - outputs: vec![Param { - name: "collators".to_owned(), - kind: ParamType::Array(Box::new(ParamType::Address)), - internal_type: None, - }], - constant: None, - state_mutability: StateMutability::View, - }; - let output = function - .decode_output(&data) - .map(|o| { - let Some(Token::Array(addrs)) = o.into_iter().next() else { return Vec::new() }; + assert_ok!(Staking::set_ring_staking_contract(RuntimeOrigin::root(), AccountId(1))); + assert_eq!(Staking::ring_staking_contract(), Some(AccountId(1))); + }); +} - addrs - .into_iter() - .filter_map(|addr| match addr { - Token::Address(addr) if addr.0 != ZERO => Some(addr.0), - _ => None, - }) - .collect() - }) - .unwrap(); +#[test] +fn set_kton_staking_contract_should_work() { + ExtBuilder.build().execute_with(|| { + assert_noop!( + Staking::set_kton_staking_contract(RuntimeOrigin::signed(AccountId(1)), AccountId(1)), + DispatchError::BadOrigin + ); - assert_eq!( - output, - [ - // 0x94f4f04a594fd690e0fea46f2882a5b26153a72f. - [ - 148, 244, 240, 74, 89, 79, 214, 144, 224, 254, 164, 111, 40, 130, 165, 178, 97, 83, - 167, 47 - ] - ] - ); + assert_ok!(Staking::set_kton_staking_contract(RuntimeOrigin::root(), AccountId(1))); + assert_eq!(Staking::kton_staking_contract(), Some(AccountId(1))); + }); } diff --git a/pallet/staking/src/weights.rs b/pallet/staking/src/weights.rs index ffa10a6b9..b4274507b 100644 --- a/pallet/staking/src/weights.rs +++ b/pallet/staking/src/weights.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for darwinia_staking //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("koi-dev"), DB CACHE: 1024 @@ -52,13 +52,8 @@ use core::marker::PhantomData; /// Weight functions needed for darwinia_staking. pub trait WeightInfo { - fn stake(x: u32, ) -> Weight; - fn unstake(x: u32, ) -> Weight; - fn collect() -> Weight; - fn nominate() -> Weight; - fn chill() -> Weight; - fn payout() -> Weight; - fn set_rate_limit() -> Weight; + fn unstake_all_for() -> Weight; + fn allocate_ring_staking_reward_of() -> Weight; fn set_ring_staking_contract() -> Weight; fn set_kton_staking_contract() -> Weight; fn set_collator_count() -> Weight; @@ -71,116 +66,28 @@ impl WeightInfo for SubstrateWeight { /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn stake(x: u32, ) -> Weight { + fn unstake_all_for() -> Weight { // Proof Size summary in bytes: - // Measured: `7088 + x * (25 ±0)` - // Estimated: `29615` - // Minimum execution time: 47_000 nanoseconds. - Weight::from_parts(859_853_520, 0) - .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 267_757 - .saturating_add(Weight::from_parts(12_932_760, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:1) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn unstake(x: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7415 + x * (26 ±0)` - // Estimated: `29615` - // Minimum execution time: 50_000 nanoseconds. - Weight::from_parts(643_370_535, 0) - .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 274_835 - .saturating_add(Weight::from_parts(14_096_069, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } - /// Storage: `DarwiniaStaking::Collators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn collect() -> Weight { - // Proof Size summary in bytes: - // Measured: `388` - // Estimated: `3497` - // Minimum execution time: 10_000 nanoseconds. - Weight::from_parts(12_000_000, 0) - .saturating_add(Weight::from_parts(3497, 0)) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:0) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:1 w:0) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Nominators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - fn nominate() -> Weight { - // Proof Size summary in bytes: - // Measured: `600` + // Measured: `406` // Estimated: `4543` - // Minimum execution time: 13_000 nanoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 51_000 nanoseconds. + Weight::from_parts(52_000_000, 0) .saturating_add(Weight::from_parts(4543, 0)) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `DarwiniaStaking::Nominators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn chill() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_000 nanoseconds. - Weight::from_parts(6_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } - /// Storage: `DarwiniaStaking::ExposureCacheStates` (r:1 w:0) - /// Proof: `DarwiniaStaking::ExposureCacheStates` (`max_values`: Some(1), `max_size`: Some(3), added: 498, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::ExposureCache2` (r:1 w:1) - /// Proof: `DarwiniaStaking::ExposureCache2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `DarwiniaStaking::PendingRewards` (r:1 w:1) /// Proof: `DarwiniaStaking::PendingRewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:32 w:32) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `2330` - // Estimated: `83902` - // Minimum execution time: 535_000 nanoseconds. - Weight::from_parts(629_000_000, 0) - .saturating_add(Weight::from_parts(83902, 0)) - .saturating_add(T::DbWeight::get().reads(35_u64)) - .saturating_add(T::DbWeight::get().writes(34_u64)) - } - /// Storage: `DarwiniaStaking::RateLimit` (r:0 w:1) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_rate_limit() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:1 w:0) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn allocate_ring_staking_reward_of() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_000 nanoseconds. - Weight::from_parts(3_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `271` + // Estimated: `3736` + // Minimum execution time: 13_000 nanoseconds. + Weight::from_parts(14_000_000, 0) + .saturating_add(Weight::from_parts(3736, 0)) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) @@ -212,7 +119,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 2_000 nanoseconds. - Weight::from_parts(3_000_000, 0) + Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -224,116 +131,28 @@ impl WeightInfo for () { /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn stake(x: u32, ) -> Weight { + fn unstake_all_for() -> Weight { // Proof Size summary in bytes: - // Measured: `7088 + x * (25 ±0)` - // Estimated: `29615` - // Minimum execution time: 47_000 nanoseconds. - Weight::from_parts(859_853_520, 0) - .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 267_757 - .saturating_add(Weight::from_parts(12_932_760, 0).saturating_mul(x.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:1) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn unstake(x: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7415 + x * (26 ±0)` - // Estimated: `29615` - // Minimum execution time: 50_000 nanoseconds. - Weight::from_parts(643_370_535, 0) - .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 274_835 - .saturating_add(Weight::from_parts(14_096_069, 0).saturating_mul(x.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } - /// Storage: `DarwiniaStaking::Collators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn collect() -> Weight { - // Proof Size summary in bytes: - // Measured: `388` - // Estimated: `3497` - // Minimum execution time: 10_000 nanoseconds. - Weight::from_parts(12_000_000, 0) - .saturating_add(Weight::from_parts(3497, 0)) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:0) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:1 w:0) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Nominators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - fn nominate() -> Weight { - // Proof Size summary in bytes: - // Measured: `600` + // Measured: `406` // Estimated: `4543` - // Minimum execution time: 13_000 nanoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 51_000 nanoseconds. + Weight::from_parts(52_000_000, 0) .saturating_add(Weight::from_parts(4543, 0)) - .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: `DarwiniaStaking::Nominators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn chill() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_000 nanoseconds. - Weight::from_parts(6_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } - /// Storage: `DarwiniaStaking::ExposureCacheStates` (r:1 w:0) - /// Proof: `DarwiniaStaking::ExposureCacheStates` (`max_values`: Some(1), `max_size`: Some(3), added: 498, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::ExposureCache2` (r:1 w:1) - /// Proof: `DarwiniaStaking::ExposureCache2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `DarwiniaStaking::PendingRewards` (r:1 w:1) /// Proof: `DarwiniaStaking::PendingRewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:32 w:32) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `2330` - // Estimated: `83902` - // Minimum execution time: 535_000 nanoseconds. - Weight::from_parts(629_000_000, 0) - .saturating_add(Weight::from_parts(83902, 0)) - .saturating_add(RocksDbWeight::get().reads(35_u64)) - .saturating_add(RocksDbWeight::get().writes(34_u64)) - } - /// Storage: `DarwiniaStaking::RateLimit` (r:0 w:1) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_rate_limit() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:1 w:0) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn allocate_ring_staking_reward_of() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_000 nanoseconds. - Weight::from_parts(3_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `271` + // Estimated: `3736` + // Minimum execution time: 13_000 nanoseconds. + Weight::from_parts(14_000_000, 0) + .saturating_add(Weight::from_parts(3736, 0)) + .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) @@ -365,7 +184,7 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 2_000 nanoseconds. - Weight::from_parts(3_000_000, 0) + Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/pallet/staking/traits/Cargo.toml b/pallet/staking/traits/Cargo.toml deleted file mode 100644 index 3e49557a2..000000000 --- a/pallet/staking/traits/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -authors.workspace = true -description = "Darwinia parachain staking's traits." -edition.workspace = true -name = "darwinia-staking-traits" -readme = "README.md" -version.workspace = true - -[dependencies] -# crates.io -codec = { workspace = true } -scale-info = { workspace = true } - -# polkadot-sdk -sp-runtime = { workspace = true } - -[features] -default = ["std"] -std = [ - # crates.io - "codec/std", - "scale-info/std", - - # polkadot-sdk - "sp-runtime/std", -] - -runtime-benchmarks = [ - "sp-runtime/runtime-benchmarks", -] diff --git a/pallet/staking/traits/src/lib.rs b/pallet/staking/traits/src/lib.rs deleted file mode 100644 index 98dbc7e53..000000000 --- a/pallet/staking/traits/src/lib.rs +++ /dev/null @@ -1,75 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -//! # Darwinia parachain staking's traits - -#![cfg_attr(not(feature = "std"), no_std)] -#![deny(missing_docs)] - -// core -use core::fmt::Debug; -// crates.io -use codec::{FullCodec, MaxEncodedLen}; -use scale_info::TypeInfo; -// polkadot-sdk -use sp_runtime::{DispatchError, DispatchResult}; - -/// Stake trait that stake items must be implemented. -pub trait Stake { - /// Account type. - type AccountId; - /// Stake item type. - /// - /// Basically, it's just a num type. - #[cfg(not(feature = "runtime-benchmarks"))] - type Item: Clone + Copy + Debug + PartialEq + FullCodec + MaxEncodedLen + TypeInfo; - /// Stake item type. - /// - /// Basically, it's just a num type. - #[cfg(feature = "runtime-benchmarks")] - type Item: Clone - + Copy - + Debug - + Default - + From - + PartialEq - + FullCodec - + MaxEncodedLen - + TypeInfo; - - /// Add stakes to the staking pool. - /// - /// This will transfer the stakes to a pallet/contact account. - fn stake(who: &Self::AccountId, item: Self::Item) -> DispatchResult; - - /// Withdraw stakes from the staking pool. - /// - /// This will transfer the stakes back to the staker's account. - fn unstake(who: &Self::AccountId, item: Self::Item) -> DispatchResult; -} - -/// Extended stake trait. -/// -/// Provide a way to access the deposit RING amount. -pub trait StakeExt: Stake { - /// Amount type. - type Amount; - - /// Get the staked amount. - fn amount(who: &Self::AccountId, item: Self::Item) -> Result; -} diff --git a/precompile/deposit/Cargo.toml b/precompile/deposit/Cargo.toml deleted file mode 100644 index f478498f1..000000000 --- a/precompile/deposit/Cargo.toml +++ /dev/null @@ -1,59 +0,0 @@ -[package] -authors.workspace = true -description = "Deposit precompile for EVM pallet." -edition.workspace = true -name = "darwinia-precompile-deposit" -readme = "README.md" -version.workspace = true - -[dependencies] -# frontier -fp-evm = { workspace = true } -pallet-evm = { workspace = true } - -# darwinia -darwinia-deposit = { workspace = true } - -# moonbeam -precompile-utils = { workspace = true } - -# polkadot-sdk -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-core = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -[dev-dependencies] -# crates.io -codec = { workspace = true, features = ["std"] } -scale-info = { workspace = true, features = ["std"] } - -# moonbeam -precompile-utils = { workspace = true, features = ["std", "testing"] } - -# polkadot-sdk -pallet-balances = { workspace = true, features = ["std"] } -pallet-timestamp = { workspace = true, features = ["std"] } -sp-io = { workspace = true, features = ["std"] } - -[features] -default = ["std"] -std = [ - # frontier - "fp-evm/std", - "pallet-evm/std", - - # darwinia - "darwinia-deposit/std", - - # moonbeam - "precompile-utils/std", - - # polkadot-sdk - "frame-support/std", - "frame-system/std", - "sp-core/std", - "sp-runtime/std", - "sp-std/std", -] diff --git a/precompile/deposit/src/lib.rs b/precompile/deposit/src/lib.rs deleted file mode 100644 index b1fafa014..000000000 --- a/precompile/deposit/src/lib.rs +++ /dev/null @@ -1,93 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg(test)] -mod mock; -#[cfg(test)] -mod tests; - -// core -use core::marker::PhantomData; -// moonbeam -use precompile_utils::prelude::*; -// polkadot-sdk -use frame_support::{ - dispatch::{GetDispatchInfo, PostDispatchInfo}, - traits::OriginTrait, -}; -use sp_core::{H160, U256}; -use sp_runtime::traits::Dispatchable; - -/// AccountId of the runtime. -type AccountIdOf = ::AccountId; - -pub struct Deposit(PhantomData); - -#[precompile_utils::precompile] -impl Deposit -where - Runtime: darwinia_deposit::Config + pallet_evm::Config, - Runtime::RuntimeCall: From> - + Dispatchable - + GetDispatchInfo, - ::AccountId: From, - <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, - ::RuntimeOrigin: From>, - AccountIdOf: From, -{ - #[precompile::public("lock(uint256,uint8)")] - fn lock(handle: &mut impl PrecompileHandle, amount: U256, months: u8) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_deposit::Call::::lock { amount: amount.as_u128(), months }, - )?; - - Ok(true) - } - - #[precompile::public("claim()")] - fn claim(handle: &mut impl PrecompileHandle) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_deposit::Call::::claim {}, - )?; - - Ok(true) - } - - #[precompile::public("claim_with_penalty(uint8)")] - fn claim_with_penalty(handle: &mut impl PrecompileHandle, id: u8) -> EvmResult { - let origin: AccountIdOf = handle.context().caller.into(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_deposit::Call::::claim_with_penalty { id: id.into() }, - )?; - - Ok(true) - } -} diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs deleted file mode 100644 index 8c74dcf46..000000000 --- a/precompile/deposit/src/mock.rs +++ /dev/null @@ -1,202 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -// crates.io -use codec::{Decode, Encode, MaxEncodedLen}; -// darwinia -use crate::*; -// frontier -use precompile_utils::Precompile; -// polkadot-sdk -use frame_support::derive_impl; -use sp_core::{H160, U256}; -use sp_runtime::BuildStorage; - -pub type Balance = u128; -type Moment = u128; -pub type AccountId = H160; -pub type PCall = DepositCall; - -#[derive(Clone, Encode, Decode, Debug, MaxEncodedLen, scale_info::TypeInfo)] -pub enum Account { - Alice, - Bob, - Precompile, -} -#[allow(clippy::from_over_into)] -impl Into for Account { - fn into(self) -> H160 { - match self { - Account::Alice => H160::repeat_byte(0xAA), - Account::Bob => H160::repeat_byte(0xBB), - Account::Precompile => H160::from_low_u64_be(1), - } - } -} - -#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)] -impl frame_system::Config for Runtime { - type AccountData = pallet_balances::AccountData; - type AccountId = AccountId; - type Block = frame_system::mocking::MockBlock; - type Lookup = sp_runtime::traits::IdentityLookup; -} - -#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)] -impl pallet_balances::Config for Runtime { - type AccountStore = System; - type Balance = Balance; - type ExistentialDeposit = (); -} - -#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig as pallet_timestamp::DefaultConfig)] -impl pallet_timestamp::Config for Runtime { - type MinimumPeriod = (); - type Moment = Moment; -} - -pub enum KtonMinting {} -impl darwinia_deposit::SimpleAsset for KtonMinting { - type AccountId = AccountId; - - fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } - - fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } -} - -impl darwinia_deposit::Config for Runtime { - type DepositMigrator = (); - type Kton = KtonMinting; - type MaxDeposits = frame_support::traits::ConstU32<16>; - type Ring = Balances; - type RuntimeEvent = RuntimeEvent; - type Treasury = (); - type WeightInfo = (); -} - -pub struct TestPrecompiles(PhantomData); -impl TestPrecompiles -where - R: pallet_evm::Config, -{ - #[allow(clippy::new_without_default)] - pub fn new() -> Self { - Self(Default::default()) - } - - pub fn set() -> [H160; 1] { - [addr(1)] - } -} -impl fp_evm::PrecompileSet for TestPrecompiles -where - crate::Deposit: fp_evm::Precompile, - R: pallet_evm::Config, -{ - fn execute(&self, handle: &mut impl PrecompileHandle) -> Option> { - match handle.code_address() { - a if a == addr(1) => Some(crate::Deposit::::execute(handle)), - _ => None, - } - } - - fn is_precompile(&self, address: H160, _gas: u64) -> fp_evm::IsPrecompileResult { - fp_evm::IsPrecompileResult::Answer { - is_precompile: Self::set().contains(&address), - extra_cost: 0, - } - } -} -fn addr(a: u64) -> H160 { - H160::from_low_u64_be(a) -} - -frame_support::parameter_types! { - pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(20_000, 0); - pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); -} - -impl pallet_evm::Config for Runtime { - type AddressMapping = pallet_evm::IdentityAddressMapping; - type BlockGasLimit = BlockGasLimit; - type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; - type CallOrigin = pallet_evm::EnsureAddressRoot; - type ChainId = frame_support::traits::ConstU64<42>; - type Currency = Balances; - type FeeCalculator = (); - type FindAuthor = (); - type GasLimitPovSizeRatio = (); - type GasWeightMapping = pallet_evm::FixedGasWeightMapping; - type OnChargeTransaction = (); - type OnCreate = (); - type PrecompilesType = TestPrecompiles; - type PrecompilesValue = PrecompilesValue; - type Runner = pallet_evm::runner::stack::Runner; - type RuntimeEvent = RuntimeEvent; - type SuicideQuickClearLimit = (); - type Timestamp = Timestamp; - type WeightInfo = (); - type WeightPerGas = WeightPerGas; - type WithdrawOrigin = pallet_evm::EnsureAddressNever; -} - -frame_support::construct_runtime! { - pub enum Runtime { - System: frame_system, - Balances: pallet_balances, - Timestamp: pallet_timestamp, - Deposit: darwinia_deposit, - EVM: pallet_evm, - } -} - -pub fn efflux(milli_secs: u128) { - Timestamp::set_timestamp(Timestamp::now() + milli_secs); -} - -#[derive(Default)] -pub struct ExtBuilder { - // endowed accounts with balances - balances: Vec<(AccountId, Balance)>, -} - -impl ExtBuilder { - pub fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { - self.balances = balances; - self - } - - pub fn build(self) -> sp_io::TestExternalities { - let mut t = >::default() - .build_storage() - .expect("Frame system builds valid default genesis config"); - - pallet_balances::GenesisConfig:: { balances: self.balances } - .assimilate_storage(&mut t) - .expect("Pallet balances storage can be assimilated"); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} diff --git a/precompile/deposit/src/tests.rs b/precompile/deposit/src/tests.rs deleted file mode 100644 index 45023f7ca..000000000 --- a/precompile/deposit/src/tests.rs +++ /dev/null @@ -1,74 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -// darwinia -use crate::mock::{ - Account::{Alice, Precompile}, - Deposit, *, -}; -use darwinia_deposit::MILLISECS_PER_MONTH; -// moonbeam -use precompile_utils::testing::PrecompileTesterExt; -// polkadot-sdk -use sp_core::H160; - -fn precompiles() -> TestPrecompiles { - PrecompilesValue::get() -} - -#[test] -fn selectors() { - assert!(PCall::lock_selectors().contains(&0x998e4242)); - assert!(PCall::claim_selectors().contains(&0x4e71d92d)); - assert!(PCall::claim_with_penalty_selectors().contains(&0xfa04a9bf)); -} - -#[test] -fn lock_and_claim() { - let alice: H160 = Alice.into(); - ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { - // lock - precompiles() - .prepare_test(alice, Precompile, PCall::lock { amount: 200.into(), months: 1 }) - .execute_returns(true); - assert!(Deposit::deposit_of(alice).is_some()); - - // claim - efflux(MILLISECS_PER_MONTH); - precompiles().prepare_test(alice, Precompile, PCall::claim {}).execute_returns(true); - assert!(Deposit::deposit_of(alice).is_none()); - }); -} - -#[test] -fn claim_with_penalty() { - let alice: H160 = Alice.into(); - ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { - // lock - precompiles() - .prepare_test(alice, Precompile, PCall::lock { amount: 200.into(), months: 1 }) - .execute_returns(true); - assert!(Deposit::deposit_of(alice).is_some()); - - // claim with penalty - precompiles() - .prepare_test(alice, Precompile, PCall::claim_with_penalty { id: 0 }) - .execute_returns(true); - assert!(Deposit::deposit_of(alice).is_none()); - }); -} diff --git a/precompile/staking/Cargo.toml b/precompile/staking/Cargo.toml deleted file mode 100644 index fc1d2c781..000000000 --- a/precompile/staking/Cargo.toml +++ /dev/null @@ -1,72 +0,0 @@ -[package] -authors.workspace = true -description = "Staking precompile for EVM pallet." -edition.workspace = true -name = "darwinia-precompile-staking" -readme = "README.md" -version.workspace = true - -[dependencies] -# frontier -fp-evm = { workspace = true } -pallet-evm = { workspace = true } - -# darwinia -darwinia-staking = { workspace = true } - -# moonbeam -precompile-utils = { workspace = true } - -# polkadot-sdk -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-core = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -[dev-dependencies] -# crates.io -codec = { workspace = true, features = ["std"] } -scale-info = { workspace = true, features = ["std"] } - -# darwinia -darwinia-deposit = { workspace = true, features = ["std"] } -dc-primitives = { workspace = true, features = ["std"] } - -# moonbeam -precompile-utils = { workspace = true, features = ["std", "testing"] } - -# polkadot-sdk -frame-system = { workspace = true, features = ["std"] } -pallet-balances = { workspace = true, features = ["std"] } -pallet-timestamp = { workspace = true, features = ["std"] } -sp-io = { workspace = true, features = ["std"] } - -[features] -default = ["std"] -std = [ - # frontier - "fp-evm/std", - "pallet-evm/std", - - # darwinia - "darwinia-staking/std", - - # moonbeam - "precompile-utils/std", - - # polkadot-sdk - "frame-support/std", - "frame-system/std", - "sp-core/std", - "sp-runtime/std", - "sp-std/std", -] - -runtime-benchmarks = [ - # darwinia - "darwinia-staking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "pallet-evm/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", -] diff --git a/precompile/staking/src/lib.rs b/precompile/staking/src/lib.rs deleted file mode 100644 index 68c5bd539..000000000 --- a/precompile/staking/src/lib.rs +++ /dev/null @@ -1,146 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg(test)] -mod mock; -#[cfg(test)] -mod tests; - -// core -use core::marker::PhantomData; -// darwinia -use darwinia_staking::Stake; -// moonbeam -use precompile_utils::prelude::*; -// polkadot-sdk -use frame_support::{ - dispatch::{GetDispatchInfo, PostDispatchInfo}, - traits::OriginTrait, -}; -use sp_core::{H160, U256}; -use sp_runtime::{traits::Dispatchable, Perbill}; -use sp_std::prelude::*; - -pub struct Staking(PhantomData); - -#[precompile_utils::precompile] -impl Staking -where - Runtime: darwinia_staking::Config + pallet_evm::Config, - Runtime::RuntimeCall: GetDispatchInfo - + Dispatchable - + From>, - ::RuntimeOrigin: From>, - ::AccountId: From, - <::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait, - <::Deposit as Stake>::Item: From, -{ - #[precompile::public("stake(uint256,uint16[])")] - fn stake( - handle: &mut impl PrecompileHandle, - ring_amount: U256, - deposits: Vec, - ) -> EvmResult { - let origin = handle.context().caller.into(); - let deposits = deposits.into_iter().map(|i| i.into()).collect(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_staking::Call::::stake { - ring_amount: ring_amount.as_u128(), - deposits, - }, - )?; - Ok(true) - } - - #[precompile::public("unstake(uint256,uint16[])")] - fn unstake( - handle: &mut impl PrecompileHandle, - ring_amount: U256, - deposits: Vec, - ) -> EvmResult { - let origin = handle.context().caller.into(); - let deposits = deposits.into_iter().map(|i| i.into()).collect(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_staking::Call::::unstake { - ring_amount: ring_amount.as_u128(), - deposits, - }, - )?; - Ok(true) - } - - #[precompile::public("collect(uint32)")] - fn collect(handle: &mut impl PrecompileHandle, commission: u32) -> EvmResult { - let origin = handle.context().caller.into(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_staking::Call::::collect { - commission: Perbill::from_percent(commission), - }, - )?; - Ok(true) - } - - #[precompile::public("nominate(address)")] - fn nominate(handle: &mut impl PrecompileHandle, target: Address) -> EvmResult { - let target: H160 = target.into(); - let origin = handle.context().caller.into(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_staking::Call::::nominate { target: target.into() }, - )?; - Ok(true) - } - - #[precompile::public("chill()")] - fn chill(handle: &mut impl PrecompileHandle) -> EvmResult { - let origin = handle.context().caller.into(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_staking::Call::::chill {}, - )?; - Ok(true) - } - - #[precompile::public("payout(address)")] - fn payout(handle: &mut impl PrecompileHandle, who: Address) -> EvmResult { - let who: H160 = who.into(); - let origin = handle.context().caller.into(); - - RuntimeHelper::::try_dispatch( - handle, - Some(origin).into(), - darwinia_staking::Call::::payout { who: who.into() }, - )?; - Ok(true) - } -} diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs deleted file mode 100644 index 15bd55949..000000000 --- a/precompile/staking/src/mock.rs +++ /dev/null @@ -1,248 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -// crates.io -use codec::{Decode, Encode, MaxEncodedLen}; -use scale_info::TypeInfo; -// frontier -use precompile_utils::Precompile; -// darwinia -use crate::*; -use dc_primitives::{AccountId, Balance, Moment}; -// polkadot-sdk -use frame_support::derive_impl; -use sp_core::{H160, U256}; -use sp_runtime::BuildStorage; - -#[derive(Clone, Encode, Decode, Debug, MaxEncodedLen, TypeInfo)] -pub enum Account { - Alice, - Bob, - Precompile, -} -impl Account { - pub fn addr(&self) -> AccountId { - match self { - Account::Alice => H160::repeat_byte(0xAA), - Account::Bob => H160::repeat_byte(0xBB), - Account::Precompile => H160::from_low_u64_be(1), - } - .into() - } -} - -#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)] -impl frame_system::Config for Runtime { - type AccountData = pallet_balances::AccountData; - type AccountId = AccountId; - type Block = frame_system::mocking::MockBlock; - type Lookup = sp_runtime::traits::IdentityLookup; -} - -#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)] -impl pallet_balances::Config for Runtime { - type AccountStore = System; - type Balance = Balance; - type ExistentialDeposit = (); -} - -#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig as pallet_timestamp::DefaultConfig)] -impl pallet_timestamp::Config for Runtime { - type MinimumPeriod = (); - type Moment = Moment; -} - -frame_support::parameter_types! { - pub TreasuryAcct: AccountId = H160::zero().into(); -} -pub enum KtonMinting {} -impl darwinia_deposit::SimpleAsset for KtonMinting { - type AccountId = AccountId; - - fn mint(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } - - fn burn(_: &Self::AccountId, _: Balance) -> sp_runtime::DispatchResult { - Ok(()) - } -} -impl darwinia_deposit::Config for Runtime { - type DepositMigrator = (); - type Kton = KtonMinting; - type MaxDeposits = frame_support::traits::ConstU32<512>; - type Ring = Balances; - type RuntimeEvent = RuntimeEvent; - type Treasury = TreasuryAcct; - type WeightInfo = (); -} - -pub struct TestPrecompiles(PhantomData); -impl TestPrecompiles -where - R: pallet_evm::Config, -{ - #[allow(clippy::new_without_default)] - pub fn new() -> Self { - Self(Default::default()) - } - - pub fn set() -> [H160; 1] { - [addr(1)] - } -} -impl fp_evm::PrecompileSet for TestPrecompiles -where - crate::Staking: fp_evm::Precompile, - R: pallet_evm::Config, -{ - fn execute(&self, handle: &mut impl PrecompileHandle) -> Option> { - match handle.code_address() { - a if a == addr(1) => Some(crate::Staking::::execute(handle)), - _ => None, - } - } - - fn is_precompile(&self, address: H160, _gas: u64) -> fp_evm::IsPrecompileResult { - fp_evm::IsPrecompileResult::Answer { - is_precompile: Self::set().contains(&address), - extra_cost: 0, - } - } -} -fn addr(a: u64) -> H160 { - H160::from_low_u64_be(a) -} - -pub type PCall = StakingCall; - -frame_support::parameter_types! { - pub const BlockGasLimit: U256 = U256::MAX; - pub const WeightPerGas: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(20_000, 0); - pub PrecompilesValue: TestPrecompiles = TestPrecompiles::<_>::new(); -} - -impl pallet_evm::Config for Runtime { - type AddressMapping = pallet_evm::IdentityAddressMapping; - type BlockGasLimit = BlockGasLimit; - type BlockHashMapping = pallet_evm::SubstrateBlockHashMapping; - type CallOrigin = pallet_evm::EnsureAddressRoot; - type ChainId = frame_support::traits::ConstU64<42>; - type Currency = Balances; - type FeeCalculator = (); - type FindAuthor = (); - type GasLimitPovSizeRatio = (); - type GasWeightMapping = pallet_evm::FixedGasWeightMapping; - type OnChargeTransaction = (); - type OnCreate = (); - type PrecompilesType = TestPrecompiles; - type PrecompilesValue = PrecompilesValue; - type Runner = pallet_evm::runner::stack::Runner; - type RuntimeEvent = RuntimeEvent; - type SuicideQuickClearLimit = (); - type Timestamp = Timestamp; - type WeightInfo = (); - type WeightPerGas = WeightPerGas; - type WithdrawOrigin = pallet_evm::EnsureAddressNever; -} - -pub enum RingStaking {} -impl darwinia_staking::Stake for RingStaking { - type AccountId = AccountId; - type Item = Balance; - - fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - who, - &darwinia_staking::account_id(), - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } - - fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - &darwinia_staking::account_id(), - who, - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } -} -impl darwinia_staking::Config for Runtime { - type Currency = Balances; - type Deposit = Deposit; - type IssuingManager = (); - type KtonStaking = (); - type MaxDeposits = ::MaxDeposits; - type Ring = RingStaking; - type RingStaking = (); - type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = (); - type Treasury = TreasuryAcct; - type UnixTime = Timestamp; - type WeightInfo = (); -} -#[cfg(not(feature = "runtime-benchmarks"))] -impl darwinia_staking::DepositConfig for Runtime {} - -frame_support::construct_runtime! { - pub enum Runtime { - System: frame_system, - Balances: pallet_balances, - Timestamp: pallet_timestamp, - Deposit: darwinia_deposit, - EVM: pallet_evm, - Staking: darwinia_staking, - } -} - -#[derive(Default)] -pub struct ExtBuilder { - // endowed accounts with balances - balances: Vec<(AccountId, Balance)>, -} - -impl ExtBuilder { - pub fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { - self.balances = balances; - self - } - - pub fn build(self) -> sp_io::TestExternalities { - let mut storage = - >::default().build_storage().unwrap(); - - pallet_balances::GenesisConfig:: { balances: self.balances } - .assimilate_storage(&mut storage) - .unwrap(); - darwinia_staking::GenesisConfig:: { - rate_limit: 500, - collator_count: 1, - ..Default::default() - } - .assimilate_storage(&mut storage) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(storage); - - ext.execute_with(|| System::set_block_number(1)); - - ext - } -} diff --git a/precompile/staking/src/tests.rs b/precompile/staking/src/tests.rs deleted file mode 100644 index e2c5ec7c6..000000000 --- a/precompile/staking/src/tests.rs +++ /dev/null @@ -1,133 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -// darwinia -use crate::mock::{ - Account::{Alice, Bob, Precompile}, - ExtBuilder, PCall, PrecompilesValue, Runtime, Staking, TestPrecompiles, -}; -use sp_runtime::Perbill; -// moonbeam -use precompile_utils::testing::PrecompileTesterExt; -// polkadot-sdk -use sp_core::H160; - -fn precompiles() -> TestPrecompiles { - PrecompilesValue::get() -} - -#[test] -fn selectors() { - assert!(PCall::stake_selectors().contains(&0x88FD3D50)); - assert!(PCall::unstake_selectors().contains(&0xE198447)); - assert!(PCall::nominate_selectors().contains(&0xb332180b)); - assert!(PCall::collect_selectors().contains(&0x10a66536)); - assert!(PCall::chill_selectors().contains(&0x2b8a3ae6)); - assert!(PCall::payout_selectors().contains(&0x0b7e9c44)); -} - -#[test] -fn stake_unstake_restake() { - let alice = Alice.addr(); - let precompile = Precompile.addr(); - - ExtBuilder::default().with_balances(vec![(alice, 300)]).build().execute_with(|| { - // stake - precompiles() - .prepare_test( - alice, - precompile, - PCall::stake { ring_amount: 200.into(), deposits: Vec::new() }, - ) - .execute_returns(true); - assert_eq!(Staking::ledger_of(alice).unwrap().ring, 200); - - // unstake - precompiles() - .prepare_test( - alice, - precompile, - PCall::unstake { ring_amount: 200.into(), deposits: Vec::new() }, - ) - .execute_returns(true); - assert!(Staking::ledger_of(alice).is_none()); - }); -} - -#[test] -fn nominate() { - let alice = Alice.addr(); - let bob = Bob.addr(); - let precompile = Precompile.addr(); - - ExtBuilder::default().with_balances(vec![(alice, 300), (bob, 300)]).build().execute_with( - || { - // alice stake first as collator - precompiles() - .prepare_test( - alice, - precompile, - PCall::stake { ring_amount: 200.into(), deposits: Vec::new() }, - ) - .execute_returns(true); - - // check the collator commission - precompiles() - .prepare_test(alice, precompile, PCall::collect { commission: 30 }) - .execute_returns(true); - assert_eq!(Staking::collator_of(alice).unwrap(), Perbill::from_percent(30)); - - // bob stake as nominator - precompiles() - .prepare_test( - bob, - precompile, - PCall::stake { ring_amount: 200.into(), deposits: Vec::new() }, - ) - .execute_returns(true); - - // check nominate result - precompiles() - .prepare_test(bob, precompile, PCall::nominate { target: H160::from(alice).into() }) - .execute_returns(true); - assert_eq!(Staking::nominator_of(bob).unwrap(), alice); - - // check alice(collator) chill - precompiles().prepare_test(alice, precompile, PCall::chill {}).execute_returns(true); - assert!(Staking::collator_of(alice).is_none()); - - // check bob(nominator) chill - precompiles().prepare_test(bob, precompile, PCall::chill {}).execute_returns(true); - assert!(Staking::nominator_of(bob).is_none()); - }, - ); -} - -#[test] -fn payout() { - let alice = Alice.addr(); - let precompile = Precompile.addr(); - - ExtBuilder::default().build().execute_with(|| { - precompiles() - .prepare_test(alice, precompile, PCall::payout { who: H160::from(alice).into() }) - .execute_reverts(|out| { - out == b"Dispatched call failed with error: Module(ModuleError { index: 5, error: [6, 0, 0, 0], message: Some(\"NoReward\") })" - }); - }); -} diff --git a/runtime/common/src/migration_helper.rs b/runtime/common/src/migration_helper.rs index d7e2ebcfd..2798f6055 100644 --- a/runtime/common/src/migration_helper.rs +++ b/runtime/common/src/migration_helper.rs @@ -1,14 +1,5 @@ pub use frame_support::migration; -// crates.io -use codec::{Decode, Encode}; -// darwinia -use dc_primitives::{AccountId, Balance}; -// polkadot-sdk -use frame_support::traits::ReservableCurrency; -use sp_runtime::traits::AppendZerosInput; -use sp_std::prelude::*; - /// Pallet migration helper. pub struct PalletCleaner { pub name: &'static [u8], @@ -37,145 +28,3 @@ impl PalletCleaner { }) } } - -pub fn migrate_identity() -> u64 -where - C: ReservableCurrency, -{ - let w = migration::clear_storage_prefix(b"AccountMigration", b"Identities", &[], None, None) - .backend; - let w1 = migration::storage_iter_with_suffix::(b"Identity", b"IdentityOf", &[]) - .drain() - .fold(0, |acc, (k, v)| { - if k.len() > 20 { - let mut who = [0u8; 20]; - - who.copy_from_slice(&k[k.len() - 20..]); - - let who = AccountId::from(who); - let deposit = v.deposit - + v.judgements - .iter() - .map(|(_, ref j)| if let Judgement::FeePaid(fee) = j { *fee } else { 0 }) - .sum::(); - - C::unreserve(&who, deposit); - - acc + 3 - } else { - acc - } - }); - - (w + w1) as _ -} - -#[cfg_attr(test, derive(Debug, PartialEq))] -#[derive(Encode)] -struct Registration { - judgements: Vec<(u32, Judgement)>, - deposit: Balance, - info: IdentityInfo, -} -impl Decode for Registration { - fn decode(input: &mut I) -> sp_std::result::Result { - let (judgements, deposit, info) = Decode::decode(&mut AppendZerosInput::new(input))?; - Ok(Self { judgements, deposit, info }) - } -} - -#[cfg_attr(test, derive(Debug, PartialEq))] -#[derive(Encode, Decode)] -enum Judgement { - Unknown, - FeePaid(Balance), - Reasonable, - KnownGood, - OutOfDate, - LowQuality, - Erroneous, -} - -#[cfg_attr(test, derive(Debug, PartialEq))] -#[derive(Encode, Decode)] -struct IdentityInfo { - additional: Vec<(Data, Data)>, - display: Data, - legal: Data, - web: Data, - riot: Data, - email: Data, - pgp_fingerprint: Option<[u8; 20]>, - image: Data, - twitter: Data, -} - -#[cfg_attr(test, derive(Debug, PartialEq))] -enum Data { - None, - Raw(Vec), - BlakeTwo256([u8; 32]), - Sha256([u8; 32]), - Keccak256([u8; 32]), - ShaThree256([u8; 32]), -} -impl Decode for Data { - fn decode(input: &mut I) -> sp_std::result::Result { - let b = input.read_byte()?; - Ok(match b { - 0 => Data::None, - n @ 1..=33 => { - let mut r = vec![0u8; n as usize - 1]; - input.read(&mut r[..])?; - Data::Raw(r) - }, - 34 => Data::BlakeTwo256(<[u8; 32]>::decode(input)?), - 35 => Data::Sha256(<[u8; 32]>::decode(input)?), - 36 => Data::Keccak256(<[u8; 32]>::decode(input)?), - 37 => Data::ShaThree256(<[u8; 32]>::decode(input)?), - _ => return Err(codec::Error::from("invalid leading byte")), - }) - } -} -impl Encode for Data { - fn encode(&self) -> Vec { - match self { - Data::None => vec![0u8; 1], - Data::Raw(ref x) => { - let l = x.len().min(32); - let mut r = vec![l as u8 + 1; l + 1]; - r[1..].copy_from_slice(&x[..l]); - r - }, - Data::BlakeTwo256(ref h) => core::iter::once(34u8).chain(h.iter().cloned()).collect(), - Data::Sha256(ref h) => core::iter::once(35u8).chain(h.iter().cloned()).collect(), - Data::Keccak256(ref h) => core::iter::once(36u8).chain(h.iter().cloned()).collect(), - Data::ShaThree256(ref h) => core::iter::once(37u8).chain(h.iter().cloned()).collect(), - } - } -} - -#[test] -fn identity_codec_should_work() { - let chain_raw_data = "0x040100000003008044fe2307236c0500000000000000000f41757265766f69725861766965720b586176696572204c61752168747470733a2f2f6c696e6b74722e65652f61757265766f69727861766965721b4061757265766f69727861766965723a6d61747269782e6f72671078617669657240696e762e636166650000104041757265766f6972586176696572"; - let encoded = array_bytes::hex2bytes_unchecked(chain_raw_data); - let decoded = Registration::decode(&mut &encoded[..]).unwrap(); - let expected = Registration { - judgements: vec![(1, Judgement::KnownGood)], - deposit: 100_025_800_000_000_000_000, - info: IdentityInfo { - additional: Vec::new(), - display: Data::Raw(b"AurevoirXavier".to_vec()), - legal: Data::Raw(b"Xavier Lau".to_vec()), - web: Data::Raw(b"https://linktr.ee/aurevoirxavier".to_vec()), - riot: Data::Raw(b"@aurevoirxavier:matrix.org".to_vec()), - email: Data::Raw(b"xavier@inv.cafe".to_vec()), - pgp_fingerprint: None, - image: Data::None, - twitter: Data::Raw(b"@AurevoirXavier".to_vec()), - }, - }; - - assert_eq!(decoded, expected); - assert_eq!(encoded, expected.encode()) -} diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index 89de4f715..a516370e2 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -301,24 +301,15 @@ macro_rules! impl_account_migration_tests { }, ], ); - >::insert( - &from_pk, - OldLedger { staked_ring: 20, ..Default::default() }, - ); assert_ok!(migrate(from, to)); - assert_eq!(Balances::free_balance(to), 60); + assert_eq!(Balances::free_balance(to), 80); assert_eq!( Balances::free_balance(&darwinia_deposit::account_id::()), 20 ); - assert_eq!( - Balances::free_balance(&darwinia_staking::account_id::()), - 20 - ); assert_eq!(Deposit::deposit_of(to).unwrap().len(), 2); assert_eq!(Assets::maybe_balance(KTON_ID, to).unwrap(), 100); - assert_eq!(DarwiniaStaking::ledger_of(to).unwrap().ring, 20); }); } } diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 66e62e2a3..26cb39890 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -25,8 +25,6 @@ darwinia-common-runtime = { workspace = true } darwinia-deposit = { workspace = true } darwinia-ethtx-forwarder = { workspace = true } darwinia-precompile-assets = { workspace = true } -darwinia-precompile-deposit = { workspace = true } -darwinia-precompile-staking = { workspace = true } darwinia-precompile-state-storage = { workspace = true } darwinia-staking = { workspace = true } dc-primitives = { workspace = true } @@ -134,8 +132,6 @@ std = [ "darwinia-deposit/std", "darwinia-ethtx-forwarder/std", "darwinia-precompile-assets/std", - "darwinia-precompile-deposit/std", - "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", @@ -229,7 +225,6 @@ runtime-benchmarks = [ "darwinia-deposit/runtime-benchmarks", "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-precompile-assets/runtime-benchmarks", - "darwinia-precompile-staking/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # frontier diff --git a/runtime/crab/src/migration.rs b/runtime/crab/src/migration.rs index bf373a08e..8b4d07d4a 100644 --- a/runtime/crab/src/migration.rs +++ b/runtime/crab/src/migration.rs @@ -36,6 +36,8 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::DispatchError> { log::info!("post"); + darwinia_staking::migration::post_check::(); + Ok(()) } @@ -49,5 +51,7 @@ fn migrate() -> frame_support::weights::Weight { let _ = System::kill_storage(RuntimeOrigin::root(), vec![k]); } - ::DbWeight::get().reads_writes(0, 1) + let (r, w) = darwinia_staking::migration::migrate::(); + + ::DbWeight::get().reads_writes(r, w + 1) } diff --git a/runtime/crab/src/pallets.rs b/runtime/crab/src/pallets.rs index bfc7549bc..32cf01974 100644 --- a/runtime/crab/src/pallets.rs +++ b/runtime/crab/src/pallets.rs @@ -42,8 +42,6 @@ mod assets; pub use assets::*; mod deposit; -#[cfg(feature = "runtime-benchmarks")] -pub use deposit::*; mod account_migration; diff --git a/runtime/crab/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index b54bc48af..77e71c0a2 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -19,34 +19,8 @@ // darwinia use crate::*; -pub enum KtonMinting {} -impl darwinia_deposit::SimpleAsset for KtonMinting { - type AccountId = AccountId; - - fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint( - RuntimeOrigin::signed(KTON_ADMIN), - (AssetIds::CKton as AssetId).into(), - *beneficiary, - amount, - ) - } - - fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - let asset_id = AssetIds::CKton as _; - - if Assets::balance(asset_id, who) < amount { - Err(>::BalanceLow)?; - } - - Assets::burn(RuntimeOrigin::signed(KTON_ADMIN), asset_id.into(), *who, amount) - } -} - impl darwinia_deposit::Config for Runtime { type DepositMigrator = darwinia_deposit::DepositMigrator; - type Kton = KtonMinting; - type MaxDeposits = ConstU32<512>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type Treasury = pallet_config::TreasuryAccount; diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index b119edc4c..355e6923b 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -18,71 +18,16 @@ // darwinia use crate::*; -// polkadot-sdk -use frame_support::traits::Currency; darwinia_common_runtime::fast_runtime_or_not!(DURATION, BlockNumber, 5 * MINUTES, 14 * DAYS); -pub enum RingStaking {} -impl darwinia_staking::Stake for RingStaking { - type AccountId = AccountId; - type Item = Balance; - - fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - who, - &darwinia_staking::account_id(), - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } - - fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - &darwinia_staking::account_id(), - who, - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } -} -pub enum KtonStaking {} -impl darwinia_staking::Stake for KtonStaking { - type AccountId = AccountId; - type Item = Balance; - - fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer( - RuntimeOrigin::signed(*who), - (AssetIds::CKton as AssetId).into(), - darwinia_staking::account_id(), - item, - ) - } - - fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer( - RuntimeOrigin::signed(darwinia_staking::account_id()), - (AssetIds::CKton as AssetId).into(), - *who, - item, - ) - } -} - impl darwinia_staking::Config for Runtime { type Currency = Balances; - type Deposit = Deposit; type IssuingManager = darwinia_staking::TreasuryIssuing>; type KtonStaking = darwinia_staking::KtonStaking; - type MaxDeposits = ::MaxDeposits; - type Ring = RingStaking; type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = darwinia_staking::ShouldEndSession; type Treasury = pallet_config::TreasuryAccount; type UnixTime = Timestamp; type WeightInfo = weights::darwinia_staking::WeightInfo; } -#[cfg(not(feature = "runtime-benchmarks"))] -impl darwinia_staking::DepositConfig for Runtime {} diff --git a/runtime/crab/src/pallets/tx_pause.rs b/runtime/crab/src/pallets/tx_pause.rs index 3a7c19db4..ae3fb3a9c 100644 --- a/runtime/crab/src/pallets/tx_pause.rs +++ b/runtime/crab/src/pallets/tx_pause.rs @@ -40,9 +40,7 @@ impl frame_support::traits::Contains !matches!( pallet, b"Balances" - | b"Assets" | b"Deposit" - | b"AccountMigration" - | b"DarwiniaStaking" + | b"Assets" | b"AccountMigration" | b"Ethereum" | b"EVM" | b"EthTxForwarder" ) diff --git a/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs b/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs index b7291e855..db877c738 100644 --- a/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs +++ b/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `cumulus_pallet_parachain_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -71,10 +71,10 @@ impl cumulus_pallet_parachain_system::WeightInfo for We // Measured: `48` // Estimated: `3517` // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + Weight::from_parts(806_123_245, 0) .saturating_add(Weight::from_parts(0, 3517)) - // Standard Error: 59_482 - .saturating_add(Weight::from_parts(104_042_533, 0).saturating_mul(n.into())) + // Standard Error: 840_467 + .saturating_add(Weight::from_parts(101_126_518, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) diff --git a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs index 32cf82370..c42bf9257 100644 --- a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -82,7 +82,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `48` // Estimated: `3517` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -93,8 +93,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `42` // Estimated: `1527` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 1527)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -106,7 +106,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `77` // Estimated: `1562` // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 1562)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -116,7 +116,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `0` // Estimated: `0` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -137,8 +137,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65677` // Estimated: `69142` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(48_000_000, 0) .saturating_add(Weight::from_parts(0, 69142)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -151,8 +151,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65676` // Estimated: `69141` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(31_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(29_000_000, 0) .saturating_add(Weight::from_parts(0, 69141)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/crab/src/weights/darwinia_account_migration.rs b/runtime/crab/src/weights/darwinia_account_migration.rs index 944bc8df1..c599f5826 100644 --- a/runtime/crab/src/weights/darwinia_account_migration.rs +++ b/runtime/crab/src/weights/darwinia_account_migration.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_account_migration` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -61,19 +61,27 @@ impl darwinia_account_migration::WeightInfo for WeightI /// Proof: `AccountMigration::KtonAccounts` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:0 w:1) + /// Storage: `AccountMigration::Ledgers` (r:1 w:1) + /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(24664), added: 27139, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `AccountMigration::Deposits` (r:1 w:1) + /// Proof: `AccountMigration::Deposits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `DarwiniaStaking::Ledgers` (r:0 w:1) + /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:0 w:1) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Deposit::Deposits` (r:0 w:1) + /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) fn migrate() -> Weight { // Proof Size summary in bytes: - // Measured: `591` - // Estimated: `3631` - // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) - .saturating_add(Weight::from_parts(0, 3631)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(5)) + // Measured: `28313` + // Estimated: `31778` + // Minimum execution time: 116_000_000 picoseconds. + Weight::from_parts(122_000_000, 0) + .saturating_add(Weight::from_parts(0, 31778)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(11)) } /// Storage: `AccountMigration::Multisigs` (r:0 w:1) /// Proof: `AccountMigration::Multisigs` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -83,25 +91,34 @@ impl darwinia_account_migration::WeightInfo for WeightI /// Proof: `AccountMigration::KtonAccounts` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:0 w:1) + /// Storage: `AccountMigration::Ledgers` (r:1 w:1) + /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(24664), added: 27139, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `AccountMigration::Deposits` (r:1 w:1) + /// Proof: `AccountMigration::Deposits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `DarwiniaStaking::Ledgers` (r:0 w:1) + /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:0 w:1) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Deposit::Deposits` (r:0 w:1) + /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) /// The range of component `x` is `[0, 99]`. /// The range of component `y` is `[0, 99]`. /// The range of component `z` is `[0, 99]`. fn migrate_multisig(x: u32, _y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` - // Estimated: `0 + x * (18 ±0) + z * (18 ±0)` + // Estimated: `2 + x * (160 ±0) + z * (160 ±0)` // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(10_423_814, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_489 - .saturating_add(Weight::from_parts(36_894, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 18).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 18).saturating_mul(z.into())) + Weight::from_parts(19_114_315, 0) + .saturating_add(Weight::from_parts(0, 2)) + // Standard Error: 10_526 + .saturating_add(Weight::from_parts(18_756, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 160).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 160).saturating_mul(z.into())) } /// Storage: `AccountMigration::Multisigs` (r:1 w:1) /// Proof: `AccountMigration::Multisigs` (`max_values`: None, `max_size`: None, mode: `Measured`) diff --git a/runtime/crab/src/weights/darwinia_deposit.rs b/runtime/crab/src/weights/darwinia_deposit.rs index 199eb5453..2d9b85ce4 100644 --- a/runtime/crab/src/weights/darwinia_deposit.rs +++ b/runtime/crab/src/weights/darwinia_deposit.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_deposit` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -55,62 +55,6 @@ use core::marker::PhantomData; /// Weight functions for `darwinia_deposit`. pub struct WeightInfo(PhantomData); impl darwinia_deposit::WeightInfo for WeightInfo { - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - fn lock() -> Weight { - // Proof Size summary in bytes: - // Measured: `26712` - // Estimated: `29615` - // Minimum execution time: 89_000_000 picoseconds. - Weight::from_parts(98_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim() -> Weight { - // Proof Size summary in bytes: - // Measured: `26441` - // Estimated: `29615` - // Minimum execution time: 66_000_000 picoseconds. - Weight::from_parts(80_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim_with_penalty() -> Weight { - // Proof Size summary in bytes: - // Measured: `26763` - // Estimated: `29615` - // Minimum execution time: 91_000_000 picoseconds. - Weight::from_parts(110_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } /// Storage: `Deposit::Deposits` (r:1 w:1) /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -127,12 +71,12 @@ impl darwinia_deposit::WeightInfo for WeightInfo { /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Ethereum::Pending` (r:1 w:1) /// Proof: `Ethereum::Pending` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn migrate() -> Weight { + fn migrate_for() -> Weight { // Proof Size summary in bytes: // Measured: `27325` // Estimated: `33265` - // Minimum execution time: 3_914_000_000 picoseconds. - Weight::from_parts(4_387_000_000, 0) + // Minimum execution time: 223_000_000 picoseconds. + Weight::from_parts(236_000_000, 0) .saturating_add(Weight::from_parts(0, 33265)) .saturating_add(T::DbWeight::get().reads(11)) .saturating_add(T::DbWeight::get().writes(4)) diff --git a/runtime/crab/src/weights/darwinia_staking.rs b/runtime/crab/src/weights/darwinia_staking.rs index ab85d14e4..46f1b5c05 100644 --- a/runtime/crab/src/weights/darwinia_staking.rs +++ b/runtime/crab/src/weights/darwinia_staking.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_staking` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -59,116 +59,28 @@ impl darwinia_staking::WeightInfo for WeightInfo { /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn stake(x: u32, ) -> Weight { + fn unstake_all_for() -> Weight { // Proof Size summary in bytes: - // Measured: `7021 + x * (25 ±0)` - // Estimated: `29615` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(673_923_539, 0) - .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 255_028 - .saturating_add(Weight::from_parts(13_024_071, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:1) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn unstake(x: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7348 + x * (26 ±0)` - // Estimated: `29615` - // Minimum execution time: 55_000_000 picoseconds. - Weight::from_parts(691_873_667, 0) - .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 257_398 - .saturating_add(Weight::from_parts(13_012_274, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `DarwiniaStaking::Collators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn collect() -> Weight { - // Proof Size summary in bytes: - // Measured: `388` - // Estimated: `3497` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) - .saturating_add(Weight::from_parts(0, 3497)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:0) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:1 w:0) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Nominators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - fn nominate() -> Weight { - // Proof Size summary in bytes: - // Measured: `600` + // Measured: `406` // Estimated: `4543` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 53_000_000 picoseconds. + Weight::from_parts(55_000_000, 0) .saturating_add(Weight::from_parts(0, 4543)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::Nominators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn chill() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: `DarwiniaStaking::ExposureCacheStates` (r:1 w:0) - /// Proof: `DarwiniaStaking::ExposureCacheStates` (`max_values`: Some(1), `max_size`: Some(3), added: 498, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::ExposureCache2` (r:1 w:1) - /// Proof: `DarwiniaStaking::ExposureCache2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `DarwiniaStaking::PendingRewards` (r:1 w:1) /// Proof: `DarwiniaStaking::PendingRewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:1 w:0) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `1811` - // Estimated: `5276` - // Minimum execution time: 141_000_000 picoseconds. - Weight::from_parts(169_000_000, 0) - .saturating_add(Weight::from_parts(0, 5276)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `DarwiniaStaking::RateLimit` (r:0 w:1) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_rate_limit() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:1 w:0) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn allocate_ring_staking_reward_of() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `271` + // Estimated: `3736` + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) + .saturating_add(Weight::from_parts(0, 3736)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) @@ -181,7 +93,8 @@ impl darwinia_staking::WeightInfo for WeightInfo { Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) - } /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + } + /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: diff --git a/runtime/crab/src/weights/frame_system.rs b/runtime/crab/src/weights/frame_system.rs index c3b3b0ac0..22ff06504 100644 --- a/runtime/crab/src/weights/frame_system.rs +++ b/runtime/crab/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -60,11 +60,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(4_970_413, 0) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(2_495_352, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(156, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(150, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { @@ -72,10 +72,10 @@ impl frame_system::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + Weight::from_parts(5_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_000, 0).saturating_mul(b.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(956, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -86,7 +86,7 @@ impl frame_system::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `1485` // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 1485)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -107,8 +107,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `164` // Estimated: `1649` - // Minimum execution time: 69_455_000_000 picoseconds. - Weight::from_parts(74_530_000_000, 0) + // Minimum execution time: 68_542_000_000 picoseconds. + Weight::from_parts(70_917_000_000, 0) .saturating_add(Weight::from_parts(0, 1649)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -120,11 +120,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. + // Minimum execution time: 1_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_908 - .saturating_add(Weight::from_parts(800_499, 0).saturating_mul(i.into())) + // Standard Error: 862 + .saturating_add(Weight::from_parts(747_082, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -137,8 +137,8 @@ impl frame_system::WeightInfo for WeightInfo { // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_502 - .saturating_add(Weight::from_parts(558_522, 0).saturating_mul(i.into())) + // Standard Error: 916 + .saturating_add(Weight::from_parts(537_428, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -148,11 +148,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `97 + p * (69 ±0)` // Estimated: `100 + p * (70 ±0)` - // Minimum execution time: 4_000_000 picoseconds. + // Minimum execution time: 3_000_000 picoseconds. Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 100)) - // Standard Error: 3_203 - .saturating_add(Weight::from_parts(1_046_988, 0).saturating_mul(p.into())) + // Standard Error: 1_213 + .saturating_add(Weight::from_parts(987_472, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -164,7 +164,7 @@ impl frame_system::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(7_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -186,8 +186,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `186` // Estimated: `1671` - // Minimum execution time: 75_039_000_000 picoseconds. - Weight::from_parts(79_857_000_000, 0) + // Minimum execution time: 72_166_000_000 picoseconds. + Weight::from_parts(75_512_000_000, 0) .saturating_add(Weight::from_parts(0, 1671)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) diff --git a/runtime/crab/src/weights/pallet_assets.rs b/runtime/crab/src/weights/pallet_assets.rs index 8c55b3e3d..f3b66bd60 100644 --- a/runtime/crab/src/weights/pallet_assets.rs +++ b/runtime/crab/src/weights/pallet_assets.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -100,13 +100,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `509 + c * (183 ±0)` + // Measured: `479 + c * (183 ±0)` // Estimated: `3631 + c * (2591 ±0)` - // Minimum execution time: 13_000_000 picoseconds. + // Minimum execution time: 14_000_000 picoseconds. Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 18_699 - .saturating_add(Weight::from_parts(11_439_479, 0).saturating_mul(c.into())) + // Standard Error: 15_915 + .saturating_add(Weight::from_parts(11_014_465, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -122,11 +122,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `458 + a * (74 ±0)` // Estimated: `3631 + a * (2603 ±0)` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(24_398_483, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 10_481 - .saturating_add(Weight::from_parts(4_273_951, 0).saturating_mul(a.into())) + // Standard Error: 20_380 + .saturating_add(Weight::from_parts(4_075_795, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -142,7 +142,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `350` // Estimated: `3631` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -156,7 +156,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `350` // Estimated: `3631` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(23_000_000, 0) + Weight::from_parts(21_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -169,8 +169,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -186,7 +186,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `501` // Estimated: `6168` // Minimum execution time: 37_000_000 picoseconds. - Weight::from_parts(44_000_000, 0) + Weight::from_parts(38_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -201,8 +201,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `501` // Estimated: `6168` - // Minimum execution time: 32_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(34_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -218,7 +218,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `501` // Estimated: `6168` // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(38_000_000, 0) + Weight::from_parts(37_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -232,7 +232,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `410` // Estimated: `3631` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -245,8 +245,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -312,12 +312,12 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `350` // Estimated: `3631` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_861_969, 0) + Weight::from_parts(12_247_339, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 3_361 - .saturating_add(Weight::from_parts(2_967, 0).saturating_mul(n.into())) - // Standard Error: 3_361 - .saturating_add(Weight::from_parts(1_998, 0).saturating_mul(s.into())) + // Standard Error: 1_280 + .saturating_add(Weight::from_parts(7_748, 0).saturating_mul(n.into())) + // Standard Error: 1_280 + .saturating_add(Weight::from_parts(3_004, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -329,7 +329,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 12_000_000 picoseconds. + // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -345,11 +345,11 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `237` // Estimated: `3631` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_154_297, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_765_587, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 2_748 - .saturating_add(Weight::from_parts(8_426, 0).saturating_mul(s.into())) + // Standard Error: 929 + .saturating_add(Weight::from_parts(5_162, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -362,7 +362,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `478` // Estimated: `3631` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -373,7 +373,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 10_000_000 picoseconds. + // Minimum execution time: 9_000_000 picoseconds. Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) @@ -387,8 +387,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -403,10 +403,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `599` + // Measured: `600` // Estimated: `6168` - // Minimum execution time: 44_000_000 picoseconds. - Weight::from_parts(51_000_000, 0) + // Minimum execution time: 43_000_000 picoseconds. + Weight::from_parts(45_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -420,7 +420,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `457` // Estimated: `3631` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(20_000_000, 0) + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -434,7 +434,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `457` // Estimated: `3631` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -461,8 +461,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -475,7 +475,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 26_000_000 picoseconds. + // Minimum execution time: 27_000_000 picoseconds. Weight::from_parts(27_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -491,8 +491,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `556` // Estimated: `3631` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(36_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -505,7 +505,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `448` // Estimated: `3631` - // Minimum execution time: 25_000_000 picoseconds. + // Minimum execution time: 26_000_000 picoseconds. Weight::from_parts(27_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -519,8 +519,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/crab/src/weights/pallet_balances.rs b/runtime/crab/src/weights/pallet_balances.rs index 8be80ee34..a5c13173b 100644 --- a/runtime/crab/src/weights/pallet_balances.rs +++ b/runtime/crab/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -61,8 +61,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 43_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -73,8 +73,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(39_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -86,7 +86,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Measured: `162` // Estimated: `3581` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -98,7 +98,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Measured: `162` // Estimated: `3581` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(23_000_000, 0) + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,8 +109,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `201` // Estimated: `6172` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(54_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(48_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -121,8 +121,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(48_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(50_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -144,13 +144,13 @@ impl pallet_balances::WeightInfo for WeightInfo { /// The range of component `u` is `[1, 1000]`. fn upgrade_accounts(u: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `91 + u * (124 ±0)` + // Measured: `57 + u * (124 ±0)` // Estimated: `990 + u * (2591 ±0)` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 22_072 - .saturating_add(Weight::from_parts(13_949_592, 0).saturating_mul(u.into())) + // Standard Error: 16_703 + .saturating_add(Weight::from_parts(13_210_192, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2591).saturating_mul(u.into())) @@ -162,7 +162,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `1501` // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 1501)) .saturating_add(T::DbWeight::get().reads(1)) } diff --git a/runtime/crab/src/weights/pallet_collective.rs b/runtime/crab/src/weights/pallet_collective.rs index 7f2cbee6b..0c29cf5a1 100644 --- a/runtime/crab/src/weights/pallet_collective.rs +++ b/runtime/crab/src/weights/pallet_collective.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_collective` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -71,12 +71,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `0 + m * (2021 ±0) + p * (2026 ±0)` // Estimated: `12200 + m * (1231 ±14) + p * (3660 ±14)` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 12200)) - // Standard Error: 45_518 - .saturating_add(Weight::from_parts(2_595_649, 0).saturating_mul(m.into())) - // Standard Error: 45_518 - .saturating_add(Weight::from_parts(5_807_718, 0).saturating_mul(p.into())) + // Standard Error: 40_472 + .saturating_add(Weight::from_parts(2_434_454, 0).saturating_mul(m.into())) + // Standard Error: 40_472 + .saturating_add(Weight::from_parts(5_554_206, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -95,12 +95,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `73 + m * (20 ±0)` // Estimated: `3997 + m * (20 ±0)` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(12_540_883, 0) + Weight::from_parts(13_695_192, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 184 - .saturating_add(Weight::from_parts(1_851, 0).saturating_mul(b.into())) - // Standard Error: 1_900 - .saturating_add(Weight::from_parts(24_908, 0).saturating_mul(m.into())) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_074, 0).saturating_mul(b.into())) + // Standard Error: 377 + .saturating_add(Weight::from_parts(3_552, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -117,12 +117,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `73 + m * (20 ±0)` // Estimated: `3997 + m * (20 ±0)` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_238_739, 0) + Weight::from_parts(15_104_139, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 196 - .saturating_add(Weight::from_parts(922, 0).saturating_mul(b.into())) - // Standard Error: 2_030 - .saturating_add(Weight::from_parts(9_101, 0).saturating_mul(m.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(1_292, 0).saturating_mul(b.into())) + // Standard Error: 399 + .saturating_add(Weight::from_parts(7_575, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -143,13 +143,15 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `357 + m * (20 ±0) + p * (36 ±0)` // Estimated: `3751 + m * (21 ±0) + p * (36 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(22_299_777, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_902_081, 0) .saturating_add(Weight::from_parts(0, 3751)) - // Standard Error: 291 - .saturating_add(Weight::from_parts(507, 0).saturating_mul(b.into())) - // Standard Error: 2_998 - .saturating_add(Weight::from_parts(130_068, 0).saturating_mul(p.into())) + // Standard Error: 74 + .saturating_add(Weight::from_parts(1_263, 0).saturating_mul(b.into())) + // Standard Error: 779 + .saturating_add(Weight::from_parts(12_809, 0).saturating_mul(m.into())) + // Standard Error: 769 + .saturating_add(Weight::from_parts(120_893, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(Weight::from_parts(0, 21).saturating_mul(m.into())) @@ -165,10 +167,10 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `832 + m * (40 ±0)` // Estimated: `4296 + m * (40 ±0)` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_457_013, 0) + Weight::from_parts(15_467_537, 0) .saturating_add(Weight::from_parts(0, 4296)) - // Standard Error: 3_368 - .saturating_add(Weight::from_parts(25_662, 0).saturating_mul(m.into())) + // Standard Error: 1_372 + .saturating_add(Weight::from_parts(12_004, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(m.into())) @@ -188,12 +190,10 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `409 + m * (40 ±0) + p * (36 ±0)` // Estimated: `3854 + m * (41 ±0) + p * (36 ±0)` // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(20_865_732, 0) + Weight::from_parts(20_389_928, 0) .saturating_add(Weight::from_parts(0, 3854)) - // Standard Error: 3_715 - .saturating_add(Weight::from_parts(11_192, 0).saturating_mul(m.into())) - // Standard Error: 3_623 - .saturating_add(Weight::from_parts(136_799, 0).saturating_mul(p.into())) + // Standard Error: 1_522 + .saturating_add(Weight::from_parts(118_551, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 41).saturating_mul(m.into())) @@ -216,11 +216,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `715 + b * (1 ±0) + m * (40 ±0) + p * (40 ±0)` // Estimated: `4032 + b * (1 ±0) + m * (42 ±0) + p * (40 ±0)` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(36_446_790, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(31_233_463, 0) .saturating_add(Weight::from_parts(0, 4032)) - // Standard Error: 5_509 - .saturating_add(Weight::from_parts(182_123, 0).saturating_mul(p.into())) + // Standard Error: 138 + .saturating_add(Weight::from_parts(1_093, 0).saturating_mul(b.into())) + // Standard Error: 1_427 + .saturating_add(Weight::from_parts(141_573, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) @@ -243,11 +245,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `429 + m * (40 ±0) + p * (36 ±0)` // Estimated: `3874 + m * (41 ±0) + p * (36 ±0)` - // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(25_330_921, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(20_808_745, 0) .saturating_add(Weight::from_parts(0, 3874)) - // Standard Error: 4_098 - .saturating_add(Weight::from_parts(120_401, 0).saturating_mul(p.into())) + // Standard Error: 865 + .saturating_add(Weight::from_parts(10_979, 0).saturating_mul(m.into())) + // Standard Error: 843 + .saturating_add(Weight::from_parts(121_696, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 41).saturating_mul(m.into())) @@ -273,14 +277,14 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `735 + b * (1 ±0) + m * (40 ±0) + p * (40 ±0)` // Estimated: `4052 + b * (1 ±0) + m * (42 ±0) + p * (40 ±0)` // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(31_661_426, 0) + Weight::from_parts(33_662_051, 0) .saturating_add(Weight::from_parts(0, 4052)) - // Standard Error: 570 - .saturating_add(Weight::from_parts(3_701, 0).saturating_mul(b.into())) - // Standard Error: 6_032 - .saturating_add(Weight::from_parts(21_727, 0).saturating_mul(m.into())) - // Standard Error: 5_880 - .saturating_add(Weight::from_parts(196_199, 0).saturating_mul(p.into())) + // Standard Error: 120 + .saturating_add(Weight::from_parts(731, 0).saturating_mul(b.into())) + // Standard Error: 1_278 + .saturating_add(Weight::from_parts(8_140, 0).saturating_mul(m.into())) + // Standard Error: 1_246 + .saturating_add(Weight::from_parts(133_698, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) @@ -298,11 +302,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `226 + p * (32 ±0)` // Estimated: `1711 + p * (32 ±0)` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_462_960, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_925_961, 0) .saturating_add(Weight::from_parts(0, 1711)) - // Standard Error: 2_892 - .saturating_add(Weight::from_parts(121_652, 0).saturating_mul(p.into())) + // Standard Error: 793 + .saturating_add(Weight::from_parts(112_755, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) diff --git a/runtime/crab/src/weights/pallet_conviction_voting.rs b/runtime/crab/src/weights/pallet_conviction_voting.rs index 357351a7e..9806e2807 100644 --- a/runtime/crab/src/weights/pallet_conviction_voting.rs +++ b/runtime/crab/src/weights/pallet_conviction_voting.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_conviction_voting` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -71,8 +71,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13458` // Estimated: `42428` - // Minimum execution time: 88_000_000 picoseconds. - Weight::from_parts(109_000_000, 0) + // Minimum execution time: 87_000_000 picoseconds. + Weight::from_parts(90_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -93,8 +93,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `14179` // Estimated: `83866` - // Minimum execution time: 131_000_000 picoseconds. - Weight::from_parts(145_000_000, 0) + // Minimum execution time: 118_000_000 picoseconds. + Weight::from_parts(122_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(6)) @@ -109,8 +109,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13928` // Estimated: `83866` - // Minimum execution time: 103_000_000 picoseconds. - Weight::from_parts(119_000_000, 0) + // Minimum execution time: 95_000_000 picoseconds. + Weight::from_parts(101_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -123,8 +123,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13052` // Estimated: `30694` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(60_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(51_000_000, 0) .saturating_add(Weight::from_parts(0, 30694)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -146,11 +146,11 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `7020 + r * (447 ±0)` // Estimated: `83866 + r * (3387 ±0)` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(91_282_789, 0) + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(97_869_057, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 346_446 - .saturating_add(Weight::from_parts(37_516_946, 0).saturating_mul(r.into())) + // Standard Error: 366_165 + .saturating_add(Weight::from_parts(34_752_401, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(6)) @@ -168,11 +168,11 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `6876 + r * (447 ±0)` // Estimated: `83866 + r * (3387 ±0)` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(55_128_879, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(85_029_564, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 314_940 - .saturating_add(Weight::from_parts(37_330_071, 0).saturating_mul(r.into())) + // Standard Error: 285_050 + .saturating_add(Weight::from_parts(34_171_495, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4)) @@ -191,8 +191,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `12038` // Estimated: `30694` - // Minimum execution time: 71_000_000 picoseconds. - Weight::from_parts(82_000_000, 0) + // Minimum execution time: 76_000_000 picoseconds. + Weight::from_parts(79_000_000, 0) .saturating_add(Weight::from_parts(0, 30694)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/runtime/crab/src/weights/pallet_message_queue.rs b/runtime/crab/src/weights/pallet_message_queue.rs index bec801e1a..815ef8ceb 100644 --- a/runtime/crab/src/weights/pallet_message_queue.rs +++ b/runtime/crab/src/weights/pallet_message_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_message_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -63,8 +63,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `223` // Estimated: `6044` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 6044)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -90,7 +90,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `6` // Estimated: `3517` // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -101,8 +101,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `72` // Estimated: `69050` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(7_000_000, 0) + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -127,8 +127,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 79_000_000 picoseconds. - Weight::from_parts(92_000_000, 0) + // Minimum execution time: 77_000_000 picoseconds. + Weight::from_parts(78_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -141,7 +141,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `171` // Estimated: `3517` // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + Weight::from_parts(7_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -154,8 +154,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(43_000_000, 0) + // Minimum execution time: 39_000_000 picoseconds. + Weight::from_parts(44_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -168,8 +168,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(54_000_000, 0) + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(53_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -182,8 +182,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(59_000_000, 0) + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(56_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/crab/src/weights/pallet_preimage.rs b/runtime/crab/src/weights/pallet_preimage.rs index 170dae6cc..929c08ebc 100644 --- a/runtime/crab/src/weights/pallet_preimage.rs +++ b/runtime/crab/src/weights/pallet_preimage.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_preimage` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -68,11 +68,11 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3544` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(50_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_118, 0).saturating_mul(s.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_112, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -88,10 +88,10 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_120, 0).saturating_mul(s.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_109, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -107,10 +107,10 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_126, 0).saturating_mul(s.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_103, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -126,8 +126,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `219` // Estimated: `3544` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(52_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(50_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -142,8 +142,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(30_000_000, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(22_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -157,7 +157,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `176` // Estimated: `3544` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(22_000_000, 0) + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -170,8 +170,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -184,8 +184,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3544` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -198,8 +198,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3544` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -215,7 +215,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `144` // Estimated: `3544` // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(23_000_000, 0) + Weight::from_parts(19_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -229,7 +229,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -243,7 +243,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -259,13 +259,13 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// The range of component `n` is `[1, 1024]`. fn ensure_updated(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `181 + n * (203 ±0)` + // Measured: `149 + n * (203 ±0)` // Estimated: `990 + n * (2591 ±0)` - // Minimum execution time: 55_000_000 picoseconds. - Weight::from_parts(58_000_000, 0) + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 47_893 - .saturating_add(Weight::from_parts(57_129_527, 0).saturating_mul(n.into())) + // Standard Error: 33_431 + .saturating_add(Weight::from_parts(53_086_984, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2591).saturating_mul(n.into())) diff --git a/runtime/crab/src/weights/pallet_proxy.rs b/runtime/crab/src/weights/pallet_proxy.rs index d99a916e8..b3aa6c653 100644 --- a/runtime/crab/src/weights/pallet_proxy.rs +++ b/runtime/crab/src/weights/pallet_proxy.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -64,11 +64,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `153 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_868_651, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_511_335, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 6_453 - .saturating_add(Weight::from_parts(55_112, 0).saturating_mul(p.into())) + // Standard Error: 2_001 + .saturating_add(Weight::from_parts(17_697, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: `Proxy::Proxies` (r:1 w:0) @@ -85,13 +85,13 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `405 + a * (56 ±0) + p * (25 ±0)` // Estimated: `5302` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(34_034_765, 0) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(31_723_038, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 11_517 - .saturating_add(Weight::from_parts(130_688, 0).saturating_mul(a.into())) - // Standard Error: 11_900 - .saturating_add(Weight::from_parts(26_788, 0).saturating_mul(p.into())) + // Standard Error: 2_270 + .saturating_add(Weight::from_parts(108_906, 0).saturating_mul(a.into())) + // Standard Error: 2_345 + .saturating_add(Weight::from_parts(12_512, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -101,17 +101,15 @@ impl pallet_proxy::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn remove_announcement(a: u32, p: u32, ) -> Weight { + fn remove_announcement(a: u32, _p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `329 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_696_926, 0) + Weight::from_parts(20_276_598, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 6_889 - .saturating_add(Weight::from_parts(138_259, 0).saturating_mul(a.into())) - // Standard Error: 7_118 - .saturating_add(Weight::from_parts(23_118, 0).saturating_mul(p.into())) + // Standard Error: 2_327 + .saturating_add(Weight::from_parts(114_252, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -126,10 +124,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `329 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_877_742, 0) + Weight::from_parts(20_787_200, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 7_182 - .saturating_add(Weight::from_parts(138_873, 0).saturating_mul(a.into())) + // Standard Error: 2_014 + .saturating_add(Weight::from_parts(111_362, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -145,13 +143,13 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `345 + a * (56 ±0) + p * (25 ±0)` // Estimated: `5302` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(27_954_010, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(25_801_041, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 8_644 - .saturating_add(Weight::from_parts(139_219, 0).saturating_mul(a.into())) - // Standard Error: 8_931 - .saturating_add(Weight::from_parts(13_609, 0).saturating_mul(p.into())) + // Standard Error: 2_000 + .saturating_add(Weight::from_parts(140_358, 0).saturating_mul(a.into())) + // Standard Error: 2_066 + .saturating_add(Weight::from_parts(20_005, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -162,11 +160,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `149 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_897_500, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(20_588_342, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 8_123 - .saturating_add(Weight::from_parts(29_671, 0).saturating_mul(p.into())) + // Standard Error: 1_827 + .saturating_add(Weight::from_parts(45_983, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -178,38 +176,38 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(22_418_603, 0) + Weight::from_parts(21_022_947, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_503 - .saturating_add(Weight::from_parts(14_007, 0).saturating_mul(p.into())) + // Standard Error: 2_673 + .saturating_add(Weight::from_parts(10_892, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Proxy::Proxies` (r:1 w:1) /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(845), added: 3320, mode: `MaxEncodedLen`) /// The range of component `p` is `[1, 31]`. - fn remove_proxies(_p: u32, ) -> Weight { + fn remove_proxies(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(22_214_453, 0) + Weight::from_parts(20_186_224, 0) .saturating_add(Weight::from_parts(0, 4310)) + // Standard Error: 1_984 + .saturating_add(Weight::from_parts(30_784, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Proxy::Proxies` (r:1 w:1) /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(845), added: 3320, mode: `MaxEncodedLen`) /// The range of component `p` is `[1, 31]`. - fn create_pure(p: u32, ) -> Weight { + fn create_pure(_p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `161` // Estimated: `4310` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(22_971_370, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(22_149_368, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 8_048 - .saturating_add(Weight::from_parts(25_556, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -221,10 +219,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `174 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(22_291_424, 0) + Weight::from_parts(20_752_447, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_580 - .saturating_add(Weight::from_parts(1_967, 0).saturating_mul(p.into())) + // Standard Error: 1_708 + .saturating_add(Weight::from_parts(12_228, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/crab/src/weights/pallet_referenda.rs b/runtime/crab/src/weights/pallet_referenda.rs index 07b3722cd..f0d5c1397 100644 --- a/runtime/crab/src/weights/pallet_referenda.rs +++ b/runtime/crab/src/weights/pallet_referenda.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_referenda` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -65,8 +65,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `275` // Estimated: `42428` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(41_000_000, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -79,8 +79,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `516` // Estimated: `83866` - // Minimum execution time: 39_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(39_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -95,10 +95,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn place_decision_deposit_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `3309` + // Measured: `3276` // Estimated: `42428` - // Minimum execution time: 43_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(43_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -113,10 +113,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn place_decision_deposit_not_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `3329` + // Measured: `3296` // Estimated: `42428` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(51_000_000, 0) + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(44_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -131,8 +131,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `516` // Estimated: `83866` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(53_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -147,8 +147,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `516` // Estimated: `83866` - // Minimum execution time: 44_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 43_000_000 picoseconds. + Weight::from_parts(44_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -159,8 +159,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `425` // Estimated: `4377` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -171,8 +171,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4377` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(31_000_000, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(25_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -185,8 +185,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `83866` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -203,8 +203,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `846` // Estimated: `83866` - // Minimum execution time: 83_000_000 picoseconds. - Weight::from_parts(87_000_000, 0) + // Minimum execution time: 84_000_000 picoseconds. + Weight::from_parts(85_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -217,8 +217,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `207` // Estimated: `5477` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -231,10 +231,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn one_fewer_deciding_failing() -> Weight { // Proof Size summary in bytes: - // Measured: `3209` + // Measured: `3162` // Estimated: `42428` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(34_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(29_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -247,10 +247,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn one_fewer_deciding_passing() -> Weight { // Proof Size summary in bytes: - // Measured: `3195` + // Measured: `3162` // Estimated: `42428` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(35_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -263,8 +263,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3020` // Estimated: `5477` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -277,8 +277,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3020` // Estimated: `5477` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -310,7 +310,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `3044` // Estimated: `5477` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -366,7 +366,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `390` // Estimated: `42428` // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + Weight::from_parts(23_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -382,7 +382,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `390` // Estimated: `42428` // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(24_000_000, 0) + Weight::from_parts(25_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -396,7 +396,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `443` // Estimated: `42428` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + Weight::from_parts(21_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -409,7 +409,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `42428` - // Minimum execution time: 19_000_000 picoseconds. + // Minimum execution time: 20_000_000 picoseconds. Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) @@ -454,7 +454,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `447` // Estimated: `83866` // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(34_000_000, 0) + Weight::from_parts(29_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -467,8 +467,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `42428` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -485,8 +485,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `4377` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(20_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/crab/src/weights/pallet_scheduler.rs b/runtime/crab/src/weights/pallet_scheduler.rs index 00e8f0842..40a716442 100644 --- a/runtime/crab/src/weights/pallet_scheduler.rs +++ b/runtime/crab/src/weights/pallet_scheduler.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_scheduler` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -75,10 +75,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `78 + s * (177 ±0)` // Estimated: `42428` // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(6_061_103, 0) + Weight::from_parts(5_568_551, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 3_856 - .saturating_add(Weight::from_parts(389_514, 0).saturating_mul(s.into())) + // Standard Error: 1_629 + .saturating_add(Weight::from_parts(381_298, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -101,11 +101,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `179 + s * (1 ±0)` // Estimated: `3644 + s * (1 ±0)` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3644)) // Standard Error: 2 - .saturating_add(Weight::from_parts(486, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(503, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) @@ -116,7 +116,7 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_000_000 picoseconds. + // Minimum execution time: 4_000_000 picoseconds. Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) @@ -156,10 +156,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `78 + s * (177 ±0)` // Estimated: `42428` // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(11_517_176, 0) + Weight::from_parts(10_972_705, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 5_666 - .saturating_add(Weight::from_parts(402_645, 0).saturating_mul(s.into())) + // Standard Error: 1_476 + .saturating_add(Weight::from_parts(372_787, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -173,10 +173,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `78 + s * (177 ±0)` // Estimated: `42428` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(11_836_816, 0) + Weight::from_parts(11_434_122, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 7_709 - .saturating_add(Weight::from_parts(653_066, 0).saturating_mul(s.into())) + // Standard Error: 1_274 + .saturating_add(Weight::from_parts(605_406, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -190,10 +190,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `255 + s * (185 ±0)` // Estimated: `42428` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(15_472_235, 0) + Weight::from_parts(14_639_058, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 7_183 - .saturating_add(Weight::from_parts(429_623, 0).saturating_mul(s.into())) + // Standard Error: 2_168 + .saturating_add(Weight::from_parts(383_222, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -207,10 +207,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `281 + s * (185 ±0)` // Estimated: `42428` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(13_326_693, 0) + Weight::from_parts(13_807_102, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 7_954 - .saturating_add(Weight::from_parts(699_188, 0).saturating_mul(s.into())) + // Standard Error: 1_277 + .saturating_add(Weight::from_parts(617_603, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/runtime/crab/src/weights/pallet_session.rs b/runtime/crab/src/weights/pallet_session.rs index 648610786..5288c3e40 100644 --- a/runtime/crab/src/weights/pallet_session.rs +++ b/runtime/crab/src/weights/pallet_session.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -64,7 +64,7 @@ impl pallet_session::WeightInfo for WeightInfo { // Measured: `246` // Estimated: `3711` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3711)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -78,7 +78,7 @@ impl pallet_session::WeightInfo for WeightInfo { // Measured: `228` // Estimated: `3693` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3693)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/crab/src/weights/pallet_timestamp.rs b/runtime/crab/src/weights/pallet_timestamp.rs index 4933c5da1..187ae9525 100644 --- a/runtime/crab/src/weights/pallet_timestamp.rs +++ b/runtime/crab/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 diff --git a/runtime/crab/src/weights/pallet_treasury.rs b/runtime/crab/src/weights/pallet_treasury.rs index deaa9b1ad..3ca77751e 100644 --- a/runtime/crab/src/weights/pallet_treasury.rs +++ b/runtime/crab/src/weights/pallet_treasury.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_treasury` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -65,7 +65,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `1887` - // Minimum execution time: 9_000_000 picoseconds. + // Minimum execution time: 10_000_000 picoseconds. Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 1887)) .saturating_add(T::DbWeight::get().reads(2)) @@ -109,10 +109,10 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `470 + p * (8 ±0)` // Estimated: `3549` // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(10_154_898, 0) + Weight::from_parts(9_253_861, 0) .saturating_add(Weight::from_parts(0, 3549)) - // Standard Error: 2_396 - .saturating_add(Weight::from_parts(34_416, 0).saturating_mul(p.into())) + // Standard Error: 1_097 + .saturating_add(Weight::from_parts(19_301, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -144,10 +144,10 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `219 + p * (97 ±0)` // Estimated: `3581 + p * (2559 ±0)` // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(18_314_921, 0) + Weight::from_parts(39_475_278, 0) .saturating_add(Weight::from_parts(0, 3581)) - // Standard Error: 32_528 - .saturating_add(Weight::from_parts(2_782_967, 0).saturating_mul(p.into())) + // Standard Error: 142_377 + .saturating_add(Weight::from_parts(2_515_355, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -162,7 +162,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `42` // Estimated: `1489` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -175,7 +175,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6172` - // Minimum execution time: 48_000_000 picoseconds. + // Minimum execution time: 50_000_000 picoseconds. Weight::from_parts(50_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(3)) @@ -188,7 +188,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `148` // Estimated: `3522` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3522)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -200,7 +200,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `148` // Estimated: `3522` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3522)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/crab/src/weights/pallet_tx_pause.rs b/runtime/crab/src/weights/pallet_tx_pause.rs index 9da3fe68f..48231b31f 100644 --- a/runtime/crab/src/weights/pallet_tx_pause.rs +++ b/runtime/crab/src/weights/pallet_tx_pause.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_tx_pause` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -62,7 +62,7 @@ impl pallet_tx_pause::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -73,8 +73,8 @@ impl pallet_tx_pause::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `566` // Estimated: `3997` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/crab/src/weights/pallet_utility.rs b/runtime/crab/src/weights/pallet_utility.rs index b2d7dfdb7..d64c37934 100644 --- a/runtime/crab/src/weights/pallet_utility.rs +++ b/runtime/crab/src/weights/pallet_utility.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -63,10 +63,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(20_124_325, 0) + Weight::from_parts(13_306_303, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 20_837 - .saturating_add(Weight::from_parts(4_967_840, 0).saturating_mul(c.into())) + // Standard Error: 2_735 + .saturating_add(Weight::from_parts(4_665_598, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `TxPause::PausedCalls` (r:1 w:0) @@ -75,7 +75,7 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `4` // Estimated: `3997` - // Minimum execution time: 7_000_000 picoseconds. + // Minimum execution time: 6_000_000 picoseconds. Weight::from_parts(7_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) @@ -88,10 +88,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(11_330_409, 0) + Weight::from_parts(9_648_556, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 19_792 - .saturating_add(Weight::from_parts(5_257_682, 0).saturating_mul(c.into())) + // Standard Error: 2_882 + .saturating_add(Weight::from_parts(4_894_709, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) } fn dispatch_as() -> Weight { @@ -110,10 +110,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(2_679_311, 0) + Weight::from_parts(3_751_663, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 21_388 - .saturating_add(Weight::from_parts(5_053_368, 0).saturating_mul(c.into())) + // Standard Error: 3_706 + .saturating_add(Weight::from_parts(4_700_288, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) } } diff --git a/runtime/crab/src/weights/pallet_whitelist.rs b/runtime/crab/src/weights/pallet_whitelist.rs index 142bb54ba..835033068 100644 --- a/runtime/crab/src/weights/pallet_whitelist.rs +++ b/runtime/crab/src/weights/pallet_whitelist.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_whitelist` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -65,7 +65,7 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `48` // Estimated: `3544` - // Minimum execution time: 14_000_000 picoseconds. + // Minimum execution time: 15_000_000 picoseconds. Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) @@ -81,8 +81,8 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,10 +101,10 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Measured: `252 + n * (1 ±0)` // Estimated: `3716 + n * (1 ±0)` // Minimum execution time: 23_000_000 picoseconds. - Weight::from_parts(23_000_000, 0) + Weight::from_parts(24_000_000, 0) .saturating_add(Weight::from_parts(0, 3716)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(506, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(503, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -121,10 +121,10 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Measured: `176` // Estimated: `3544` // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(19_545_715, 0) + Weight::from_parts(18_253_001, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 34 - .saturating_add(Weight::from_parts(949, 0).saturating_mul(n.into())) + // Standard Error: 5 + .saturating_add(Weight::from_parts(1_001, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index fe8b6ef26..81099de3d 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -27,8 +27,6 @@ darwinia-common-runtime = { workspace = true } darwinia-deposit = { workspace = true } darwinia-ethtx-forwarder = { workspace = true } darwinia-precompile-assets = { workspace = true } -darwinia-precompile-deposit = { workspace = true } -darwinia-precompile-staking = { workspace = true } darwinia-precompile-state-storage = { workspace = true } darwinia-staking = { workspace = true } dc-inflation = { workspace = true } @@ -143,8 +141,6 @@ std = [ "darwinia-deposit/std", "darwinia-ethtx-forwarder/std", "darwinia-precompile-assets/std", - "darwinia-precompile-deposit/std", - "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-inflation/std", @@ -248,7 +244,6 @@ runtime-benchmarks = [ "darwinia-deposit/runtime-benchmarks", "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-precompile-assets/runtime-benchmarks", - "darwinia-precompile-staking/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # frontier diff --git a/runtime/darwinia/src/migration.rs b/runtime/darwinia/src/migration.rs index e73972d8c..e45355693 100644 --- a/runtime/darwinia/src/migration.rs +++ b/runtime/darwinia/src/migration.rs @@ -51,6 +51,8 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::DispatchError> { log::info!("post"); + darwinia_staking::migration::post_check::(); + assert!(migration::storage_iter::<()>(b"Vesting", b"Vesting").count() == 0); assert!(Balances::locks( // 0x081cbab52e2dbcd52f441c7ae9ad2a3be42e2284. @@ -73,6 +75,7 @@ fn migrate() -> frame_support::weights::Weight { // polkadot-sdk use frame_support::traits::LockableCurrency; + let (r, w) = darwinia_staking::migration::migrate::(); let _ = migration::clear_storage_prefix(b"Vesting", b"Vesting", &[], None, None); Balances::remove_lock( @@ -83,5 +86,5 @@ fn migrate() -> frame_support::weights::Weight { ]), ); - ::DbWeight::get().reads_writes(0, 5) + ::DbWeight::get().reads_writes(r, w + 5) } diff --git a/runtime/darwinia/src/pallets.rs b/runtime/darwinia/src/pallets.rs index 15e84e1a7..fdfb521c4 100644 --- a/runtime/darwinia/src/pallets.rs +++ b/runtime/darwinia/src/pallets.rs @@ -42,8 +42,6 @@ mod assets; pub use assets::*; mod deposit; -#[cfg(feature = "runtime-benchmarks")] -pub use deposit::*; mod account_migration; diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index d723c020f..77e71c0a2 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -19,34 +19,8 @@ // darwinia use crate::*; -pub enum KtonMinting {} -impl darwinia_deposit::SimpleAsset for KtonMinting { - type AccountId = AccountId; - - fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint( - RuntimeOrigin::signed(KTON_ADMIN), - (AssetIds::Kton as AssetId).into(), - *beneficiary, - amount, - ) - } - - fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - let asset_id = AssetIds::Kton as _; - - if Assets::balance(asset_id, who) < amount { - Err(>::BalanceLow)?; - } - - Assets::burn(RuntimeOrigin::signed(KTON_ADMIN), asset_id.into(), *who, amount) - } -} - impl darwinia_deposit::Config for Runtime { type DepositMigrator = darwinia_deposit::DepositMigrator; - type Kton = KtonMinting; - type MaxDeposits = ConstU32<512>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type Treasury = pallet_config::TreasuryAccount; diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index ef0d0f84f..78cfe2de7 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -18,71 +18,16 @@ // darwinia use crate::*; -// polkadot-sdk -use frame_support::traits::Currency; darwinia_common_runtime::fast_runtime_or_not!(DURATION, BlockNumber, 5 * MINUTES, 14 * DAYS); -pub enum RingStaking {} -impl darwinia_staking::Stake for RingStaking { - type AccountId = AccountId; - type Item = Balance; - - fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - who, - &darwinia_staking::account_id(), - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } - - fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - &darwinia_staking::account_id(), - who, - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } -} -pub enum KtonStaking {} -impl darwinia_staking::Stake for KtonStaking { - type AccountId = AccountId; - type Item = Balance; - - fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer( - RuntimeOrigin::signed(*who), - (AssetIds::Kton as AssetId).into(), - darwinia_staking::account_id(), - item, - ) - } - - fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - Assets::transfer( - RuntimeOrigin::signed(darwinia_staking::account_id()), - (AssetIds::Kton as AssetId).into(), - *who, - item, - ) - } -} - impl darwinia_staking::Config for Runtime { type Currency = Balances; - type Deposit = Deposit; - type IssuingManager = darwinia_staking::BalanceIssuing; + type IssuingManager = darwinia_staking::BalancesIssuing; type KtonStaking = darwinia_staking::KtonStaking; - type MaxDeposits = ::MaxDeposits; - type Ring = RingStaking; type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = darwinia_staking::ShouldEndSession; type Treasury = pallet_config::TreasuryAccount; type UnixTime = Timestamp; type WeightInfo = weights::darwinia_staking::WeightInfo; } -#[cfg(not(feature = "runtime-benchmarks"))] -impl darwinia_staking::DepositConfig for Runtime {} diff --git a/runtime/darwinia/src/pallets/system.rs b/runtime/darwinia/src/pallets/system.rs index f00b1c9e5..7825ab56a 100644 --- a/runtime/darwinia/src/pallets/system.rs +++ b/runtime/darwinia/src/pallets/system.rs @@ -25,22 +25,11 @@ frame_support::parameter_types! { pub const Version: sp_version::RuntimeVersion = VERSION; } -pub enum LockAndStake {} -impl frame_support::traits::Contains for LockAndStake { - fn contains(c: &RuntimeCall) -> bool { - matches!( - c, - RuntimeCall::DarwiniaStaking(darwinia_staking::Call::stake { .. }) - | RuntimeCall::Deposit(darwinia_deposit::Call::lock { .. }) - ) - } -} - #[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)] impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; type AccountId = AccountId; - type BaseCallFilter = frame_support::traits::EverythingBut; + type BaseCallFilter = frame_support::traits::Everything; type Block = Block; type BlockLength = pallet_config::RuntimeBlockLength; type BlockWeights = pallet_config::RuntimeBlockWeights; diff --git a/runtime/darwinia/src/pallets/tx_pause.rs b/runtime/darwinia/src/pallets/tx_pause.rs index 3a7c19db4..ae3fb3a9c 100644 --- a/runtime/darwinia/src/pallets/tx_pause.rs +++ b/runtime/darwinia/src/pallets/tx_pause.rs @@ -40,9 +40,7 @@ impl frame_support::traits::Contains !matches!( pallet, b"Balances" - | b"Assets" | b"Deposit" - | b"AccountMigration" - | b"DarwiniaStaking" + | b"Assets" | b"AccountMigration" | b"Ethereum" | b"EVM" | b"EthTxForwarder" ) diff --git a/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs b/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs index eef5c2bcb..3bb86f94f 100644 --- a/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs +++ b/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `cumulus_pallet_parachain_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -73,8 +73,8 @@ impl cumulus_pallet_parachain_system::WeightInfo for We // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) - // Standard Error: 57_770 - .saturating_add(Weight::from_parts(104_402_544, 0).saturating_mul(n.into())) + // Standard Error: 40_190 + .saturating_add(Weight::from_parts(100_461_192, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) diff --git a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs index ef97eb03c..0ca2dce83 100644 --- a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -82,7 +82,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `48` // Estimated: `3517` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -116,7 +116,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `0` // Estimated: `0` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -137,8 +137,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65677` // Estimated: `69142` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(47_000_000, 0) .saturating_add(Weight::from_parts(0, 69142)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -151,8 +151,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65676` // Estimated: `69141` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(31_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(29_000_000, 0) .saturating_add(Weight::from_parts(0, 69141)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/darwinia/src/weights/darwinia_account_migration.rs b/runtime/darwinia/src/weights/darwinia_account_migration.rs index e74294041..b168d0f50 100644 --- a/runtime/darwinia/src/weights/darwinia_account_migration.rs +++ b/runtime/darwinia/src/weights/darwinia_account_migration.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_account_migration` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -61,19 +61,27 @@ impl darwinia_account_migration::WeightInfo for WeightI /// Proof: `AccountMigration::KtonAccounts` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:0 w:1) + /// Storage: `AccountMigration::Ledgers` (r:1 w:1) + /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(24664), added: 27139, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `AccountMigration::Deposits` (r:1 w:1) + /// Proof: `AccountMigration::Deposits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `DarwiniaStaking::Ledgers` (r:0 w:1) + /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:0 w:1) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Deposit::Deposits` (r:0 w:1) + /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) fn migrate() -> Weight { // Proof Size summary in bytes: - // Measured: `591` - // Estimated: `3631` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) - .saturating_add(Weight::from_parts(0, 3631)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(5)) + // Measured: `28346` + // Estimated: `31811` + // Minimum execution time: 118_000_000 picoseconds. + Weight::from_parts(125_000_000, 0) + .saturating_add(Weight::from_parts(0, 31811)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(11)) } /// Storage: `AccountMigration::Multisigs` (r:0 w:1) /// Proof: `AccountMigration::Multisigs` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -83,25 +91,34 @@ impl darwinia_account_migration::WeightInfo for WeightI /// Proof: `AccountMigration::KtonAccounts` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) /// Storage: `Assets::Asset` (r:1 w:1) /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:0 w:1) + /// Storage: `AccountMigration::Ledgers` (r:1 w:1) + /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(24664), added: 27139, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:3) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `AccountMigration::Deposits` (r:1 w:1) + /// Proof: `AccountMigration::Deposits` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `DarwiniaStaking::Ledgers` (r:0 w:1) + /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `Assets::Account` (r:0 w:1) /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Deposit::Deposits` (r:0 w:1) + /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) /// The range of component `x` is `[0, 99]`. /// The range of component `y` is `[0, 99]`. /// The range of component `z` is `[0, 99]`. fn migrate_multisig(x: u32, _y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` - // Estimated: `0 + x * (18 ±0) + z * (18 ±0)` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(10_220_315, 0) - .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_252 - .saturating_add(Weight::from_parts(41_724, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(Weight::from_parts(0, 18).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 18).saturating_mul(z.into())) + // Estimated: `2 + x * (161 ±0) + z * (161 ±0)` + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(19_462_486, 0) + .saturating_add(Weight::from_parts(0, 2)) + // Standard Error: 10_480 + .saturating_add(Weight::from_parts(19_792, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 161).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 161).saturating_mul(z.into())) } /// Storage: `AccountMigration::Multisigs` (r:1 w:1) /// Proof: `AccountMigration::Multisigs` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -111,8 +128,8 @@ impl darwinia_account_migration::WeightInfo for WeightI // Proof Size summary in bytes: // Measured: `3499` // Estimated: `6964` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 6964)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/darwinia/src/weights/darwinia_deposit.rs b/runtime/darwinia/src/weights/darwinia_deposit.rs index 10e8bffe9..36b77446f 100644 --- a/runtime/darwinia/src/weights/darwinia_deposit.rs +++ b/runtime/darwinia/src/weights/darwinia_deposit.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_deposit` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -55,62 +55,6 @@ use core::marker::PhantomData; /// Weight functions for `darwinia_deposit`. pub struct WeightInfo(PhantomData); impl darwinia_deposit::WeightInfo for WeightInfo { - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - fn lock() -> Weight { - // Proof Size summary in bytes: - // Measured: `26812` - // Estimated: `29615` - // Minimum execution time: 83_000_000 picoseconds. - Weight::from_parts(100_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim() -> Weight { - // Proof Size summary in bytes: - // Measured: `26541` - // Estimated: `29615` - // Minimum execution time: 65_000_000 picoseconds. - Weight::from_parts(84_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim_with_penalty() -> Weight { - // Proof Size summary in bytes: - // Measured: `26863` - // Estimated: `29615` - // Minimum execution time: 95_000_000 picoseconds. - Weight::from_parts(111_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } /// Storage: `Deposit::Deposits` (r:1 w:1) /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -127,12 +71,12 @@ impl darwinia_deposit::WeightInfo for WeightInfo { /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Ethereum::Pending` (r:1 w:1) /// Proof: `Ethereum::Pending` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn migrate() -> Weight { + fn migrate_for() -> Weight { // Proof Size summary in bytes: // Measured: `27484` // Estimated: `33424` - // Minimum execution time: 3_936_000_000 picoseconds. - Weight::from_parts(4_548_000_000, 0) + // Minimum execution time: 229_000_000 picoseconds. + Weight::from_parts(233_000_000, 0) .saturating_add(Weight::from_parts(0, 33424)) .saturating_add(T::DbWeight::get().reads(11)) .saturating_add(T::DbWeight::get().writes(4)) diff --git a/runtime/darwinia/src/weights/darwinia_staking.rs b/runtime/darwinia/src/weights/darwinia_staking.rs index cddebe04b..f02be5bee 100644 --- a/runtime/darwinia/src/weights/darwinia_staking.rs +++ b/runtime/darwinia/src/weights/darwinia_staking.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_staking` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -59,116 +59,28 @@ impl darwinia_staking::WeightInfo for WeightInfo { /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn stake(x: u32, ) -> Weight { + fn unstake_all_for() -> Weight { // Proof Size summary in bytes: - // Measured: `7088 + x * (25 ±0)` - // Estimated: `29615` - // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(770_181_918, 0) - .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 262_777 - .saturating_add(Weight::from_parts(13_019_225, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:1) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn unstake(x: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7415 + x * (26 ±0)` - // Estimated: `29615` - // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(755_853_947, 0) - .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 261_936 - .saturating_add(Weight::from_parts(13_061_272, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `DarwiniaStaking::Collators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn collect() -> Weight { - // Proof Size summary in bytes: - // Measured: `388` - // Estimated: `3497` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) - .saturating_add(Weight::from_parts(0, 3497)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:0) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:1 w:0) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Nominators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - fn nominate() -> Weight { - // Proof Size summary in bytes: - // Measured: `600` + // Measured: `406` // Estimated: `4543` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(55_000_000, 0) .saturating_add(Weight::from_parts(0, 4543)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::Nominators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn chill() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: `DarwiniaStaking::ExposureCacheStates` (r:1 w:0) - /// Proof: `DarwiniaStaking::ExposureCacheStates` (`max_values`: Some(1), `max_size`: Some(3), added: 498, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::ExposureCache2` (r:1 w:1) - /// Proof: `DarwiniaStaking::ExposureCache2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `DarwiniaStaking::PendingRewards` (r:1 w:1) /// Proof: `DarwiniaStaking::PendingRewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:32 w:32) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `2184` - // Estimated: `83902` - // Minimum execution time: 527_000_000 picoseconds. - Weight::from_parts(616_000_000, 0) - .saturating_add(Weight::from_parts(0, 83902)) - .saturating_add(T::DbWeight::get().reads(35)) - .saturating_add(T::DbWeight::get().writes(34)) - } - /// Storage: `DarwiniaStaking::RateLimit` (r:0 w:1) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_rate_limit() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:1 w:0) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn allocate_ring_staking_reward_of() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(2_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `271` + // Estimated: `3736` + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) + .saturating_add(Weight::from_parts(0, 3736)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) @@ -181,7 +93,8 @@ impl darwinia_staking::WeightInfo for WeightInfo { Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) - } /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + } + /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: diff --git a/runtime/darwinia/src/weights/frame_system.rs b/runtime/darwinia/src/weights/frame_system.rs index 3febf6169..003d6691a 100644 --- a/runtime/darwinia/src/weights/frame_system.rs +++ b/runtime/darwinia/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -60,22 +60,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(2_022_883, 0) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(2_743_822, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(158, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(149, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. + // Minimum execution time: 5_000_000 picoseconds. Weight::from_parts(5_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_004, 0).saturating_mul(b.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(953, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -107,8 +107,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `198` // Estimated: `1683` - // Minimum execution time: 68_735_000_000 picoseconds. - Weight::from_parts(75_159_000_000, 0) + // Minimum execution time: 67_705_000_000 picoseconds. + Weight::from_parts(71_630_000_000, 0) .saturating_add(Weight::from_parts(0, 1683)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -123,8 +123,8 @@ impl frame_system::WeightInfo for WeightInfo { // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_238 - .saturating_add(Weight::from_parts(796_198, 0).saturating_mul(i.into())) + // Standard Error: 2_602 + .saturating_add(Weight::from_parts(763_849, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -134,11 +134,11 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. + // Minimum execution time: 1_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_484 - .saturating_add(Weight::from_parts(567_851, 0).saturating_mul(i.into())) + // Standard Error: 851 + .saturating_add(Weight::from_parts(538_465, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -151,8 +151,8 @@ impl frame_system::WeightInfo for WeightInfo { // Minimum execution time: 3_000_000 picoseconds. Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 102)) - // Standard Error: 3_104 - .saturating_add(Weight::from_parts(1_048_017, 0).saturating_mul(p.into())) + // Standard Error: 1_226 + .saturating_add(Weight::from_parts(990_199, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -164,7 +164,7 @@ impl frame_system::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -186,8 +186,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `220` // Estimated: `1705` - // Minimum execution time: 70_228_000_000 picoseconds. - Weight::from_parts(79_493_000_000, 0) + // Minimum execution time: 67_521_000_000 picoseconds. + Weight::from_parts(76_287_000_000, 0) .saturating_add(Weight::from_parts(0, 1705)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) diff --git a/runtime/darwinia/src/weights/pallet_asset_manager.rs b/runtime/darwinia/src/weights/pallet_asset_manager.rs index e4081918f..f67c418e6 100644 --- a/runtime/darwinia/src/weights/pallet_asset_manager.rs +++ b/runtime/darwinia/src/weights/pallet_asset_manager.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_asset_manager` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -84,11 +84,11 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `595 + x * (9 ±0)` // Estimated: `3983 + x * (10 ±0)` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(17_795_668, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_177_208, 0) .saturating_add(Weight::from_parts(0, 3983)) - // Standard Error: 5_207 - .saturating_add(Weight::from_parts(392_816, 0).saturating_mul(x.into())) + // Standard Error: 2_681 + .saturating_add(Weight::from_parts(359_761, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(x.into())) @@ -107,10 +107,10 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Measured: `968 + x * (13 ±0)` // Estimated: `4303 + x * (14 ±0)` // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(28_440_466, 0) + Weight::from_parts(26_284_970, 0) .saturating_add(Weight::from_parts(0, 4303)) - // Standard Error: 6_795 - .saturating_add(Weight::from_parts(386_150, 0).saturating_mul(x.into())) + // Standard Error: 2_793 + .saturating_add(Weight::from_parts(370_531, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(6)) .saturating_add(Weight::from_parts(0, 14).saturating_mul(x.into())) @@ -125,10 +125,10 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Measured: `196 + x * (5 ±0)` // Estimated: `1678 + x * (5 ±0)` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(11_889_301, 0) + Weight::from_parts(10_702_161, 0) .saturating_add(Weight::from_parts(0, 1678)) - // Standard Error: 4_468 - .saturating_add(Weight::from_parts(336_614, 0).saturating_mul(x.into())) + // Standard Error: 2_312 + .saturating_add(Weight::from_parts(323_872, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 5).saturating_mul(x.into())) @@ -147,10 +147,10 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Measured: `486 + x * (10 ±0)` // Estimated: `3949 + x * (10 ±0)` // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(20_650_636, 0) + Weight::from_parts(18_830_428, 0) .saturating_add(Weight::from_parts(0, 3949)) - // Standard Error: 5_638 - .saturating_add(Weight::from_parts(331_744, 0).saturating_mul(x.into())) + // Standard Error: 3_006 + .saturating_add(Weight::from_parts(329_557, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(x.into())) diff --git a/runtime/darwinia/src/weights/pallet_assets.rs b/runtime/darwinia/src/weights/pallet_assets.rs index 1e2943cb0..c7a04cfd5 100644 --- a/runtime/darwinia/src/weights/pallet_assets.rs +++ b/runtime/darwinia/src/weights/pallet_assets.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -61,7 +61,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `157` // Estimated: `3631` - // Minimum execution time: 10_000_000 picoseconds. + // Minimum execution time: 9_000_000 picoseconds. Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) @@ -100,13 +100,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `577 + c * (183 ±0)` + // Measured: `543 + c * (183 ±0)` // Estimated: `3631 + c * (2591 ±0)` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 19_912 - .saturating_add(Weight::from_parts(11_438_394, 0).saturating_mul(c.into())) + // Standard Error: 12_460 + .saturating_add(Weight::from_parts(10_929_710, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -123,10 +123,10 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `458 + a * (74 ±0)` // Estimated: `3631 + a * (2603 ±0)` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + Weight::from_parts(39_637_390, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 9_699 - .saturating_add(Weight::from_parts(4_253_783, 0).saturating_mul(a.into())) + // Standard Error: 22_886 + .saturating_add(Weight::from_parts(4_059_990, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -156,7 +156,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `350` // Estimated: `3631` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + Weight::from_parts(22_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -169,8 +169,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(32_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -185,8 +185,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `501` // Estimated: `6168` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(42_000_000, 0) + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(39_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -201,8 +201,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `501` // Estimated: `6168` - // Minimum execution time: 32_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 34_000_000 picoseconds. + Weight::from_parts(35_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -217,8 +217,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `501` // Estimated: `6168` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 36_000_000 picoseconds. + Weight::from_parts(38_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -231,8 +231,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -245,8 +245,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -258,7 +258,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -296,7 +296,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -312,12 +312,12 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `350` // Estimated: `3631` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_129_697, 0) + Weight::from_parts(13_194_851, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 2_810 - .saturating_add(Weight::from_parts(15_482, 0).saturating_mul(n.into())) - // Standard Error: 2_810 - .saturating_add(Weight::from_parts(23_441, 0).saturating_mul(s.into())) + // Standard Error: 1_044 + .saturating_add(Weight::from_parts(38, 0).saturating_mul(n.into())) + // Standard Error: 1_044 + .saturating_add(Weight::from_parts(716, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -330,7 +330,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `478` // Estimated: `3631` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -346,12 +346,12 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `237` // Estimated: `3631` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_891_526, 0) + Weight::from_parts(11_589_578, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 2_723 - .saturating_add(Weight::from_parts(24_590, 0).saturating_mul(n.into())) - // Standard Error: 2_723 - .saturating_add(Weight::from_parts(14_605, 0).saturating_mul(s.into())) + // Standard Error: 1_021 + .saturating_add(Weight::from_parts(3_615, 0).saturating_mul(n.into())) + // Standard Error: 1_021 + .saturating_add(Weight::from_parts(1_307, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -363,8 +363,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -390,7 +390,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -405,10 +405,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `599` + // Measured: `600` // Estimated: `6168` - // Minimum execution time: 43_000_000 picoseconds. - Weight::from_parts(47_000_000, 0) + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(45_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -422,7 +422,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `457` // Estimated: `3631` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -436,7 +436,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `457` // Estimated: `3631` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + Weight::from_parts(19_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -463,7 +463,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 29_000_000 picoseconds. + // Minimum execution time: 30_000_000 picoseconds. Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) @@ -477,8 +477,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(28_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(29_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -493,8 +493,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `556` // Estimated: `3631` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(28_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -507,8 +507,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `448` // Estimated: `3631` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(28_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(27_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/darwinia/src/weights/pallet_balances.rs b/runtime/darwinia/src/weights/pallet_balances.rs index 9c332b819..ee467fb83 100644 --- a/runtime/darwinia/src/weights/pallet_balances.rs +++ b/runtime/darwinia/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -62,7 +62,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Measured: `39` // Estimated: `3581` // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(53_000_000, 0) + Weight::from_parts(47_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -73,8 +73,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(43_000_000, 0) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(39_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -85,8 +85,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `195` // Estimated: `3581` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,8 +109,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `234` // Estimated: `6172` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(47_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(49_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -121,8 +121,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(48_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(49_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -144,13 +144,13 @@ impl pallet_balances::WeightInfo for WeightInfo { /// The range of component `u` is `[1, 1000]`. fn upgrade_accounts(u: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `190 + u * (124 ±0)` + // Measured: `150 + u * (124 ±0)` // Estimated: `990 + u * (2591 ±0)` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 21_312 - .saturating_add(Weight::from_parts(13_977_832, 0).saturating_mul(u.into())) + // Standard Error: 19_025 + .saturating_add(Weight::from_parts(13_309_259, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2591).saturating_mul(u.into())) diff --git a/runtime/darwinia/src/weights/pallet_collective.rs b/runtime/darwinia/src/weights/pallet_collective.rs index a2bba17a5..72811bd7b 100644 --- a/runtime/darwinia/src/weights/pallet_collective.rs +++ b/runtime/darwinia/src/weights/pallet_collective.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_collective` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -70,13 +70,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + m * (2021 ±0) + p * (2026 ±0)` // Estimated: `12200 + m * (1231 ±14) + p * (3660 ±14)` - // Minimum execution time: 10_000_000 picoseconds. + // Minimum execution time: 11_000_000 picoseconds. Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 12200)) - // Standard Error: 50_693 - .saturating_add(Weight::from_parts(2_697_813, 0).saturating_mul(m.into())) - // Standard Error: 50_693 - .saturating_add(Weight::from_parts(5_731_591, 0).saturating_mul(p.into())) + // Standard Error: 63_745 + .saturating_add(Weight::from_parts(2_666_766, 0).saturating_mul(m.into())) + // Standard Error: 63_745 + .saturating_add(Weight::from_parts(5_183_869, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -93,12 +93,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `69 + m * (20 ±0)` // Estimated: `1554 + m * (20 ±0)` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_240_775, 0) + Weight::from_parts(11_569_530, 0) .saturating_add(Weight::from_parts(0, 1554)) - // Standard Error: 142 - .saturating_add(Weight::from_parts(854, 0).saturating_mul(b.into())) - // Standard Error: 1_472 - .saturating_add(Weight::from_parts(3_463, 0).saturating_mul(m.into())) + // Standard Error: 36 + .saturating_add(Weight::from_parts(1_237, 0).saturating_mul(b.into())) + // Standard Error: 379 + .saturating_add(Weight::from_parts(1_436, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -113,12 +113,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `69 + m * (20 ±0)` // Estimated: `3534 + m * (20 ±0)` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_648_786, 0) + Weight::from_parts(12_993_859, 0) .saturating_add(Weight::from_parts(0, 3534)) - // Standard Error: 181 - .saturating_add(Weight::from_parts(678, 0).saturating_mul(b.into())) - // Standard Error: 1_869 - .saturating_add(Weight::from_parts(2_211, 0).saturating_mul(m.into())) + // Standard Error: 47 + .saturating_add(Weight::from_parts(1_173, 0).saturating_mul(b.into())) + // Standard Error: 486 + .saturating_add(Weight::from_parts(7_926, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -135,19 +135,17 @@ impl pallet_collective::WeightInfo for WeightInfo { /// The range of component `b` is `[2, 1024]`. /// The range of component `m` is `[2, 100]`. /// The range of component `p` is `[1, 100]`. - fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + fn propose_proposed(_b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `357 + m * (20 ±0) + p * (36 ±0)` // Estimated: `3751 + m * (21 ±0) + p * (36 ±0)` // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(19_890_728, 0) + Weight::from_parts(20_878_785, 0) .saturating_add(Weight::from_parts(0, 3751)) - // Standard Error: 319 - .saturating_add(Weight::from_parts(1_542, 0).saturating_mul(b.into())) - // Standard Error: 3_329 - .saturating_add(Weight::from_parts(5_709, 0).saturating_mul(m.into())) - // Standard Error: 3_287 - .saturating_add(Weight::from_parts(144_012, 0).saturating_mul(p.into())) + // Standard Error: 1_233 + .saturating_add(Weight::from_parts(8_042, 0).saturating_mul(m.into())) + // Standard Error: 1_217 + .saturating_add(Weight::from_parts(122_710, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(Weight::from_parts(0, 21).saturating_mul(m.into())) @@ -163,10 +161,10 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `832 + m * (40 ±0)` // Estimated: `4296 + m * (40 ±0)` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(18_419_291, 0) + Weight::from_parts(15_663_114, 0) .saturating_add(Weight::from_parts(0, 4296)) - // Standard Error: 3_323 - .saturating_add(Weight::from_parts(11_124, 0).saturating_mul(m.into())) + // Standard Error: 937 + .saturating_add(Weight::from_parts(9_090, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(m.into())) @@ -186,12 +184,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `409 + m * (40 ±0) + p * (36 ±0)` // Estimated: `3854 + m * (41 ±0) + p * (36 ±0)` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_904_391, 0) + Weight::from_parts(19_733_115, 0) .saturating_add(Weight::from_parts(0, 3854)) - // Standard Error: 3_844 - .saturating_add(Weight::from_parts(3_705, 0).saturating_mul(m.into())) - // Standard Error: 3_748 - .saturating_add(Weight::from_parts(138_780, 0).saturating_mul(p.into())) + // Standard Error: 826 + .saturating_add(Weight::from_parts(2_791, 0).saturating_mul(m.into())) + // Standard Error: 806 + .saturating_add(Weight::from_parts(122_389, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 41).saturating_mul(m.into())) @@ -212,13 +210,15 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `711 + b * (1 ±0) + m * (40 ±0) + p * (40 ±0)` // Estimated: `4028 + b * (1 ±0) + m * (42 ±0) + p * (40 ±0)` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(31_689_539, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(27_874_122, 0) .saturating_add(Weight::from_parts(0, 4028)) - // Standard Error: 466 - .saturating_add(Weight::from_parts(349, 0).saturating_mul(b.into())) - // Standard Error: 4_809 - .saturating_add(Weight::from_parts(168_485, 0).saturating_mul(p.into())) + // Standard Error: 134 + .saturating_add(Weight::from_parts(1_095, 0).saturating_mul(b.into())) + // Standard Error: 1_420 + .saturating_add(Weight::from_parts(6_041, 0).saturating_mul(m.into())) + // Standard Error: 1_384 + .saturating_add(Weight::from_parts(136_940, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) @@ -242,12 +242,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `429 + m * (40 ±0) + p * (36 ±0)` // Estimated: `3874 + m * (41 ±0) + p * (36 ±0)` // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(22_644_454, 0) + Weight::from_parts(21_845_753, 0) .saturating_add(Weight::from_parts(0, 3874)) - // Standard Error: 3_882 - .saturating_add(Weight::from_parts(16_481, 0).saturating_mul(m.into())) - // Standard Error: 3_785 - .saturating_add(Weight::from_parts(142_766, 0).saturating_mul(p.into())) + // Standard Error: 925 + .saturating_add(Weight::from_parts(3_034, 0).saturating_mul(m.into())) + // Standard Error: 902 + .saturating_add(Weight::from_parts(118_242, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 41).saturating_mul(m.into())) @@ -270,13 +270,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `731 + b * (1 ±0) + m * (40 ±0) + p * (40 ±0)` // Estimated: `4048 + b * (1 ±0) + m * (42 ±0) + p * (40 ±0)` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(34_238_646, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_263_927, 0) .saturating_add(Weight::from_parts(0, 4048)) - // Standard Error: 479 - .saturating_add(Weight::from_parts(516, 0).saturating_mul(b.into())) - // Standard Error: 4_942 - .saturating_add(Weight::from_parts(177_711, 0).saturating_mul(p.into())) + // Standard Error: 149 + .saturating_add(Weight::from_parts(953, 0).saturating_mul(b.into())) + // Standard Error: 1_539 + .saturating_add(Weight::from_parts(146_062, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) @@ -295,10 +295,10 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `226 + p * (32 ±0)` // Estimated: `1711 + p * (32 ±0)` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_804_007, 0) + Weight::from_parts(11_788_664, 0) .saturating_add(Weight::from_parts(0, 1711)) - // Standard Error: 2_831 - .saturating_add(Weight::from_parts(128_548, 0).saturating_mul(p.into())) + // Standard Error: 832 + .saturating_add(Weight::from_parts(113_821, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) diff --git a/runtime/darwinia/src/weights/pallet_conviction_voting.rs b/runtime/darwinia/src/weights/pallet_conviction_voting.rs index 3fc1ec2c1..f9ccd0469 100644 --- a/runtime/darwinia/src/weights/pallet_conviction_voting.rs +++ b/runtime/darwinia/src/weights/pallet_conviction_voting.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_conviction_voting` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -71,8 +71,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13458` // Estimated: `42428` - // Minimum execution time: 90_000_000 picoseconds. - Weight::from_parts(100_000_000, 0) + // Minimum execution time: 87_000_000 picoseconds. + Weight::from_parts(90_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -94,7 +94,7 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Measured: `14179` // Estimated: `83866` // Minimum execution time: 124_000_000 picoseconds. - Weight::from_parts(149_000_000, 0) + Weight::from_parts(127_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(6)) @@ -110,7 +110,7 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Measured: `13928` // Estimated: `83866` // Minimum execution time: 96_000_000 picoseconds. - Weight::from_parts(111_000_000, 0) + Weight::from_parts(101_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -123,8 +123,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13052` // Estimated: `30694` - // Minimum execution time: 49_000_000 picoseconds. - Weight::from_parts(57_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(50_000_000, 0) .saturating_add(Weight::from_parts(0, 30694)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -146,11 +146,11 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `7020 + r * (447 ±0)` // Estimated: `83866 + r * (3387 ±0)` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(107_491_225, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(169_715_477, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 345_022 - .saturating_add(Weight::from_parts(37_023_763, 0).saturating_mul(r.into())) + // Standard Error: 344_025 + .saturating_add(Weight::from_parts(33_257_361, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(6)) @@ -168,11 +168,11 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `6876 + r * (447 ±0)` // Estimated: `83866 + r * (3387 ±0)` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(49_135_530, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(80_046_584, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 355_033 - .saturating_add(Weight::from_parts(37_751_665, 0).saturating_mul(r.into())) + // Standard Error: 360_070 + .saturating_add(Weight::from_parts(34_073_453, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4)) @@ -192,7 +192,7 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Measured: `12038` // Estimated: `30694` // Minimum execution time: 74_000_000 picoseconds. - Weight::from_parts(90_000_000, 0) + Weight::from_parts(81_000_000, 0) .saturating_add(Weight::from_parts(0, 30694)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/runtime/darwinia/src/weights/pallet_message_queue.rs b/runtime/darwinia/src/weights/pallet_message_queue.rs index f6a0c3bef..ccdce69e1 100644 --- a/runtime/darwinia/src/weights/pallet_message_queue.rs +++ b/runtime/darwinia/src/weights/pallet_message_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_message_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -113,7 +113,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `72` // Estimated: `69050` - // Minimum execution time: 4_000_000 picoseconds. + // Minimum execution time: 5_000_000 picoseconds. Weight::from_parts(5_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(1)) @@ -127,8 +127,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_000_000 picoseconds. - Weight::from_parts(91_000_000, 0) + // Minimum execution time: 81_000_000 picoseconds. + Weight::from_parts(82_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -141,7 +141,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `171` // Estimated: `3517` // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + Weight::from_parts(7_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -154,7 +154,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 34_000_000 picoseconds. + // Minimum execution time: 33_000_000 picoseconds. Weight::from_parts(36_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) @@ -182,8 +182,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(63_000_000, 0) + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(53_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/darwinia/src/weights/pallet_preimage.rs b/runtime/darwinia/src/weights/pallet_preimage.rs index 97f95ceeb..e3b0cccff 100644 --- a/runtime/darwinia/src/weights/pallet_preimage.rs +++ b/runtime/darwinia/src/weights/pallet_preimage.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_preimage` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -68,11 +68,11 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3544` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(47_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_165, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_049, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -88,10 +88,10 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_164, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_062, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -106,11 +106,11 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3544` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_124, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_066, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -126,7 +126,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `219` // Estimated: `3544` - // Minimum execution time: 46_000_000 picoseconds. + // Minimum execution time: 50_000_000 picoseconds. Weight::from_parts(53_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) @@ -142,8 +142,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(23_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -157,7 +157,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `176` // Estimated: `3544` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(22_000_000, 0) + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -171,7 +171,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `144` // Estimated: `3544` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -185,7 +185,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `42` // Estimated: `3544` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -198,8 +198,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3544` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -214,8 +214,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(23_000_000, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -229,7 +229,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -243,7 +243,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -259,13 +259,13 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// The range of component `n` is `[1, 1024]`. fn ensure_updated(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `270 + n * (203 ±0)` + // Measured: `240 + n * (203 ±0)` // Estimated: `990 + n * (2591 ±0)` - // Minimum execution time: 54_000_000 picoseconds. - Weight::from_parts(55_000_000, 0) + // Minimum execution time: 55_000_000 picoseconds. + Weight::from_parts(56_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 51_485 - .saturating_add(Weight::from_parts(57_512_634, 0).saturating_mul(n.into())) + // Standard Error: 48_531 + .saturating_add(Weight::from_parts(53_177_511, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2591).saturating_mul(n.into())) diff --git a/runtime/darwinia/src/weights/pallet_proxy.rs b/runtime/darwinia/src/weights/pallet_proxy.rs index f384a61bb..6d970ee20 100644 --- a/runtime/darwinia/src/weights/pallet_proxy.rs +++ b/runtime/darwinia/src/weights/pallet_proxy.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -63,10 +63,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_108_108, 0) + Weight::from_parts(11_199_676, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 5_981 - .saturating_add(Weight::from_parts(7_080, 0).saturating_mul(p.into())) + // Standard Error: 2_154 + .saturating_add(Weight::from_parts(26_824, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Proxy::Proxies` (r:1 w:0) @@ -77,15 +77,17 @@ impl pallet_proxy::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn proxy_announced(a: u32, _p: u32, ) -> Weight { + fn proxy_announced(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `401 + a * (56 ±0) + p * (25 ±0)` // Estimated: `5302` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(33_686_226, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(28_484_875, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 11_152 - .saturating_add(Weight::from_parts(104_511, 0).saturating_mul(a.into())) + // Standard Error: 2_632 + .saturating_add(Weight::from_parts(104_640, 0).saturating_mul(a.into())) + // Standard Error: 2_720 + .saturating_add(Weight::from_parts(29_378, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -95,15 +97,17 @@ impl pallet_proxy::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn remove_announcement(a: u32, _p: u32, ) -> Weight { + fn remove_announcement(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `329 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(22_564_195, 0) + Weight::from_parts(19_684_431, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 8_176 - .saturating_add(Weight::from_parts(135_367, 0).saturating_mul(a.into())) + // Standard Error: 2_115 + .saturating_add(Weight::from_parts(115_932, 0).saturating_mul(a.into())) + // Standard Error: 2_186 + .saturating_add(Weight::from_parts(8_897, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -117,13 +121,13 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `329 + a * (56 ±0)` // Estimated: `5302` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_930_472, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_076_423, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 7_828 - .saturating_add(Weight::from_parts(111_972, 0).saturating_mul(a.into())) - // Standard Error: 8_088 - .saturating_add(Weight::from_parts(45_616, 0).saturating_mul(p.into())) + // Standard Error: 1_825 + .saturating_add(Weight::from_parts(101_666, 0).saturating_mul(a.into())) + // Standard Error: 1_886 + .saturating_add(Weight::from_parts(440, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -140,12 +144,12 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `345 + a * (56 ±0) + p * (25 ±0)` // Estimated: `5302` // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(29_590_481, 0) + Weight::from_parts(25_526_960, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 8_950 - .saturating_add(Weight::from_parts(129_564, 0).saturating_mul(a.into())) - // Standard Error: 9_247 - .saturating_add(Weight::from_parts(7_791, 0).saturating_mul(p.into())) + // Standard Error: 2_076 + .saturating_add(Weight::from_parts(133_697, 0).saturating_mul(a.into())) + // Standard Error: 2_145 + .saturating_add(Weight::from_parts(17_397, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -157,10 +161,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(22_575_376, 0) + Weight::from_parts(20_804_075, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_376 - .saturating_add(Weight::from_parts(34_705, 0).saturating_mul(p.into())) + // Standard Error: 1_629 + .saturating_add(Weight::from_parts(18_809, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -172,10 +176,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(22_895_966, 0) + Weight::from_parts(21_019_111, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_963 - .saturating_add(Weight::from_parts(11_728, 0).saturating_mul(p.into())) + // Standard Error: 2_000 + .saturating_add(Weight::from_parts(4_180, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -186,24 +190,26 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `149 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_817_261, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_033_644, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_639 - .saturating_add(Weight::from_parts(17_057, 0).saturating_mul(p.into())) + // Standard Error: 2_249 + .saturating_add(Weight::from_parts(23_089, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Proxy::Proxies` (r:1 w:1) /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(845), added: 3320, mode: `MaxEncodedLen`) /// The range of component `p` is `[1, 31]`. - fn create_pure(_p: u32, ) -> Weight { + fn create_pure(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `161` // Estimated: `4310` // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(24_370_900, 0) + Weight::from_parts(21_931_978, 0) .saturating_add(Weight::from_parts(0, 4310)) + // Standard Error: 732 + .saturating_add(Weight::from_parts(2_965, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -214,11 +220,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `174 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(22_602_233, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_311_267, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 10_018 - .saturating_add(Weight::from_parts(38_000, 0).saturating_mul(p.into())) + // Standard Error: 1_905 + .saturating_add(Weight::from_parts(29_113, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/darwinia/src/weights/pallet_referenda.rs b/runtime/darwinia/src/weights/pallet_referenda.rs index a3f428328..98d85c260 100644 --- a/runtime/darwinia/src/weights/pallet_referenda.rs +++ b/runtime/darwinia/src/weights/pallet_referenda.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_referenda` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -65,8 +65,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `275` // Estimated: `42428` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(38_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -95,10 +95,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn place_decision_deposit_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `3314` + // Measured: `3309` // Estimated: `42428` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(55_000_000, 0) + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(41_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -113,10 +113,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn place_decision_deposit_not_queued() -> Weight { // Proof Size summary in bytes: - // Measured: `3334` + // Measured: `3329` // Estimated: `42428` - // Minimum execution time: 44_000_000 picoseconds. - Weight::from_parts(54_000_000, 0) + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(41_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -131,8 +131,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `516` // Estimated: `83866` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(52_000_000, 0) + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(45_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -147,8 +147,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `516` // Estimated: `83866` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(52_000_000, 0) + // Minimum execution time: 43_000_000 picoseconds. + Weight::from_parts(44_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -171,8 +171,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4377` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(25_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -186,7 +186,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `390` // Estimated: `83866` // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + Weight::from_parts(25_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -204,7 +204,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `880` // Estimated: `83866` // Minimum execution time: 82_000_000 picoseconds. - Weight::from_parts(96_000_000, 0) + Weight::from_parts(83_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -217,8 +217,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `207` // Estimated: `5477` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -231,10 +231,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn one_fewer_deciding_failing() -> Weight { // Proof Size summary in bytes: - // Measured: `3179` + // Measured: `3195` // Estimated: `42428` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(37_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(27_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -247,10 +247,10 @@ impl pallet_referenda::WeightInfo for WeightInfo { /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) fn one_fewer_deciding_passing() -> Weight { // Proof Size summary in bytes: - // Measured: `3165` + // Measured: `3209` // Estimated: `42428` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -263,8 +263,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3020` // Estimated: `5477` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -277,8 +277,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3020` // Estimated: `5477` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -293,8 +293,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3024` // Estimated: `5477` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -309,8 +309,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3044` // Estimated: `5477` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -324,7 +324,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `354` // Estimated: `42428` // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -350,7 +350,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `299` // Estimated: `4377` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -381,7 +381,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `42428` - // Minimum execution time: 23_000_000 picoseconds. + // Minimum execution time: 24_000_000 picoseconds. Weight::from_parts(24_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) @@ -395,8 +395,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `42428` - // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -410,7 +410,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `426` // Estimated: `42428` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -424,7 +424,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `443` // Estimated: `42428` // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -453,8 +453,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `447` // Estimated: `83866` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(28_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -485,8 +485,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `4377` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -499,8 +499,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `376` // Estimated: `4377` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/darwinia/src/weights/pallet_scheduler.rs b/runtime/darwinia/src/weights/pallet_scheduler.rs index 5258d51fa..e209551ed 100644 --- a/runtime/darwinia/src/weights/pallet_scheduler.rs +++ b/runtime/darwinia/src/weights/pallet_scheduler.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_scheduler` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -75,10 +75,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `78 + s * (177 ±0)` // Estimated: `42428` // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(5_871_990, 0) + Weight::from_parts(5_440_030, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 3_474 - .saturating_add(Weight::from_parts(391_272, 0).saturating_mul(s.into())) + // Standard Error: 1_561 + .saturating_add(Weight::from_parts(360_194, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -102,10 +102,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `179 + s * (1 ±0)` // Estimated: `3644 + s * (1 ±0)` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3644)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(515, 0).saturating_mul(s.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(429, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) @@ -116,8 +116,8 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -142,7 +142,7 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `Scheduler::Agenda` (r:1 w:1) @@ -152,11 +152,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(11_255_764, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(10_550_117, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 5_709 - .saturating_add(Weight::from_parts(409_315, 0).saturating_mul(s.into())) + // Standard Error: 1_437 + .saturating_add(Weight::from_parts(351_342, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -169,11 +169,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(12_321_142, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(11_286_530, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 6_710 - .saturating_add(Weight::from_parts(633_210, 0).saturating_mul(s.into())) + // Standard Error: 1_232 + .saturating_add(Weight::from_parts(567_587, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -186,11 +186,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `255 + s * (185 ±0)` // Estimated: `42428` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(16_528_470, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(14_020_000, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 12_470 - .saturating_add(Weight::from_parts(416_144, 0).saturating_mul(s.into())) + // Standard Error: 2_037 + .saturating_add(Weight::from_parts(361_469, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -203,11 +203,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `281 + s * (185 ±0)` // Estimated: `42428` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_350_612, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_208_489, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 6_616 - .saturating_add(Weight::from_parts(618_093, 0).saturating_mul(s.into())) + // Standard Error: 2_098 + .saturating_add(Weight::from_parts(592_686, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/runtime/darwinia/src/weights/pallet_session.rs b/runtime/darwinia/src/weights/pallet_session.rs index cc8cfb9df..1d26b6737 100644 --- a/runtime/darwinia/src/weights/pallet_session.rs +++ b/runtime/darwinia/src/weights/pallet_session.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -78,7 +78,7 @@ impl pallet_session::WeightInfo for WeightInfo { // Measured: `228` // Estimated: `3693` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3693)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/darwinia/src/weights/pallet_timestamp.rs b/runtime/darwinia/src/weights/pallet_timestamp.rs index 862242cad..630c920c1 100644 --- a/runtime/darwinia/src/weights/pallet_timestamp.rs +++ b/runtime/darwinia/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -61,8 +61,8 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `6` // Estimated: `1493` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 1493)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/darwinia/src/weights/pallet_treasury.rs b/runtime/darwinia/src/weights/pallet_treasury.rs index 0b38fdc7b..19184062d 100644 --- a/runtime/darwinia/src/weights/pallet_treasury.rs +++ b/runtime/darwinia/src/weights/pallet_treasury.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_treasury` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -66,7 +66,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `109` // Estimated: `1887` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 1887)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -79,8 +79,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `275` // Estimated: `1489` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(24_000_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -93,7 +93,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `571` // Estimated: `6172` - // Minimum execution time: 37_000_000 picoseconds. + // Minimum execution time: 36_000_000 picoseconds. Weight::from_parts(38_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(3)) @@ -108,11 +108,11 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `537 + p * (8 ±0)` // Estimated: `3549` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(10_364_812, 0) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(8_522_616, 0) .saturating_add(Weight::from_parts(0, 3549)) - // Standard Error: 2_150 - .saturating_add(Weight::from_parts(24_626, 0).saturating_mul(p.into())) + // Standard Error: 649 + .saturating_add(Weight::from_parts(14_512, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -123,7 +123,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `194` // Estimated: `1887` // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + Weight::from_parts(5_000_000, 0) .saturating_add(Weight::from_parts(0, 1887)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -143,11 +143,11 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `328 + p * (97 ±0)` // Estimated: `3581 + p * (2559 ±0)` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(30_538_237, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(101_923_655, 0) .saturating_add(Weight::from_parts(0, 3581)) - // Standard Error: 72_753 - .saturating_add(Weight::from_parts(2_692_855, 0).saturating_mul(p.into())) + // Standard Error: 160_060 + .saturating_add(Weight::from_parts(2_362_471, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -161,8 +161,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1489` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -175,7 +175,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `416` // Estimated: `6172` - // Minimum execution time: 49_000_000 picoseconds. + // Minimum execution time: 48_000_000 picoseconds. Weight::from_parts(51_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(3)) @@ -187,8 +187,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `215` // Estimated: `3522` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3522)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -199,8 +199,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `215` // Estimated: `3522` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3522)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/darwinia/src/weights/pallet_utility.rs b/runtime/darwinia/src/weights/pallet_utility.rs index 881e6aaa0..c54567c50 100644 --- a/runtime/darwinia/src/weights/pallet_utility.rs +++ b/runtime/darwinia/src/weights/pallet_utility.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -61,10 +61,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(13_536_226, 0) + Weight::from_parts(43_762_053, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 15_122 - .saturating_add(Weight::from_parts(3_778_643, 0).saturating_mul(c.into())) + // Standard Error: 7_629 + .saturating_add(Weight::from_parts(3_474_455, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: @@ -80,17 +80,17 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(1_695_457, 0) + Weight::from_parts(10_492_983, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 18_788 - .saturating_add(Weight::from_parts(4_094_435, 0).saturating_mul(c.into())) + // Standard Error: 2_684 + .saturating_add(Weight::from_parts(3_709_294, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(7_000_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// The range of component `c` is `[0, 1000]`. @@ -99,9 +99,9 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(4_366_648, 0) + Weight::from_parts(8_226_985, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 17_973 - .saturating_add(Weight::from_parts(3_855_063, 0).saturating_mul(c.into())) + // Standard Error: 2_289 + .saturating_add(Weight::from_parts(3_470_797, 0).saturating_mul(c.into())) } } diff --git a/runtime/darwinia/src/weights/pallet_whitelist.rs b/runtime/darwinia/src/weights/pallet_whitelist.rs index 6b70d94c2..c6f4a7671 100644 --- a/runtime/darwinia/src/weights/pallet_whitelist.rs +++ b/runtime/darwinia/src/weights/pallet_whitelist.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_whitelist` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -66,7 +66,7 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Measured: `48` // Estimated: `3544` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -82,7 +82,7 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Measured: `176` // Estimated: `3544` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -100,11 +100,11 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `252 + n * (1 ±0)` // Estimated: `3716 + n * (1 ±0)` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(24_000_000, 0) + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(23_000_000, 0) .saturating_add(Weight::from_parts(0, 3716)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(550, 0).saturating_mul(n.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(516, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -120,11 +120,11 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(20_290_598, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_064_344, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 39 - .saturating_add(Weight::from_parts(1_090, 0).saturating_mul(n.into())) + // Standard Error: 13 + .saturating_add(Weight::from_parts(939, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/runtime/koi/Cargo.toml b/runtime/koi/Cargo.toml index 104a3fa00..422eed5c5 100644 --- a/runtime/koi/Cargo.toml +++ b/runtime/koi/Cargo.toml @@ -24,8 +24,6 @@ darwinia-common-runtime = { workspace = true } darwinia-deposit = { workspace = true } darwinia-ethtx-forwarder = { workspace = true } darwinia-precompile-assets = { workspace = true } -darwinia-precompile-deposit = { workspace = true } -darwinia-precompile-staking = { workspace = true } darwinia-precompile-state-storage = { workspace = true } darwinia-staking = { workspace = true } dc-primitives = { workspace = true } @@ -139,8 +137,6 @@ std = [ "darwinia-deposit/std", "darwinia-ethtx-forwarder/std", "darwinia-precompile-assets/std", - "darwinia-precompile-deposit/std", - "darwinia-precompile-staking/std", "darwinia-precompile-state-storage/std", "darwinia-staking/std", "dc-primitives/std", @@ -239,7 +235,6 @@ runtime-benchmarks = [ "darwinia-deposit/runtime-benchmarks", "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-precompile-assets/runtime-benchmarks", - "darwinia-precompile-staking/runtime-benchmarks", "darwinia-staking/runtime-benchmarks", # frontier diff --git a/runtime/koi/src/migration.rs b/runtime/koi/src/migration.rs index 198778bb6..350ecc858 100644 --- a/runtime/koi/src/migration.rs +++ b/runtime/koi/src/migration.rs @@ -36,6 +36,8 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn post_upgrade(_state: Vec) -> Result<(), sp_runtime::DispatchError> { log::info!("post"); + darwinia_staking::migration::post_check::(); + Ok(()) } @@ -45,5 +47,7 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - ::DbWeight::get().reads_writes(0, 0) + let (r, w) = darwinia_staking::migration::migrate::(); + + ::DbWeight::get().reads_writes(r, w) } diff --git a/runtime/koi/src/pallets.rs b/runtime/koi/src/pallets.rs index 3fd287d88..2e5b21d77 100644 --- a/runtime/koi/src/pallets.rs +++ b/runtime/koi/src/pallets.rs @@ -42,8 +42,6 @@ mod assets; pub use assets::*; mod deposit; -#[cfg(feature = "runtime-benchmarks")] -pub use deposit::*; // Consensus stuff. mod authorship; diff --git a/runtime/koi/src/pallets/deposit.rs b/runtime/koi/src/pallets/deposit.rs index fc5b2673e..77e71c0a2 100644 --- a/runtime/koi/src/pallets/deposit.rs +++ b/runtime/koi/src/pallets/deposit.rs @@ -19,34 +19,8 @@ // darwinia use crate::*; -pub enum KtonMinting {} -impl darwinia_deposit::SimpleAsset for KtonMinting { - type AccountId = AccountId; - - fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - Assets::mint( - RuntimeOrigin::signed(KTON_ADMIN), - (AssetIds::KKton as AssetId).into(), - *beneficiary, - amount, - ) - } - - fn burn(who: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { - let asset_id = AssetIds::KKton as _; - - if Assets::balance(asset_id, who) < amount { - Err(>::BalanceLow)?; - } - - Assets::burn(RuntimeOrigin::signed(KTON_ADMIN), asset_id.into(), *who, amount) - } -} - impl darwinia_deposit::Config for Runtime { type DepositMigrator = darwinia_deposit::DepositMigrator; - type Kton = KtonMinting; - type MaxDeposits = ConstU32<512>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type Treasury = pallet_config::TreasuryAccount; diff --git a/runtime/koi/src/pallets/staking.rs b/runtime/koi/src/pallets/staking.rs index e444a9029..835785187 100644 --- a/runtime/koi/src/pallets/staking.rs +++ b/runtime/koi/src/pallets/staking.rs @@ -19,43 +19,13 @@ // darwinia use crate::*; -pub enum RingStaking {} -impl darwinia_staking::Stake for RingStaking { - type AccountId = AccountId; - type Item = Balance; - - fn stake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - who, - &darwinia_staking::account_id(), - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } - - fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { - >::transfer( - &darwinia_staking::account_id(), - who, - item, - frame_support::traits::ExistenceRequirement::AllowDeath, - ) - } -} - impl darwinia_staking::Config for Runtime { type Currency = Balances; - type Deposit = Deposit; - type IssuingManager = darwinia_staking::BalanceIssuing; + type IssuingManager = darwinia_staking::BalancesIssuing; type KtonStaking = darwinia_staking::KtonStaking; - type MaxDeposits = ::MaxDeposits; - type Ring = RingStaking; type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = darwinia_staking::ShouldEndSession; type Treasury = pallet_config::TreasuryAccount; type UnixTime = Timestamp; type WeightInfo = weights::darwinia_staking::WeightInfo; } -#[cfg(not(feature = "runtime-benchmarks"))] -impl darwinia_staking::DepositConfig for Runtime {} diff --git a/runtime/koi/src/pallets/tx_pause.rs b/runtime/koi/src/pallets/tx_pause.rs index 4ff419cf8..c881761a3 100644 --- a/runtime/koi/src/pallets/tx_pause.rs +++ b/runtime/koi/src/pallets/tx_pause.rs @@ -37,14 +37,7 @@ impl frame_support::traits::Contains let pallet = full_name.0.as_slice(); // Pallets that can be paused by the tx-pause pallet. - !matches!( - pallet, - b"Balances" - | b"Assets" | b"Deposit" - | b"DarwiniaStaking" - | b"Ethereum" - | b"EVM" | b"EthTxForwarder" - ) + !matches!(pallet, b"Balances" | b"Assets" | b"Ethereum" | b"EVM" | b"EthTxForwarder") } } diff --git a/runtime/koi/src/weights/cumulus_pallet_parachain_system.rs b/runtime/koi/src/weights/cumulus_pallet_parachain_system.rs index 00d8cb921..04adda031 100644 --- a/runtime/koi/src/weights/cumulus_pallet_parachain_system.rs +++ b/runtime/koi/src/weights/cumulus_pallet_parachain_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `cumulus_pallet_parachain_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -71,10 +71,10 @@ impl cumulus_pallet_parachain_system::WeightInfo for We // Measured: `82` // Estimated: `3517` // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + Weight::from_parts(3_036_346_176, 0) .saturating_add(Weight::from_parts(0, 3517)) - // Standard Error: 58_621 - .saturating_add(Weight::from_parts(104_049_044, 0).saturating_mul(n.into())) + // Standard Error: 1_129_862 + .saturating_add(Weight::from_parts(98_535_273, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) diff --git a/runtime/koi/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/koi/src/weights/cumulus_pallet_xcmp_queue.rs index c11528041..16666223a 100644 --- a/runtime/koi/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/koi/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -82,7 +82,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `48` // Estimated: `3517` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -93,7 +93,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `42` // Estimated: `1527` - // Minimum execution time: 3_000_000 picoseconds. + // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 1527)) .saturating_add(T::DbWeight::get().reads(1)) @@ -137,8 +137,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65677` // Estimated: `69142` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(58_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(46_000_000, 0) .saturating_add(Weight::from_parts(0, 69142)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -151,8 +151,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65676` // Estimated: `69141` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(36_000_000, 0) .saturating_add(Weight::from_parts(0, 69141)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/koi/src/weights/darwinia_deposit.rs b/runtime/koi/src/weights/darwinia_deposit.rs index 172164848..97e677b51 100644 --- a/runtime/koi/src/weights/darwinia_deposit.rs +++ b/runtime/koi/src/weights/darwinia_deposit.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_deposit` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -55,62 +55,6 @@ use core::marker::PhantomData; /// Weight functions for `darwinia_deposit`. pub struct WeightInfo(PhantomData); impl darwinia_deposit::WeightInfo for WeightInfo { - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - fn lock() -> Weight { - // Proof Size summary in bytes: - // Measured: `26812` - // Estimated: `29615` - // Minimum execution time: 81_000_000 picoseconds. - Weight::from_parts(92_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim() -> Weight { - // Proof Size summary in bytes: - // Measured: `26541` - // Estimated: `29615` - // Minimum execution time: 66_000_000 picoseconds. - Weight::from_parts(70_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `Timestamp::Now` (r:1 w:0) - /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) - /// Storage: `Assets::Account` (r:1 w:1) - /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Assets::Asset` (r:1 w:1) - /// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(166), added: 2641, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn claim_with_penalty() -> Weight { - // Proof Size summary in bytes: - // Measured: `26863` - // Estimated: `29615` - // Minimum execution time: 90_000_000 picoseconds. - Weight::from_parts(98_000_000, 0) - .saturating_add(Weight::from_parts(0, 29615)) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } /// Storage: `Deposit::Deposits` (r:1 w:1) /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) /// Storage: `Timestamp::Now` (r:1 w:0) @@ -127,12 +71,12 @@ impl darwinia_deposit::WeightInfo for WeightInfo { /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Ethereum::Pending` (r:1 w:1) /// Proof: `Ethereum::Pending` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn migrate() -> Weight { + fn migrate_for() -> Weight { // Proof Size summary in bytes: // Measured: `27516` // Estimated: `33456` - // Minimum execution time: 4_027_000_000 picoseconds. - Weight::from_parts(4_420_000_000, 0) + // Minimum execution time: 221_000_000 picoseconds. + Weight::from_parts(227_000_000, 0) .saturating_add(Weight::from_parts(0, 33456)) .saturating_add(T::DbWeight::get().reads(11)) .saturating_add(T::DbWeight::get().writes(4)) @@ -144,7 +88,7 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(2_000_000, 0) + Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/koi/src/weights/darwinia_staking.rs b/runtime/koi/src/weights/darwinia_staking.rs index 365b6fc7b..03d0265f2 100644 --- a/runtime/koi/src/weights/darwinia_staking.rs +++ b/runtime/koi/src/weights/darwinia_staking.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `darwinia_staking` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -59,116 +59,28 @@ impl darwinia_staking::WeightInfo for WeightInfo { /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn stake(x: u32, ) -> Weight { + fn unstake_all_for() -> Weight { // Proof Size summary in bytes: - // Measured: `7088 + x * (25 ±0)` - // Estimated: `29615` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(713_221_476, 0) - .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 256_283 - .saturating_add(Weight::from_parts(12_886_306, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:1) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - /// Storage: `Deposit::Deposits` (r:1 w:1) - /// Proof: `Deposit::Deposits` (`max_values`: None, `max_size`: Some(26150), added: 28625, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimitState` (r:1 w:1) - /// Proof: `DarwiniaStaking::RateLimitState` (`max_values`: Some(1), `max_size`: Some(17), added: 512, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::RateLimit` (r:1 w:0) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 1023]`. - fn unstake(x: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7415 + x * (26 ±0)` - // Estimated: `29615` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(754_642_664, 0) - .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 263_617 - .saturating_add(Weight::from_parts(13_048_816, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5)) - .saturating_add(T::DbWeight::get().writes(4)) - } - /// Storage: `DarwiniaStaking::Collators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn collect() -> Weight { - // Proof Size summary in bytes: - // Measured: `388` - // Estimated: `3497` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) - .saturating_add(Weight::from_parts(0, 3497)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::Ledgers` (r:1 w:0) - /// Proof: `DarwiniaStaking::Ledgers` (`max_values`: None, `max_size`: Some(1078), added: 3553, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:1 w:0) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Nominators` (r:1 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - fn nominate() -> Weight { - // Proof Size summary in bytes: - // Measured: `600` + // Measured: `406` // Estimated: `4543` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 53_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) .saturating_add(Weight::from_parts(0, 4543)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::Nominators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::Collators` (r:0 w:1) - /// Proof: `DarwiniaStaking::Collators` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `MaxEncodedLen`) - fn chill() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } - /// Storage: `DarwiniaStaking::ExposureCacheStates` (r:1 w:0) - /// Proof: `DarwiniaStaking::ExposureCacheStates` (`max_values`: Some(1), `max_size`: Some(3), added: 498, mode: `MaxEncodedLen`) - /// Storage: `DarwiniaStaking::ExposureCache2` (r:1 w:1) - /// Proof: `DarwiniaStaking::ExposureCache2` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `DarwiniaStaking::PendingRewards` (r:1 w:1) /// Proof: `DarwiniaStaking::PendingRewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:32 w:32) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) - fn payout() -> Weight { - // Proof Size summary in bytes: - // Measured: `2330` - // Estimated: `83902` - // Minimum execution time: 534_000_000 picoseconds. - Weight::from_parts(626_000_000, 0) - .saturating_add(Weight::from_parts(0, 83902)) - .saturating_add(T::DbWeight::get().reads(35)) - .saturating_add(T::DbWeight::get().writes(34)) - } - /// Storage: `DarwiniaStaking::RateLimit` (r:0 w:1) - /// Proof: `DarwiniaStaking::RateLimit` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_rate_limit() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:1 w:0) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn allocate_ring_staking_reward_of() -> Weight { // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) - .saturating_add(Weight::from_parts(0, 0)) + // Measured: `271` + // Estimated: `3736` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) + .saturating_add(Weight::from_parts(0, 3736)) + .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) @@ -178,10 +90,11 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) - } /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + } + /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: diff --git a/runtime/koi/src/weights/frame_system.rs b/runtime/koi/src/weights/frame_system.rs index c10888f71..fae08fab8 100644 --- a/runtime/koi/src/weights/frame_system.rs +++ b/runtime/koi/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -60,22 +60,22 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(4_417_236, 0) + // Minimum execution time: 1_000_000 picoseconds. + Weight::from_parts(2_142_176, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(156, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(151, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_000_000 picoseconds. + // Minimum execution time: 4_000_000 picoseconds. Weight::from_parts(5_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(993, 0).saturating_mul(b.into())) + // Standard Error: 0 + .saturating_add(Weight::from_parts(956, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -107,8 +107,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `198` // Estimated: `1683` - // Minimum execution time: 70_989_000_000 picoseconds. - Weight::from_parts(74_848_000_000, 0) + // Minimum execution time: 67_647_000_000 picoseconds. + Weight::from_parts(72_880_000_000, 0) .saturating_add(Weight::from_parts(0, 1683)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -123,8 +123,8 @@ impl frame_system::WeightInfo for WeightInfo { // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_331 - .saturating_add(Weight::from_parts(804_469, 0).saturating_mul(i.into())) + // Standard Error: 993 + .saturating_add(Weight::from_parts(752_528, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -137,8 +137,8 @@ impl frame_system::WeightInfo for WeightInfo { // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 1_491 - .saturating_add(Weight::from_parts(567_168, 0).saturating_mul(i.into())) + // Standard Error: 841 + .saturating_add(Weight::from_parts(539_001, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -151,8 +151,8 @@ impl frame_system::WeightInfo for WeightInfo { // Minimum execution time: 3_000_000 picoseconds. Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 94)) - // Standard Error: 2_915 - .saturating_add(Weight::from_parts(1_044_881, 0).saturating_mul(p.into())) + // Standard Error: 1_136 + .saturating_add(Weight::from_parts(983_292, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -163,7 +163,7 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_000_000 picoseconds. + // Minimum execution time: 7_000_000 picoseconds. Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) @@ -186,8 +186,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `220` // Estimated: `1705` - // Minimum execution time: 75_450_000_000 picoseconds. - Weight::from_parts(80_770_000_000, 0) + // Minimum execution time: 72_574_000_000 picoseconds. + Weight::from_parts(74_924_000_000, 0) .saturating_add(Weight::from_parts(0, 1705)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) diff --git a/runtime/koi/src/weights/pallet_asset_manager.rs b/runtime/koi/src/weights/pallet_asset_manager.rs index 4041fbc12..4879f24cd 100644 --- a/runtime/koi/src/weights/pallet_asset_manager.rs +++ b/runtime/koi/src/weights/pallet_asset_manager.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_asset_manager` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -67,7 +67,7 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `276` // Estimated: `3741` - // Minimum execution time: 30_000_000 picoseconds. + // Minimum execution time: 29_000_000 picoseconds. Weight::from_parts(30_000_000, 0) .saturating_add(Weight::from_parts(0, 3741)) .saturating_add(T::DbWeight::get().reads(3)) @@ -85,10 +85,10 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Measured: `595 + x * (9 ±0)` // Estimated: `3983 + x * (10 ±0)` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(20_209_116, 0) + Weight::from_parts(16_509_436, 0) .saturating_add(Weight::from_parts(0, 3983)) - // Standard Error: 5_727 - .saturating_add(Weight::from_parts(344_576, 0).saturating_mul(x.into())) + // Standard Error: 3_922 + .saturating_add(Weight::from_parts(413_005, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(x.into())) @@ -106,11 +106,11 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `968 + x * (13 ±0)` // Estimated: `4303 + x * (14 ±0)` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(28_993_534, 0) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(25_965_198, 0) .saturating_add(Weight::from_parts(0, 4303)) - // Standard Error: 6_928 - .saturating_add(Weight::from_parts(386_014, 0).saturating_mul(x.into())) + // Standard Error: 4_398 + .saturating_add(Weight::from_parts(415_009, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(6)) .saturating_add(Weight::from_parts(0, 14).saturating_mul(x.into())) @@ -125,10 +125,10 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Measured: `196 + x * (5 ±0)` // Estimated: `1678 + x * (5 ±0)` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(11_943_329, 0) + Weight::from_parts(9_940_214, 0) .saturating_add(Weight::from_parts(0, 1678)) - // Standard Error: 4_562 - .saturating_add(Weight::from_parts(325_272, 0).saturating_mul(x.into())) + // Standard Error: 3_042 + .saturating_add(Weight::from_parts(366_547, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 5).saturating_mul(x.into())) @@ -147,10 +147,10 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Measured: `486 + x * (10 ±0)` // Estimated: `3949 + x * (10 ±0)` // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(20_951_661, 0) + Weight::from_parts(18_249_451, 0) .saturating_add(Weight::from_parts(0, 3949)) - // Standard Error: 5_591 - .saturating_add(Weight::from_parts(333_493, 0).saturating_mul(x.into())) + // Standard Error: 4_688 + .saturating_add(Weight::from_parts(377_326, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(Weight::from_parts(0, 10).saturating_mul(x.into())) diff --git a/runtime/koi/src/weights/pallet_assets.rs b/runtime/koi/src/weights/pallet_assets.rs index 0e27ae2c5..bad371a0a 100644 --- a/runtime/koi/src/weights/pallet_assets.rs +++ b/runtime/koi/src/weights/pallet_assets.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_assets` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -62,7 +62,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `157` // Estimated: `3631` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -73,8 +73,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `157` // Estimated: `3631` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -100,13 +100,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// The range of component `c` is `[0, 1000]`. fn destroy_accounts(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `820 + c * (183 ±0)` + // Measured: `787 + c * (183 ±0)` // Estimated: `3631 + c * (2591 ±0)` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(18_889_041, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 36_945 - .saturating_add(Weight::from_parts(11_531_247, 0).saturating_mul(c.into())) + // Standard Error: 13_236 + .saturating_add(Weight::from_parts(10_982_328, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -123,10 +123,10 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `458 + a * (74 ±0)` // Estimated: `3631 + a * (2603 ±0)` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 10_046 - .saturating_add(Weight::from_parts(4_316_338, 0).saturating_mul(a.into())) + // Standard Error: 6_875 + .saturating_add(Weight::from_parts(4_067_989, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into()))) .saturating_add(T::DbWeight::get().writes(1)) @@ -155,8 +155,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -169,7 +169,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 25_000_000 picoseconds. + // Minimum execution time: 26_000_000 picoseconds. Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -202,7 +202,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `449` // Estimated: `6168` // Minimum execution time: 32_000_000 picoseconds. - Weight::from_parts(38_000_000, 0) + Weight::from_parts(34_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -217,8 +217,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `449` // Estimated: `6168` - // Minimum execution time: 38_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 36_000_000 picoseconds. + Weight::from_parts(37_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -245,7 +245,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 12_000_000 picoseconds. + // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -257,8 +257,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -269,8 +269,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -283,7 +283,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 11_000_000 picoseconds. + // Minimum execution time: 12_000_000 picoseconds. Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -296,7 +296,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -307,15 +307,13 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(144), added: 2619, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn set_metadata(_n: u32, s: u32, ) -> Weight { + fn set_metadata(_n: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_246_244, 0) + Weight::from_parts(12_881_106, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 3_156 - .saturating_add(Weight::from_parts(4_629, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -327,8 +325,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -339,13 +337,15 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(144), added: 2619, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 50]`. /// The range of component `s` is `[0, 50]`. - fn force_set_metadata(_n: u32, _s: u32, ) -> Weight { + fn force_set_metadata(_n: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `237` // Estimated: `3631` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_511_667, 0) + Weight::from_parts(11_793_139, 0) .saturating_add(Weight::from_parts(0, 3631)) + // Standard Error: 1_034 + .saturating_add(Weight::from_parts(322, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -357,8 +357,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -383,7 +383,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 15_000_000 picoseconds. + // Minimum execution time: 14_000_000 picoseconds. Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -399,10 +399,10 @@ impl pallet_assets::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) fn transfer_approved() -> Weight { // Proof Size summary in bytes: - // Measured: `599` + // Measured: `600` // Estimated: `6168` - // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(44_000_000, 0) + // Minimum execution time: 43_000_000 picoseconds. + Weight::from_parts(45_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -416,7 +416,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `457` // Estimated: `3631` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -429,8 +429,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `457` // Estimated: `3631` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -442,7 +442,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -457,8 +457,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `512` // Estimated: `3631` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(35_000_000, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -471,8 +471,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(28_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -487,8 +487,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `590` // Estimated: `3631` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -501,8 +501,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `448` // Estimated: `3631` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(32_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -516,7 +516,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `410` // Estimated: `3631` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/koi/src/weights/pallet_balances.rs b/runtime/koi/src/weights/pallet_balances.rs index 12556b5f9..e157c85d5 100644 --- a/runtime/koi/src/weights/pallet_balances.rs +++ b/runtime/koi/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -61,8 +61,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(53_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(47_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -73,8 +73,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 37_000_000 picoseconds. - Weight::from_parts(39_000_000, 0) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(38_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,8 +109,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `234` // Estimated: `6172` - // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(57_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(47_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -121,8 +121,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 49_000_000 picoseconds. - Weight::from_parts(54_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(49_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -133,7 +133,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `195` // Estimated: `3581` - // Minimum execution time: 17_000_000 picoseconds. + // Minimum execution time: 18_000_000 picoseconds. Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) @@ -144,13 +144,13 @@ impl pallet_balances::WeightInfo for WeightInfo { /// The range of component `u` is `[1, 1000]`. fn upgrade_accounts(u: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `458 + u * (124 ±0)` + // Measured: `417 + u * (124 ±0)` // Estimated: `990 + u * (2591 ±0)` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 22_067 - .saturating_add(Weight::from_parts(14_037_134, 0).saturating_mul(u.into())) + // Standard Error: 16_585 + .saturating_add(Weight::from_parts(13_189_595, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2591).saturating_mul(u.into())) @@ -162,7 +162,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `1501` // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 1501)) .saturating_add(T::DbWeight::get().reads(1)) } diff --git a/runtime/koi/src/weights/pallet_collective.rs b/runtime/koi/src/weights/pallet_collective.rs index b7b0c6e18..5c64ca9b5 100644 --- a/runtime/koi/src/weights/pallet_collective.rs +++ b/runtime/koi/src/weights/pallet_collective.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_collective` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -70,13 +70,13 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0 + m * (2021 ±0) + p * (2026 ±0)` // Estimated: `12200 + m * (1231 ±15) + p * (3660 ±15)` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 12200)) - // Standard Error: 45_994 - .saturating_add(Weight::from_parts(2_608_930, 0).saturating_mul(m.into())) - // Standard Error: 45_994 - .saturating_add(Weight::from_parts(5_749_452, 0).saturating_mul(p.into())) + // Standard Error: 100_382 + .saturating_add(Weight::from_parts(2_724_994, 0).saturating_mul(m.into())) + // Standard Error: 100_382 + .saturating_add(Weight::from_parts(5_259_215, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -95,10 +95,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `73 + m * (20 ±0)` // Estimated: `3997 + m * (20 ±0)` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_709_724, 0) + Weight::from_parts(14_250_900, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 172 - .saturating_add(Weight::from_parts(375, 0).saturating_mul(b.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(644, 0).saturating_mul(b.into())) + // Standard Error: 391 + .saturating_add(Weight::from_parts(3_561, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -115,12 +117,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `73 + m * (20 ±0)` // Estimated: `3997 + m * (20 ±0)` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_328_339, 0) + Weight::from_parts(15_683_246, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 213 - .saturating_add(Weight::from_parts(1_773, 0).saturating_mul(b.into())) - // Standard Error: 2_199 - .saturating_add(Weight::from_parts(5_705, 0).saturating_mul(m.into())) + // Standard Error: 38 + .saturating_add(Weight::from_parts(1_053, 0).saturating_mul(b.into())) + // Standard Error: 401 + .saturating_add(Weight::from_parts(5_208, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -141,15 +143,15 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `357 + m * (20 ±0) + p * (36 ±0)` // Estimated: `3751 + m * (21 ±0) + p * (36 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_702_013, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_982_732, 0) .saturating_add(Weight::from_parts(0, 3751)) - // Standard Error: 315 - .saturating_add(Weight::from_parts(796, 0).saturating_mul(b.into())) - // Standard Error: 3_293 - .saturating_add(Weight::from_parts(14_028, 0).saturating_mul(m.into())) - // Standard Error: 3_251 - .saturating_add(Weight::from_parts(146_957, 0).saturating_mul(p.into())) + // Standard Error: 82 + .saturating_add(Weight::from_parts(888, 0).saturating_mul(b.into())) + // Standard Error: 860 + .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(m.into())) + // Standard Error: 849 + .saturating_add(Weight::from_parts(114_999, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) .saturating_add(Weight::from_parts(0, 21).saturating_mul(m.into())) @@ -164,11 +166,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `832 + m * (40 ±0)` // Estimated: `4296 + m * (40 ±0)` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(18_888_620, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_488_642, 0) .saturating_add(Weight::from_parts(0, 4296)) - // Standard Error: 3_932 - .saturating_add(Weight::from_parts(7_792, 0).saturating_mul(m.into())) + // Standard Error: 775 + .saturating_add(Weight::from_parts(9_407, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 40).saturating_mul(m.into())) @@ -187,11 +189,11 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `409 + m * (40 ±0) + p * (36 ±0)` // Estimated: `3854 + m * (41 ±0) + p * (36 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(22_509_197, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(21_853_448, 0) .saturating_add(Weight::from_parts(0, 3854)) - // Standard Error: 3_630 - .saturating_add(Weight::from_parts(134_361, 0).saturating_mul(p.into())) + // Standard Error: 1_421 + .saturating_add(Weight::from_parts(113_584, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 41).saturating_mul(m.into())) @@ -215,14 +217,14 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `715 + b * (1 ±0) + m * (40 ±0) + p * (40 ±0)` // Estimated: `4032 + b * (1 ±0) + m * (42 ±0) + p * (40 ±0)` // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(30_157_309, 0) + Weight::from_parts(31_747_128, 0) .saturating_add(Weight::from_parts(0, 4032)) - // Standard Error: 537 - .saturating_add(Weight::from_parts(2_673, 0).saturating_mul(b.into())) - // Standard Error: 5_682 - .saturating_add(Weight::from_parts(30_326, 0).saturating_mul(m.into())) - // Standard Error: 5_539 - .saturating_add(Weight::from_parts(198_810, 0).saturating_mul(p.into())) + // Standard Error: 127 + .saturating_add(Weight::from_parts(725, 0).saturating_mul(b.into())) + // Standard Error: 1_347 + .saturating_add(Weight::from_parts(5_496, 0).saturating_mul(m.into())) + // Standard Error: 1_313 + .saturating_add(Weight::from_parts(135_294, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) @@ -246,12 +248,12 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `429 + m * (40 ±0) + p * (36 ±0)` // Estimated: `3874 + m * (41 ±0) + p * (36 ±0)` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(23_366_099, 0) + Weight::from_parts(21_281_035, 0) .saturating_add(Weight::from_parts(0, 3874)) - // Standard Error: 3_943 - .saturating_add(Weight::from_parts(14_161, 0).saturating_mul(m.into())) - // Standard Error: 3_845 - .saturating_add(Weight::from_parts(138_421, 0).saturating_mul(p.into())) + // Standard Error: 853 + .saturating_add(Weight::from_parts(6_650, 0).saturating_mul(m.into())) + // Standard Error: 831 + .saturating_add(Weight::from_parts(118_132, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 41).saturating_mul(m.into())) @@ -276,15 +278,15 @@ impl pallet_collective::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `735 + b * (1 ±0) + m * (40 ±0) + p * (40 ±0)` // Estimated: `4052 + b * (1 ±0) + m * (42 ±0) + p * (40 ±0)` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(33_127_380, 0) + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(33_208_783, 0) .saturating_add(Weight::from_parts(0, 4052)) - // Standard Error: 563 - .saturating_add(Weight::from_parts(2_533, 0).saturating_mul(b.into())) - // Standard Error: 5_952 - .saturating_add(Weight::from_parts(16_297, 0).saturating_mul(m.into())) - // Standard Error: 5_802 - .saturating_add(Weight::from_parts(200_372, 0).saturating_mul(p.into())) + // Standard Error: 120 + .saturating_add(Weight::from_parts(800, 0).saturating_mul(b.into())) + // Standard Error: 1_274 + .saturating_add(Weight::from_parts(9_665, 0).saturating_mul(m.into())) + // Standard Error: 1_242 + .saturating_add(Weight::from_parts(140_639, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) @@ -303,10 +305,10 @@ impl pallet_collective::WeightInfo for WeightInfo { // Measured: `226 + p * (32 ±0)` // Estimated: `1711 + p * (32 ±0)` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_796_290, 0) + Weight::from_parts(11_832_124, 0) .saturating_add(Weight::from_parts(0, 1711)) - // Standard Error: 2_932 - .saturating_add(Weight::from_parts(136_419, 0).saturating_mul(p.into())) + // Standard Error: 742 + .saturating_add(Weight::from_parts(112_432, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) diff --git a/runtime/koi/src/weights/pallet_conviction_voting.rs b/runtime/koi/src/weights/pallet_conviction_voting.rs index 1a9c1f4c8..bb1549dd2 100644 --- a/runtime/koi/src/weights/pallet_conviction_voting.rs +++ b/runtime/koi/src/weights/pallet_conviction_voting.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_conviction_voting` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -71,8 +71,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13458` // Estimated: `42428` - // Minimum execution time: 85_000_000 picoseconds. - Weight::from_parts(105_000_000, 0) + // Minimum execution time: 84_000_000 picoseconds. + Weight::from_parts(88_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(5)) @@ -93,8 +93,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `14179` // Estimated: `83866` - // Minimum execution time: 125_000_000 picoseconds. - Weight::from_parts(151_000_000, 0) + // Minimum execution time: 122_000_000 picoseconds. + Weight::from_parts(127_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(6)) @@ -109,8 +109,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13928` // Estimated: `83866` - // Minimum execution time: 104_000_000 picoseconds. - Weight::from_parts(124_000_000, 0) + // Minimum execution time: 98_000_000 picoseconds. + Weight::from_parts(103_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -123,8 +123,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `13052` // Estimated: `30694` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(58_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(51_000_000, 0) .saturating_add(Weight::from_parts(0, 30694)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -146,11 +146,11 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `7020 + r * (447 ±0)` // Estimated: `83866 + r * (3387 ±0)` - // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(94_354_931, 0) + // Minimum execution time: 58_000_000 picoseconds. + Weight::from_parts(127_864_505, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 349_326 - .saturating_add(Weight::from_parts(37_658_543, 0).saturating_mul(r.into())) + // Standard Error: 309_024 + .saturating_add(Weight::from_parts(33_851_201, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(6)) @@ -168,11 +168,11 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `6876 + r * (447 ±0)` // Estimated: `83866 + r * (3387 ±0)` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(53_657_365, 0) + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(84_905_799, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 323_752 - .saturating_add(Weight::from_parts(37_507_322, 0).saturating_mul(r.into())) + // Standard Error: 380_953 + .saturating_add(Weight::from_parts(34_159_818, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4)) @@ -191,8 +191,8 @@ impl pallet_conviction_voting::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `12038` // Estimated: `30694` - // Minimum execution time: 75_000_000 picoseconds. - Weight::from_parts(80_000_000, 0) + // Minimum execution time: 78_000_000 picoseconds. + Weight::from_parts(83_000_000, 0) .saturating_add(Weight::from_parts(0, 30694)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/runtime/koi/src/weights/pallet_message_queue.rs b/runtime/koi/src/weights/pallet_message_queue.rs index c398d7157..9e3a6eda0 100644 --- a/runtime/koi/src/weights/pallet_message_queue.rs +++ b/runtime/koi/src/weights/pallet_message_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_message_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -63,7 +63,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `223` // Estimated: `6044` - // Minimum execution time: 10_000_000 picoseconds. + // Minimum execution time: 11_000_000 picoseconds. Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 6044)) .saturating_add(T::DbWeight::get().reads(3)) @@ -78,7 +78,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `218` // Estimated: `6044` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 6044)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -113,8 +113,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `72` // Estimated: `69050` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -127,8 +127,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_000_000 picoseconds. - Weight::from_parts(93_000_000, 0) + // Minimum execution time: 81_000_000 picoseconds. + Weight::from_parts(82_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -141,7 +141,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `171` // Estimated: `3517` // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -154,8 +154,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(42_000_000, 0) + // Minimum execution time: 34_000_000 picoseconds. + Weight::from_parts(38_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -168,7 +168,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 41_000_000 picoseconds. + // Minimum execution time: 44_000_000 picoseconds. Weight::from_parts(48_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) @@ -183,7 +183,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `65667` // Estimated: `69050` // Minimum execution time: 50_000_000 picoseconds. - Weight::from_parts(61_000_000, 0) + Weight::from_parts(55_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/koi/src/weights/pallet_preimage.rs b/runtime/koi/src/weights/pallet_preimage.rs index 7a4d5a244..67aece869 100644 --- a/runtime/koi/src/weights/pallet_preimage.rs +++ b/runtime/koi/src/weights/pallet_preimage.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_preimage` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -68,11 +68,11 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3544` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(32_860_287, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_056, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -87,11 +87,11 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3544` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_133, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_067, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -107,10 +107,10 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_128, 0).saturating_mul(s.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_062, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -126,8 +126,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `219` // Estimated: `3544` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(58_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(50_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -142,8 +142,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(22_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -156,7 +156,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // Minimum execution time: 14_000_000 picoseconds. + // Minimum execution time: 15_000_000 picoseconds. Weight::from_parts(19_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) @@ -170,8 +170,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -185,7 +185,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `42` // Estimated: `3544` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -198,8 +198,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3544` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -214,8 +214,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -228,8 +228,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3544` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -242,8 +242,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3544` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(9_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -259,13 +259,13 @@ impl pallet_preimage::WeightInfo for WeightInfo { /// The range of component `n` is `[1, 1024]`. fn ensure_updated(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `532 + n * (203 ±0)` + // Measured: `498 + n * (203 ±0)` // Estimated: `990 + n * (2591 ±0)` - // Minimum execution time: 56_000_000 picoseconds. - Weight::from_parts(60_000_000, 0) + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(55_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 47_697 - .saturating_add(Weight::from_parts(57_455_847, 0).saturating_mul(n.into())) + // Standard Error: 32_386 + .saturating_add(Weight::from_parts(53_019_625, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2591).saturating_mul(n.into())) diff --git a/runtime/koi/src/weights/pallet_proxy.rs b/runtime/koi/src/weights/pallet_proxy.rs index 6f6ad95a3..b9c53de57 100644 --- a/runtime/koi/src/weights/pallet_proxy.rs +++ b/runtime/koi/src/weights/pallet_proxy.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_proxy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -65,10 +65,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `119 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(14_095_571, 0) + Weight::from_parts(13_542_900, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_508 - .saturating_add(Weight::from_parts(48_610, 0).saturating_mul(p.into())) + // Standard Error: 1_815 + .saturating_add(Weight::from_parts(19_271, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: `Proxy::Proxies` (r:1 w:0) @@ -81,17 +81,15 @@ impl pallet_proxy::WeightInfo for WeightInfo { /// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn proxy_announced(a: u32, p: u32, ) -> Weight { + fn proxy_announced(a: u32, _p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `371 + a * (56 ±0) + p * (25 ±0)` // Estimated: `5302` // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(34_463_299, 0) + Weight::from_parts(32_182_775, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 11_636 - .saturating_add(Weight::from_parts(123_729, 0).saturating_mul(a.into())) - // Standard Error: 12_022 - .saturating_add(Weight::from_parts(14_431, 0).saturating_mul(p.into())) + // Standard Error: 2_939 + .saturating_add(Weight::from_parts(113_289, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -101,17 +99,15 @@ impl pallet_proxy::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn remove_announcement(a: u32, p: u32, ) -> Weight { + fn remove_announcement(a: u32, _p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `295 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_259_863, 0) + Weight::from_parts(20_703_950, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 7_217 - .saturating_add(Weight::from_parts(132_453, 0).saturating_mul(a.into())) - // Standard Error: 7_457 - .saturating_add(Weight::from_parts(21_254, 0).saturating_mul(p.into())) + // Standard Error: 1_803 + .saturating_add(Weight::from_parts(111_699, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -126,10 +122,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `295 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_964_838, 0) + Weight::from_parts(20_802_468, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 7_084 - .saturating_add(Weight::from_parts(143_488, 0).saturating_mul(a.into())) + // Standard Error: 1_913 + .saturating_add(Weight::from_parts(113_969, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -141,15 +137,17 @@ impl pallet_proxy::WeightInfo for WeightInfo { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) /// The range of component `a` is `[0, 31]`. /// The range of component `p` is `[1, 31]`. - fn announce(a: u32, _p: u32, ) -> Weight { + fn announce(a: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `311 + a * (56 ±0) + p * (25 ±0)` // Estimated: `5302` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(27_807_662, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(26_805_478, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 8_462 - .saturating_add(Weight::from_parts(180_035, 0).saturating_mul(a.into())) + // Standard Error: 2_340 + .saturating_add(Weight::from_parts(131_497, 0).saturating_mul(a.into())) + // Standard Error: 2_418 + .saturating_add(Weight::from_parts(1_666, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -160,11 +158,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `115 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_111_983, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(21_211_149, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 6_929 - .saturating_add(Weight::from_parts(64_047, 0).saturating_mul(p.into())) + // Standard Error: 2_351 + .saturating_add(Weight::from_parts(7_271, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -176,10 +174,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `115 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(22_347_148, 0) + Weight::from_parts(20_951_322, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 9_039 - .saturating_add(Weight::from_parts(33_946, 0).saturating_mul(p.into())) + // Standard Error: 2_706 + .saturating_add(Weight::from_parts(21_822, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -191,25 +189,23 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `115 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_953_276, 0) + Weight::from_parts(20_500_808, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_731 - .saturating_add(Weight::from_parts(38_577, 0).saturating_mul(p.into())) + // Standard Error: 2_304 + .saturating_add(Weight::from_parts(14_509, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Proxy::Proxies` (r:1 w:1) /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(845), added: 3320, mode: `MaxEncodedLen`) /// The range of component `p` is `[1, 31]`. - fn create_pure(p: u32, ) -> Weight { + fn create_pure(_p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `127` // Estimated: `4310` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(22_926_728, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(22_074_056, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 8_619 - .saturating_add(Weight::from_parts(15_932, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -221,10 +217,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `140 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(21_780_110, 0) + Weight::from_parts(20_641_704, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 7_638 - .saturating_add(Weight::from_parts(17_761, 0).saturating_mul(p.into())) + // Standard Error: 1_549 + .saturating_add(Weight::from_parts(18_064, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/koi/src/weights/pallet_referenda.rs b/runtime/koi/src/weights/pallet_referenda.rs index fc0f78cfd..28c160340 100644 --- a/runtime/koi/src/weights/pallet_referenda.rs +++ b/runtime/koi/src/weights/pallet_referenda.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_referenda` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -65,8 +65,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `275` // Estimated: `42428` - // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -79,7 +79,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `516` // Estimated: `83866` - // Minimum execution time: 38_000_000 picoseconds. + // Minimum execution time: 37_000_000 picoseconds. Weight::from_parts(39_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(3)) @@ -97,8 +97,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3350` // Estimated: `42428` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(48_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -115,8 +115,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3370` // Estimated: `42428` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(53_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(49_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -146,7 +146,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `461` // Estimated: `4377` // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(32_000_000, 0) + Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -169,8 +169,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4377` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -183,7 +183,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `83866` - // Minimum execution time: 25_000_000 picoseconds. + // Minimum execution time: 26_000_000 picoseconds. Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(3)) @@ -201,8 +201,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `880` // Estimated: `83866` - // Minimum execution time: 84_000_000 picoseconds. - Weight::from_parts(87_000_000, 0) + // Minimum execution time: 86_000_000 picoseconds. + Weight::from_parts(88_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -215,7 +215,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `207` // Estimated: `5477` - // Minimum execution time: 7_000_000 picoseconds. + // Minimum execution time: 8_000_000 picoseconds. Weight::from_parts(8_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) @@ -232,7 +232,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `3137` // Estimated: `42428` // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(32_000_000, 0) + Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -247,8 +247,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3195` // Estimated: `42428` - // Minimum execution time: 34_000_000 picoseconds. - Weight::from_parts(41_000_000, 0) + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(33_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -261,8 +261,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3020` // Estimated: `5477` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -275,8 +275,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3020` // Estimated: `5477` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -291,8 +291,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3024` // Estimated: `5477` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -307,8 +307,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3044` // Estimated: `5477` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(20_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -321,8 +321,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `354` // Estimated: `42428` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -335,7 +335,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `42428` - // Minimum execution time: 18_000_000 picoseconds. + // Minimum execution time: 17_000_000 picoseconds. Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) @@ -348,7 +348,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `299` // Estimated: `4377` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -379,8 +379,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `42428` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(30_000_000, 0) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(25_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -393,8 +393,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `42428` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_000_000, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -407,8 +407,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `42428` - // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(22_000_000, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -422,7 +422,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `443` // Estimated: `42428` // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(22_000_000, 0) + Weight::from_parts(19_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -465,8 +465,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `42428` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(21_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -483,8 +483,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `4377` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -497,7 +497,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `376` // Estimated: `4377` - // Minimum execution time: 12_000_000 picoseconds. + // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(2)) diff --git a/runtime/koi/src/weights/pallet_scheduler.rs b/runtime/koi/src/weights/pallet_scheduler.rs index ef3bbdff8..a402cb318 100644 --- a/runtime/koi/src/weights/pallet_scheduler.rs +++ b/runtime/koi/src/weights/pallet_scheduler.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_scheduler` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -75,10 +75,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `78 + s * (177 ±0)` // Estimated: `42428` // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(5_834_698, 0) + Weight::from_parts(5_698_198, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 3_784 - .saturating_add(Weight::from_parts(398_666, 0).saturating_mul(s.into())) + // Standard Error: 1_310 + .saturating_add(Weight::from_parts(374_788, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -101,11 +101,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `179 + s * (1 ±0)` // Estimated: `3644 + s * (1 ±0)` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3644)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(521, 0).saturating_mul(s.into())) + // Standard Error: 1 + .saturating_add(Weight::from_parts(482, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) @@ -117,7 +117,7 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -136,7 +136,7 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -156,10 +156,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `78 + s * (177 ±0)` // Estimated: `42428` // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(12_251_764, 0) + Weight::from_parts(11_128_941, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 5_910 - .saturating_add(Weight::from_parts(397_968, 0).saturating_mul(s.into())) + // Standard Error: 1_780 + .saturating_add(Weight::from_parts(371_553, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -172,11 +172,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(12_843_673, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(11_635_183, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 6_444 - .saturating_add(Weight::from_parts(612_797, 0).saturating_mul(s.into())) + // Standard Error: 1_243 + .saturating_add(Weight::from_parts(599_404, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -190,10 +190,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `255 + s * (185 ±0)` // Estimated: `42428` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(15_768_000, 0) + Weight::from_parts(14_648_000, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 6_871 - .saturating_add(Weight::from_parts(402_285, 0).saturating_mul(s.into())) + // Standard Error: 2_039 + .saturating_add(Weight::from_parts(382_612, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -207,10 +207,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `281 + s * (185 ±0)` // Estimated: `42428` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_722_204, 0) + Weight::from_parts(14_070_775, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 7_510 - .saturating_add(Weight::from_parts(657_325, 0).saturating_mul(s.into())) + // Standard Error: 1_327 + .saturating_add(Weight::from_parts(612_518, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/runtime/koi/src/weights/pallet_session.rs b/runtime/koi/src/weights/pallet_session.rs index ac496a87b..9b47eb18f 100644 --- a/runtime/koi/src/weights/pallet_session.rs +++ b/runtime/koi/src/weights/pallet_session.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_session` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -64,7 +64,7 @@ impl pallet_session::WeightInfo for WeightInfo { // Measured: `246` // Estimated: `3711` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3711)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -78,7 +78,7 @@ impl pallet_session::WeightInfo for WeightInfo { // Measured: `228` // Estimated: `3693` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3693)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) diff --git a/runtime/koi/src/weights/pallet_timestamp.rs b/runtime/koi/src/weights/pallet_timestamp.rs index 47c9b0cba..7eb821240 100644 --- a/runtime/koi/src/weights/pallet_timestamp.rs +++ b/runtime/koi/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 diff --git a/runtime/koi/src/weights/pallet_treasury.rs b/runtime/koi/src/weights/pallet_treasury.rs index dbfb9ac96..7a6ec22dd 100644 --- a/runtime/koi/src/weights/pallet_treasury.rs +++ b/runtime/koi/src/weights/pallet_treasury.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_treasury` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -65,8 +65,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1887` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 1887)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -79,8 +79,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `275` // Estimated: `1489` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(25_000_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) @@ -93,8 +93,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `571` // Estimated: `6172` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 39_000_000 picoseconds. + Weight::from_parts(40_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -109,10 +109,10 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `537 + p * (8 ±0)` // Estimated: `3549` // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(10_074_563, 0) + Weight::from_parts(8_929_052, 0) .saturating_add(Weight::from_parts(0, 3549)) - // Standard Error: 2_320 - .saturating_add(Weight::from_parts(34_382, 0).saturating_mul(p.into())) + // Standard Error: 1_129 + .saturating_add(Weight::from_parts(26_457, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -143,11 +143,11 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `328 + p * (97 ±0)` // Estimated: `3581 + p * (2559 ±0)` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(28_697_260, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(104_307_124, 0) .saturating_add(Weight::from_parts(0, 3581)) - // Standard Error: 77_972 - .saturating_add(Weight::from_parts(2_780_716, 0).saturating_mul(p.into())) + // Standard Error: 181_098 + .saturating_add(Weight::from_parts(1_688_920, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(3)) @@ -175,8 +175,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `416` // Estimated: `6172` - // Minimum execution time: 55_000_000 picoseconds. - Weight::from_parts(59_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(50_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -199,7 +199,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `215` // Estimated: `3522` - // Minimum execution time: 9_000_000 picoseconds. + // Minimum execution time: 10_000_000 picoseconds. Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3522)) .saturating_add(T::DbWeight::get().reads(1)) diff --git a/runtime/koi/src/weights/pallet_tx_pause.rs b/runtime/koi/src/weights/pallet_tx_pause.rs index 2bcf92130..fb30436f6 100644 --- a/runtime/koi/src/weights/pallet_tx_pause.rs +++ b/runtime/koi/src/weights/pallet_tx_pause.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_tx_pause` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -61,8 +61,8 @@ impl pallet_tx_pause::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `4` // Estimated: `3997` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) diff --git a/runtime/koi/src/weights/pallet_utility.rs b/runtime/koi/src/weights/pallet_utility.rs index 78e3e3106..9f398fccb 100644 --- a/runtime/koi/src/weights/pallet_utility.rs +++ b/runtime/koi/src/weights/pallet_utility.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -63,10 +63,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + Weight::from_parts(9_405_159, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 12_721 - .saturating_add(Weight::from_parts(5_456_832, 0).saturating_mul(c.into())) + // Standard Error: 2_765 + .saturating_add(Weight::from_parts(4_953_957, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `TxPause::PausedCalls` (r:1 w:0) @@ -76,7 +76,7 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + Weight::from_parts(8_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -88,10 +88,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(5_000_000, 0) + Weight::from_parts(6_693_835, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 9_960 - .saturating_add(Weight::from_parts(5_916_048, 0).saturating_mul(c.into())) + // Standard Error: 2_877 + .saturating_add(Weight::from_parts(5_214_634, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) } fn dispatch_as() -> Weight { @@ -99,7 +99,7 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(7_000_000, 0) + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `TxPause::PausedCalls` (r:1 w:0) @@ -110,10 +110,10 @@ impl pallet_utility::WeightInfo for WeightInfo { // Measured: `4` // Estimated: `3997` // Minimum execution time: 4_000_000 picoseconds. - Weight::from_parts(19_124_290, 0) + Weight::from_parts(3_211_371, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 20_179 - .saturating_add(Weight::from_parts(5_499_270, 0).saturating_mul(c.into())) + // Standard Error: 5_402 + .saturating_add(Weight::from_parts(4_991_256, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1)) } } diff --git a/runtime/koi/src/weights/pallet_whitelist.rs b/runtime/koi/src/weights/pallet_whitelist.rs index 56dc70aba..e4f884372 100644 --- a/runtime/koi/src/weights/pallet_whitelist.rs +++ b/runtime/koi/src/weights/pallet_whitelist.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_whitelist` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-10-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -65,8 +65,8 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `48` // Estimated: `3544` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -82,7 +82,7 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Measured: `176` // Estimated: `3544` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -101,10 +101,10 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Measured: `252 + n * (1 ±0)` // Estimated: `3716 + n * (1 ±0)` // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + Weight::from_parts(315_272, 0) .saturating_add(Weight::from_parts(0, 3716)) - // Standard Error: 2 - .saturating_add(Weight::from_parts(543, 0).saturating_mul(n.into())) + // Standard Error: 5 + .saturating_add(Weight::from_parts(491, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -120,11 +120,11 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(20_605_827, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(18_176_033, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 26 - .saturating_add(Weight::from_parts(1_150, 0).saturating_mul(n.into())) + // Standard Error: 6 + .saturating_add(Weight::from_parts(1_039, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) }