From c0bc09d0fc1bd75c907b2f87772090c83ed26165 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 19 Jul 2024 15:27:19 +0800 Subject: [PATCH 01/20] RING DAO part.1 --- Cargo.lock | 2 +- pallet/account-migration/src/mock.rs | 2 +- pallet/staking/Cargo.toml | 12 +- pallet/staking/src/lib.rs | 308 +++++++++++++++++++----- pallet/staking/src/migration/v1.rs | 2 +- pallet/staking/src/migration/v2.rs | 2 +- pallet/staking/src/mock.rs | 2 +- pallet/staking/src/tests.rs | 14 +- precompile/staking/src/mock.rs | 2 +- runtime/crab/src/pallets/staking.rs | 2 +- runtime/darwinia/src/pallets/staking.rs | 2 +- runtime/koi/src/pallets/staking.rs | 2 +- 12 files changed, 271 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 53b05f1a9..d10b03ce5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3008,7 +3008,7 @@ dependencies = [ "darwinia-ethtx-forwarder", "darwinia-staking-traits", "dc-inflation", - "dc-types", + "dc-primitives", "ethabi", "ethereum", "frame-benchmarking", diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index f33d44513..f11df7856 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -139,7 +139,7 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = (); type Kton = Dummy; type KtonRewardDistributionContract = (); - type KtonStakerNotifier = (); + type RewardToKton = (); type MaxDeposits = (); type Ring = Dummy; type RuntimeEvent = RuntimeEvent; diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index f5a5d38dc..f7461af07 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -15,9 +15,9 @@ log = { workspace = true } scale-info = { workspace = true } # darwinia -darwinia-ethtx-forwarder = { workspace = true } -darwinia-staking-traits = { workspace = true } -dc-types = { workspace = true } +darwinia-ethtx-forwarder = { workspace = true } +darwinia-staking-traits = { workspace = true } +dc-primitives = { workspace = true } # darwinia optional darwinia-deposit = { workspace = true, optional = true } @@ -26,6 +26,7 @@ frame-support = { workspace = true } frame-system = { workspace = true } pallet-authorship = { workspace = true } pallet-session = { workspace = true } +pallet-timestamp = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } @@ -43,7 +44,6 @@ darwinia-deposit = { workspace = true, features = ["std"] } dc-inflation = { workspace = true, features = ["std"] } pallet-balances = { workspace = true, features = ["std"] } pallet-session = { workspace = true, features = ["std"] } -pallet-timestamp = { workspace = true, features = ["std"] } pallet-treasury = { workspace = true, features = ["std"] } sp-io = { workspace = true, features = ["std"] } substrate-test-utils = { workspace = true } @@ -61,6 +61,7 @@ std = [ # darwinia "darwinia-ethtx-forwarder/std", "darwinia-staking-traits/std", + "dc-primitives/std", # darwinia optional "darwinia-deposit?/std", @@ -70,6 +71,7 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-session/std", + "pallet-timestamp/std", "sp-core/std", "sp-runtime/std", "sp-std/std", @@ -87,6 +89,7 @@ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] @@ -97,5 +100,6 @@ try-runtime = [ "frame-support/try-runtime", "frame-system/try-runtime", "pallet-authorship/try-runtime", + "pallet-timestamp/try-runtime", "sp-runtime/try-runtime", ] diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 2ef26f6ac..21658cead 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -27,6 +27,8 @@ //! - 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)] @@ -51,10 +53,12 @@ use ethabi::{Function, Param, ParamType, StateMutability}; use ethereum::TransactionAction; // darwinia use darwinia_ethtx_forwarder::{ForwardEthOrigin, ForwardRequest, TxType}; -use dc_types::{Balance, Moment}; +use dc_primitives::{AccountId, Balance, Moment}; // polkadot-sdk use frame_support::{ - pallet_prelude::*, traits::Currency, DefaultNoBound, EqNoBound, PalletId, PartialEqNoBound, + pallet_prelude::*, + traits::{Currency, UnixTime}, + DefaultNoBound, EqNoBound, PalletId, PartialEqNoBound, }; use frame_system::{pallet_prelude::*, RawOrigin}; use sp_core::{H160, U256}; @@ -69,9 +73,9 @@ use sp_std::{collections::btree_map::BTreeMap, prelude::*}; macro_rules! call_on_exposure { ($s_e:expr, <$s:ident<$t:ident>>$($f:tt)*) => {{ match $s_e { - ($crate::ExposureCacheState::$s, _, _) => Ok(<$crate::ExposureCache0<$t>>$($f)*), - (_, $crate::ExposureCacheState::$s, _) => Ok(<$crate::ExposureCache1<$t>>$($f)*), - (_, _, $crate::ExposureCacheState::$s) => Ok(<$crate::ExposureCache2<$t>>$($f)*), + ($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!("[pallet::staking] exposure cache states must be correct; qed"); @@ -85,15 +89,33 @@ macro_rules! call_on_exposure { $crate::call_on_exposure!(s, <$s<$t>>$($f)*) }}; } +/// Make it easier to call a function on a specific collators storage. +#[macro_export] +macro_rules! call_on_cache { + ($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!("[pallet::staking] 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::CollatorsCacheState<$t>>::get(); + + $crate::call_on_cache!(s, <$s<$t>>$($f)*) + }}; +} #[frame_support::pallet] pub mod pallet { // darwinia use crate::*; - // TODO: limit the number of nominators that a collator can have. - // const MAX_NOMINATIONS: u32 = 32; - // Deposit helper for runtime benchmark. #[cfg(feature = "runtime-benchmarks")] use darwinia_deposit::Config as DepositConfig; @@ -105,7 +127,9 @@ pub mod pallet { pub trait DepositConfig {} #[pallet::config] - pub trait Config: frame_system::Config + DepositConfig { + pub trait Config: + frame_system::Config + pallet_timestamp::Config + DepositConfig + { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -128,8 +152,14 @@ pub mod pallet { /// Inflation and reward manager. type IssuingManager: IssuingManager; - /// KTON staker notifier. - type KtonStakerNotifier: KtonStakerNotification; + /// RING staker reward distributor. + type RewardToRing: RewardToContract; + + /// KTON staker reward distributor. + type RewardToKton: RewardToContract; + + /// Election result provider. + type ElectionResultProvider: ElectionResultProvider; /// Pass [`pallet_session::Config::ShouldEndSession`]'s result to here. type ShouldEndSession: Get; @@ -215,15 +245,14 @@ pub mod pallet { #[pallet::getter(fn exposure_cache_states)] pub type ExposureCacheStates = StorageValue< _, - (ExposureCacheState, ExposureCacheState, ExposureCacheState), + (CacheState, CacheState, CacheState), ValueQuery, ExposureCacheStatesDefault, >; /// Default value for [`ExposureCacheStates`]. #[pallet::type_value] - pub fn ExposureCacheStatesDefault( - ) -> (ExposureCacheState, ExposureCacheState, ExposureCacheState) { - (ExposureCacheState::Previous, ExposureCacheState::Current, ExposureCacheState::Next) + pub fn ExposureCacheStatesDefault() -> (CacheState, CacheState, CacheState) { + (CacheState::Previous, CacheState::Current, CacheState::Next) } /// Exposure cache 0. @@ -295,6 +324,66 @@ pub mod pallet { #[pallet::getter(fn rate_limit_state)] pub type RateLimitState = StorageValue<_, RateLimiter, ValueQuery>; + /// Migration start point. + #[pallet::storage] + #[pallet::getter(fn migration_start_point)] + pub type MigrationStartPoint = StorageValue<_, u64, ValueQuery>; + + /// Collator cache state. + /// + /// 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 collator_cache_state)] + pub type CollatorsCacheState = StorageValue< + _, + (CacheState, CacheState, CacheState), + ValueQuery, + CollatorCacheStateDefault, + >; + /// Default value for [`CollatorsCacheState`]. + #[pallet::type_value] + pub fn CollatorCacheStateDefault() -> (CacheState, CacheState, CacheState) { + (CacheState::Previous, CacheState::Current, CacheState::Next) + } + + // 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 { @@ -631,15 +720,24 @@ pub mod pallet { /// Distribute the session reward to staking pot and update the stakers' reward record. pub fn distribute_session_reward(amount: Balance) { let reward_to_ring = amount.saturating_div(2); - let reward_to_kton = amount.saturating_sub(reward_to_ring); + let reward_to_kton_dao = amount.saturating_sub(reward_to_ring); let (total, map) = >::take(); - let actual_reward_to_ring = map.into_iter().fold(0, |s, (c, b)| { - let r = Perbill::from_rational(b, total) * reward_to_ring; + let contract_collators = call_on_cache!(>::get()).unwrap_or_default(); + let mut actual_reward_to_ring = 0; + let reward_to_ring_dao = map + .into_iter() + .filter_map(|(c, b)| { + let r = Perbill::from_rational(b, total) * reward_to_ring; - >::mutate(c, |u| *u = u.map(|u| u + r).or(Some(r))); + actual_reward_to_ring += r; - s + r - }); + if contract_collators.contains(&c) { + Some((c, r)) + } else { + None + } + }) + .collect::>(); let reward = |who, amount| { if T::IssuingManager::reward(&who, amount).is_ok() { Self::deposit_event(Event::Payout { who, amount }); @@ -649,9 +747,13 @@ pub mod pallet { }; reward(account_id(), actual_reward_to_ring); - reward(T::KtonRewardDistributionContract::get(), reward_to_kton); + reward(T::KtonRewardDistributionContract::get(), reward_to_kton_dao); + + for (c, r) in reward_to_ring_dao { + T::RewardToRing::distribute(Some(c), r); + } - T::KtonStakerNotifier::notify(reward_to_kton); + T::RewardToKton::distribute(None, reward_to_kton_dao); } /// Pay the reward to the collator and its nominators. @@ -688,12 +790,11 @@ pub mod pallet { /// Prepare the session state. pub fn prepare_new_session(index: u32) -> Option> { >::kill(); - >::shift_exposure_cache_states(); + >::shift_cache_states(); #[allow(deprecated)] - if call_on_exposure!(>::remove_all(None)).is_err() { - return None; - } + call_on_exposure!(>::remove_all(None)).ok()?; + call_on_cache!(>::kill()).ok()?; let bn = >::block_number(); @@ -701,25 +802,28 @@ pub mod pallet { "[pallet::staking] assembling new collators for new session {index} at #{bn:?}", ); - if let Ok(cs) = Self::elect() { - if !cs.is_empty() { - // TODO?: if we really need this event - Self::deposit_event(Event::Elected { collators: cs.clone() }); + let (n1, n2) = Self::elect_ns(); + let cs_from_contract = Self::try_elect(n1, Self::elect_from_contract); + let cs_from_pallet = Self::try_elect(n2, Self::elect); + let cs = [cs_from_contract, cs_from_pallet].concat(); + + if cs.is_empty() { + // This error log is acceptable when testing with `genesis_collator = false`. + log::error!( + "[pallet::staking] fail to elect collators for new session {index} at #{bn:?}" + ); + + // 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. + None + } else { + // TODO?: if we really need this event + Self::deposit_event(Event::Elected { collators: cs.clone() }); - return Some(cs); - } + Some(cs) } - - // This error log is acceptable when testing with `genesis_collator = false`. - log::error!( - "[pallet::staking] fail to elect collators for new session {index} at #{bn:?}" - ); - - // 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. - None } /// Shift the exposure cache states. @@ -731,16 +835,20 @@ pub mod pallet { /// ```nocompile /// loop { mutate(2, 0, 1) } /// ``` - pub fn shift_exposure_cache_states() { + pub fn shift_cache_states() { let (s0, s1, s2) = >::get(); >::put((s2, s0, s1)); + + 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() -> Result, DispatchError> { + pub fn elect(n: u32) -> Option> { let nominators = >::iter().collect::>(); let mut collators = >::iter() .map(|(c, cm)| { @@ -771,15 +879,66 @@ pub mod pallet { collators .into_iter() - .take(>::get() as _) + .take(n as _) .map(|((c, e), _)| { - call_on_exposure!(cache_states, >::insert(&c, e)) - .map(|_| c) - .map_err(Into::into) + call_on_exposure!(cache_states, >::insert(&c, e)).map(|_| c).ok() }) .collect() } } + // Implementation part.2. + // + // After the migration is completed, + // the following implementation blocks will be merged into one. + impl Pallet + where + T: Config, + { + fn now() -> u64 { + as UnixTime>::now().as_secs() + } + + fn migration_progress() -> Perbill { + const TOTAL: u64 = 30 * 2 * 24 * 60 * 60; + + let start = >::get(); + let now = Self::now(); + + Perbill::from_rational(now - start, TOTAL) + } + + fn elect_ns() -> (u32, u32) { + let n = >::get(); + let n1 = Self::migration_progress() * n; + + (n1, n - n1) + } + + fn try_elect(n: u32, elect: F) -> R + where + F: FnOnce(u32) -> Option, + R: Default, + { + if n > 0 { + elect(n).unwrap_or_default() + } else { + Default::default() + } + } + + fn elect_from_contract(n: u32) -> Option> { + const ZERO: [u8; 20] = [0; 20]; + + let winners = T::ElectionResultProvider::get(n) + .into_iter() + .filter(|w| w.0 != ZERO) + .collect::>(); + + call_on_cache!(>::put(winners.clone())).ok()?; + + Some(winners) + } + } } pub use pallet::*; @@ -873,11 +1032,11 @@ impl Default for RateLimiter { } } -/// Exposure cache's state. +/// 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 ExposureCacheState { +pub enum CacheState { Previous, Current, Next, @@ -971,6 +1130,19 @@ where PalletId(*b"da/staki").into_account_truncating() } +/// Election result provider. +pub trait ElectionResultProvider { + /// Get the election result. + fn get(n: u32) -> Vec; +} +/// Election contract. +pub struct ElectionContract; +impl ElectionContract { + fn get(n: u32) -> Vec { + todo!() + } +} + /// The address of the `StakingRewardDistribution` contract. /// 0x0DBFbb1Ab6e42F89661B4f98d5d0acdBE21d1ffC. pub struct KtonRewardDistributionContract; @@ -987,23 +1159,37 @@ where } } -/// `StakingRewardDistribution` contact notification interface. -pub trait KtonStakerNotification { - /// Notify the KTON staker contract. - fn notify(_: Balance) {} +/// Distribute the reward to a contract. +pub trait RewardToContract { + /// Distribute the reward. + fn distribute(who: Option, amount: Balance) {} +} +impl RewardToContract for () {} +/// Distribute the reward to KTON contract. +/// +/// https://github.com/darwinia-network/DIP-7/blob/7fa307136586f06c6911ce98d16c88689d91ba8c/src/collator/CollatorStakingHub.sol#L142. +pub struct RewardToRing(PhantomData); +impl RewardToContract for RewardToRing +where + T: Config + darwinia_ethtx_forwarder::Config, + T::RuntimeOrigin: Into> + From, + ::AccountId: Into, +{ + fn distribute(who: Option, amount: Balance) { + todo!() + } } -impl KtonStakerNotification for () {} -/// `StakingRewardDistribution` contact notifier. +/// Distribute the reward to KTON contract. /// /// https://github.com/darwinia-network/KtonDAO/blob/2de20674f2ef90b749ade746d0768c7bda356402/src/staking/KtonDAOVault.sol#L40. -pub struct KtonStakerNotifier(PhantomData); -impl KtonStakerNotification for KtonStakerNotifier +pub struct RewardToKton(PhantomData); +impl RewardToContract for RewardToKton where T: Config + darwinia_ethtx_forwarder::Config, T::RuntimeOrigin: Into> + From, ::AccountId: Into, { - fn notify(amount: Balance) { + fn distribute(_: Option, amount: Balance) { let krd_contract = T::KtonRewardDistributionContract::get().into(); #[allow(deprecated)] let function = Function { diff --git a/pallet/staking/src/migration/v1.rs b/pallet/staking/src/migration/v1.rs index 08961d5b7..cbbbc917d 100644 --- a/pallet/staking/src/migration/v1.rs +++ b/pallet/staking/src/migration/v1.rs @@ -101,7 +101,7 @@ where // Check the starting state is correct. assert_eq!( >::get(), - (ExposureCacheState::Previous, ExposureCacheState::Current, ExposureCacheState::Next) + (CacheState::Previous, CacheState::Current, CacheState::Next) ); assert_eq!( diff --git a/pallet/staking/src/migration/v2.rs b/pallet/staking/src/migration/v2.rs index d7ec88a50..bb52d803d 100644 --- a/pallet/staking/src/migration/v2.rs +++ b/pallet/staking/src/migration/v2.rs @@ -2,7 +2,7 @@ use core::marker::PhantomData; // darwinia use crate::*; -use dc_types::UNIT; +use dc_primitives::UNIT; // polkadot-sdk use frame_support::traits::OnRuntimeUpgrade; #[cfg(feature = "try-runtime")] diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index ea6f59e87..06ebfcc09 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -277,7 +277,7 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = StatedOnSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = (); - type KtonStakerNotifier = (); + type RewardToKton = (); type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; diff --git a/pallet/staking/src/tests.rs b/pallet/staking/src/tests.rs index 37a1de691..342cc8fda 100644 --- a/pallet/staking/src/tests.rs +++ b/pallet/staking/src/tests.rs @@ -59,10 +59,10 @@ fn exposure_cache_states_should_work() { assert!(call_on_exposure!(>::get(2).is_some()).unwrap()); assert_eq!( >::get(), - (ExposureCacheState::Previous, ExposureCacheState::Current, ExposureCacheState::Next) + (CacheState::Previous, CacheState::Current, CacheState::Next) ); - Staking::shift_exposure_cache_states(); + Staking::shift_cache_states(); assert!(call_on_exposure!(>::get(0).is_none()).unwrap()); assert!(call_on_exposure!(>::get(1).is_some()).unwrap()); @@ -75,10 +75,10 @@ fn exposure_cache_states_should_work() { assert!(call_on_exposure!(>::get(2).is_none()).unwrap()); assert_eq!( >::get(), - (ExposureCacheState::Next, ExposureCacheState::Previous, ExposureCacheState::Current) + (CacheState::Next, CacheState::Previous, CacheState::Current) ); - Staking::shift_exposure_cache_states(); + Staking::shift_cache_states(); assert!(call_on_exposure!(>::get(0).is_none()).unwrap()); assert!(call_on_exposure!(>::get(1).is_none()).unwrap()); @@ -91,10 +91,10 @@ fn exposure_cache_states_should_work() { assert!(call_on_exposure!(>::get(2).is_none()).unwrap()); assert_eq!( >::get(), - (ExposureCacheState::Current, ExposureCacheState::Next, ExposureCacheState::Previous) + (CacheState::Current, CacheState::Next, CacheState::Previous) ); - Staking::shift_exposure_cache_states(); + Staking::shift_cache_states(); assert!(call_on_exposure!(>::get(0).is_some()).unwrap()); assert!(call_on_exposure!(>::get(1).is_none()).unwrap()); @@ -107,7 +107,7 @@ fn exposure_cache_states_should_work() { assert!(call_on_exposure!(>::get(2).is_some()).unwrap()); assert_eq!( >::get(), - (ExposureCacheState::Previous, ExposureCacheState::Current, ExposureCacheState::Next) + (CacheState::Previous, CacheState::Current, CacheState::Next) ); }); } diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 1e8a2231d..f09d0ac91 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -206,7 +206,7 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = (); type Kton = KtonStaking; type KtonRewardDistributionContract = (); - type KtonStakerNotifier = (); + type RewardToKton = (); type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index eea945df2..fa104ac74 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -104,7 +104,7 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = OnCrabSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = darwinia_staking::KtonRewardDistributionContract; - type KtonStakerNotifier = darwinia_staking::KtonStakerNotifier; + type RewardToKton = darwinia_staking::RewardToKton; type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 7fb8a362e..833ab29a0 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -115,7 +115,7 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = OnDarwiniaSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = darwinia_staking::KtonRewardDistributionContract; - type KtonStakerNotifier = darwinia_staking::KtonStakerNotifier; + type RewardToKton = darwinia_staking::RewardToKton; type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; diff --git a/runtime/koi/src/pallets/staking.rs b/runtime/koi/src/pallets/staking.rs index 892203b93..bca825304 100644 --- a/runtime/koi/src/pallets/staking.rs +++ b/runtime/koi/src/pallets/staking.rs @@ -100,7 +100,7 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = OnKoiSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = darwinia_staking::KtonRewardDistributionContract; - type KtonStakerNotifier = darwinia_staking::KtonStakerNotifier; + type RewardToKton = darwinia_staking::RewardToKton; type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; From b5827bb5c9a28e36fa98adaf183e4206e1faedcf Mon Sep 17 00:00:00 2001 From: Bear Wang Date: Mon, 22 Jul 2024 22:18:05 +0800 Subject: [PATCH 02/20] impl get (#1545) --- Cargo.lock | 5 ++ pallet/account-migration/src/mock.rs | 2 +- pallet/ethtx-forwarder/Cargo.toml | 1 + pallet/ethtx-forwarder/src/lib.rs | 36 +++++++++++-- pallet/ethtx-forwarder/src/test.rs | 54 +++++++++++++++++-- pallet/staking/Cargo.toml | 4 ++ pallet/staking/src/lib.rs | 70 +++++++++++++++++++++++-- pallet/staking/src/mock.rs | 2 +- precompile/staking/src/mock.rs | 2 +- runtime/crab/src/pallets/staking.rs | 2 +- runtime/darwinia/src/pallets/staking.rs | 2 +- runtime/koi/src/pallets/staking.rs | 2 +- 12 files changed, 166 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d10b03ce5..b1fdf472e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2795,6 +2795,7 @@ name = "darwinia-ethtx-forwarder" version = "6.6.3" dependencies = [ "array-bytes 6.2.3", + "ethabi", "ethereum", "fp-ethereum", "fp-evm", @@ -3011,6 +3012,7 @@ dependencies = [ "dc-primitives", "ethabi", "ethereum", + "fp-evm", "frame-benchmarking", "frame-support", "frame-system", @@ -3548,7 +3550,10 @@ checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ "ethereum-types", "hex", + "once_cell", + "regex", "serde", + "serde_json", "sha3", "thiserror", "uint", diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index f11df7856..8b537dac4 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -139,8 +139,8 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = (); type Kton = Dummy; type KtonRewardDistributionContract = (); - type RewardToKton = (); type MaxDeposits = (); + type RewardToKton = (); type Ring = Dummy; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); diff --git a/pallet/ethtx-forwarder/Cargo.toml b/pallet/ethtx-forwarder/Cargo.toml index 24e1a054a..b38407fd6 100644 --- a/pallet/ethtx-forwarder/Cargo.toml +++ b/pallet/ethtx-forwarder/Cargo.toml @@ -31,6 +31,7 @@ sp-std = { workspace = true } [dev-dependencies] # crates.io array-bytes = { workspace = true } +ethabi = { version = "18.0" } libsecp256k1 = { workspace = true, features = ["std"] } sha3 = { workspace = true } diff --git a/pallet/ethtx-forwarder/src/lib.rs b/pallet/ethtx-forwarder/src/lib.rs index 4c4b27980..67ec029e7 100644 --- a/pallet/ethtx-forwarder/src/lib.rs +++ b/pallet/ethtx-forwarder/src/lib.rs @@ -34,7 +34,7 @@ use scale_info::TypeInfo; // frontier use fp_ethereum::{TransactionData, ValidatedTransaction}; use fp_evm::{CheckEvmTransaction, CheckEvmTransactionConfig, TransactionValidationError}; -use pallet_evm::{FeeCalculator, GasWeightMapping}; +use pallet_evm::{FeeCalculator, GasWeightMapping, Runner}; // polkadot-sdk #[cfg(feature = "evm-tracing")] use frame_support::dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo}; @@ -112,7 +112,7 @@ pub mod pallet { where OriginFor: Into>>, { - //This call can only be used at runtime and is not available to EOA users. + // This call can only be used at runtime and is not available to EOA users. #[pallet::call_index(0)] #[pallet::weight({ ::GasWeightMapping::gas_to_weight(request.gas_limit.unique_saturated_into(), true) @@ -259,6 +259,33 @@ impl Pallet { Ok(transaction) } + pub fn forward_call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + ) -> Result { + let (who, _) = pallet_evm::Pallet::::account_basic(&from); + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + None, + None, + Some(who.nonce), + vec![], + false, // non-transactional + true, + None, + None, + ::config(), + ) + .map_err(|err| err.error.into()) + } + #[cfg(feature = "evm-tracing")] fn trace_tx( source: H160, @@ -283,7 +310,7 @@ impl Pallet { res }, - Some(EthereumXcmTracingStatus::Transaction(traced_transaction_hash)) => + Some(EthereumXcmTracingStatus::Transaction(traced_transaction_hash)) => { if transaction.hash() == traced_transaction_hash { let mut res = Ok(PostDispatchInfo::default()); @@ -300,7 +327,8 @@ impl Pallet { } else { T::ValidatedTransaction::apply(source, transaction) .map(|(post_info, _)| post_info) - }, + } + }, Some(EthereumXcmTracingStatus::TransactionExited) => Ok(PostDispatchInfo { actual_weight: None, pays_fee: frame_support::pallet_prelude::Pays::No, diff --git a/pallet/ethtx-forwarder/src/test.rs b/pallet/ethtx-forwarder/src/test.rs index 6d11c4d8d..ed93f03b6 100644 --- a/pallet/ethtx-forwarder/src/test.rs +++ b/pallet/ethtx-forwarder/src/test.rs @@ -20,6 +20,7 @@ use crate::{mock::*, ForwardEthOrigin, ForwardRequest, TxType}; // crates.io use ethereum::TransactionSignature; +use fp_evm::ExecutionInfoV2; // polkadot-sdk use frame_support::{assert_err, assert_ok, traits::Currency}; use sp_core::{H256, U256}; @@ -29,9 +30,9 @@ use sp_runtime::{DispatchError, ModuleError}; // pragma solidity ^0.5.0; // import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/token/ERC20/ERC20.sol"; // contract MyToken is ERC20 { -// constructor() public { _mint(msg.sender, 2**256 - 1); } +// constructor() public { _mint(msg.sender, 1000000); } // } -const ERC20_CONTRACT_BYTECODE: &str = "608060405234801561001057600080fd5b50610041337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61004660201b60201c565b610291565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156100e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6101028160025461020960201b610c7c1790919060201c565b60028190555061015d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461020960201b610c7c1790919060201c565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015610287576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b610e3a806102a06000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806370a082311161005b57806370a08231146101fd578063a457c2d714610255578063a9059cbb146102bb578063dd62ed3e1461032157610088565b8063095ea7b31461008d57806318160ddd146100f357806323b872dd146101115780633950935114610197575b600080fd5b6100d9600480360360408110156100a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610399565b604051808215151515815260200191505060405180910390f35b6100fb6103b7565b6040518082815260200191505060405180910390f35b61017d6004803603606081101561012757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103c1565b604051808215151515815260200191505060405180910390f35b6101e3600480360360408110156101ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049a565b604051808215151515815260200191505060405180910390f35b61023f6004803603602081101561021357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061054d565b6040518082815260200191505060405180910390f35b6102a16004803603604081101561026b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610595565b604051808215151515815260200191505060405180910390f35b610307600480360360408110156102d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610662565b604051808215151515815260200191505060405180910390f35b6103836004803603604081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610680565b6040518082815260200191505060405180910390f35b60006103ad6103a6610707565b848461070f565b6001905092915050565b6000600254905090565b60006103ce848484610906565b61048f846103da610707565b61048a85604051806060016040528060288152602001610d7060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610440610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b600190509392505050565b60006105436104a7610707565b8461053e85600160006104b8610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b61070f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006106586105a2610707565b8461065385604051806060016040528060258152602001610de160259139600160006105cc610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b6001905092915050565b600061067661066f610707565b8484610906565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610795576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610dbd6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561081b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610d286022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610d986025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610d056023913960400191505060405180910390fd5b610a7d81604051806060016040528060268152602001610d4a602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b10816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610c69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610c2e578082015181840152602081019050610c13565b50505050905090810190601f168015610c5b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015610cfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820c7a5ffabf642bda14700b2de42f8c57b36621af020441df825de45fd2b3e1c5c64736f6c63430005100032"; +const ERC20_CONTRACT_BYTECODE: &str = "608060405234801561001057600080fd5b5061002433620f424061002960201b60201c565b610274565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156100cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6100e5816002546101ec60201b610c7c1790919060201c565b600281905550610140816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546101ec60201b610c7c1790919060201c565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008082840190508381101561026a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b610e3a806102836000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806370a082311161005b57806370a08231146101fd578063a457c2d714610255578063a9059cbb146102bb578063dd62ed3e1461032157610088565b8063095ea7b31461008d57806318160ddd146100f357806323b872dd146101115780633950935114610197575b600080fd5b6100d9600480360360408110156100a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610399565b604051808215151515815260200191505060405180910390f35b6100fb6103b7565b6040518082815260200191505060405180910390f35b61017d6004803603606081101561012757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103c1565b604051808215151515815260200191505060405180910390f35b6101e3600480360360408110156101ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061049a565b604051808215151515815260200191505060405180910390f35b61023f6004803603602081101561021357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061054d565b6040518082815260200191505060405180910390f35b6102a16004803603604081101561026b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610595565b604051808215151515815260200191505060405180910390f35b610307600480360360408110156102d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610662565b604051808215151515815260200191505060405180910390f35b6103836004803603604081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610680565b6040518082815260200191505060405180910390f35b60006103ad6103a6610707565b848461070f565b6001905092915050565b6000600254905090565b60006103ce848484610906565b61048f846103da610707565b61048a85604051806060016040528060288152602001610d7060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610440610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b600190509392505050565b60006105436104a7610707565b8461053e85600160006104b8610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b61070f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006106586105a2610707565b8461065385604051806060016040528060258152602001610de160259139600160006105cc610707565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b61070f565b6001905092915050565b600061067661066f610707565b8484610906565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610795576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180610dbd6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561081b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610d286022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180610d986025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610d056023913960400191505060405180910390fd5b610a7d81604051806060016040528060268152602001610d4a602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610bbc9092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b10816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c7c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610c69576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610c2e578082015181840152602081019050610c13565b50505050905090810190601f168015610c5b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015610cfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a723158204b72fba02adebd751a8e173005e094f50807c69fde771436ef2cb081650def3c64736f6c63430005110032"; fn mocked_request() -> ForwardRequest { ForwardRequest { @@ -72,7 +73,7 @@ fn forward_request_works() { } #[test] -fn forward_legacy_request_sufficient_balance() { +fn forward_request_sufficient_balance() { let alice = address_build(1); ExtBuilder::default().build().execute_with(|| { macro_rules! test_tx_types { @@ -109,6 +110,53 @@ fn forward_legacy_request_sufficient_balance() { }); } +#[test] +fn foraward_call_works() { + let alice = address_build(1); + ExtBuilder::default() + .with_balances(vec![(alice.address, 1_000_000_000_000)]) + .build() + .execute_with(|| { + let request = mocked_request(); + assert_ok!(EthTxForwarder::forward_transact( + ForwardEthOrigin::ForwardEth(alice.address).into(), + request, + )); + let pallet_ethereum::Event::Executed { to, .. } = + System::read_events_for_pallet().into_iter().nth(0).expect("events expected"); + + use ethabi::{Function, Param, ParamType, Token}; + #[allow(deprecated)] + let function = Function { + name: "balanceOf".to_owned(), + inputs: vec![Param { + name: "account".to_owned(), + kind: ParamType::Address, + internal_type: None, + }], + outputs: vec![Param { + name: "balance".to_owned(), + kind: ParamType::Uint(256), + internal_type: None, + }], + constant: None, + state_mutability: ethabi::StateMutability::View, + }; + let input = function.encode_input(&[Token::Address(alice.address)]).unwrap(); + let result = EthTxForwarder::forward_call( + alice.address, + to, + input, + Default::default(), + U256::from(10_000_000u64), + ) + .ok() + .expect("call should succeed"); + let ExecutionInfoV2 { value, .. } = result; + assert_eq!(U256::from_big_endian(&value), U256::from(1000000)); + }); +} + #[test] fn mock_signature_valid() { assert!( diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index f7461af07..b4aa92242 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -14,6 +14,8 @@ ethereum = { workspace = true } log = { workspace = true } scale-info = { workspace = true } +fp-evm = { workspace = true } + # darwinia darwinia-ethtx-forwarder = { workspace = true } darwinia-staking-traits = { workspace = true } @@ -58,6 +60,8 @@ std = [ "log/std", "scale-info/std", + "fp-evm/std", + # darwinia "darwinia-ethtx-forwarder/std", "darwinia-staking-traits/std", diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 21658cead..f6bba78fd 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -1135,11 +1135,75 @@ pub trait ElectionResultProvider { /// Get the election result. fn get(n: u32) -> Vec; } + +use ethabi::Token; +use fp_evm::ExecutionInfoV2; /// Election contract. -pub struct ElectionContract; -impl ElectionContract { +pub struct ElectionContract(PhantomData); +impl ElectionContract +where + T: Config + darwinia_ethtx_forwarder::Config, +{ fn get(n: u32) -> Vec { - todo!() + let sender = H160([ + 109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0, + ]); + + // TODO: Use the correct CollatorSet contract address + let to = H160([ + 109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 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: ethabi::StateMutability::View, + }; + let input = match function.encode_input(&[Token::Int(n.into())]) { + Ok(i) => i, + Err(e) => { + log::error!("failed to encode input due to {e:?}"); + return vec![]; + }, + }; + + match >::forward_call( + sender, + to, + input, + Default::default(), + U256::from(10_000_000u64), + ) { + Ok(ExecutionInfoV2 { value, .. }) => { + function + .decode_output(&value) + .map_err(|e| log::error!("failed to decode output due to {e:?}")) + .map(|tokens| { + tokens + .into_iter() + .filter_map(|token| match token { + Token::Address(addr) => Some(AccountId::from(addr)), + _ => None, + }) + .collect() + }) + .unwrap_or(vec![]) + }, + Err(e) => { + log::error!("failed to forward call due to {e:?}"); + vec![] + }, + } } } diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index 06ebfcc09..bdfa60844 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -277,8 +277,8 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = StatedOnSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = (); - type RewardToKton = (); type MaxDeposits = ::MaxDeposits; + type RewardToKton = (); type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index f09d0ac91..fad4923d9 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -206,8 +206,8 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = (); type Kton = KtonStaking; type KtonRewardDistributionContract = (); - type RewardToKton = (); type MaxDeposits = ::MaxDeposits; + type RewardToKton = (); type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index fa104ac74..78e995d5d 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -104,8 +104,8 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = OnCrabSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = darwinia_staking::KtonRewardDistributionContract; - type RewardToKton = darwinia_staking::RewardToKton; type MaxDeposits = ::MaxDeposits; + type RewardToKton = darwinia_staking::RewardToKton; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 833ab29a0..5daa5dd10 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -115,8 +115,8 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = OnDarwiniaSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = darwinia_staking::KtonRewardDistributionContract; - type RewardToKton = darwinia_staking::RewardToKton; type MaxDeposits = ::MaxDeposits; + type RewardToKton = darwinia_staking::RewardToKton; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; diff --git a/runtime/koi/src/pallets/staking.rs b/runtime/koi/src/pallets/staking.rs index bca825304..f2d5948ce 100644 --- a/runtime/koi/src/pallets/staking.rs +++ b/runtime/koi/src/pallets/staking.rs @@ -100,8 +100,8 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = OnKoiSessionEnd; type Kton = KtonStaking; type KtonRewardDistributionContract = darwinia_staking::KtonRewardDistributionContract; - type RewardToKton = darwinia_staking::RewardToKton; type MaxDeposits = ::MaxDeposits; + type RewardToKton = darwinia_staking::RewardToKton; type Ring = RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; From f6e91da2836a729e094dfa053dc039475231828d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 31 Jul 2024 16:22:11 +0800 Subject: [PATCH 03/20] Format --- pallet/staking/src/lib.rs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 3669a4663..6765bd716 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -847,7 +847,7 @@ pub mod pallet { // collators if any error occurs to prevent the chain from stalling. None } else { - // TODO?: if we really need this event + // ? if we really need this event. Self::deposit_event(Event::Elected { collators: cs.clone() }); Some(cs) @@ -967,10 +967,6 @@ pub mod pallet { Some(winners) } } - // Add reward points to block authors: - // - 20 points to the block producer for producing a (non-uncle) block in the parachain chain, - // - 2 points to the block producer for each reference to a previously unreferenced uncle, and - // - 1 point to the producer of each referenced uncle block. impl pallet_authorship::EventHandler> for Pallet where T: Config + pallet_authorship::Config + pallet_session::Config, @@ -979,8 +975,6 @@ pub mod pallet { Self::note_authors(&[author]) } } - - // Play the role of the session manager. impl pallet_session::SessionManager for Pallet where T: Config, @@ -1017,12 +1011,12 @@ where } /// Calculate the reward. - fn calculate_reward(issued: Balance) -> Balance { + fn calculate_reward(_: Balance) -> Balance { 0 } /// The reward function. - fn reward(who: &T::AccountId, amount: Balance) -> DispatchResult { + fn reward(_: &T::AccountId, _: Balance) -> DispatchResult { Ok(()) } } @@ -1031,7 +1025,7 @@ impl IssuingManager for () where T: Config {} /// Election result provider. pub trait ElectionResultProvider { /// Get the election result. - fn get(n: u32) -> Vec { + fn get(_: u32) -> Vec { Vec::new() } } @@ -1040,7 +1034,7 @@ impl ElectionResultProvider for () {} /// Distribute the reward to a contract. pub trait RewardToContract { /// Distribute the reward. - fn distribute(who: Option, amount: Balance) {} + fn distribute(_: Option, _: Balance) {} } impl RewardToContract for () {} @@ -1163,7 +1157,6 @@ where T: Config + darwinia_ethtx_forwarder::Config, { fn get(n: u32) -> Vec { - // TODO: Use the correct CollatorSet contract address let to = H160([ 109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0, ]); From fe196b78a83a4199654c9dce402dea4b6e00c17a Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 1 Aug 2024 10:03:12 +0800 Subject: [PATCH 04/20] Refactor --- Cargo.lock | 5 +- Cargo.toml | 1 + pallet/ethtx-forwarder/Cargo.toml | 6 +- pallet/ethtx-forwarder/src/lib.rs | 175 ++++++++++++---------- pallet/ethtx-forwarder/src/mock.rs | 14 ++ pallet/ethtx-forwarder/src/test.rs | 7 +- pallet/staking/Cargo.toml | 14 +- pallet/staking/src/lib.rs | 226 +++++++++++++---------------- pallet/staking/src/migration.rs | 92 +++--------- pallet/staking/src/migration/v1.rs | 123 ---------------- pallet/staking/src/migration/v2.rs | 161 -------------------- 11 files changed, 260 insertions(+), 564 deletions(-) delete mode 100644 pallet/staking/src/migration/v1.rs delete mode 100644 pallet/staking/src/migration/v2.rs diff --git a/Cargo.lock b/Cargo.lock index 2c31436c5..4d41655ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2803,6 +2803,7 @@ dependencies = [ "frame-support", "frame-system", "libsecp256k1", + "log", "moonbeam-evm-tracer", "pallet-balances", "pallet-ethereum", @@ -3011,7 +3012,6 @@ dependencies = [ "dc-inflation", "dc-primitives", "ethabi", - "ethereum", "fp-evm", "frame-benchmarking", "frame-support", @@ -3550,10 +3550,7 @@ checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" dependencies = [ "ethereum-types", "hex", - "once_cell", - "regex", "serde", - "serde_json", "sha3", "thiserror", "uint", diff --git a/Cargo.toml b/Cargo.toml index cb5112003..83aab3f43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ version = "6.6.3" # crates.io array-bytes = { version = "6.2" } codec = { package = "parity-scale-codec", version = "3.6", default-features = false } +ethabi = { version = "18.0", default-features = false } ethereum = { version = "0.15", default-features = false, features = ["with-codec"] } libsecp256k1 = { version = "0.7", default-features = false } log = { version = "0.4" } diff --git a/pallet/ethtx-forwarder/Cargo.toml b/pallet/ethtx-forwarder/Cargo.toml index b38407fd6..f162e9b83 100644 --- a/pallet/ethtx-forwarder/Cargo.toml +++ b/pallet/ethtx-forwarder/Cargo.toml @@ -9,7 +9,9 @@ version.workspace = true [dependencies] # crates.io codec = { workspace = true, package = "parity-scale-codec" } +ethabi = { workspace = true } ethereum = { workspace = true } +log = { workspace = true } scale-info = { workspace = true } # frontier @@ -31,7 +33,7 @@ sp-std = { workspace = true } [dev-dependencies] # crates.io array-bytes = { workspace = true } -ethabi = { version = "18.0" } +ethabi = { workspace = true, features = ["std"] } libsecp256k1 = { workspace = true, features = ["std"] } sha3 = { workspace = true } @@ -50,7 +52,9 @@ default = ["std"] std = [ # crates.io "codec/std", + "ethabi/std", "ethereum/std", + "log/std", "scale-info/std", # frontier diff --git a/pallet/ethtx-forwarder/src/lib.rs b/pallet/ethtx-forwarder/src/lib.rs index 67ec029e7..7f003fc43 100644 --- a/pallet/ethtx-forwarder/src/lib.rs +++ b/pallet/ethtx-forwarder/src/lib.rs @@ -25,22 +25,23 @@ mod test; // crates.io use codec::{Decode, Encode, MaxEncodedLen}; +use ethabi::{Function, Token}; use ethereum::{ EIP1559Transaction, EIP2930Transaction, LegacyTransaction, TransactionAction, TransactionSignature, TransactionV2 as Transaction, }; -use frame_support::sp_runtime::traits::UniqueSaturatedInto; use scale_info::TypeInfo; // frontier use fp_ethereum::{TransactionData, ValidatedTransaction}; use fp_evm::{CheckEvmTransaction, CheckEvmTransactionConfig, TransactionValidationError}; use pallet_evm::{FeeCalculator, GasWeightMapping, Runner}; // polkadot-sdk -#[cfg(feature = "evm-tracing")] -use frame_support::dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo}; -use frame_support::{traits::EnsureOrigin, PalletError}; +use frame_support::{dispatch::DispatchResultWithPostInfo, traits::EnsureOrigin, PalletError}; use sp_core::{Get, H160, H256, U256}; -use sp_runtime::{traits::BadOrigin, DispatchError, RuntimeDebug}; +use sp_runtime::{ + traits::{BadOrigin, UniqueSaturatedInto}, + DispatchError, RuntimeDebug, +}; use sp_std::vec::Vec; pub use pallet::*; @@ -85,7 +86,6 @@ impl> + From> EnsureOrigin #[frame_support::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; #[pallet::origin] @@ -121,45 +121,65 @@ pub mod pallet { origin: OriginFor, request: ForwardRequest, ) -> DispatchResultWithPostInfo { - let source = ensure_forward_transact(origin)?; - let transaction = Self::validated_transaction(source, request)?; - - #[cfg(feature = "evm-tracing")] - return Self::trace_tx(source, transaction); - #[cfg(not(feature = "evm-tracing"))] - return T::ValidatedTransaction::apply(source, transaction) - .map(|(post_info, _)| post_info); + Self::forward_transact_inner(ensure_forward_transact(origin)?, request) } } } impl Pallet { - /// Calculates the fee for submitting such an EVM transaction. - /// - /// The gas_price of an EVM transaction is always the min_gas_price(), which is a fixed value. - /// Therefore, only the gas_limit and value of the transaction should be considered in the - /// calculation of the fee, and the gas_price of the transaction itself can be ignored. - pub fn total_payment(request: &ForwardRequest) -> U256 { - let base_fee = ::FeeCalculator::min_gas_price().0; - let fee = base_fee.saturating_mul(request.gas_limit); - - request.value.saturating_add(fee) + pub fn forward_call( + from: H160, + to: H160, + data: Vec, + value: U256, + gas_limit: U256, + ) -> Result { + let (who, _) = pallet_evm::Pallet::::account_basic(&from); + ::Runner::call( + from, + to, + data, + value, + gas_limit.unique_saturated_into(), + None, + None, + Some(who.nonce), + vec![], + false, // non-transactional + true, + None, + None, + ::config(), + ) + .map_err(|err| err.error.into()) + } + + pub fn forward_transact_inner( + source: H160, + request: ForwardRequest, + ) -> DispatchResultWithPostInfo { + let transaction = Self::validated_transaction(source, request)?; + + #[cfg(feature = "evm-tracing")] + return Self::trace_tx(source, transaction); + #[cfg(not(feature = "evm-tracing"))] + return T::ValidatedTransaction::apply(source, transaction).map(|(post_info, _)| post_info); } fn validated_transaction( source: H160, - req: ForwardRequest, + request: ForwardRequest, ) -> Result { let (who, _) = pallet_evm::Pallet::::account_basic(&source); let base_fee = T::FeeCalculator::min_gas_price().0; - let transaction = match req.tx_type { + let transaction = match request.tx_type { TxType::LegacyTransaction => Transaction::Legacy(LegacyTransaction { nonce: who.nonce, gas_price: base_fee, - gas_limit: req.gas_limit, - action: req.action, - value: req.value, - input: req.input, + gas_limit: request.gas_limit, + action: request.action, + value: request.value, + input: request.input, // copied from: // https://github.com/rust-ethereum/ethereum/blob/24739cc8ba6e9d8ee30ada8ec92161e4c48d578e/src/transaction.rs#L798 signature: TransactionSignature::new( @@ -180,10 +200,10 @@ impl Pallet { chain_id: 0, nonce: who.nonce, gas_price: base_fee, - gas_limit: req.gas_limit, - action: req.action, - value: req.value, - input: req.input, + gas_limit: request.gas_limit, + action: request.action, + 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 @@ -206,10 +226,10 @@ impl Pallet { nonce: who.nonce, max_fee_per_gas: base_fee, max_priority_fee_per_gas: U256::zero(), - gas_limit: req.gas_limit, - action: req.action, - value: req.value, - input: req.input, + gas_limit: request.gas_limit, + action: request.action, + 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 @@ -259,42 +279,12 @@ impl Pallet { Ok(transaction) } - pub fn forward_call( - from: H160, - to: H160, - data: Vec, - value: U256, - gas_limit: U256, - ) -> Result { - let (who, _) = pallet_evm::Pallet::::account_basic(&from); - ::Runner::call( - from, - to, - data, - value, - gas_limit.unique_saturated_into(), - None, - None, - Some(who.nonce), - vec![], - false, // non-transactional - true, - None, - None, - ::config(), - ) - .map_err(|err| err.error.into()) - } - #[cfg(feature = "evm-tracing")] - fn trace_tx( - source: H160, - transaction: Transaction, - ) -> Result { + fn trace_tx(source: H160, transaction: Transaction) -> DispatchResultWithPostInfo { // moonbeam use moonbeam_evm_tracer::tracer::EvmTracer; // polkadot-sdk - use frame_support::storage::unhashed; + use frame_support::{dispatch::PostDispatchInfo, storage::unhashed}; use xcm_primitives::{EthereumXcmTracingStatus, ETHEREUM_XCM_TRACING_STORAGE_KEY}; match unhashed::get(ETHEREUM_XCM_TRACING_STORAGE_KEY) { @@ -339,6 +329,14 @@ impl Pallet { } } +#[derive(Clone, Debug, PartialEq, Eq, Encode, Decode, TypeInfo, Default)] +pub enum TxType { + #[default] + LegacyTransaction, + EIP2930Transaction, + EIP1559Transaction, +} + // TODO: replace it with upstream error type #[derive(Encode, Decode, TypeInfo, PalletError)] pub enum TxErrorWrapper { @@ -381,10 +379,35 @@ pub struct ForwardRequest { pub input: Vec, } -#[derive(Clone, Debug, PartialEq, Eq, Encode, Decode, TypeInfo, Default)] -pub enum TxType { - #[default] - LegacyTransaction, - EIP2930Transaction, - EIP1559Transaction, +pub fn quick_forward_transact( + source: H160, + function: Function, + input: &[Token], + call: H160, + value: U256, + gas_limit: U256, +) where + T: Config, +{ + log::info!("forwarding {function:?} to {call:?} with {{ input: {input:?}, value: {value:?} }}"); + + let input = match function.encode_input(input) { + Ok(i) => i, + Err(e) => { + log::error!("failed to encode input due to {e:?}"); + + return; + }, + }; + let req = ForwardRequest { + tx_type: TxType::LegacyTransaction, + action: TransactionAction::Call(call), + value, + input, + gas_limit, + }; + + if let Err(e) = >::forward_transact_inner(source, req) { + log::error!("failed to forward ethtx due to {e:?}"); + } } diff --git a/pallet/ethtx-forwarder/src/mock.rs b/pallet/ethtx-forwarder/src/mock.rs index 70d02a037..702f06a6b 100644 --- a/pallet/ethtx-forwarder/src/mock.rs +++ b/pallet/ethtx-forwarder/src/mock.rs @@ -22,6 +22,8 @@ pub use crate as darwinia_ethtx_forwarder; // crates.io use sha3::Digest; +// darwinia +use crate::*; // polkadot-sdk use frame_support::derive_impl; use sp_runtime::BuildStorage; @@ -208,3 +210,15 @@ impl ExtBuilder { ext } } + +// Calculates the fee for submitting such an EVM transaction. +// +// The gas_price of an EVM transaction is always the min_gas_price(), which is a fixed value. +// Therefore, only the gas_limit and value of the transaction should be considered in the +// calculation of the fee, and the gas_price of the transaction itself can be ignored. +pub fn total_payment(request: &ForwardRequest) -> U256 { + let base_fee = ::FeeCalculator::min_gas_price().0; + let fee = base_fee.saturating_mul(request.gas_limit); + + request.value.saturating_add(fee) +} diff --git a/pallet/ethtx-forwarder/src/test.rs b/pallet/ethtx-forwarder/src/test.rs index ed93f03b6..9b199d413 100644 --- a/pallet/ethtx-forwarder/src/test.rs +++ b/pallet/ethtx-forwarder/src/test.rs @@ -17,7 +17,10 @@ // along with Darwinia. If not, see . // darwinia -use crate::{mock::*, ForwardEthOrigin, ForwardRequest, TxType}; +use crate::{ + mock::{self, *}, + ForwardEthOrigin, ForwardRequest, TxType, +}; // crates.io use ethereum::TransactionSignature; use fp_evm::ExecutionInfoV2; @@ -93,7 +96,7 @@ fn forward_request_sufficient_balance() { }) ); - let fee = EthTxForwarder::total_payment(&request); + let fee = mock::total_payment(&request); let _ = Balances::deposit_creating(&alice.address, fee.as_u64()); assert_ok!(EthTxForwarder::forward_transact( ForwardEthOrigin::ForwardEth(alice.address).into(), diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index b4aa92242..3e892413b 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -9,13 +9,10 @@ version.workspace = true [dependencies] # crates.io codec = { workspace = true, package = "parity-scale-codec" } -ethabi = { version = "18.0", default-features = false } -ethereum = { workspace = true } +ethabi = { workspace = true } log = { workspace = true } scale-info = { workspace = true } -fp-evm = { workspace = true } - # darwinia darwinia-ethtx-forwarder = { workspace = true } darwinia-staking-traits = { workspace = true } @@ -23,6 +20,9 @@ dc-primitives = { workspace = true } # darwinia optional darwinia-deposit = { workspace = true, optional = true } +# frontier +fp-evm = { workspace = true } + # subtrate frame-support = { workspace = true } frame-system = { workspace = true } @@ -56,12 +56,9 @@ std = [ # crates.io "codec/std", "ethabi/std", - "ethereum/std", "log/std", "scale-info/std", - "fp-evm/std", - # darwinia "darwinia-ethtx-forwarder/std", "darwinia-staking-traits/std", @@ -69,6 +66,9 @@ std = [ # darwinia optional "darwinia-deposit?/std", + # frontier + "fp-evm/std", + # subtrate "frame-support/std", "frame-system/std", diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 6765bd716..402295f2f 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -50,12 +50,8 @@ pub use darwinia_staking_traits::*; // crates.io use codec::FullCodec; use ethabi::{Function, Param, ParamType, StateMutability, Token}; -use ethereum::TransactionAction; // darwinia -use darwinia_ethtx_forwarder::{ForwardEthOrigin, ForwardRequest, TxType}; use dc_primitives::{AccountId, Balance, Moment}; -// frontier -use fp_evm::ExecutionInfoV2; // polkadot-sdk use frame_support::{ pallet_prelude::*, @@ -146,10 +142,6 @@ pub mod pallet { /// RING [`Stake`] interface. type Ring: Stake; - // TODO: Remove after the migration. - /// KTON [`Stake`] interface. - type Kton: Stake; - /// Deposit [`StakeExt`] interface. type Deposit: StakeExt; @@ -159,14 +151,11 @@ pub mod pallet { /// Inflation and reward manager. type IssuingManager: IssuingManager; - /// RING staker reward distributor. - type RewardToRing: RewardToContract; - - /// KTON staker reward distributor. - type RewardToKton: RewardToContract; + /// RING staking interface. + type RingStaking: Election + Reward; - /// Election result provider. - type ElectionResultProvider: ElectionResultProvider; + /// KTON staking interface. + type KtonStaking: Reward; /// Pass [`pallet_session::Config::ShouldEndSession`]'s result to here. type ShouldEndSession: Get; @@ -327,14 +316,19 @@ pub mod pallet { #[pallet::getter(fn rate_limit_state)] pub type RateLimitState = StorageValue<_, RateLimiter, ValueQuery>; - /// KTON reward distribution contract address. + /// RING staking contract address. #[pallet::storage] - #[pallet::getter(fn kton_reward_distribution_contract)] - pub type KtonRewardDistributionContract = - StorageValue<_, T::AccountId, ValueQuery, KtonRewardDistributionContractDefault>; - /// Default value for [`KtonRewardDistributionContract`]. + #[pallet::getter(fn ring_staking_contract)] + pub type RingStakingContract = + StorageValue<_, T::AccountId, ValueQuery, StakingContractDefault>; + /// KTON staking contract address. + #[pallet::storage] + #[pallet::getter(fn kton_staking_contract)] + pub type KtonStakingContract = + StorageValue<_, T::AccountId, ValueQuery, StakingContractDefault>; + /// Default value for staking contracts. #[pallet::type_value] - pub fn KtonRewardDistributionContractDefault() -> T::AccountId { + pub fn StakingContractDefault() -> T::AccountId { account_id() } @@ -654,7 +648,7 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; - >::put(address); + >::put(address); Ok(()) } @@ -747,19 +741,19 @@ pub mod pallet { /// Distribute the session reward to staking pot and update the stakers' reward record. pub fn distribute_session_reward(amount: Balance) { - let reward_to_ring = amount.saturating_div(2); - let reward_to_kton_dao = amount.saturating_sub(reward_to_ring); + let reward_r = amount.saturating_div(2); + let reward_k = amount.saturating_sub(reward_r); let (total, map) = >::take(); - let contract_collators = call_on_cache!(>::get()).unwrap_or_default(); - let mut actual_reward_to_ring = 0; - let reward_to_ring_dao = map + let collators_v2 = call_on_cache!(>::get()).unwrap_or_default(); + let mut actual_reward_r = 0; + let reward_r_v2 = map .into_iter() .filter_map(|(c, b)| { - let r = Perbill::from_rational(b, total) * reward_to_ring; + let r = Perbill::from_rational(b, total) * reward_r; - actual_reward_to_ring += r; + actual_reward_r += r; - if contract_collators.contains(&c) { + if collators_v2.contains(&c) { Some((c, r)) } else { None @@ -774,14 +768,14 @@ pub mod pallet { } }; - reward(account_id(), actual_reward_to_ring); - reward(>::get(), reward_to_kton_dao); + reward(account_id(), actual_reward_r); + reward(>::get(), reward_k); - for (c, r) in reward_to_ring_dao { - T::RewardToRing::distribute(Some(c), r); + for (c, r) in reward_r_v2 { + T::RingStaking::distribute(Some(c), r); } - T::RewardToKton::distribute(None, reward_to_kton_dao); + T::KtonStaking::distribute(None, reward_k); } /// Pay the reward to the collator and its nominators. @@ -957,10 +951,8 @@ pub mod pallet { fn elect_from_contract(n: u32) -> Option> { const ZERO: [u8; 20] = [0; 20]; - let winners = T::ElectionResultProvider::get(n) - .into_iter() - .filter(|w| w.0 != ZERO) - .collect::>(); + let winners = + T::RingStaking::elect(n)?.into_iter().filter(|w| w.0 != ZERO).collect::>(); call_on_cache!(>::put(winners.clone())).ok()?; @@ -1022,21 +1014,21 @@ where } impl IssuingManager for () where T: Config {} -/// Election result provider. -pub trait ElectionResultProvider { - /// Get the election result. - fn get(_: u32) -> Vec { - Vec::new() +/// Election interface. +pub trait Election { + /// Elect the new collators. + fn elect(_: u32) -> Option> { + None } } -impl ElectionResultProvider for () {} +impl Election for () {} /// Distribute the reward to a contract. -pub trait RewardToContract { +pub trait Reward { /// Distribute the reward. fn distribute(_: Option, _: Balance) {} } -impl RewardToContract for () {} +impl Reward for () {} /// Staking rate limiter. #[derive(Clone, Debug, PartialEq, Encode, Decode, MaxEncodedLen, TypeInfo)] @@ -1150,16 +1142,14 @@ pub struct IndividualExposure { pub vote: Balance, } -/// Election contract. -pub struct ElectionContract(PhantomData); -impl ElectionContract +/// RING staking interface. +pub struct RingStaking(PhantomData); +impl Election for RingStaking where T: Config + darwinia_ethtx_forwarder::Config, { - fn get(n: u32) -> Vec { - let to = H160([ - 109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0, - ]); + fn elect(n: u32) -> Option> { + let rsc = >::get().into(); #[allow(deprecated)] let function = Function { name: "getTopCollators".to_owned(), @@ -1176,25 +1166,25 @@ where constant: None, state_mutability: StateMutability::View, }; - let input = match function.encode_input(&[Token::Int(n.into())]) { - Ok(i) => i, - Err(e) => { - log::error!("failed to encode input due to {e:?}"); - - return Vec::new(); - }, - }; + let input = function + .encode_input(&[Token::Int(n.into())]) + .map_err(|e| log::error!("failed to encode input due to {e:?}")) + .ok()?; - match >::forward_call( + >::forward_call( TREASURY_ADDR, - to, + rsc, input, Default::default(), U256::from(10_000_000_u64), - ) { - Ok(ExecutionInfoV2 { value, .. }) => function - .decode_output(&value) + ) + .map_err(|e| log::error!("failed to forward call due to {e:?}")) + .ok() + .and_then(|i| { + function + .decode_output(&i.value) .map_err(|e| log::error!("failed to decode output due to {e:?}")) + .ok() .map(|tokens| { tokens .into_iter() @@ -1207,76 +1197,68 @@ where }) .collect() }) - .unwrap_or_default(), - Err(e) => { - log::error!("failed to forward call due to {e:?}"); - - Vec::new() - }, - } + }) } } - -/// Distribute the reward to KTON contract. -/// -/// https://github.com/darwinia-network/DIP-7/blob/7fa307136586f06c6911ce98d16c88689d91ba8c/src/collator/CollatorStakingHub.sol#L142. -pub struct RewardToRing(PhantomData); -impl RewardToContract for RewardToRing +// Distribute the reward to RING staking contract. +// +// https://github.com/darwinia-network/DIP-7/blob/7fa307136586f06c6911ce98d16c88689d91ba8c/src/collator/CollatorStakingHub.sol#L142. +impl Reward for RingStaking where T: Config + darwinia_ethtx_forwarder::Config, - T::RuntimeOrigin: Into> + From, { fn distribute(who: Option, amount: Balance) { - todo!() + #[allow(deprecated)] + darwinia_ethtx_forwarder::quick_forward_transact::( + TREASURY_ADDR, + Function { + name: "distributeReward".into(), + inputs: vec![Param { + name: "address".to_owned(), + kind: ParamType::Address, + internal_type: None, + }], + outputs: Vec::new(), + constant: None, + state_mutability: StateMutability::Payable, + }, + &[Token::Address(who.unwrap_or(account_id()).into())], + >::get().into(), + amount.into(), + 1_000_000.into(), + ) } } -/// Distribute the reward to KTON contract. -/// -/// https://github.com/darwinia-network/KtonDAO/blob/2de20674f2ef90b749ade746d0768c7bda356402/src/staking/KtonDAOVault.sol#L40. -pub struct RewardToKton(PhantomData); -impl RewardToContract for RewardToKton +/// KTON staking interface. +pub struct KtonStaking(PhantomData); +// Distribute the reward to KTON staking contract. +// +// https://github.com/darwinia-network/KtonDAO/blob/2de20674f2ef90b749ade746d0768c7bda356402/src/staking/KtonDAOVault.sol#L40. +impl Reward for KtonStaking where T: Config + darwinia_ethtx_forwarder::Config, - T::RuntimeOrigin: Into> + From, { fn distribute(_: Option, amount: Balance) { - let krd_contract = >::get().into(); #[allow(deprecated)] - let function = Function { - name: "distributeRewards".into(), - inputs: Vec::new(), - outputs: vec![Param { - name: "success or not".into(), - kind: ParamType::Bool, - internal_type: None, - }], - constant: None, - state_mutability: StateMutability::Payable, - }; - let input = match function.encode_input(&[]) { - Ok(i) => i, - Err(e) => { - log::error!("failed to encode input due to {e:?}"); - - return; + darwinia_ethtx_forwarder::quick_forward_transact::( + TREASURY_ADDR, + Function { + name: "distributeRewards".into(), + inputs: Vec::new(), + outputs: vec![Param { + name: "success or not".into(), + kind: ParamType::Bool, + internal_type: None, + }], + constant: None, + state_mutability: StateMutability::Payable, }, - }; - let req = ForwardRequest { - tx_type: TxType::LegacyTransaction, - action: TransactionAction::Call(krd_contract), - value: U256::from(amount), - input, - gas_limit: U256::from(1_000_000), - }; - let sender = TREASURY_ADDR; - - if let Err(e) = >::forward_transact( - ForwardEthOrigin::ForwardEth(sender).into(), - req, - ) { - log::error!("failed to call `distributeRewards` on `KtonRewardDistributionContract` contract due to {e:?}"); - } + &[], + >::get().into(), + amount.into(), + 1_000_000.into(), + ) } } diff --git a/pallet/staking/src/migration.rs b/pallet/staking/src/migration.rs index 50ec8f5ee..945aa92ff 100644 --- a/pallet/staking/src/migration.rs +++ b/pallet/staking/src/migration.rs @@ -1,10 +1,5 @@ //! Pallet migrations. -/// Migration version 1. -pub mod v1; -/// Migration version 2. -pub mod v2; - // crates.io use ethabi::Token; // self @@ -14,24 +9,20 @@ use crate::*; /// /// https://github.com/darwinia-network/KtonDAO/blob/722bdf62942868de2eeaf19bc70d7a165fc031af/src/Owned.sol#L5. /// https://github.com/darwinia-network/KtonDAO/blob/045b5b59d56b426cb8b06b9da912d0a3ad0a636d/src/staking/KtonDAOVault.sol#L36. -pub fn migrate_staking_reward_distribution_contract( - kton_reward_distribution_contract: T::AccountId, -) where +pub fn migrate_staking_reward_distribution_contract(kton_staking_contract: T::AccountId) +where T: Config + darwinia_ethtx_forwarder::Config, - T::RuntimeOrigin: Into> + From, { - // Treasury pallet account. - let sender = - H160([109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0]); - let krd_contract = kton_reward_distribution_contract.into(); + let ksc = kton_staking_contract.into(); // 0x000000000Ae5DB7BDAf8D071e680452e33d91Dd5. - let krd_contract_old = H160([ + let ksc_old = H160([ 0, 0, 0, 0, 10, 229, 219, 123, 218, 248, 208, 113, 230, 128, 69, 46, 51, 217, 29, 213, ]); - { - #[allow(deprecated)] - let func = Function { + #[allow(deprecated)] + darwinia_ethtx_forwarder::quick_forward_transact::( + TREASURY_ADDR, + Function { name: "nominateNewOwner".into(), inputs: vec![Param { name: "_owner".into(), @@ -41,60 +32,25 @@ pub fn migrate_staking_reward_distribution_contract( outputs: Vec::new(), constant: None, state_mutability: StateMutability::Payable, - }; - let input = match func.encode_input(&[Token::Address(krd_contract)]) { - Ok(i) => i, - Err(e) => { - log::error!("failed to encode input due to {e:?}"); - - return; - }, - }; - let req = ForwardRequest { - tx_type: TxType::LegacyTransaction, - action: TransactionAction::Call(krd_contract_old), - value: U256::zero(), - input, - gas_limit: U256::from(1_000_000), - }; - - if let Err(e) = >::forward_transact( - ForwardEthOrigin::ForwardEth(sender).into(), - req, - ) { - log::error!("failed to call `nominateNewOwner` due to {e:?}"); - } - } - { - #[allow(deprecated)] - let func = Function { + }, + &[Token::Address(ksc)], + ksc_old, + 0.into(), + 1_000_000.into(), + ); + #[allow(deprecated)] + darwinia_ethtx_forwarder::quick_forward_transact::( + TREASURY_ADDR, + Function { name: "acceptOwnershipFromOldDistribution".into(), inputs: Vec::new(), outputs: Vec::new(), constant: None, state_mutability: StateMutability::Payable, - }; - let input = match func.encode_input(&[]) { - Ok(i) => i, - Err(e) => { - log::error!("failed to encode input due to {e:?}"); - - return; - }, - }; - let req = ForwardRequest { - tx_type: TxType::LegacyTransaction, - action: TransactionAction::Call(krd_contract), - value: U256::zero(), - input, - gas_limit: U256::from(1_000_000), - }; - - if let Err(e) = >::forward_transact( - ForwardEthOrigin::ForwardEth(sender).into(), - req, - ) { - log::error!("failed to call `acceptOwnershipFromOldDistribution` due to {e:?}"); - } - } + }, + &[], + ksc, + 0.into(), + 1_000_000.into(), + ); } diff --git a/pallet/staking/src/migration/v1.rs b/pallet/staking/src/migration/v1.rs deleted file mode 100644 index cbbbc917d..000000000 --- a/pallet/staking/src/migration/v1.rs +++ /dev/null @@ -1,123 +0,0 @@ -// core -use core::marker::PhantomData; -// darwinia -use crate::*; -// polkadot-sdk -use frame_support::traits::OnRuntimeUpgrade; -#[cfg(feature = "try-runtime")] -use sp_runtime::TryRuntimeError; - -type AccountId = ::AccountId; - -#[frame_support::storage_alias] -type NextExposures = - StorageMap, Twox64Concat, AccountId, ExposureV0>>; - -#[frame_support::storage_alias] -type Exposures = - StorageMap, Twox64Concat, AccountId, ExposureV0>>; - -#[frame_support::storage_alias] -type RewardPoints = - StorageValue, (u32, BTreeMap, u32>), ValueQuery>; - -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] -struct ExposureV0 { - vote: Balance, - nominators: Vec>, -} - -/// Migrate darwinia-staking from v0 to v1. -pub struct MigrateToV1(PhantomData); -impl OnRuntimeUpgrade for MigrateToV1 -where - T: Config, -{ - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - Ok(Vec::new()) - } - - fn on_runtime_upgrade() -> Weight { - let version = StorageVersion::get::>(); - - if version != 0 { - log::warn!( - "[pallet::staking] skipping v0 to v1 migration: executed on wrong storage version. Expected version 0, found {version:?}", - ); - - return T::DbWeight::get().reads(1); - } - - let mut count = 4; - - let (sum, map) = >::take(); - >::put(( - >::from(sum / 20), - map.into_iter() - .map(|(k, v)| (k, >::from(v / 20))) - .collect::>(), - )); - - >::iter().drain().for_each(|(k, v)| { - count += 1; - - >::insert( - &k, - Exposure { - commission: >::get(&k).unwrap_or_default(), - vote: v.vote, - nominators: v.nominators, - }, - ); - }); - >::iter().drain().for_each(|(k, v)| { - count += 1; - - >::insert( - &k, - Exposure { - commission: >::get(&k).unwrap_or_default(), - vote: v.vote, - nominators: v.nominators, - }, - ); - }); - - StorageVersion::new(1).put::>(); - - T::DbWeight::get().reads_writes(count, count) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_: Vec) -> Result<(), TryRuntimeError> { - assert_eq!(StorageVersion::get::>(), 1, "Version must be upgraded."); - - // Old storages should be killed. - assert_eq!(>::iter_keys().count(), 0); - assert_eq!(>::iter_keys().count(), 0); - assert!(!>::exists()); - - // Check the starting state is correct. - assert_eq!( - >::get(), - (CacheState::Previous, CacheState::Current, CacheState::Next) - ); - - assert_eq!( - >::iter_keys().count(), - 0, - "Previous exposure should be empty at start." - ); - - // Check that everything decoded fine. - >::iter_keys().for_each(|k| { - assert!(>::try_get(k).is_ok(), "Can not decode V1 `Exposure`."); - }); - >::iter_keys().for_each(|k| { - assert!(>::try_get(k).is_ok(), "Can not decode V1 `Exposure`."); - }); - - Ok(()) - } -} diff --git a/pallet/staking/src/migration/v2.rs b/pallet/staking/src/migration/v2.rs deleted file mode 100644 index bb52d803d..000000000 --- a/pallet/staking/src/migration/v2.rs +++ /dev/null @@ -1,161 +0,0 @@ -// core -use core::marker::PhantomData; -// darwinia -use crate::*; -use dc_primitives::UNIT; -// polkadot-sdk -use frame_support::traits::OnRuntimeUpgrade; -#[cfg(feature = "try-runtime")] -use sp_runtime::TryRuntimeError; - -#[frame_support::storage_alias] -type RingPool = StorageValue, ()>; -#[frame_support::storage_alias] -type KtonPool = StorageValue, ()>; -#[frame_support::storage_alias] -type MigrationStartBlock = StorageValue, ()>; - -#[allow(missing_docs)] -#[derive( - DebugNoBound, - DefaultNoBound, - PartialEqNoBound, - EqNoBound, - Encode, - Decode, - MaxEncodedLen, - TypeInfo, -)] -#[scale_info(skip_type_params(T))] -pub struct OldLedger -where - T: Config, -{ - pub staked_ring: Balance, - pub staked_kton: Balance, - pub staked_deposits: BoundedVec, ::MaxDeposits>, - pub unstaking_ring: BoundedVec<(Balance, BlockNumberFor), ConstU32<16>>, - pub unstaking_kton: BoundedVec<(Balance, BlockNumberFor), ConstU32<16>>, - pub unstaking_deposits: BoundedVec<(DepositId, BlockNumberFor), ConstU32<16>>, -} - -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] -struct OldExposure { - commission: Perbill, - vote: u32, - nominators: Vec>, -} -#[cfg_attr(test, derive(Clone))] -#[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] -struct OldIndividualExposure { - who: AccountId, - vote: u32, -} - -/// Migrate darwinia-staking from v1 to v2. -pub struct MigrateToV2(PhantomData); -impl OnRuntimeUpgrade for MigrateToV2 -where - T: Config, -{ - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, TryRuntimeError> { - Ok(Vec::new()) - } - - fn on_runtime_upgrade() -> Weight { - let version = StorageVersion::get::>(); - let r = 1; - - if version != 1 { - log::warn!( - "\ - [pallet::staking] skipping v1 to v2 migration: executed on wrong storage version.\ - Expected version 1, found {version:?}\ - ", - ); - - return T::DbWeight::get().reads(r); - } - - let mut w = 5; - - >::kill(); - >::kill(); - >::kill(); - >::put(20_000_000 * UNIT); - >::translate::, _>(|a, o| { - w += 6; - - let unstaking_ring = o.unstaking_ring.into_iter().fold(0, |s, (v, _)| s + v); - - // Release the unstaking RING immediately. - if unstaking_ring != 0 { - let _ = ::Ring::unstake(&a, unstaking_ring); - } - - // Release all KTON immediately. - let _ = ::Kton::unstake( - &a, - o.staked_kton + o.unstaking_kton.into_iter().fold(0, |s, (v, _)| s + v), - ); - - // Release the unstaking deposits immediately. - for (d, _) in o.unstaking_deposits { - let _ = T::Deposit::unstake(&a, d); - } - - Some(Ledger { ring: o.staked_ring, deposits: o.staked_deposits }) - }); - >::translate_values::, _>(|o| { - w += 1; - - Some(Exposure { - commission: o.commission, - vote: o.vote as _, - nominators: o - .nominators - .into_iter() - .map(|o| IndividualExposure { who: o.who, vote: o.vote as _ }) - .collect(), - }) - }); - >::translate_values::, _>(|o| { - w += 1; - - Some(Exposure { - commission: o.commission, - vote: o.vote as _, - nominators: o - .nominators - .into_iter() - .map(|o| IndividualExposure { who: o.who, vote: o.vote as _ }) - .collect(), - }) - }); - >::translate_values::, _>(|o| { - w += 1; - - Some(Exposure { - commission: o.commission, - vote: o.vote as _, - nominators: o - .nominators - .into_iter() - .map(|o| IndividualExposure { who: o.who, vote: o.vote as _ }) - .collect(), - }) - }); - - StorageVersion::new(2).put::>(); - - T::DbWeight::get().reads_writes(r, w) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_: Vec) -> Result<(), TryRuntimeError> { - assert_eq!(StorageVersion::get::>(), 2, "Version must be upgraded."); - - Ok(()) - } -} From 36d695550b2352a52d0c76616aa434df941976ac Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 1 Aug 2024 10:43:53 +0800 Subject: [PATCH 05/20] Fix compile --- pallet/account-migration/src/lib.rs | 32 +++++++++++----- pallet/account-migration/src/mock.rs | 6 +-- pallet/staking/src/benchmarking.rs | 2 +- pallet/staking/src/lib.rs | 18 ++++++++- pallet/staking/src/mock.rs | 6 +-- pallet/staking/src/weights.rs | 37 +++++++++++++++---- precompile/staking/src/mock.rs | 6 +-- runtime/crab/src/pallets/staking.rs | 6 +-- runtime/crab/src/weights/darwinia_staking.rs | 17 +++++++-- runtime/darwinia/src/pallets/staking.rs | 6 +-- .../darwinia/src/weights/darwinia_staking.rs | 17 +++++++-- runtime/koi/src/pallets/staking.rs | 29 +-------------- runtime/koi/src/weights/darwinia_staking.rs | 17 +++++++-- 13 files changed, 124 insertions(+), 75 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 9325af003..93a906ef8 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -55,9 +55,9 @@ mod weights; pub use weights::WeightInfo; // darwinia -use darwinia_deposit::Deposit; -use darwinia_staking::{migration::v2::OldLedger, Ledger}; -use dc_primitives::{AccountId as AccountId20, AssetId, Balance, Nonce}; +use darwinia_deposit::{Deposit, DepositId}; +use darwinia_staking::Ledger; +use dc_primitives::{AccountId as AccountId20, AssetId, Balance, BlockNumber, Nonce}; // polkadot-sdk use frame_support::{ migration, @@ -108,7 +108,10 @@ pub mod pallet { > + pallet_assets::Config + pallet_balances::Config + darwinia_deposit::Config - + darwinia_staking::Config + + darwinia_staking::Config< + Deposit = darwinia_deposit::Pallet, + MaxDeposits = ConstU32<512>, + > { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From + IsType<::RuntimeEvent>; @@ -161,7 +164,7 @@ pub mod pallet { /// [`darwinia_staking::migration::v2::OldLedger`] data. #[pallet::storage] #[pallet::getter(fn ledger_of)] - pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, OldLedger>; + pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, OldLedger>; /// Multisig migration caches. #[pallet::storage] @@ -459,7 +462,7 @@ pub(crate) type Signature = [u8; 64]; // Copy from . // Due to its visibility. #[allow(missing_docs)] -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)] +#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] pub struct AssetAccount { balance: Balance, is_frozen: bool, @@ -467,7 +470,7 @@ pub struct AssetAccount { extra: (), } #[allow(missing_docs)] -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)] +#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] pub(crate) enum ExistenceReason { #[codec(index = 0)] Consumer, @@ -479,7 +482,7 @@ pub(crate) enum ExistenceReason { DepositRefunded, } #[allow(missing_docs)] -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)] +#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] pub(crate) struct AssetDetails { owner: AccountId20, issuer: AccountId20, @@ -495,7 +498,7 @@ pub(crate) struct AssetDetails { status: AssetStatus, } #[allow(missing_docs)] -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)] +#[derive(PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] pub(crate) enum AssetStatus { Live, Frozen, @@ -518,6 +521,17 @@ pub struct MultisigMigrationDetail { threshold: u16, } +#[allow(missing_docs)] +#[derive(Default, PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] +pub struct OldLedger { + staked_ring: Balance, + staked_kton: Balance, + staked_deposits: BoundedVec>, + unstaking_ring: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, + unstaking_kton: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, + unstaking_deposits: BoundedVec<(DepositId, BlockNumber), ConstU32<512>>, +} + /// Build a Darwinia account migration message. pub fn signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index 967807887..e6cf3d264 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -136,13 +136,11 @@ impl darwinia_deposit::Config for Runtime { impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type ElectionResultProvider = (); type IssuingManager = (); - type Kton = Dummy; + type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = (); - type RewardToKton = (); - type RewardToRing = (); type Ring = Dummy; + type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); type WeightInfo = (); diff --git a/pallet/staking/src/benchmarking.rs b/pallet/staking/src/benchmarking.rs index 973b068aa..57d408255 100644 --- a/pallet/staking/src/benchmarking.rs +++ b/pallet/staking/src/benchmarking.rs @@ -168,7 +168,7 @@ mod benchmarks { } #[benchmark] - fn set_kton_reward_distribution_contract() { + fn set_kton_staking_contract() { // Worst-case scenario: // // Set successfully. diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 402295f2f..6c3e737ee 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -639,10 +639,24 @@ pub mod pallet { Ok(()) } + /// Set the RING reward distribution contract address. + #[pallet::call_index(11)] + #[pallet::weight(::WeightInfo::set_ring_staking_contract())] + pub fn set_ring_staking_contract( + origin: OriginFor, + address: T::AccountId, + ) -> DispatchResult { + ensure_root(origin)?; + + >::put(address); + + Ok(()) + } + /// Set the KTON reward distribution contract address. #[pallet::call_index(10)] - #[pallet::weight(::WeightInfo::set_kton_reward_distribution_contract())] - pub fn set_kton_reward_distribution_contract( + #[pallet::weight(::WeightInfo::set_kton_staking_contract())] + pub fn set_kton_staking_contract( origin: OriginFor, address: T::AccountId, ) -> DispatchResult { diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index 1f43e1d09..72aa1622a 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -289,13 +289,11 @@ impl darwinia_staking::Stake for KtonStaking { impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type ElectionResultProvider = (); type IssuingManager = StatedOnSessionEnd; - type Kton = KtonStaking; + type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; - type RewardToKton = (); - type RewardToRing = (); type Ring = RingStaking; + type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; type WeightInfo = (); diff --git a/pallet/staking/src/weights.rs b/pallet/staking/src/weights.rs index 130c2c18d..4c8c26f06 100644 --- a/pallet/staking/src/weights.rs +++ b/pallet/staking/src/weights.rs @@ -59,7 +59,8 @@ pub trait WeightInfo { fn chill() -> Weight; fn payout() -> Weight; fn set_rate_limit() -> Weight; - fn set_kton_reward_distribution_contract() -> Weight; + fn set_ring_staking_contract() -> Weight; + fn set_kton_staking_contract() -> Weight; fn set_collator_count() -> Weight; } @@ -182,9 +183,20 @@ impl WeightInfo for SubstrateWeight { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: `DarwiniaStaking::KtonRewardDistributionContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonRewardDistributionContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_kton_reward_distribution_contract() -> Weight { + // Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + // Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` @@ -324,9 +336,20 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: `DarwiniaStaking::KtonRewardDistributionContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonRewardDistributionContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_kton_reward_distribution_contract() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index cca6b2425..88c393f01 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -200,13 +200,11 @@ impl darwinia_staking::Stake for KtonStaking { impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type ElectionResultProvider = (); type IssuingManager = (); - type Kton = KtonStaking; + type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; - type RewardToKton = (); - type RewardToRing = (); type Ring = RingStaking; + type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); type WeightInfo = (); diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index 25bb02e3b..91d43bcf1 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -101,13 +101,11 @@ impl frame_support::traits::Get for ShouldEndSession { impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type ElectionResultProvider = (); type IssuingManager = OnCrabSessionEnd; - type Kton = KtonStaking; + type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; - type RewardToKton = darwinia_staking::RewardToKton; - type RewardToRing = (); type Ring = RingStaking; + type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; type WeightInfo = weights::darwinia_staking::WeightInfo; diff --git a/runtime/crab/src/weights/darwinia_staking.rs b/runtime/crab/src/weights/darwinia_staking.rs index d527f93f6..dbd416deb 100644 --- a/runtime/crab/src/weights/darwinia_staking.rs +++ b/runtime/crab/src/weights/darwinia_staking.rs @@ -171,9 +171,20 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `DarwiniaStaking::KtonRewardDistributionContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonRewardDistributionContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_kton_reward_distribution_contract() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 558e3d468..305d7dde4 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -112,13 +112,11 @@ impl frame_support::traits::Get for ShouldEndSession { impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type ElectionResultProvider = (); type IssuingManager = OnDarwiniaSessionEnd; - type Kton = KtonStaking; + type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; - type RewardToKton = darwinia_staking::RewardToKton; - type RewardToRing = (); type Ring = RingStaking; + type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; type WeightInfo = weights::darwinia_staking::WeightInfo; diff --git a/runtime/darwinia/src/weights/darwinia_staking.rs b/runtime/darwinia/src/weights/darwinia_staking.rs index 49f5b9564..654162255 100644 --- a/runtime/darwinia/src/weights/darwinia_staking.rs +++ b/runtime/darwinia/src/weights/darwinia_staking.rs @@ -171,9 +171,20 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `DarwiniaStaking::KtonRewardDistributionContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonRewardDistributionContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_kton_reward_distribution_contract() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` diff --git a/runtime/koi/src/pallets/staking.rs b/runtime/koi/src/pallets/staking.rs index d5b4425e9..a45bb6c52 100644 --- a/runtime/koi/src/pallets/staking.rs +++ b/runtime/koi/src/pallets/staking.rs @@ -42,29 +42,6 @@ impl darwinia_staking::Stake for RingStaking { ) } } -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::KKton 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::KKton as AssetId).into(), - *who, - item, - ) - } -} pub enum OnKoiSessionEnd {} impl darwinia_staking::IssuingManager for OnKoiSessionEnd { @@ -97,13 +74,11 @@ impl frame_support::traits::Get for ShouldEndSession { impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type ElectionResultProvider = (); type IssuingManager = OnKoiSessionEnd; - type Kton = KtonStaking; + type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; - type RewardToKton = darwinia_staking::RewardToKton; - type RewardToRing = (); type Ring = RingStaking; + type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = ShouldEndSession; type WeightInfo = weights::darwinia_staking::WeightInfo; diff --git a/runtime/koi/src/weights/darwinia_staking.rs b/runtime/koi/src/weights/darwinia_staking.rs index c3be04aec..e007206f4 100644 --- a/runtime/koi/src/weights/darwinia_staking.rs +++ b/runtime/koi/src/weights/darwinia_staking.rs @@ -171,9 +171,20 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `DarwiniaStaking::KtonRewardDistributionContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonRewardDistributionContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_kton_reward_distribution_contract() -> Weight { + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_kton_staking_contract() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` From 761ffe52864b7714bffaf055531e6f531b9ca2be Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 1 Aug 2024 15:45:45 +0800 Subject: [PATCH 06/20] Refactor --- pallet/account-migration/src/mock.rs | 4 +- pallet/ethtx-forwarder/Cargo.toml | 22 --- pallet/staking/Cargo.toml | 11 +- pallet/staking/src/benchmarking.rs | 16 +- pallet/staking/src/lib.rs | 165 ++++++++++++++------- pallet/staking/src/migration.rs | 10 +- pallet/staking/src/mock.rs | 98 +++---------- pallet/staking/src/tests.rs | 187 ++++++++++++------------ precompile/staking/src/mock.rs | 17 +-- runtime/crab/Cargo.toml | 2 - runtime/crab/src/pallets/staking.rs | 33 +---- runtime/darwinia/Cargo.toml | 2 - runtime/darwinia/src/pallets/staking.rs | 44 +----- runtime/koi/Cargo.toml | 2 - runtime/koi/src/pallets/staking.rs | 33 +---- 15 files changed, 259 insertions(+), 387 deletions(-) diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index e6cf3d264..2afce4e64 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -137,10 +137,10 @@ impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; type IssuingManager = (); - type KtonStaking = darwinia_staking::KtonStaking; + type KtonStaking = (); type MaxDeposits = (); type Ring = Dummy; - type RingStaking = darwinia_staking::RingStaking; + type RingStaking = (); type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); type WeightInfo = (); diff --git a/pallet/ethtx-forwarder/Cargo.toml b/pallet/ethtx-forwarder/Cargo.toml index f162e9b83..4542f9096 100644 --- a/pallet/ethtx-forwarder/Cargo.toml +++ b/pallet/ethtx-forwarder/Cargo.toml @@ -74,28 +74,6 @@ std = [ "sp-std/std", ] -runtime-benchmarks = [ - # frontier - "pallet-evm/runtime-benchmarks", - - # moonbeam - "xcm-primitives?/runtime-benchmarks", - - # polkadot-sdk - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", -] - -try-runtime = [ - # frontier - "pallet-evm/try-runtime", - - # polkadot-sdk - "frame-support/try-runtime", - "frame-system/try-runtime", - "sp-runtime/try-runtime", -] - evm-tracing = [ # moonbeam "moonbeam-evm-tracer", diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 3e892413b..049553aed 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -16,6 +16,7 @@ scale-info = { workspace = true } # darwinia darwinia-ethtx-forwarder = { workspace = true } darwinia-staking-traits = { workspace = true } +dc-inflation = { workspace = true } dc-primitives = { workspace = true } # darwinia optional darwinia-deposit = { workspace = true, optional = true } @@ -28,7 +29,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } pallet-authorship = { workspace = true } pallet-session = { workspace = true } -pallet-timestamp = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } @@ -43,9 +43,9 @@ pretty_env_logger = { version = "0.5" } darwinia-deposit = { workspace = true, features = ["std"] } # polkadot-sdk -dc-inflation = { workspace = true, features = ["std"] } pallet-balances = { workspace = true, features = ["std"] } pallet-session = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } pallet-treasury = { workspace = true, features = ["std"] } sp-io = { workspace = true, features = ["std"] } substrate-test-utils = { workspace = true } @@ -62,6 +62,7 @@ std = [ # darwinia "darwinia-ethtx-forwarder/std", "darwinia-staking-traits/std", + "dc-inflation/std", "dc-primitives/std", # darwinia optional "darwinia-deposit?/std", @@ -75,7 +76,6 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-session/std", - "pallet-timestamp/std", "sp-core/std", "sp-runtime/std", "sp-std/std", @@ -86,24 +86,19 @@ std = [ runtime-benchmarks = [ # darwinia "darwinia-deposit", - "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-staking-traits/runtime-benchmarks", # polkadot-sdk "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] try-runtime = [ - # darwinia - "darwinia-ethtx-forwarder/try-runtime", # polkadot-sdk "frame-support/try-runtime", "frame-system/try-runtime", "pallet-authorship/try-runtime", - "pallet-timestamp/try-runtime", "sp-runtime/try-runtime", ] diff --git a/pallet/staking/src/benchmarking.rs b/pallet/staking/src/benchmarking.rs index 57d408255..7c11d2aaf 100644 --- a/pallet/staking/src/benchmarking.rs +++ b/pallet/staking/src/benchmarking.rs @@ -77,7 +77,7 @@ mod benchmarks { let deposits = deposit_for::(&a, x); - >::stake(RawOrigin::Signed(a.clone()).into(), UNIT, deposits.clone()).unwrap(); + >::stake(RawOrigin::Signed(a).into(), UNIT, deposits.clone()).unwrap(); // Worst-case scenario: // @@ -100,13 +100,13 @@ mod benchmarks { #[benchmark] fn nominate() { let a = frame_benchmarking::whitelisted_caller::(); - let a_cloned = a.clone(); + let a_cloned = a; // 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(); + >::stake(RawOrigin::Signed(a).into(), UNIT, Default::default()).unwrap(); + >::collect(RawOrigin::Signed(a).into(), Default::default()).unwrap(); // Worst-case scenario: // @@ -122,9 +122,9 @@ mod benchmarks { // 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(); + >::stake(RawOrigin::Signed(a).into(), UNIT, Default::default()).unwrap(); + >::collect(RawOrigin::Signed(a).into(), Default::default()).unwrap(); + >::nominate(RawOrigin::Signed(a).into(), a).unwrap(); // Worst-case scenario: // @@ -136,7 +136,7 @@ mod benchmarks { #[benchmark] fn payout() { let a = frame_benchmarking::whitelisted_caller::(); - let sender = a.clone(); + let sender = a; call_on_exposure!(>::insert( &a, diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 6c3e737ee..e5aeadcc3 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -36,8 +36,8 @@ pub mod migration; #[cfg(test)] mod mock; -// #[cfg(test)] -// mod tests; +#[cfg(test)] +mod tests; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; @@ -51,7 +51,7 @@ pub use darwinia_staking_traits::*; use codec::FullCodec; use ethabi::{Function, Param, ParamType, StateMutability, Token}; // darwinia -use dc_primitives::{AccountId, Balance, Moment}; +use dc_primitives::{AccountId, Balance, Moment, UNIT}; // polkadot-sdk use frame_support::{ pallet_prelude::*, @@ -59,7 +59,8 @@ use frame_support::{ DefaultNoBound, EqNoBound, PalletId, PartialEqNoBound, }; use frame_system::{pallet_prelude::*, RawOrigin}; -use sp_core::{H160, U256}; +use pallet_session::ShouldEndSession as _; +use sp_core::U256; use sp_runtime::{ traits::{AccountIdConversion, Convert, One, Zero}, Perbill, @@ -111,8 +112,9 @@ macro_rules! call_on_cache { type DepositId = <::Deposit as Stake>::Item; -const TREASURY_ADDR: H160 = - H160([109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0]); +const PAYOUT_FRAC: Perbill = Perbill::from_percent(40); +const TREASURY_ADDR: [u8; 20] = + [109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0]; #[frame_support::pallet] pub mod pallet { @@ -130,36 +132,37 @@ pub mod pallet { pub trait DepositConfig {} #[pallet::config] - pub trait Config: - frame_system::Config + pallet_timestamp::Config + DepositConfig - { + pub trait Config: frame_system::Config + DepositConfig { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; - /// RING [`Stake`] interface. - type Ring: Stake; + /// Unix time interface. + type UnixTime: UnixTime; - /// Deposit [`StakeExt`] interface. - type Deposit: StakeExt; + /// Pass [`pallet_session::Config::ShouldEndSession`]'s result to here. + type ShouldEndSession: Get; /// Currency interface to pay the reward. - type Currency: Currency; + 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; /// KTON staking interface. type KtonStaking: Reward; - /// Pass [`pallet_session::Config::ShouldEndSession`]'s result to here. - type ShouldEndSession: Get; - /// Maximum deposit count. #[pallet::constant] type MaxDeposits: Get; @@ -755,25 +758,6 @@ pub mod pallet { /// Distribute the session reward to staking pot and update the stakers' reward record. pub fn distribute_session_reward(amount: Balance) { - let reward_r = amount.saturating_div(2); - let reward_k = amount.saturating_sub(reward_r); - let (total, map) = >::take(); - let collators_v2 = call_on_cache!(>::get()).unwrap_or_default(); - let mut actual_reward_r = 0; - let reward_r_v2 = map - .into_iter() - .filter_map(|(c, b)| { - let r = Perbill::from_rational(b, total) * reward_r; - - actual_reward_r += r; - - if collators_v2.contains(&c) { - Some((c, r)) - } else { - None - } - }) - .collect::>(); let reward = |who, amount| { if T::IssuingManager::reward(&who, amount).is_ok() { Self::deposit_event(Event::Payout { who, amount }); @@ -781,13 +765,24 @@ pub mod pallet { Self::deposit_event(Event::Unpaid { who, amount }); } }; + let reward_r = amount.saturating_div(2); + let reward_k = amount.saturating_sub(reward_r); - reward(account_id(), actual_reward_r); + reward(account_id(), reward_r); reward(>::get(), reward_k); - for (c, r) in reward_r_v2 { - T::RingStaking::distribute(Some(c), r); - } + let (total, map) = >::take(); + let collators_v2 = call_on_cache!(>::get()).unwrap_or_default(); + + map.into_iter().for_each(|(c, b)| { + let r = Perbill::from_rational(b, total).mul_floor(reward_r); + + if collators_v2.contains(&c) { + T::RingStaking::distribute(Some(c), r); + } else { + >::mutate(c, |u| *u = u.map(|u| u + r).or(Some(r))); + } + }); T::KtonStaking::distribute(None, reward_k); } @@ -930,17 +925,12 @@ pub mod pallet { where T: Config, { - fn now() -> u64 { - as UnixTime>::now().as_secs() - } - fn migration_progress() -> Perbill { const TOTAL: u64 = 30 * 2 * 24 * 60 * 60; let start = >::get(); - let now = Self::now(); - Perbill::from_rational(now - start, TOTAL) + Perbill::from_rational(now::() - start, TOTAL) } fn elect_ns() -> (u32, u32) { @@ -1105,6 +1095,76 @@ pub enum CacheState { 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 +where + T: Config, +{ + fn inflate() -> Balance { + let now = now::() as Moment; + let session_duration = now - >::get(); + let elapsed_time = >::mutate(|t| { + *t = t.saturating_add(session_duration); + + *t + }); + + >::put(now); + + dc_inflation::issuing_in_period(session_duration, elapsed_time).unwrap_or_default() + } + + fn calculate_reward(issued: Balance) -> Balance { + PAYOUT_FRAC * issued + } + + fn reward(who: &AccountId, amount: Balance) -> DispatchResult { + let _ = T::Currency::deposit_creating(who, amount); + + Ok(()) + } +} + +/// Transfer issued token from pallet-treasury. +pub struct TreasuryIssuing(PhantomData); +impl IssuingManager for TreasuryIssuing +where + T: Config, +{ + fn calculate_reward(_: Balance) -> Balance { + 10_000 * UNIT + } + + fn reward(who: &AccountId, amount: Balance) -> DispatchResult { + let treasury = TREASURY_ADDR.into(); + + if who == &treasury { + Ok(()) + } else { + T::Currency::transfer( + &treasury, + who, + amount, + frame_support::traits::ExistenceRequirement::KeepAlive, + ) + } + } +} + /// A convertor from collators id. Since this pallet does not have stash/controller, this is /// just identity. pub struct IdentityCollator; @@ -1186,7 +1246,7 @@ where .ok()?; >::forward_call( - TREASURY_ADDR, + TREASURY_ADDR.into(), rsc, input, Default::default(), @@ -1224,7 +1284,7 @@ where fn distribute(who: Option, amount: Balance) { #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR, + TREASURY_ADDR.into(), Function { name: "distributeReward".into(), inputs: vec![Param { @@ -1256,7 +1316,7 @@ where fn distribute(_: Option, amount: Balance) { #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR, + TREASURY_ADDR.into(), Function { name: "distributeRewards".into(), inputs: Vec::new(), @@ -1283,3 +1343,10 @@ where { PalletId(*b"da/staki").into_account_truncating() } + +fn now() -> u64 +where + T: Config, +{ + T::UnixTime::now().as_secs() +} diff --git a/pallet/staking/src/migration.rs b/pallet/staking/src/migration.rs index 945aa92ff..ba26a1fd1 100644 --- a/pallet/staking/src/migration.rs +++ b/pallet/staking/src/migration.rs @@ -1,9 +1,9 @@ //! Pallet migrations. -// crates.io -use ethabi::Token; -// self +// darwinia use crate::*; +// polkadot-sdk +use sp_core::H160; /// Migrate `StakingRewardDistribution` contract. /// @@ -21,7 +21,7 @@ where #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR, + TREASURY_ADDR.into(), Function { name: "nominateNewOwner".into(), inputs: vec![Param { @@ -40,7 +40,7 @@ where ); #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR, + TREASURY_ADDR.into(), Function { name: "acceptOwnershipFromOldDistribution".into(), inputs: Vec::new(), diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index 72aa1622a..b5efa8396 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -21,10 +21,7 @@ pub use crate as darwinia_staking; // darwinia use dc_primitives::{AccountId, Balance, Moment, UNIT}; // polkadot-sdk -use frame_support::{ - derive_impl, - traits::{Currency, OnInitialize}, -}; +use frame_support::{derive_impl, traits::OnInitialize}; use sp_core::H160; use sp_io::TestExternalities; use sp_runtime::{BuildStorage, RuntimeAppPublic}; @@ -169,87 +166,34 @@ impl pallet_treasury::Config for Runtime { } frame_support::parameter_types! { - pub PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); pub static InflationType: u8 = 0; } pub enum StatedOnSessionEnd {} impl darwinia_staking::IssuingManager for StatedOnSessionEnd { fn inflate() -> Balance { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - OnDarwiniaSessionEnd::inflate() + >::inflate() } else { - OnCrabSessionEnd::inflate() + >::inflate() } } fn calculate_reward(issued: Balance) -> Balance { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - OnDarwiniaSessionEnd::calculate_reward(issued) + >::calculate_reward(issued) } else { - OnCrabSessionEnd::calculate_reward(issued) + >::calculate_reward(issued) } } fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - OnDarwiniaSessionEnd::reward(who, amount) + >::reward(who, amount) } else { - OnCrabSessionEnd::reward(who, amount) + >::reward(who, amount) } } } -pub enum OnDarwiniaSessionEnd {} -impl darwinia_staking::IssuingManager for OnDarwiniaSessionEnd { - fn inflate() -> Balance { - let now = Timestamp::now(); - let session_duration = now - >::get(); - let elapsed_time = >::mutate(|t| { - *t = t.saturating_add(session_duration); - - *t - }); - - >::put(now); - - dc_inflation::issuing_in_period(session_duration, elapsed_time).unwrap_or_default() - } - - fn calculate_reward(issued: Balance) -> Balance { - PayoutFraction::get() * issued - } - - fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - let _ = Balances::deposit_creating(who, amount); - - Ok(()) - } -} -pub enum OnCrabSessionEnd {} -impl darwinia_staking::IssuingManager for OnCrabSessionEnd { - fn calculate_reward(_inflation: Balance) -> Balance { - 10_000 * UNIT - } - - fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - >::transfer( - &Treasury::account_id(), - who, - amount, - frame_support::traits::ExistenceRequirement::KeepAlive, - ) - } -} -pub enum ShouldEndSession {} -impl frame_support::traits::Get for ShouldEndSession { - fn get() -> bool { - // polkadot-sdk - use pallet_session::ShouldEndSession; - - ::ShouldEndSession::should_end_session( - System::block_number(), - ) - } -} pub enum RingStaking {} impl darwinia_staking::Stake for RingStaking { type AccountId = AccountId; @@ -273,29 +217,29 @@ impl darwinia_staking::Stake for RingStaking { ) } } -pub enum KtonStaking {} -impl darwinia_staking::Stake for KtonStaking { - 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(()) +impl darwinia_staking::Election for RingStaking { + fn elect(_: u32) -> Option> { + None } } +impl darwinia_staking::Reward for RingStaking { + fn distribute(_: Option, _: Balance) {} +} +pub enum KtonStaking {} +impl darwinia_staking::Reward for KtonStaking { + fn distribute(_: Option, _: Balance) {} +} impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; type IssuingManager = StatedOnSessionEnd; - type KtonStaking = darwinia_staking::KtonStaking; + type KtonStaking = KtonStaking; type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; - type RingStaking = darwinia_staking::RingStaking; + type RingStaking = RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = ShouldEndSession; + type ShouldEndSession = darwinia_staking::ShouldEndSession; + type UnixTime = Timestamp; type WeightInfo = (); } #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/pallet/staking/src/tests.rs b/pallet/staking/src/tests.rs index c5592ffb5..26ce416db 100644 --- a/pallet/staking/src/tests.rs +++ b/pallet/staking/src/tests.rs @@ -21,7 +21,6 @@ use core::time::Duration; // darwinia use crate::{mock::*, *}; use darwinia_deposit::Error as DepositError; -use dc_primitives::UNIT; // polkadot-sdk use frame_support::{assert_noop, assert_ok, BoundedVec}; use sp_runtime::{assert_eq_error_rate, DispatchError, Perbill}; @@ -362,7 +361,7 @@ fn elect_should_work() { }); assert_eq!( - Staking::elect().unwrap(), + Staking::elect(Staking::collator_count()).unwrap(), vec![account_id_of(5), account_id_of(4), account_id_of(3)] ); }); @@ -438,7 +437,7 @@ fn payout_should_work() { .collect::>() ); assert_eq_error_rate!( - PayoutFraction::get() + PAYOUT_FRAC * dc_inflation::issuing_in_period(session_duration, Timestamp::now()).unwrap() / 2, rewards.iter().sum::(), @@ -551,97 +550,97 @@ fn payout_should_work() { }); } -#[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(account_id_of(i)), - i as Balance * UNIT, - Vec::new() - )); - assert_ok!(Staking::collect( - RuntimeOrigin::signed(account_id_of(i)), - Perbill::from_percent(i as u32 * 10) - )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i) - )); - }); - (3..=4).for_each(|i| { - assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), - (5 - i as Balance) * UNIT, - Vec::new() - )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i - 2) - )); - }); - new_session(); - new_session(); - - Efflux::time(>::get() as Moment); - Staking::note_authors(&[account_id_of(1), account_id_of(2)]); - new_session(); - (1..=4).for_each(|i| { - assert_eq!( - Balances::free_balance(account_id_of(i)), - (1_000 - if i < 3 { i } else { 5 - i }) as Balance * UNIT - ) - }); - - Efflux::block(1); - assert_eq!( - [ - Balances::free_balance(account_id_of(1)), - Balances::free_balance(account_id_of(2)), - Balances::free_balance(account_id_of(3)), - Balances::free_balance(account_id_of(4)), - ], - [ - 999000607164541135398, - 998000000000000000000, - 998000910746811475409, - 999000000000000000000 - ] - ); - - Efflux::block(1); - assert_eq!( - [ - Balances::free_balance(account_id_of(1)), - Balances::free_balance(account_id_of(2)), - Balances::free_balance(account_id_of(3)), - Balances::free_balance(account_id_of(4)), - ], - [ - 999000607164541135398, - 998001113134992106860, - 998000910746811475409, - 999000404776360655738 - ] - ); - - Efflux::block(1); - assert_eq!( - [ - Balances::free_balance(account_id_of(1)), - Balances::free_balance(account_id_of(2)), - Balances::free_balance(account_id_of(3)), - Balances::free_balance(account_id_of(4)), - ], - [ - 999000607164541135398, - 998001113134992106860, - 998000910746811475409, - 999000404776360655738 - ] - ); - }); -} +// #[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(account_id_of(i)), +// i as Balance * UNIT, +// Vec::new() +// )); +// assert_ok!(Staking::collect( +// RuntimeOrigin::signed(account_id_of(i)), +// Perbill::from_percent(i as u32 * 10) +// )); +// assert_ok!(Staking::nominate( +// RuntimeOrigin::signed(account_id_of(i)), +// account_id_of(i) +// )); +// }); +// (3..=4).for_each(|i| { +// assert_ok!(Staking::stake( +// RuntimeOrigin::signed(account_id_of(i)), +// (5 - i as Balance) * UNIT, +// Vec::new() +// )); +// assert_ok!(Staking::nominate( +// RuntimeOrigin::signed(account_id_of(i)), +// account_id_of(i - 2) +// )); +// }); +// new_session(); +// new_session(); + +// Efflux::time(>::get() as Moment); +// Staking::note_authors(&[account_id_of(1), account_id_of(2)]); +// new_session(); +// (1..=4).for_each(|i| { +// assert_eq!( +// Balances::free_balance(account_id_of(i)), +// (1_000 - if i < 3 { i } else { 5 - i }) as Balance * UNIT +// ) +// }); + +// Efflux::block(1); +// assert_eq!( +// [ +// Balances::free_balance(account_id_of(1)), +// Balances::free_balance(account_id_of(2)), +// Balances::free_balance(account_id_of(3)), +// Balances::free_balance(account_id_of(4)), +// ], +// [ +// 999000607164541135398, +// 998000000000000000000, +// 998000910746811475409, +// 999000000000000000000 +// ] +// ); + +// Efflux::block(1); +// assert_eq!( +// [ +// Balances::free_balance(account_id_of(1)), +// Balances::free_balance(account_id_of(2)), +// Balances::free_balance(account_id_of(3)), +// Balances::free_balance(account_id_of(4)), +// ], +// [ +// 999000607164541135398, +// 998001113134992106860, +// 998000910746811475409, +// 999000404776360655738 +// ] +// ); + +// Efflux::block(1); +// assert_eq!( +// [ +// Balances::free_balance(account_id_of(1)), +// Balances::free_balance(account_id_of(2)), +// Balances::free_balance(account_id_of(3)), +// Balances::free_balance(account_id_of(4)), +// ], +// [ +// 999000607164541135398, +// 998001113134992106860, +// 998000910746811475409, +// 999000404776360655738 +// ] +// ); +// }); +// } #[test] fn on_new_session_should_work() { diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 88c393f01..3cf54d01a 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -184,27 +184,14 @@ impl darwinia_staking::Stake for RingStaking { ) } } -pub enum KtonStaking {} -impl darwinia_staking::Stake for KtonStaking { - 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(()) - } -} impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; type IssuingManager = (); - type KtonStaking = darwinia_staking::KtonStaking; + type KtonStaking = (); type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; - type RingStaking = darwinia_staking::RingStaking; + type RingStaking = (); type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); type WeightInfo = (); diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 0d0ee0e90..a750c1dd5 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -227,7 +227,6 @@ runtime-benchmarks = [ "darwinia-account-migration/runtime-benchmarks", "darwinia-common-runtime/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", @@ -277,7 +276,6 @@ try-runtime = [ # darwinia "darwinia-account-migration/try-runtime", "darwinia-deposit/try-runtime", - "darwinia-ethtx-forwarder/try-runtime", "darwinia-staking/try-runtime", # frontier diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index 91d43bcf1..8e4c8b89a 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -70,44 +70,17 @@ impl darwinia_staking::Stake for KtonStaking { } } -pub enum OnCrabSessionEnd {} -impl darwinia_staking::IssuingManager for OnCrabSessionEnd { - fn calculate_reward(_inflation: Balance) -> Balance { - 20_000 * UNIT - } - - fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - >::transfer( - &Treasury::account_id(), - who, - amount, - frame_support::traits::ExistenceRequirement::KeepAlive, - ) - } -} - -pub enum ShouldEndSession {} -impl frame_support::traits::Get for ShouldEndSession { - fn get() -> bool { - // polkadot-sdk - use pallet_session::ShouldEndSession; - - ::ShouldEndSession::should_end_session( - System::block_number(), - ) - } -} - impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type IssuingManager = OnCrabSessionEnd; + 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 = ShouldEndSession; + type ShouldEndSession = darwinia_staking::ShouldEndSession; + type UnixTime = Timestamp; type WeightInfo = weights::darwinia_staking::WeightInfo; } #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index c87c39260..2499b6ebc 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -246,7 +246,6 @@ runtime-benchmarks = [ "darwinia-account-migration/runtime-benchmarks", "darwinia-common-runtime/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", @@ -301,7 +300,6 @@ try-runtime = [ "darwinia-account-migration/try-runtime", "darwinia-asset-limit/try-runtime", "darwinia-deposit/try-runtime", - "darwinia-ethtx-forwarder/try-runtime", "darwinia-staking/try-runtime", # frontier diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 305d7dde4..181316c39 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -70,55 +70,17 @@ impl darwinia_staking::Stake for KtonStaking { } } -pub enum OnDarwiniaSessionEnd {} -impl darwinia_staking::IssuingManager for OnDarwiniaSessionEnd { - fn inflate() -> Balance { - let now = Timestamp::now() as Moment; - let session_duration = now - >::get(); - let elapsed_time = >::mutate(|t| { - *t = t.saturating_add(session_duration); - - *t - }); - - >::put(now); - - dc_inflation::issuing_in_period(session_duration, elapsed_time).unwrap_or_default() - } - - fn calculate_reward(issued: Balance) -> Balance { - sp_runtime::Perbill::from_percent(40) * issued - } - - fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - let _ = Balances::deposit_creating(who, amount); - - Ok(()) - } -} - -pub enum ShouldEndSession {} -impl frame_support::traits::Get for ShouldEndSession { - fn get() -> bool { - // polkadot-sdk - use pallet_session::ShouldEndSession; - - ::ShouldEndSession::should_end_session( - System::block_number(), - ) - } -} - impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type IssuingManager = OnDarwiniaSessionEnd; + type IssuingManager = darwinia_staking::BalanceIssuing; type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = ShouldEndSession; + type ShouldEndSession = darwinia_staking::ShouldEndSession; + type UnixTime = Timestamp; type WeightInfo = weights::darwinia_staking::WeightInfo; } #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/runtime/koi/Cargo.toml b/runtime/koi/Cargo.toml index 1d9723d92..f6337df57 100644 --- a/runtime/koi/Cargo.toml +++ b/runtime/koi/Cargo.toml @@ -238,7 +238,6 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/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", @@ -292,7 +291,6 @@ try-runtime = [ # darwinia "darwinia-asset-limit/try-runtime", "darwinia-deposit/try-runtime", - "darwinia-ethtx-forwarder/try-runtime", "darwinia-staking/try-runtime", # moonbeam diff --git a/runtime/koi/src/pallets/staking.rs b/runtime/koi/src/pallets/staking.rs index a45bb6c52..14a333e99 100644 --- a/runtime/koi/src/pallets/staking.rs +++ b/runtime/koi/src/pallets/staking.rs @@ -43,44 +43,17 @@ impl darwinia_staking::Stake for RingStaking { } } -pub enum OnKoiSessionEnd {} -impl darwinia_staking::IssuingManager for OnKoiSessionEnd { - fn calculate_reward(_inflation: Balance) -> Balance { - 20_000 * UNIT - } - - fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { - >::transfer( - &Treasury::account_id(), - who, - amount, - frame_support::traits::ExistenceRequirement::KeepAlive, - ) - } -} - -pub enum ShouldEndSession {} -impl frame_support::traits::Get for ShouldEndSession { - fn get() -> bool { - // polkadot-sdk - use pallet_session::ShouldEndSession; - - ::ShouldEndSession::should_end_session( - System::block_number(), - ) - } -} - impl darwinia_staking::Config for Runtime { type Currency = Balances; type Deposit = Deposit; - type IssuingManager = OnKoiSessionEnd; + type IssuingManager = darwinia_staking::BalanceIssuing; type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; type Ring = RingStaking; type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = ShouldEndSession; + type ShouldEndSession = darwinia_staking::ShouldEndSession; + type UnixTime = Timestamp; type WeightInfo = weights::darwinia_staking::WeightInfo; } #[cfg(not(feature = "runtime-benchmarks"))] From a9747ed2a3ec92c049d116bbd621e8a4a5f3ff83 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 1 Aug 2024 16:30:52 +0800 Subject: [PATCH 07/20] Fix tests --- pallet/account-migration/src/lib.rs | 12 +- pallet/account-migration/src/mock.rs | 3 +- pallet/staking/src/lib.rs | 10 +- pallet/staking/src/tests.rs | 224 +++++++++++++-------------- precompile/staking/src/mock.rs | 1 + runtime/common/src/test.rs | 2 +- 6 files changed, 127 insertions(+), 125 deletions(-) diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 93a906ef8..2e87ee2e0 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -524,12 +524,12 @@ pub struct MultisigMigrationDetail { #[allow(missing_docs)] #[derive(Default, PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] pub struct OldLedger { - staked_ring: Balance, - staked_kton: Balance, - staked_deposits: BoundedVec>, - unstaking_ring: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, - unstaking_kton: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, - unstaking_deposits: BoundedVec<(DepositId, BlockNumber), ConstU32<512>>, + pub staked_ring: Balance, + pub staked_kton: Balance, + pub staked_deposits: BoundedVec>, + pub unstaking_ring: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, + pub unstaking_kton: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, + pub unstaking_deposits: BoundedVec<(DepositId, BlockNumber), ConstU32<512>>, } /// Build a Darwinia account migration message. diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index 2afce4e64..390068a38 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -138,11 +138,12 @@ impl darwinia_staking::Config for Runtime { type Deposit = Deposit; type IssuingManager = (); type KtonStaking = (); - type MaxDeposits = (); + type MaxDeposits = frame_support::traits::ConstU32<512>; type Ring = Dummy; type RingStaking = (); type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); + type UnixTime = Timestamp; type WeightInfo = (); } #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index e5aeadcc3..29f817d1c 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -338,7 +338,7 @@ pub mod pallet { /// Migration start point. #[pallet::storage] #[pallet::getter(fn migration_start_point)] - pub type MigrationStartPoint = StorageValue<_, u64, ValueQuery>; + pub type MigrationStartPoint = StorageValue<_, Moment, ValueQuery>; /// Collator cache state. /// @@ -926,7 +926,7 @@ pub mod pallet { T: Config, { fn migration_progress() -> Perbill { - const TOTAL: u64 = 30 * 2 * 24 * 60 * 60; + const TOTAL: Moment = 30 * 2 * 24 * 60 * 60; let start = >::get(); @@ -1146,7 +1146,7 @@ where T: Config, { fn calculate_reward(_: Balance) -> Balance { - 10_000 * UNIT + 20_000 * UNIT } fn reward(who: &AccountId, amount: Balance) -> DispatchResult { @@ -1344,9 +1344,9 @@ where PalletId(*b"da/staki").into_account_truncating() } -fn now() -> u64 +fn now() -> Moment where T: Config, { - T::UnixTime::now().as_secs() + T::UnixTime::now().as_millis() } diff --git a/pallet/staking/src/tests.rs b/pallet/staking/src/tests.rs index 26ce416db..ff0a2ea98 100644 --- a/pallet/staking/src/tests.rs +++ b/pallet/staking/src/tests.rs @@ -429,13 +429,6 @@ fn payout_should_work() { 145719489836065573771, 60716453916211293261, ]; - assert_eq!( - rewards.as_slice(), - (1..=10) - .map(|i| Balances::free_balance(account_id_of(i)) - - (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT) - .collect::>() - ); assert_eq_error_rate!( PAYOUT_FRAC * dc_inflation::issuing_in_period(session_duration, Timestamp::now()).unwrap() @@ -444,6 +437,13 @@ fn payout_should_work() { // Error rate 1 RING. UNIT ); + assert_eq!( + rewards.as_slice(), + (1..=10) + .map(|i| Balances::free_balance(account_id_of(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(|| { @@ -496,16 +496,16 @@ fn payout_should_work() { payout(); let rewards = [ - 249999999400000000000, - 466666666400000000000, - 650000000000000000000, - 799999999600000000000, - 916666666500000000000, - 749999999700000000000, - 533333332800000000000, - 350000000000000000000, - 199999999800000000000, - 83333333000000000000, + 499999998800000000000, + 933333332800000000000, + 1300000000000000000000, + 1599999999200000000000, + 1833333333000000000000, + 1499999999400000000000, + 1066666665600000000000, + 700000000000000000000, + 399999999600000000000, + 166666666000000000000, ]; assert_eq!( rewards.as_slice(), @@ -537,110 +537,110 @@ fn payout_should_work() { .collect::>(), vec![ // Pay to staking failed. - Event::Unpaid { who: account_id(), amount: 5000000000000000000000 }, + Event::Unpaid { who: account_id(), amount: 10000 * UNIT }, // Pay to distribution contract failed. // The contract address is the same as staking pallet account in unit test. - Event::Unpaid { who: account_id(), amount: 5000000000000000000000 }, + Event::Unpaid { who: account_id(), amount: 10000 * UNIT }, // Pay to collator failed. - Event::Unpaid { who: account_id_of(6), amount: 3749999998500000000000 }, + Event::Unpaid { who: account_id_of(6), amount: 7499999997000000000000 }, // Pay to nominator failed. - Event::Unpaid { who: account_id_of(1), amount: 1249999997000000000000 } + Event::Unpaid { who: account_id_of(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(account_id_of(i)), -// i as Balance * UNIT, -// Vec::new() -// )); -// assert_ok!(Staking::collect( -// RuntimeOrigin::signed(account_id_of(i)), -// Perbill::from_percent(i as u32 * 10) -// )); -// assert_ok!(Staking::nominate( -// RuntimeOrigin::signed(account_id_of(i)), -// account_id_of(i) -// )); -// }); -// (3..=4).for_each(|i| { -// assert_ok!(Staking::stake( -// RuntimeOrigin::signed(account_id_of(i)), -// (5 - i as Balance) * UNIT, -// Vec::new() -// )); -// assert_ok!(Staking::nominate( -// RuntimeOrigin::signed(account_id_of(i)), -// account_id_of(i - 2) -// )); -// }); -// new_session(); -// new_session(); - -// Efflux::time(>::get() as Moment); -// Staking::note_authors(&[account_id_of(1), account_id_of(2)]); -// new_session(); -// (1..=4).for_each(|i| { -// assert_eq!( -// Balances::free_balance(account_id_of(i)), -// (1_000 - if i < 3 { i } else { 5 - i }) as Balance * UNIT -// ) -// }); - -// Efflux::block(1); -// assert_eq!( -// [ -// Balances::free_balance(account_id_of(1)), -// Balances::free_balance(account_id_of(2)), -// Balances::free_balance(account_id_of(3)), -// Balances::free_balance(account_id_of(4)), -// ], -// [ -// 999000607164541135398, -// 998000000000000000000, -// 998000910746811475409, -// 999000000000000000000 -// ] -// ); - -// Efflux::block(1); -// assert_eq!( -// [ -// Balances::free_balance(account_id_of(1)), -// Balances::free_balance(account_id_of(2)), -// Balances::free_balance(account_id_of(3)), -// Balances::free_balance(account_id_of(4)), -// ], -// [ -// 999000607164541135398, -// 998001113134992106860, -// 998000910746811475409, -// 999000404776360655738 -// ] -// ); - -// Efflux::block(1); -// assert_eq!( -// [ -// Balances::free_balance(account_id_of(1)), -// Balances::free_balance(account_id_of(2)), -// Balances::free_balance(account_id_of(3)), -// Balances::free_balance(account_id_of(4)), -// ], -// [ -// 999000607164541135398, -// 998001113134992106860, -// 998000910746811475409, -// 999000404776360655738 -// ] -// ); -// }); -// } +#[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(account_id_of(i)), + i as Balance * UNIT, + Vec::new() + )); + assert_ok!(Staking::collect( + RuntimeOrigin::signed(account_id_of(i)), + Perbill::from_percent(i as u32 * 10) + )); + assert_ok!(Staking::nominate( + RuntimeOrigin::signed(account_id_of(i)), + account_id_of(i) + )); + }); + (3..=4).for_each(|i| { + assert_ok!(Staking::stake( + RuntimeOrigin::signed(account_id_of(i)), + (5 - i as Balance) * UNIT, + Vec::new() + )); + assert_ok!(Staking::nominate( + RuntimeOrigin::signed(account_id_of(i)), + account_id_of(i - 2) + )); + }); + new_session(); + new_session(); + + Efflux::time(>::get() as Moment); + Staking::note_authors(&[account_id_of(1), account_id_of(2)]); + new_session(); + (1..=4).for_each(|i| { + assert_eq!( + Balances::free_balance(account_id_of(i)), + (1_000 - if i < 3 { i } else { 5 - i }) as Balance * UNIT + ) + }); + + Efflux::block(1); + assert_eq!( + [ + Balances::free_balance(account_id_of(1)), + Balances::free_balance(account_id_of(2)), + Balances::free_balance(account_id_of(3)), + Balances::free_balance(account_id_of(4)), + ], + [ + 999000607164541135398, + 998000000000000000000, + 998000910746811475409, + 999000000000000000000 + ] + ); + + Efflux::block(1); + assert_eq!( + [ + Balances::free_balance(account_id_of(1)), + Balances::free_balance(account_id_of(2)), + Balances::free_balance(account_id_of(3)), + Balances::free_balance(account_id_of(4)), + ], + [ + 999000607164541135398, + 998001113134992106860, + 998000910746811475409, + 999000404776360655738 + ] + ); + + Efflux::block(1); + assert_eq!( + [ + Balances::free_balance(account_id_of(1)), + Balances::free_balance(account_id_of(2)), + Balances::free_balance(account_id_of(3)), + Balances::free_balance(account_id_of(4)), + ], + [ + 999000607164541135398, + 998001113134992106860, + 998000910746811475409, + 999000404776360655738 + ] + ); + }); +} #[test] fn on_new_session_should_work() { diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 3cf54d01a..541d64426 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -194,6 +194,7 @@ impl darwinia_staking::Config for Runtime { type RingStaking = (); type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); + type UnixTime = Timestamp; type WeightInfo = (); } #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index 4a707ae1b..652172fb4 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -22,8 +22,8 @@ macro_rules! impl_account_migration_tests { mod account_migration { // darwinia use super::mock::*; + use darwinia_account_migration::OldLedger; use darwinia_deposit::Deposit as DepositS; - use darwinia_staking::migration::v2::OldLedger; // polkadot-sdk use frame_support::{ assert_err, assert_ok, migration, Blake2_128Concat, StorageHasher, From 021d73ace31b44f686d157670c2c9babb48d81b2 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 1 Aug 2024 21:17:13 +0800 Subject: [PATCH 08/20] More tests --- Cargo.lock | 10 -- pallet/account-migration/src/lib.rs | 39 ----- pallet/deposit/src/lib.rs | 11 ++ pallet/staking/Cargo.toml | 1 - pallet/staking/src/lib.rs | 51 +++--- pallet/staking/src/mock.rs | 118 +++++++++---- pallet/staking/src/tests.rs | 254 +++++++++++++++++++++------- 7 files changed, 315 insertions(+), 169 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d41655ef..d1acbd366 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3029,7 +3029,6 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std 14.0.0 (git+https://github.com/darwinia-network/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "substrate-test-utils", ] [[package]] @@ -14852,15 +14851,6 @@ dependencies = [ "trie-db", ] -[[package]] -name = "substrate-test-utils" -version = "4.0.0-dev" -source = "git+https://github.com/darwinia-network/polkadot-sdk?branch=release-polkadot-v1.7.2#581178546b4b0fb8ebf4a6cee5a51d5629419197" -dependencies = [ - "futures 0.3.30", - "tokio", -] - [[package]] name = "substrate-typenum" version = "1.16.0" diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 2e87ee2e0..078c9f2ac 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -155,17 +155,6 @@ pub mod pallet { #[pallet::getter(fn kton_account_of)] pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, AssetAccount>; - /// [`darwinia_deposit::Deposits`] data. - #[pallet::storage] - #[pallet::unbounded] - #[pallet::getter(fn deposit_of)] - pub type Deposits = StorageMap<_, Blake2_128Concat, AccountId32, Vec>; - - /// [`darwinia_staking::migration::v2::OldLedger`] data. - #[pallet::storage] - #[pallet::getter(fn ledger_of)] - pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, OldLedger>; - /// Multisig migration caches. #[pallet::storage] #[pallet::unbounded] @@ -421,34 +410,6 @@ pub mod pallet { ); } } - 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( - to, - Ledger { ring: l.staked_ring, deposits: l.staked_deposits }, - ); - } Ok(()) } diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 8c0edad07..742a59579 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -291,6 +291,17 @@ pub mod pallet { Ok(()) } + + /// Migration data to deposit contract. + #[pallet::call_index(3)] + #[pallet::weight(::WeightInfo::migrate())] + pub fn migrate(origin: OriginFor) -> DispatchResult { + let who = ensure_signed(origin)?; + + // TODO. + + Ok(()) + } } } pub use pallet::*; diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 049553aed..84bf24c3c 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -48,7 +48,6 @@ pallet-session = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } pallet-treasury = { workspace = true, features = ["std"] } sp-io = { workspace = true, features = ["std"] } -substrate-test-utils = { workspace = true } [features] default = ["std"] diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 29f817d1c..615bdd02d 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -115,6 +115,7 @@ type DepositId = <::Deposit as Stake>::Item; const PAYOUT_FRAC: Perbill = Perbill::from_percent(40); const TREASURY_ADDR: [u8; 20] = [109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0]; +const DAY_IN_MILLIS: Moment = 24 * 60 * 60 * 1_000; #[frame_support::pallet] pub mod pallet { @@ -332,7 +333,7 @@ pub mod pallet { /// Default value for staking contracts. #[pallet::type_value] pub fn StakingContractDefault() -> T::AccountId { - account_id() + TREASURY_ADDR.into() } /// Migration start point. @@ -758,24 +759,21 @@ pub mod pallet { /// Distribute the session reward to staking pot and update the stakers' reward record. pub fn distribute_session_reward(amount: Balance) { - let reward = |who, amount| { - if T::IssuingManager::reward(&who, amount).is_ok() { - Self::deposit_event(Event::Payout { who, amount }); - } else { - Self::deposit_event(Event::Unpaid { who, amount }); - } - }; - let reward_r = amount.saturating_div(2); - let reward_k = amount.saturating_sub(reward_r); + let who = TREASURY_ADDR.into(); - reward(account_id(), reward_r); - reward(>::get(), reward_k); + if T::IssuingManager::reward(&who, amount).is_ok() { + Self::deposit_event(Event::Payout { who, amount }); + } else { + Self::deposit_event(Event::Unpaid { who, amount }); + } - let (total, map) = >::take(); + let reward_r = amount.saturating_div(2); + let reward_k = amount.saturating_sub(reward_r); + let (b_total, map) = >::take(); let collators_v2 = call_on_cache!(>::get()).unwrap_or_default(); map.into_iter().for_each(|(c, b)| { - let r = Perbill::from_rational(b, total).mul_floor(reward_r); + let r = Perbill::from_rational(b, b_total).mul_floor(reward_r); if collators_v2.contains(&c) { T::RingStaking::distribute(Some(c), r); @@ -925,21 +923,22 @@ pub mod pallet { where T: Config, { + /// Elect the new collators. + pub fn elect_ns() -> (u32, u32) { + let n = >::get(); + let n1 = Self::migration_progress() * n; + + (n1, n - n1) + } + fn migration_progress() -> Perbill { - const TOTAL: Moment = 30 * 2 * 24 * 60 * 60; + const TOTAL: Moment = 30 * 2 * DAY_IN_MILLIS; let start = >::get(); Perbill::from_rational(now::() - start, TOTAL) } - fn elect_ns() -> (u32, u32) { - let n = >::get(); - let n1 = Self::migration_progress() * n; - - (n1, n - n1) - } - fn try_elect(n: u32, elect: F) -> R where F: FnOnce(u32) -> Option, @@ -1282,6 +1281,12 @@ where T: Config + darwinia_ethtx_forwarder::Config, { fn distribute(who: Option, amount: Balance) { + let Some(who) = who else { + log::error!("who must be some; qed"); + + return; + }; + #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( TREASURY_ADDR.into(), @@ -1296,7 +1301,7 @@ where constant: None, state_mutability: StateMutability::Payable, }, - &[Token::Address(who.unwrap_or(account_id()).into())], + &[Token::Address(who.into())], >::get().into(), amount.into(), 1_000_000.into(), diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index b5efa8396..aad6f95d2 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -16,12 +16,10 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -pub use crate as darwinia_staking; - // darwinia -use dc_primitives::{AccountId, Balance, Moment, UNIT}; +use crate::*; // polkadot-sdk -use frame_support::{derive_impl, traits::OnInitialize}; +use frame_support::{assert_ok, derive_impl, traits::OnInitialize}; use sp_core::H160; use sp_io::TestExternalities; use sp_runtime::{BuildStorage, RuntimeAppPublic}; @@ -115,7 +113,7 @@ impl pallet_session::Config for Runtime { type SessionManager = Staking; type ShouldEndSession = pallet_session::PeriodicSessions; type ValidatorId = Self::AccountId; - type ValidatorIdOf = darwinia_staking::IdentityCollator; + type ValidatorIdOf = crate::IdentityCollator; type WeightInfo = (); } @@ -169,40 +167,40 @@ frame_support::parameter_types! { pub static InflationType: u8 = 0; } pub enum StatedOnSessionEnd {} -impl darwinia_staking::IssuingManager for StatedOnSessionEnd { +impl crate::IssuingManager for StatedOnSessionEnd { fn inflate() -> Balance { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - >::inflate() + >::inflate() } else { - >::inflate() + >::inflate() } } fn calculate_reward(issued: Balance) -> Balance { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - >::calculate_reward(issued) + >::calculate_reward(issued) } else { - >::calculate_reward(issued) + >::calculate_reward(issued) } } fn reward(who: &AccountId, amount: Balance) -> sp_runtime::DispatchResult { if INFLATION_TYPE.with(|v| *v.borrow()) == 0 { - >::reward(who, amount) + >::reward(who, amount) } else { - >::reward(who, amount) + >::reward(who, amount) } } } pub enum RingStaking {} -impl darwinia_staking::Stake for RingStaking { +impl crate::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(), + &crate::account_id(), item, frame_support::traits::ExistenceRequirement::AllowDeath, ) @@ -210,26 +208,54 @@ impl darwinia_staking::Stake for RingStaking { fn unstake(who: &Self::AccountId, item: Self::Item) -> sp_runtime::DispatchResult { >::transfer( - &darwinia_staking::account_id(), + &crate::account_id(), who, item, frame_support::traits::ExistenceRequirement::AllowDeath, ) } } -impl darwinia_staking::Election for RingStaking { - fn elect(_: u32) -> Option> { - None +impl crate::Election for RingStaking { + fn elect(n: u32) -> Option> { + Some( + (100..=(100 + n) as u64) + .map(|x| { + let who = account_id_of(x); + let _ = >::deposit_creating(&who, x as _); + + assert_ok!(Session::set_keys( + RuntimeOrigin::signed(who), + SessionKeys { uint: x.into() }, + Vec::new() + )); + + who + }) + .collect(), + ) } } -impl darwinia_staking::Reward for RingStaking { - fn distribute(_: Option, _: Balance) {} +impl crate::Reward for RingStaking { + fn distribute(who: Option, amount: Balance) { + let Some(who) = who else { return }; + let _ = Balances::transfer_keep_alive( + RuntimeOrigin::signed(Treasury::account_id()), + who, + amount, + ); + } } pub enum KtonStaking {} -impl darwinia_staking::Reward for KtonStaking { - fn distribute(_: Option, _: Balance) {} +impl crate::Reward for KtonStaking { + fn distribute(_: Option, amount: Balance) { + let _ = Balances::transfer_keep_alive( + RuntimeOrigin::signed(Treasury::account_id()), + >::get(), + amount, + ); + } } -impl darwinia_staking::Config for Runtime { +impl crate::Config for Runtime { type Currency = Balances; type Deposit = Deposit; type IssuingManager = StatedOnSessionEnd; @@ -238,12 +264,12 @@ impl darwinia_staking::Config for Runtime { type Ring = RingStaking; type RingStaking = RingStaking; type RuntimeEvent = RuntimeEvent; - type ShouldEndSession = darwinia_staking::ShouldEndSession; + type ShouldEndSession = crate::ShouldEndSession; type UnixTime = Timestamp; type WeightInfo = (); } #[cfg(not(feature = "runtime-benchmarks"))] -impl darwinia_staking::DepositConfig for Runtime {} +impl crate::DepositConfig for Runtime {} frame_support::construct_runtime! { pub enum Runtime { @@ -253,14 +279,14 @@ frame_support::construct_runtime! { Deposit: darwinia_deposit, Session: pallet_session, Treasury: pallet_treasury, - Staking: darwinia_staking, + Staking: crate, } } pub enum Efflux {} impl Efflux { - pub fn time(milli_secs: Moment) { - Timestamp::set_timestamp(Timestamp::now() + milli_secs); + pub fn time(millis: Moment) { + Timestamp::set_timestamp(Timestamp::now() + millis); } pub fn block(number: BlockNumber) { @@ -303,17 +329,17 @@ impl ExtBuilder { pallet_balances::GenesisConfig:: { balances: (1..=10) - .map(|i| (account_id_of(i), 1_000 * UNIT)) - .chain([(Treasury::account_id(), 1_000_000 * UNIT)]) + .map(|x| (account_id_of(x), 1_000 * UNIT)) + .chain([(Treasury::account_id(), 1_000_000_000 * UNIT)]) .collect(), } .assimilate_storage(&mut storage) .unwrap(); - darwinia_staking::GenesisConfig:: { + crate::GenesisConfig:: { rate_limit: 100 * UNIT, collator_count: self.collator_count, collators: if self.genesis_collator { - (1..=self.collator_count as u64).map(|i| (account_id_of(i), UNIT)).collect() + (1..=self.collator_count as u64).map(|x| (account_id_of(x), x as _)).collect() } else { Default::default() }, @@ -324,7 +350,7 @@ impl ExtBuilder { if self.genesis_collator { pallet_session::GenesisConfig:: { keys: (1..=self.collator_count as u64) - .map(|i| (account_id_of(i), account_id_of(i), SessionKeys { uint: i.into() })) + .map(|x| (account_id_of(x), account_id_of(x), SessionKeys { uint: x.into() })) .collect(), } .assimilate_storage(&mut storage) @@ -344,8 +370,28 @@ impl Default for ExtBuilder { } } -pub fn account_id_of(i: u64) -> AccountId { - H160::from_low_u64_le(i).into() +pub fn account_id_of(x: u64) -> AccountId { + H160::from_low_u64_le(x).into() +} + +pub fn u64_of(account_id: AccountId) -> u64 { + H160::to_low_u64_le(&account_id.into()) +} + +pub fn preset_collators(n: u64) { + (10..(10 + n)).for_each(|x| { + let who = account_id_of(x); + let _ = >::deposit_creating(&who, x as _); + + assert_ok!(Session::set_keys( + RuntimeOrigin::signed(who), + SessionKeys { uint: x.into() }, + Vec::new() + )); + assert_ok!(Staking::stake(RuntimeOrigin::signed(who), x as _, Vec::new())); + assert_ok!(Staking::collect(RuntimeOrigin::signed(who), Perbill::zero())); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(who), who)); + }); } pub fn initialize_block(number: BlockNumber) { @@ -366,7 +412,7 @@ pub fn new_session() { } pub fn payout() { - darwinia_staking::call_on_exposure!(>::iter_keys().for_each(|c| { + crate::call_on_exposure!(>::iter_keys().for_each(|c| { let _ = Staking::payout_inner(c); })) .unwrap(); diff --git a/pallet/staking/src/tests.rs b/pallet/staking/src/tests.rs index ff0a2ea98..8b72b4ac2 100644 --- a/pallet/staking/src/tests.rs +++ b/pallet/staking/src/tests.rs @@ -24,7 +24,6 @@ use darwinia_deposit::Error as DepositError; // polkadot-sdk use frame_support::{assert_noop, assert_ok, BoundedVec}; use sp_runtime::{assert_eq_error_rate, DispatchError, Perbill}; -use substrate_test_utils::assert_eq_uvec; #[test] fn exposure_cache_states_should_work() { @@ -405,6 +404,8 @@ fn payout_should_work() { }); let session_duration = Duration::new(12 * 600, 0).as_millis(); + let kton_staking_contract_balance = + Balances::free_balance(>::get()); Efflux::time(session_duration - >::get() as Moment); Staking::note_authors(&[ account_id_of(1), @@ -429,12 +430,15 @@ fn payout_should_work() { 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!( - PAYOUT_FRAC - * dc_inflation::issuing_in_period(session_duration, Timestamp::now()).unwrap() - / 2, - rewards.iter().sum::(), - // Error rate 1 RING. + // Multiplied by 2 because there are 2 sessions. + half_reward * 2, + Balances::free_balance(>::get()) + - kton_staking_contract_balance, UNIT ); assert_eq!( @@ -536,11 +540,6 @@ fn payout_should_work() { }) .collect::>(), vec![ - // Pay to staking failed. - Event::Unpaid { who: account_id(), amount: 10000 * UNIT }, - // Pay to distribution contract failed. - // The contract address is the same as staking pallet account in unit test. - Event::Unpaid { who: account_id(), amount: 10000 * UNIT }, // Pay to collator failed. Event::Unpaid { who: account_id_of(6), amount: 7499999997000000000000 }, // Pay to nominator failed. @@ -645,92 +644,76 @@ fn auto_payout_should_work() { #[test] fn on_new_session_should_work() { ExtBuilder::default().collator_count(2).genesis_collator().build().execute_with(|| { - assert_eq_uvec!( - darwinia_staking::call_on_exposure!( - >::iter_keys().collect::>() - ) - .unwrap(), + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), [account_id_of(1), account_id_of(2)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), [account_id_of(1), account_id_of(2)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()) - .unwrap(), + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), [account_id_of(1), account_id_of(2)] ); assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(3)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(3)), 2 * UNIT, Vec::new())); + assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(3)), 2, Vec::new())); assert_ok!(Staking::nominate(RuntimeOrigin::signed(account_id_of(3)), account_id_of(3))); Staking::note_authors(&Session::validators()); new_session(); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!( - >::iter_keys().collect::>() - ) - .unwrap(), + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), [account_id_of(1), account_id_of(2)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), [account_id_of(1), account_id_of(2)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()) - .unwrap(), - [account_id_of(1), account_id_of(3)] + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + [account_id_of(2), account_id_of(3)] ); assert_ok!(Staking::chill(RuntimeOrigin::signed(account_id_of(3)))); assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(4)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(4)), 2 * UNIT, Vec::new())); + assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(4)), 2, Vec::new())); assert_ok!(Staking::nominate(RuntimeOrigin::signed(account_id_of(4)), account_id_of(4))); Staking::note_authors(&Session::validators()); new_session(); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!( - >::iter_keys().collect::>() - ) - .unwrap(), + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), [account_id_of(1), account_id_of(2)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(3)] + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + [account_id_of(2), account_id_of(3)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()) - .unwrap(), - [account_id_of(1), account_id_of(4)] + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + [account_id_of(4), account_id_of(2)] ); assert_ok!(Staking::chill(RuntimeOrigin::signed(account_id_of(4)))); assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(5)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(5)), 2 * UNIT, Vec::new())); + assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(5)), 2, Vec::new())); assert_ok!(Staking::nominate(RuntimeOrigin::signed(account_id_of(5)), account_id_of(5))); Staking::note_authors(&Session::validators()); new_session(); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!( - >::iter_keys().collect::>() - ) - .unwrap(), - [account_id_of(1), account_id_of(3)] + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + [account_id_of(2), account_id_of(3)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(4)] + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + [account_id_of(4), account_id_of(2)] ); - assert_eq_uvec!( - darwinia_staking::call_on_exposure!(>::iter_keys().collect::>()) - .unwrap(), - [account_id_of(1), account_id_of(5)] + assert_eq!( + crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), + [account_id_of(5), account_id_of(2)] ); }); } @@ -773,3 +756,154 @@ fn rate_limiter_should_work() { 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); + }); + }); +} + +#[test] +fn hybrid_election_should_work() { + ExtBuilder::default().collator_count(10).build().execute_with(|| { + mock::preset_collators(10); + new_session(); + new_session(); + + assert_eq!( + (10..20).rev().collect::>(), + >::get() + .into_iter() + .map(u64_of) + .collect::>() + ); + + Timestamp::set_timestamp(15 * DAY_IN_MILLIS); + new_session(); + new_session(); + + assert_eq!( + (100..103).chain((12..20).rev()).collect::>(), + >::get() + .into_iter() + .map(u64_of) + .collect::>() + ); + + Timestamp::set_timestamp(30 * DAY_IN_MILLIS); + new_session(); + new_session(); + + assert_eq!( + (100..106).chain((15..20).rev()).collect::>(), + >::get() + .into_iter() + .map(u64_of) + .collect::>() + ); + + Timestamp::set_timestamp(45 * DAY_IN_MILLIS); + new_session(); + new_session(); + + assert_eq!( + (100..108).chain((17..20).rev()).collect::>(), + >::get() + .into_iter() + .map(u64_of) + .collect::>() + ); + + Timestamp::set_timestamp(60 * DAY_IN_MILLIS); + new_session(); + new_session(); + + assert_eq!( + (100..=110).collect::>(), + >::get() + .into_iter() + .map(u64_of) + .collect::>() + ); + }); +} + +#[test] +fn hybrid_payout_should_work() { + ExtBuilder::default().collator_count(10).build().execute_with(|| { + mock::preset_collators(10); + Timestamp::set_timestamp(30 * DAY_IN_MILLIS); + new_session(); + new_session(); + }); +} From 41c6a6260bfc14986918c5ad5f4afafea5c1c5d1 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 2 Aug 2024 12:36:21 +0800 Subject: [PATCH 09/20] Migrate deposit --- Cargo.lock | 4 + pallet/deposit/Cargo.toml | 17 ++- pallet/deposit/src/lib.rs | 243 ++++++++++++++++++++++---------- pallet/deposit/src/weights.rs | 7 + pallet/staking/src/lib.rs | 54 ++++--- pallet/staking/src/migration.rs | 5 +- 6 files changed, 229 insertions(+), 101 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1acbd366..b20d4708e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2774,17 +2774,21 @@ dependencies = [ name = "darwinia-deposit" version = "6.6.3" dependencies = [ + "darwinia-ethtx-forwarder", "darwinia-staking-traits", "dc-inflation", "dc-types", + "ethabi", "frame-benchmarking", "frame-support", "frame-system", + "log", "pallet-assets", "pallet-balances", "pallet-timestamp", "parity-scale-codec", "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)", diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 869474a47..ae5c0edbf 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -9,17 +9,21 @@ version.workspace = true [dependencies] # crates.io codec = { workspace = true, package = "parity-scale-codec" } +ethabi = { workspace = true } +log = { workspace = true } scale-info = { workspace = true } # darwinia -darwinia-staking-traits = { workspace = true } -dc-inflation = { workspace = true } -dc-types = { workspace = true } +darwinia-ethtx-forwarder = { workspace = true } +darwinia-staking-traits = { workspace = true } +dc-inflation = { workspace = true } +dc-types = { workspace = true } # subtrate frame-support = { workspace = true } frame-system = { workspace = true } pallet-timestamp = { workspace = true } +sp-core = { workspace = true } sp-runtime = { workspace = true } # polkadot-sdk optional frame-benchmarking = { workspace = true, optional = true } @@ -36,20 +40,23 @@ default = ["std"] std = [ # crates.io "codec/std", + "ethabi/std", "scale-info/std", # darwinia + "darwinia-ethtx-forwarder/std", "darwinia-staking-traits/std", "dc-inflation/std", - # subtrate + # polkadot-sdk "frame-support/std", "frame-system/std", "pallet-timestamp/std", + "sp-core/std", "sp-runtime/std", - "sp-std?/std", # polkadot-sdk optional "frame-benchmarking?/std", + "sp-std?/std", ] runtime-benchmarks = [ diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 742a59579..0a9b240a7 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -40,10 +40,12 @@ pub use weights::WeightInfo; // core use core::{ cmp::Ordering::{Equal, Greater, Less}, + marker::PhantomData, ops::ControlFlow::{Break, Continue}, }; // crates.io use codec::FullCodec; +use ethabi::{Function, Param, ParamType, StateMutability, Token}; // darwinia use dc_inflation::MILLISECS_PER_YEAR; use dc_types::{Balance, Moment}; @@ -54,6 +56,7 @@ use frame_support::{ PalletId, }; use frame_system::pallet_prelude::*; +use sp_core::H160; use sp_runtime::traits::AccountIdConversion; #[frame_support::pallet] @@ -75,6 +78,10 @@ pub mod pallet { /// KTON asset. type Kton: SimpleAsset; + /// Treasury account. + #[pallet::constant] + type Treasury: Get; + /// Minimum amount to lock at least. #[pallet::constant] type MinLockingAmount: Get; @@ -99,14 +106,16 @@ pub mod pallet { expired_time: Moment, kton_reward: Balance, }, - /// An expired deposit has been claimed. - DepositClaimed { owner: T::AccountId, deposit_id: DepositId }, + /// 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] @@ -137,6 +146,11 @@ pub mod pallet { pub type Deposits = StorageMap<_, Blake2_128Concat, T::AccountId, BoundedVec>; + // Deposit contract address. + #[pallet::storage] + #[pallet::getter(fn deposit_contract)] + pub type DepositContract = StorageValue<_, T::AccountId>; + #[pallet::pallet] pub struct Pallet(_); #[pallet::call] @@ -218,18 +232,14 @@ pub mod pallet { pub fn claim(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; let now = Self::now(); - let mut claimed = 0; + 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 { - claimed += d.value; - - Self::deposit_event(Event::DepositClaimed { - owner: who.clone(), - deposit_id: d.id, - }); + to_claim.0 += d.value; + to_claim.1.push(d.id); false } else { @@ -246,7 +256,8 @@ pub mod pallet { >::Ok(()) }); - T::Ring::transfer(&account_id(), &who, claimed, AllowDeath)?; + T::Ring::transfer(&account_id(), &who, to_claim.0, AllowDeath)?; + Self::deposit_event(Event::DepositsClaimed { owner: who, deposits: to_claim.1 }); Ok(()) } @@ -297,15 +308,113 @@ pub mod pallet { #[pallet::weight(::WeightInfo::migrate())] pub fn migrate(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; + let Some(ds) = >::take(&who) else { return Ok(()) }; + let now = Self::now(); + + for c in ds.chunks(50) { + let mut to_claim = (0, Vec::new()); + let mut to_migrate = (0, Vec::new()); + + for d in c { + if d.in_use { + Err(>::DepositInUse)?; + } - // TODO. + 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); + } + } + + T::Ring::transfer(&account_id(), &who, to_claim.0, AllowDeath)?; + T::Ring::transfer(&account_id(), &T::Treasury::get(), to_migrate.0, AllowDeath)?; + + Self::deposit_event(Event::DepositsClaimed { + owner: who.clone(), + deposits: to_claim.1, + }); + Self::deposit_event(Event::DepositsMigrated { + owner: who.clone(), + deposits: to_migrate.1, + }); + } Ok(()) } } + impl Pallet + where + T: Config, + { + 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)?; + + if d.in_use { + Err(>::DepositInUse)? + } else { + d.in_use = true; + + Ok(()) + } + }) + } + + 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; + + 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)?) + } + } } 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; @@ -324,13 +433,12 @@ pub trait SimpleAsset { fn burn(who: &Self::AccountId, amount: Balance) -> DispatchResult; } -/// 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; +/// Migrate to contract trait. +pub trait MigrateToContract { + /// Migrate to contract. + fn migrate() {} +} +impl MigrateToContract for () {} /// Deposit. #[derive(Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] @@ -347,63 +455,52 @@ pub struct Deposit { pub in_use: bool, } -impl Pallet -where - T: Config, -{ - 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)?; - - if d.in_use { - Err(>::DepositInUse)? - } else { - d.in_use = true; - - Ok(()) - } - }) - } - - 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; - - Ok(()) - } else { - Err(>::DepositNotInUse)? - } - }) - } -} -impl darwinia_staking_traits::StakeExt for Pallet +/// Deposit migrator. +pub struct DepositMigrator(PhantomData); +impl MigrateToContract for DepositMigrator where - T: Config, + T: Config + darwinia_ethtx_forwarder::Config, + T::AccountId: Into, { - 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)?) + fn migrate() { + let Some(dc) = >::get() else { + log::error!("deposit contract must be some; qed"); + + return; + }; + let dc = dc.into(); + let treasury = T::Treasury::get().into(); + + #[allow(deprecated)] + darwinia_ethtx_forwarder::quick_forward_transact::( + treasury, + Function { + name: "migrate".into(), + inputs: vec![ + Param { + name: "address".to_owned(), + kind: ParamType::Address, + internal_type: None, + }, + Param { + name: "deposits".to_owned(), + kind: ParamType::Array(Box::new(ParamType::Tuple(vec![ + ParamType::Uint(256), + ParamType::Uint(64), + ParamType::Uint(64), + ]))), + internal_type: None, + }, + ], + outputs: Vec::new(), + constant: None, + state_mutability: StateMutability::Payable, + }, + &[Token::Address(treasury), Token::Array(vec![])], + dc, + 0.into(), + 1_000_000.into(), + ) } } diff --git a/pallet/deposit/src/weights.rs b/pallet/deposit/src/weights.rs index 6ffa5b074..6f8da992f 100644 --- a/pallet/deposit/src/weights.rs +++ b/pallet/deposit/src/weights.rs @@ -55,6 +55,7 @@ pub trait WeightInfo { fn lock() -> Weight; fn claim() -> Weight; fn claim_with_penalty() -> Weight; + fn migrate() -> Weight; } /// Weights for darwinia_deposit using the Substrate node and recommended hardware. @@ -114,6 +115,9 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } + fn migrate() -> Weight { + 0.into() + } } // For backwards compatibility and tests @@ -172,4 +176,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } + fn migrate() -> Weight { + 0.into() + } } diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 615bdd02d..17c458537 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -113,8 +113,6 @@ macro_rules! call_on_cache { type DepositId = <::Deposit as Stake>::Item; const PAYOUT_FRAC: Perbill = Perbill::from_percent(40); -const TREASURY_ADDR: [u8; 20] = - [109, 111, 100, 108, 100, 97, 47, 116, 114, 115, 114, 121, 0, 0, 0, 0, 0, 0, 0, 0]; const DAY_IN_MILLIS: Moment = 24 * 60 * 60 * 1_000; #[frame_support::pallet] @@ -164,6 +162,9 @@ pub mod pallet { /// KTON staking interface. type KtonStaking: Reward; + /// Treasury address. + type Treasury: Get; + /// Maximum deposit count. #[pallet::constant] type MaxDeposits: Get; @@ -323,18 +324,11 @@ pub mod pallet { /// RING staking contract address. #[pallet::storage] #[pallet::getter(fn ring_staking_contract)] - pub type RingStakingContract = - StorageValue<_, T::AccountId, ValueQuery, StakingContractDefault>; + pub type RingStakingContract = StorageValue<_, T::AccountId>; /// KTON staking contract address. #[pallet::storage] #[pallet::getter(fn kton_staking_contract)] - pub type KtonStakingContract = - StorageValue<_, T::AccountId, ValueQuery, StakingContractDefault>; - /// Default value for staking contracts. - #[pallet::type_value] - pub fn StakingContractDefault() -> T::AccountId { - TREASURY_ADDR.into() - } + pub type KtonStakingContract = StorageValue<_, T::AccountId>; /// Migration start point. #[pallet::storage] @@ -759,7 +753,7 @@ pub mod pallet { /// Distribute the session reward to staking pot and update the stakers' reward record. pub fn distribute_session_reward(amount: Balance) { - let who = TREASURY_ADDR.into(); + let who = T::Treasury::get(); if T::IssuingManager::reward(&who, amount).is_ok() { Self::deposit_event(Event::Payout { who, amount }); @@ -1149,7 +1143,7 @@ where } fn reward(who: &AccountId, amount: Balance) -> DispatchResult { - let treasury = TREASURY_ADDR.into(); + let treasury = T::Treasury::get(); if who == &treasury { Ok(()) @@ -1222,7 +1216,12 @@ where T: Config + darwinia_ethtx_forwarder::Config, { fn elect(n: u32) -> Option> { - let rsc = >::get().into(); + let Some(rsc) = >::get() else { + log::error!("RING staking contract must be some; qed"); + + return None; + }; + let rsc = rsc.into(); #[allow(deprecated)] let function = Function { name: "getTopCollators".to_owned(), @@ -1245,7 +1244,7 @@ where .ok()?; >::forward_call( - TREASURY_ADDR.into(), + T::Treasury::get().into(), rsc, input, Default::default(), @@ -1286,10 +1285,16 @@ where return; }; + let Some(rsc) = >::get() else { + log::error!("RING staking contract must be some; qed"); + + return; + }; + let rsc = rsc.into(); #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR.into(), + T::Treasury::get().into(), Function { name: "distributeReward".into(), inputs: vec![Param { @@ -1302,10 +1307,10 @@ where state_mutability: StateMutability::Payable, }, &[Token::Address(who.into())], - >::get().into(), + rsc, amount.into(), 1_000_000.into(), - ) + ); } } @@ -1319,9 +1324,16 @@ where T: Config + darwinia_ethtx_forwarder::Config, { fn distribute(_: Option, amount: Balance) { + let Some(ksc) = >::get() else { + log::error!("KTON staking contract must be some; qed"); + + return; + }; + let ksc = ksc.into(); + #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR.into(), + T::Treasury::get().into(), Function { name: "distributeRewards".into(), inputs: Vec::new(), @@ -1334,10 +1346,10 @@ where state_mutability: StateMutability::Payable, }, &[], - >::get().into(), + ksc, amount.into(), 1_000_000.into(), - ) + ); } } diff --git a/pallet/staking/src/migration.rs b/pallet/staking/src/migration.rs index ba26a1fd1..acefb4748 100644 --- a/pallet/staking/src/migration.rs +++ b/pallet/staking/src/migration.rs @@ -13,6 +13,7 @@ pub fn migrate_staking_reward_distribution_contract(kton_staking_contract: T: where T: Config + darwinia_ethtx_forwarder::Config, { + let treasury = T::Treasury::get().into(); let ksc = kton_staking_contract.into(); // 0x000000000Ae5DB7BDAf8D071e680452e33d91Dd5. let ksc_old = H160([ @@ -21,7 +22,7 @@ where #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR.into(), + treasury, Function { name: "nominateNewOwner".into(), inputs: vec![Param { @@ -40,7 +41,7 @@ where ); #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - TREASURY_ADDR.into(), + treasury, Function { name: "acceptOwnershipFromOldDistribution".into(), inputs: Vec::new(), From 7ffe94b18460d0fe4aa6834647e749c6f86cf79e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 2 Aug 2024 14:18:03 +0800 Subject: [PATCH 10/20] Deposit migration --- Cargo.lock | 5 +- pallet/account-migration/Cargo.toml | 12 - pallet/account-migration/src/benchmarking.rs | 32 -- pallet/account-migration/src/lib.rs | 27 +- pallet/account-migration/src/mock.rs | 59 --- pallet/deposit/src/lib.rs | 55 ++- pallet/deposit/src/mock.rs | 2 + pallet/deposit/src/weights.rs | 7 + pallet/ethtx-forwarder/Cargo.toml | 12 + pallet/staking/Cargo.toml | 14 +- pallet/staking/src/benchmarking.rs | 20 +- pallet/staking/src/lib.rs | 108 ++--- pallet/staking/src/migration.rs | 3 +- pallet/staking/src/mock.rs | 106 +++-- pallet/staking/src/tests.rs | 420 ++++++++---------- precompile/deposit/src/mock.rs | 2 + precompile/staking/src/mock.rs | 10 +- runtime/common/src/test.rs | 54 --- runtime/crab/src/pallets/deposit.rs | 2 + runtime/crab/src/pallets/staking.rs | 1 + runtime/crab/src/weights/darwinia_deposit.rs | 6 + runtime/darwinia/src/pallets/deposit.rs | 2 + runtime/darwinia/src/pallets/staking.rs | 1 + .../darwinia/src/weights/darwinia_deposit.rs | 6 + runtime/koi/src/pallets/deposit.rs | 2 + runtime/koi/src/pallets/staking.rs | 1 + runtime/koi/src/weights/darwinia_deposit.rs | 6 + 27 files changed, 431 insertions(+), 544 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b20d4708e..80819f40c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2709,8 +2709,6 @@ name = "darwinia-account-migration" version = "6.6.3" dependencies = [ "array-bytes 6.2.3", - "darwinia-deposit", - "darwinia-staking", "dc-primitives", "frame-benchmarking", "frame-support", @@ -3014,7 +3012,7 @@ dependencies = [ "darwinia-ethtx-forwarder", "darwinia-staking-traits", "dc-inflation", - "dc-primitives", + "dc-types", "ethabi", "fp-evm", "frame-benchmarking", @@ -3029,6 +3027,7 @@ dependencies = [ "parity-scale-codec", "pretty_env_logger", "scale-info", + "serde", "sp-core", "sp-io", "sp-runtime", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 9b4273974..cb8ab345c 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -13,8 +13,6 @@ codec = { workspace = true, package = "parity-scale-codec" } scale-info = { workspace = true } # darwinia -darwinia-deposit = { workspace = true } -darwinia-staking = { workspace = true } dc-primitives = { workspace = true } # polkadot-sdk @@ -42,8 +40,6 @@ std = [ "scale-info/std", # darwinia - "darwinia-deposit/std", - "darwinia-staking/std", "dc-primitives/std", # polkadot-sdk @@ -60,10 +56,6 @@ std = [ ] runtime-benchmarks = [ - # darwinia - "darwinia-deposit/runtime-benchmarks", - "darwinia-staking/runtime-benchmarks", - # polkadot-sdk "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", @@ -74,10 +66,6 @@ runtime-benchmarks = [ ] try-runtime = [ - # darwinia - "darwinia-deposit/try-runtime", - "darwinia-staking/try-runtime", - # polkadot-sdk "frame-support/try-runtime", "frame-system/try-runtime", diff --git a/pallet/account-migration/src/benchmarking.rs b/pallet/account-migration/src/benchmarking.rs index 6dce09416..52b5abe57 100644 --- a/pallet/account-migration/src/benchmarking.rs +++ b/pallet/account-migration/src/benchmarking.rs @@ -69,38 +69,6 @@ mod benchmarks { extra: Default::default(), }, ); - >::insert( - from, - vec![ - Deposit { - id: Default::default(), - value: 1, - start_time: Default::default(), - expired_time: Default::default(), - in_use: Default::default(), - }; - ::MaxDeposits::get() as usize - ], - ); - >::insert( - from, - OldLedger { - staked_ring: 1, - staked_deposits: BoundedVec::truncate_from(vec![ - Default::default(); - ::MaxDeposits::get() - as usize - ]), - unstaking_ring: BoundedVec::truncate_from(vec![ - ( - Default::default(), - Default::default() - ); - 16 - ]), - ..Default::default() - }, - ); } #[benchmark] diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 078c9f2ac..280fe8896 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -55,16 +55,9 @@ mod weights; pub use weights::WeightInfo; // darwinia -use darwinia_deposit::{Deposit, DepositId}; -use darwinia_staking::Ledger; -use dc_primitives::{AccountId as AccountId20, AssetId, Balance, BlockNumber, Nonce}; +use dc_primitives::{AccountId as AccountId20, AssetId, Balance, Nonce}; // polkadot-sdk -use frame_support::{ - migration, - pallet_prelude::*, - traits::{Currency, ExistenceRequirement::AllowDeath}, - StorageHasher, -}; +use frame_support::{migration, pallet_prelude::*, StorageHasher}; use frame_system::{pallet_prelude::*, AccountInfo}; use pallet_balances::AccountData; use sp_core::{ @@ -107,11 +100,6 @@ pub mod pallet { Lookup = IdentityLookup, > + 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>; @@ -482,17 +470,6 @@ pub struct MultisigMigrationDetail { threshold: u16, } -#[allow(missing_docs)] -#[derive(Default, PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] -pub struct OldLedger { - pub staked_ring: Balance, - pub staked_kton: Balance, - pub staked_deposits: BoundedVec>, - pub unstaking_ring: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, - pub unstaking_kton: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, - pub unstaking_deposits: BoundedVec<(DepositId, BlockNumber), ConstU32<512>>, -} - /// Build a Darwinia account migration message. pub fn signable_message(spec_name: &[u8], account_id_20: &AccountId20) -> Vec { [ diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index 390068a38..dfdb060de 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -24,31 +24,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"), @@ -117,38 +92,6 @@ impl pallet_assets::Config for Runtime { type WeightInfo = (); } -frame_support::parameter_types! { - pub UnvestedFundsAllowedWithdrawReasons: frame_support::traits::WithdrawReasons = - frame_support::traits::WithdrawReasons::except( - frame_support::traits::WithdrawReasons::TRANSFER | frame_support::traits::WithdrawReasons::RESERVE - ); -} - -impl darwinia_deposit::Config for Runtime { - type Kton = Dummy; - type MaxDeposits = (); - type MinLockingAmount = (); - type Ring = Balances; - type RuntimeEvent = RuntimeEvent; - 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 UnixTime = Timestamp; - type WeightInfo = (); -} -#[cfg(not(feature = "runtime-benchmarks"))] -impl darwinia_staking::DepositConfig for Runtime {} - impl darwinia_account_migration::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = (); @@ -160,8 +103,6 @@ frame_support::construct_runtime! { Timestamp: pallet_timestamp, Balances: pallet_balances, Assets: pallet_assets, - Deposit: darwinia_deposit, - Staking: darwinia_staking, AccountMigration: darwinia_account_migration, } } diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 0a9b240a7..78fb12a2e 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -78,6 +78,9 @@ pub mod pallet { /// KTON asset. type Kton: SimpleAsset; + /// Deposit contract migrator. + type DepositMigrator: MigrateToContract; + /// Treasury account. #[pallet::constant] type Treasury: Get; @@ -313,7 +316,7 @@ pub mod pallet { for c in ds.chunks(50) { let mut to_claim = (0, Vec::new()); - let mut to_migrate = (0, Vec::new()); + let mut to_migrate = (0, Vec::new(), Vec::new()); for d in c { if d.in_use { @@ -326,11 +329,13 @@ pub mod pallet { } else { to_migrate.0 += d.value; to_migrate.1.push(d.id); + to_migrate.2.push((d.value, d.start_time, d.expired_time)); } } 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.2); Self::deposit_event(Event::DepositsClaimed { owner: who.clone(), @@ -344,6 +349,20 @@ pub mod pallet { Ok(()) } + + /// Set deposit contract address. + #[pallet::call_index(4)] + #[pallet::weight(::WeightInfo::set_deposit_contract())] + pub fn set_deposit_contract( + origin: OriginFor, + deposit_contract: T::AccountId, + ) -> DispatchResult { + ensure_root(origin)?; + + >::put(deposit_contract); + + Ok(()) + } } impl Pallet where @@ -434,11 +453,14 @@ pub trait SimpleAsset { } /// Migrate to contract trait. -pub trait MigrateToContract { +pub trait MigrateToContract +where + T: Config, +{ /// Migrate to contract. - fn migrate() {} + fn migrate(_: T::AccountId, _: Vec<(Balance, Moment, Moment)>) {} } -impl MigrateToContract for () {} +impl MigrateToContract for () where T: Config {} /// Deposit. #[derive(Clone, PartialEq, Eq, Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebug)] @@ -457,23 +479,22 @@ pub struct Deposit { /// Deposit migrator. pub struct DepositMigrator(PhantomData); -impl MigrateToContract for DepositMigrator +impl MigrateToContract for DepositMigrator where T: Config + darwinia_ethtx_forwarder::Config, T::AccountId: Into, { - fn migrate() { + fn migrate(who: T::AccountId, deposits: Vec<(Balance, Moment, Moment)>) { let Some(dc) = >::get() else { log::error!("deposit contract must be some; qed"); return; }; let dc = dc.into(); - let treasury = T::Treasury::get().into(); #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - treasury, + T::Treasury::get().into(), Function { name: "migrate".into(), inputs: vec![ @@ -485,7 +506,7 @@ where Param { name: "deposits".to_owned(), kind: ParamType::Array(Box::new(ParamType::Tuple(vec![ - ParamType::Uint(256), + ParamType::Uint(128), ParamType::Uint(64), ParamType::Uint(64), ]))), @@ -496,7 +517,21 @@ where constant: None, state_mutability: StateMutability::Payable, }, - &[Token::Address(treasury), Token::Array(vec![])], + &[ + Token::Address(who.into()), + Token::Array( + deposits + .into_iter() + .map(|(v, s, e)| { + Token::Tuple(vec![ + Token::Uint(v.into()), + Token::Uint(s.into()), + Token::Uint(e.into()), + ]) + }) + .collect(), + ), + ], dc, 0.into(), 1_000_000.into(), diff --git a/pallet/deposit/src/mock.rs b/pallet/deposit/src/mock.rs index ec06bcf71..6f3d0cd2e 100644 --- a/pallet/deposit/src/mock.rs +++ b/pallet/deposit/src/mock.rs @@ -87,11 +87,13 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { } } impl darwinia_deposit::Config for Runtime { + type DepositMigrator = (); type Kton = KtonMinting; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; + type Treasury = (); type WeightInfo = (); } diff --git a/pallet/deposit/src/weights.rs b/pallet/deposit/src/weights.rs index 6f8da992f..9654858f9 100644 --- a/pallet/deposit/src/weights.rs +++ b/pallet/deposit/src/weights.rs @@ -56,6 +56,7 @@ pub trait WeightInfo { fn claim() -> Weight; fn claim_with_penalty() -> Weight; fn migrate() -> Weight; + fn set_deposit_contract() -> Weight; } /// Weights for darwinia_deposit using the Substrate node and recommended hardware. @@ -118,6 +119,9 @@ impl WeightInfo for SubstrateWeight { fn migrate() -> Weight { 0.into() } + fn set_deposit_contract() -> Weight { + 0.into() + } } // For backwards compatibility and tests @@ -179,4 +183,7 @@ impl WeightInfo for () { fn migrate() -> Weight { 0.into() } + fn set_deposit_contract() -> Weight { + 0.into() + } } diff --git a/pallet/ethtx-forwarder/Cargo.toml b/pallet/ethtx-forwarder/Cargo.toml index 4542f9096..45b7b4b8c 100644 --- a/pallet/ethtx-forwarder/Cargo.toml +++ b/pallet/ethtx-forwarder/Cargo.toml @@ -74,6 +74,18 @@ std = [ "sp-std/std", ] +runtime-benchmarks = [ + # frontier + "pallet-evm/runtime-benchmarks", + + # moonbeam + "xcm-primitives?/runtime-benchmarks", + + # polkadot-sdk + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] + evm-tracing = [ # moonbeam "moonbeam-evm-tracer", diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 84bf24c3c..b22f41898 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -17,7 +17,7 @@ scale-info = { workspace = true } darwinia-ethtx-forwarder = { workspace = true } darwinia-staking-traits = { workspace = true } dc-inflation = { workspace = true } -dc-primitives = { workspace = true } +dc-types = { workspace = true } # darwinia optional darwinia-deposit = { workspace = true, optional = true } @@ -38,16 +38,17 @@ frame-benchmarking = { workspace = true, optional = true } [dev-dependencies] # crates.io 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"] } -pallet-timestamp = { workspace = true, features = ["std"] } -pallet-treasury = { workspace = true, features = ["std"] } -sp-io = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +pallet-session = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +pallet-treasury = { workspace = true, features = ["std"] } +sp-io = { workspace = true, features = ["std"] } [features] default = ["std"] @@ -62,7 +63,6 @@ std = [ "darwinia-ethtx-forwarder/std", "darwinia-staking-traits/std", "dc-inflation/std", - "dc-primitives/std", # darwinia optional "darwinia-deposit?/std", diff --git a/pallet/staking/src/benchmarking.rs b/pallet/staking/src/benchmarking.rs index 7c11d2aaf..5cf257aec 100644 --- a/pallet/staking/src/benchmarking.rs +++ b/pallet/staking/src/benchmarking.rs @@ -19,7 +19,7 @@ // darwinia use crate::*; use darwinia_deposit::SimpleAsset; -use dc_primitives::UNIT; +use dc_types::UNIT; // polkadot-sdk use frame_benchmarking::v2; use frame_system::RawOrigin; @@ -77,7 +77,7 @@ mod benchmarks { let deposits = deposit_for::(&a, x); - >::stake(RawOrigin::Signed(a).into(), UNIT, deposits.clone()).unwrap(); + >::stake(RawOrigin::Signed(a.clone()).into(), UNIT, deposits.clone()).unwrap(); // Worst-case scenario: // @@ -100,13 +100,13 @@ mod benchmarks { #[benchmark] fn nominate() { let a = frame_benchmarking::whitelisted_caller::(); - let a_cloned = a; + 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).into(), UNIT, Default::default()).unwrap(); - >::collect(RawOrigin::Signed(a).into(), Default::default()).unwrap(); + >::stake(RawOrigin::Signed(a.clone()).into(), UNIT, Default::default()).unwrap(); + >::collect(RawOrigin::Signed(a.clone()).into(), Default::default()).unwrap(); // Worst-case scenario: // @@ -122,9 +122,9 @@ mod benchmarks { // Remove `+ 1` after https://github.com/paritytech/substrate/pull/13655. ::Ring::make_free_balance_be(&a, UNIT + 1); - >::stake(RawOrigin::Signed(a).into(), UNIT, Default::default()).unwrap(); - >::collect(RawOrigin::Signed(a).into(), Default::default()).unwrap(); - >::nominate(RawOrigin::Signed(a).into(), a).unwrap(); + >::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: // @@ -136,7 +136,7 @@ mod benchmarks { #[benchmark] fn payout() { let a = frame_benchmarking::whitelisted_caller::(); - let sender = a; + let a_cloned = a.clone(); call_on_exposure!(>::insert( &a, @@ -155,7 +155,7 @@ mod benchmarks { >::insert(&a, 500); #[extrinsic_call] - _(RawOrigin::Signed(sender), a); + _(RawOrigin::Signed(a), a_cloned); } #[benchmark] diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 17c458537..457b169ec 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -51,7 +51,7 @@ pub use darwinia_staking_traits::*; use codec::FullCodec; use ethabi::{Function, Param, ParamType, StateMutability, Token}; // darwinia -use dc_primitives::{AccountId, Balance, Moment, UNIT}; +use dc_types::{Balance, Moment, UNIT}; // polkadot-sdk use frame_support::{ pallet_prelude::*, @@ -60,7 +60,7 @@ use frame_support::{ }; use frame_system::{pallet_prelude::*, RawOrigin}; use pallet_session::ShouldEndSession as _; -use sp_core::U256; +use sp_core::{H160, U256}; use sp_runtime::{ traits::{AccountIdConversion, Convert, One, Zero}, Perbill, @@ -131,7 +131,7 @@ pub mod pallet { pub trait DepositConfig {} #[pallet::config] - pub trait Config: frame_system::Config + DepositConfig { + pub trait Config: frame_system::Config + DepositConfig { /// Override the [`frame_system::Config::RuntimeEvent`]. type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -157,10 +157,10 @@ pub mod pallet { type Deposit: StakeExt; /// RING staking interface. - type RingStaking: Election + Reward; + type RingStaking: Election + Reward; /// KTON staking interface. - type KtonStaking: Reward; + type KtonStaking: Reward; /// Treasury address. type Treasury: Get; @@ -376,19 +376,19 @@ pub mod pallet { #[pallet::storage] #[pallet::unbounded] #[pallet::getter(fn collators_cache_0)] - pub type CollatorsCache0 = StorageValue<_, Vec, ValueQuery>; + 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>; + 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>; + pub type CollatorsCache2 = StorageValue<_, Vec, ValueQuery>; #[derive(DefaultNoBound)] #[pallet::genesis_config] @@ -626,6 +626,25 @@ pub mod pallet { Ok(()) } + /// Set the collator count. + /// + /// This will apply to the incoming session. + /// + /// Require root origin. + #[pallet::call_index(7)] + #[pallet::weight(::WeightInfo::set_collator_count())] + pub fn set_collator_count(origin: OriginFor, count: u32) -> DispatchResult { + ensure_root(origin)?; + + if count == 0 { + return Err(>::ZeroCollatorCount)?; + } + + >::put(count); + + Ok(()) + } + /// Set the max unstake RING limit. #[pallet::call_index(9)] #[pallet::weight(::WeightInfo::set_rate_limit())] @@ -664,25 +683,6 @@ pub mod pallet { Ok(()) } - - /// Set the collator count. - /// - /// This will apply to the incoming session. - /// - /// Require root origin. - #[pallet::call_index(7)] - #[pallet::weight(::WeightInfo::set_collator_count())] - pub fn set_collator_count(origin: OriginFor, count: u32) -> DispatchResult { - ensure_root(origin)?; - - if count == 0 { - return Err(>::ZeroCollatorCount)?; - } - - >::put(count); - - Ok(()) - } } impl Pallet where @@ -753,7 +753,7 @@ pub mod pallet { /// Distribute the session reward to staking pot and update the stakers' reward record. pub fn distribute_session_reward(amount: Balance) { - let who = T::Treasury::get(); + let who = ::Treasury::get(); if T::IssuingManager::reward(&who, amount).is_ok() { Self::deposit_event(Event::Payout { who, amount }); @@ -946,10 +946,7 @@ pub mod pallet { } fn elect_from_contract(n: u32) -> Option> { - const ZERO: [u8; 20] = [0; 20]; - - let winners = - T::RingStaking::elect(n)?.into_iter().filter(|w| w.0 != ZERO).collect::>(); + let winners = T::RingStaking::elect(n)?; call_on_cache!(>::put(winners.clone())).ok()?; @@ -1012,20 +1009,20 @@ where impl IssuingManager for () where T: Config {} /// Election interface. -pub trait Election { +pub trait Election { /// Elect the new collators. fn elect(_: u32) -> Option> { None } } -impl Election for () {} +impl Election for () {} /// Distribute the reward to a contract. -pub trait Reward { +pub trait Reward { /// Distribute the reward. fn distribute(_: Option, _: Balance) {} } -impl Reward for () {} +impl Reward for () {} /// Staking rate limiter. #[derive(Clone, Debug, PartialEq, Encode, Decode, MaxEncodedLen, TypeInfo)] @@ -1125,7 +1122,7 @@ where PAYOUT_FRAC * issued } - fn reward(who: &AccountId, amount: Balance) -> DispatchResult { + fn reward(who: &T::AccountId, amount: Balance) -> DispatchResult { let _ = T::Currency::deposit_creating(who, amount); Ok(()) @@ -1142,8 +1139,8 @@ where 20_000 * UNIT } - fn reward(who: &AccountId, amount: Balance) -> DispatchResult { - let treasury = T::Treasury::get(); + fn reward(who: &T::AccountId, amount: Balance) -> DispatchResult { + let treasury = ::Treasury::get(); if who == &treasury { Ok(()) @@ -1211,11 +1208,14 @@ pub struct IndividualExposure { /// RING staking interface. pub struct RingStaking(PhantomData); -impl Election for RingStaking +impl Election for RingStaking where T: Config + darwinia_ethtx_forwarder::Config, + T::AccountId: From + Into, { - fn elect(n: u32) -> Option> { + fn elect(n: u32) -> Option> { + const ZERO: [u8; 20] = [0; 20]; + let Some(rsc) = >::get() else { log::error!("RING staking contract must be some; qed"); @@ -1244,7 +1244,7 @@ where .ok()?; >::forward_call( - T::Treasury::get().into(), + ::Treasury::get().into(), rsc, input, Default::default(), @@ -1260,12 +1260,10 @@ where .map(|tokens| { tokens .into_iter() - .filter_map(|token| { - if let Token::Address(addr) = token { - Some(AccountId::from(addr)) - } else { - None - } + .filter_map(|token| match token { + Token::Address(addr) if addr.0 != ZERO => + Some(T::AccountId::from(addr)), + _ => None, }) .collect() }) @@ -1275,11 +1273,12 @@ where // Distribute the reward to RING staking contract. // // https://github.com/darwinia-network/DIP-7/blob/7fa307136586f06c6911ce98d16c88689d91ba8c/src/collator/CollatorStakingHub.sol#L142. -impl Reward for RingStaking +impl Reward for RingStaking where T: Config + darwinia_ethtx_forwarder::Config, + T::AccountId: Into, { - fn distribute(who: Option, amount: Balance) { + fn distribute(who: Option, amount: Balance) { let Some(who) = who else { log::error!("who must be some; qed"); @@ -1294,7 +1293,7 @@ where #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - T::Treasury::get().into(), + ::Treasury::get().into(), Function { name: "distributeReward".into(), inputs: vec![Param { @@ -1319,11 +1318,12 @@ pub struct KtonStaking(PhantomData); // Distribute the reward to KTON staking contract. // // https://github.com/darwinia-network/KtonDAO/blob/2de20674f2ef90b749ade746d0768c7bda356402/src/staking/KtonDAOVault.sol#L40. -impl Reward for KtonStaking +impl Reward for KtonStaking where T: Config + darwinia_ethtx_forwarder::Config, + T::AccountId: Into, { - fn distribute(_: Option, amount: Balance) { + fn distribute(_: Option, amount: Balance) { let Some(ksc) = >::get() else { log::error!("KTON staking contract must be some; qed"); @@ -1333,7 +1333,7 @@ where #[allow(deprecated)] darwinia_ethtx_forwarder::quick_forward_transact::( - T::Treasury::get().into(), + ::Treasury::get().into(), Function { name: "distributeRewards".into(), inputs: Vec::new(), diff --git a/pallet/staking/src/migration.rs b/pallet/staking/src/migration.rs index acefb4748..9228bf1bc 100644 --- a/pallet/staking/src/migration.rs +++ b/pallet/staking/src/migration.rs @@ -12,8 +12,9 @@ use sp_core::H160; pub fn migrate_staking_reward_distribution_contract(kton_staking_contract: T::AccountId) where T: Config + darwinia_ethtx_forwarder::Config, + T::AccountId: Into, { - let treasury = T::Treasury::get().into(); + let treasury = ::Treasury::get().into(); let ksc = kton_staking_contract.into(); // 0x000000000Ae5DB7BDAf8D071e680452e33d91Dd5. let ksc_old = H160([ diff --git a/pallet/staking/src/mock.rs b/pallet/staking/src/mock.rs index aad6f95d2..7e767a55c 100644 --- a/pallet/staking/src/mock.rs +++ b/pallet/staking/src/mock.rs @@ -16,6 +16,12 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . +// core +use core::fmt::{Display, Formatter, Result as FmtResult}; +// crates.io +use codec::MaxEncodedLen; +use scale_info::TypeInfo; +use serde::{Deserialize, Serialize}; // darwinia use crate::*; // polkadot-sdk @@ -26,6 +32,37 @@ use sp_runtime::{BuildStorage, RuntimeAppPublic}; pub type BlockNumber = frame_system::pallet_prelude::BlockNumberFor; +#[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Serialize, + Deserialize, + Encode, + Decode, + MaxEncodedLen, + TypeInfo, +)] +pub struct AccountId(pub u64); +impl From for AccountId { + fn from(value: H160) -> Self { + Self(H160::to_low_u64_le(&value)) + } +} +impl Into for AccountId { + fn into(self) -> H160 { + H160::from_low_u64_le(self.0) + } +} +impl Display for AccountId { + fn fmt(&self, f: &mut Formatter) -> FmtResult { + write!(f, "{}", self.0) + } +} #[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)] impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; @@ -60,11 +97,13 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { } } impl darwinia_deposit::Config for Runtime { + type DepositMigrator = (); type Kton = KtonMinting; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; + type Treasury = TreasuryAcct; type WeightInfo = (); } @@ -119,7 +158,7 @@ impl pallet_session::Config for Runtime { frame_support::parameter_types! { pub const TreasuryPalletId: frame_support::PalletId = frame_support::PalletId(*b"da/trsry"); - pub TreasuryAccount: AccountId = Treasury::account_id(); + pub TreasuryAcct: AccountId = Treasury::account_id(); } #[cfg(feature = "runtime-benchmarks")] pub struct DummyBenchmarkHelper; @@ -133,7 +172,7 @@ where } fn create_beneficiary(_: [u8; 32]) -> AccountId { - Default::default() + AccountId(0) } } impl pallet_treasury::Config for Runtime { @@ -150,7 +189,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 = (); @@ -215,17 +254,17 @@ impl crate::Stake for RingStaking { ) } } -impl crate::Election for RingStaking { +impl crate::Election for RingStaking { fn elect(n: u32) -> Option> { Some( (100..=(100 + n) as u64) - .map(|x| { - let who = account_id_of(x); - let _ = >::deposit_creating(&who, x as _); + .map(|i| { + let who = AccountId(i); + let _ = >::deposit_creating(&who, i as _); assert_ok!(Session::set_keys( RuntimeOrigin::signed(who), - SessionKeys { uint: x.into() }, + SessionKeys { uint: i.into() }, Vec::new() )); @@ -235,22 +274,19 @@ impl crate::Election for RingStaking { ) } } -impl crate::Reward for RingStaking { +impl crate::Reward for RingStaking { fn distribute(who: Option, amount: Balance) { let Some(who) = who else { return }; - let _ = Balances::transfer_keep_alive( - RuntimeOrigin::signed(Treasury::account_id()), - who, - amount, - ); + let _ = + Balances::transfer_keep_alive(RuntimeOrigin::signed(TreasuryAcct::get()), who, amount); } } pub enum KtonStaking {} -impl crate::Reward for KtonStaking { +impl crate::Reward for KtonStaking { fn distribute(_: Option, amount: Balance) { let _ = Balances::transfer_keep_alive( - RuntimeOrigin::signed(Treasury::account_id()), - >::get(), + RuntimeOrigin::signed(TreasuryAcct::get()), + >::get().unwrap(), amount, ); } @@ -265,6 +301,7 @@ impl crate::Config for Runtime { type RingStaking = RingStaking; type RuntimeEvent = RuntimeEvent; type ShouldEndSession = crate::ShouldEndSession; + type Treasury = TreasuryAcct; type UnixTime = Timestamp; type WeightInfo = (); } @@ -323,14 +360,14 @@ impl ExtBuilder { } 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(|x| (account_id_of(x), 1_000 * UNIT)) - .chain([(Treasury::account_id(), 1_000_000_000 * UNIT)]) + .map(|i| (AccountId(i), 1_000 * UNIT)) + .chain([(TreasuryAcct::get(), 1_000_000 * UNIT)]) .collect(), } .assimilate_storage(&mut storage) @@ -339,7 +376,7 @@ impl ExtBuilder { rate_limit: 100 * UNIT, collator_count: self.collator_count, collators: if self.genesis_collator { - (1..=self.collator_count as u64).map(|x| (account_id_of(x), x as _)).collect() + (1..=self.collator_count as u64).map(|i| (AccountId(i), i as _)).collect() } else { Default::default() }, @@ -350,7 +387,7 @@ impl ExtBuilder { if self.genesis_collator { pallet_session::GenesisConfig:: { keys: (1..=self.collator_count as u64) - .map(|x| (account_id_of(x), account_id_of(x), SessionKeys { uint: x.into() })) + .map(|i| (AccountId(i), AccountId(i), SessionKeys { uint: i.into() })) .collect(), } .assimilate_storage(&mut storage) @@ -359,7 +396,12 @@ impl ExtBuilder { let mut ext = TestExternalities::from(storage); - ext.execute_with(|| new_session()); + ext.execute_with(|| { + >::put(AccountId(718)); + >::put(AccountId(719)); + + new_session(); + }); ext } @@ -370,25 +412,17 @@ impl Default for ExtBuilder { } } -pub fn account_id_of(x: u64) -> AccountId { - H160::from_low_u64_le(x).into() -} - -pub fn u64_of(account_id: AccountId) -> u64 { - H160::to_low_u64_le(&account_id.into()) -} - pub fn preset_collators(n: u64) { - (10..(10 + n)).for_each(|x| { - let who = account_id_of(x); - let _ = >::deposit_creating(&who, x as _); + (10..(10 + n)).for_each(|i| { + let who = AccountId(i); + let _ = >::deposit_creating(&who, i as _); assert_ok!(Session::set_keys( RuntimeOrigin::signed(who), - SessionKeys { uint: x.into() }, + SessionKeys { uint: i.into() }, Vec::new() )); - assert_ok!(Staking::stake(RuntimeOrigin::signed(who), x as _, 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)); }); diff --git a/pallet/staking/src/tests.rs b/pallet/staking/src/tests.rs index 8b72b4ac2..ac7d4358a 100644 --- a/pallet/staking/src/tests.rs +++ b/pallet/staking/src/tests.rs @@ -41,20 +41,20 @@ fn exposure_cache_states_should_work() { nominators: Default::default(), }; - >::insert(account_id_of(0), e.clone()); - >::insert(account_id_of(1), e.clone()); - >::insert(account_id_of(2), e); + >::insert(AccountId(0), e.clone()); + >::insert(AccountId(1), e.clone()); + >::insert(AccountId(2), e); } - assert!(call_on_exposure!(>::get(account_id_of(0)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_some()).unwrap()); assert_eq!( >::get(), (CacheState::Previous, CacheState::Current, CacheState::Next) @@ -62,15 +62,15 @@ fn exposure_cache_states_should_work() { Staking::shift_cache_states(); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); assert_eq!( >::get(), (CacheState::Next, CacheState::Previous, CacheState::Current) @@ -78,15 +78,15 @@ fn exposure_cache_states_should_work() { Staking::shift_cache_states(); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); assert_eq!( >::get(), (CacheState::Current, CacheState::Next, CacheState::Previous) @@ -94,15 +94,15 @@ fn exposure_cache_states_should_work() { Staking::shift_cache_states(); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_some()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(0)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(1)).is_none()).unwrap()); - assert!(call_on_exposure!(>::get(account_id_of(2)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_some()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(0)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(1)).is_none()).unwrap()); + assert!(call_on_exposure!(>::get(AccountId(2)).is_some()).unwrap()); assert_eq!( >::get(), (CacheState::Previous, CacheState::Current, CacheState::Next) @@ -113,45 +113,45 @@ fn exposure_cache_states_should_work() { #[test] fn stake_should_work() { ExtBuilder::default().build().execute_with(|| { - assert_eq!(System::account(account_id_of(1)).consumers, 0); - assert!(Staking::ledger_of(account_id_of(1)).is_none()); - assert_eq!(Balances::free_balance(account_id_of(1)), 1_000 * UNIT); + 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(account_id_of(1)), UNIT, Vec::new())); - assert_eq!(System::account(account_id_of(1)).consumers, 1); + assert_ok!(Staking::stake(RuntimeOrigin::signed(AccountId(1)), UNIT, Vec::new())); + assert_eq!(System::account(AccountId(1)).consumers, 1); assert_eq!( - Staking::ledger_of(account_id_of(1)).unwrap(), + Staking::ledger_of(AccountId(1)).unwrap(), Ledger { ring: UNIT, deposits: Default::default() } ); - assert_eq!(Balances::free_balance(account_id_of(1)), 999 * UNIT); + 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(account_id_of(1)), 0, vec![0]), + Staking::stake(RuntimeOrigin::signed(AccountId(1)), 0, vec![0]), >::DepositNotFound ); // Stake 1 deposit. - assert_eq!(System::account(account_id_of(1)).consumers, 1); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(account_id_of(1)), UNIT, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(1)), 0, vec![0])); + 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(account_id_of(1)).unwrap(), + 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(account_id_of(1)).consumers, 2); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(account_id_of(1)), UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(account_id_of(1)), UNIT, 1)); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(1)), 2 * UNIT, vec![1, 2])); - assert_eq!(Balances::free_balance(account_id_of(1)), 994 * UNIT); + 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(account_id_of(1)).unwrap(), + Staking::ledger_of(AccountId(1)).unwrap(), Ledger { ring: 3 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } ); assert_eq!(Staking::rate_limit_state(), RateLimiter::Pos(6 * UNIT)); @@ -161,22 +161,18 @@ fn stake_should_work() { #[test] fn unstake_should_work() { ExtBuilder::default().build().execute_with(|| { - assert_ok!(Deposit::lock(RuntimeOrigin::signed(account_id_of(1)), UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(account_id_of(1)), UNIT, 1)); - assert_ok!(Deposit::lock(RuntimeOrigin::signed(account_id_of(1)), UNIT, 1)); - assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(1)), - 3 * UNIT, - vec![0, 1, 2] - )); - assert_eq!(Balances::free_balance(account_id_of(1)), 994 * UNIT); + 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(account_id_of(1)).unwrap(), + Staking::ledger_of(AccountId(1)).unwrap(), Ledger { ring: 3 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } ); assert_eq!( - Deposit::deposit_of(account_id_of(1)) + Deposit::deposit_of(AccountId(1)) .unwrap() .into_iter() .map(|d| d.in_use) @@ -185,30 +181,30 @@ fn unstake_should_work() { ); // Unstake 1 RING. - assert_ok!(Staking::unstake(RuntimeOrigin::signed(account_id_of(1)), UNIT, Vec::new())); + 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(account_id_of(1)), 995 * UNIT); + assert_eq!(Balances::free_balance(AccountId(1)), 995 * UNIT); assert_eq!( - Staking::ledger_of(account_id_of(1)).unwrap(), + Staking::ledger_of(AccountId(1)).unwrap(), Ledger { ring: 2 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 1, 2]) } ); // Unstake invalid deposit. assert_noop!( - Staking::unstake(RuntimeOrigin::signed(account_id_of(1)), 0, vec![3]), + Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 0, vec![3]), >::DepositNotFound ); // Unstake 1 deposit. Efflux::block(1); - assert_ok!(Staking::unstake(RuntimeOrigin::signed(account_id_of(1)), 0, vec![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(account_id_of(1)).unwrap(), + Staking::ledger_of(AccountId(1)).unwrap(), Ledger { ring: 2 * UNIT, deposits: BoundedVec::truncate_from(vec![0, 2]) } ); assert_eq!( - Deposit::deposit_of(account_id_of(1)) + Deposit::deposit_of(AccountId(1)) .unwrap() .into_iter() .map(|d| d.in_use) @@ -218,11 +214,11 @@ fn unstake_should_work() { // Unstake 2 RING and 2 deposits. Efflux::block(1); - assert_ok!(Staking::unstake(RuntimeOrigin::signed(account_id_of(1)), 2 * UNIT, vec![0, 2])); + 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(account_id_of(1)).is_none()); + assert!(Staking::ledger_of(AccountId(1)).is_none()); assert_eq!( - Deposit::deposit_of(account_id_of(1)) + Deposit::deposit_of(AccountId(1)) .unwrap() .into_iter() .map(|d| d.in_use) @@ -231,31 +227,27 @@ fn unstake_should_work() { ); // Prepare rate limit test data. - assert_ok!(Deposit::lock(RuntimeOrigin::signed(account_id_of(1)), 100 * UNIT + 1, 1)); + assert_ok!(Deposit::lock(RuntimeOrigin::signed(AccountId(1)), 100 * UNIT + 1, 1)); >::put(200 * UNIT + 2); - assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(1)), - 100 * UNIT + 1, - vec![3] - )); + 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(account_id_of(1)), 100 * UNIT + 1, Vec::new()), + Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 100 * UNIT + 1, Vec::new()), >::ExceedRateLimit ); // Unstake 100 UNIT + 1. assert_noop!( - Staking::unstake(RuntimeOrigin::signed(account_id_of(1)), 0, vec![3]), + Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 0, vec![3]), >::ExceedRateLimit ); // Unstake RING(100 UNIT + 1) and deposit(100 UNIT + 1). assert_noop!( - Staking::unstake(RuntimeOrigin::signed(account_id_of(1)), 100 * UNIT + 1, vec![3]), + Staking::unstake(RuntimeOrigin::signed(AccountId(1)), 100 * UNIT + 1, vec![3]), >::ExceedRateLimit ); }); @@ -264,14 +256,14 @@ fn unstake_should_work() { #[test] fn collect_should_work() { ExtBuilder::default().build().execute_with(|| { - assert!(Staking::collator_of(account_id_of(1)).is_none()); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(1)), UNIT, Vec::new())); + 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(account_id_of(1)), c)); - assert_eq!(Staking::collator_of(account_id_of(1)).unwrap(), c); + assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(1)), c)); + assert_eq!(Staking::collator_of(AccountId(1)).unwrap(), c); }); }); } @@ -279,17 +271,14 @@ fn collect_should_work() { #[test] fn nominate_should_work() { ExtBuilder::default().build().execute_with(|| { - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(1)), UNIT, Vec::new())); - assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(1)), Perbill::zero())); + 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(account_id_of(i)).is_none()); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(i)), UNIT, Vec::new())); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(1) - )); - assert_eq!(Staking::nominator_of(account_id_of(i)).unwrap(), account_id_of(1)); + 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)); }); }); } @@ -297,23 +286,20 @@ fn nominate_should_work() { #[test] fn chill_should_work() { ExtBuilder::default().build().execute_with(|| { - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(1)), UNIT, Vec::new())); - assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(1)), Perbill::zero())); + 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(account_id_of(i)), UNIT, Vec::new())); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(1) - )); + 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(account_id_of(1)).is_some()); - (2..=10).for_each(|i| assert!(Staking::nominator_of(account_id_of(i)).is_some())); + assert!(Staking::collator_of(AccountId(1)).is_some()); + (2..=10).for_each(|i| assert!(Staking::nominator_of(AccountId(i)).is_some())); (1..=10).for_each(|i| { - assert_ok!(Staking::chill(RuntimeOrigin::signed(account_id_of(i)))); + assert_ok!(Staking::chill(RuntimeOrigin::signed(AccountId(i)))); }); - assert!(Staking::collator_of(account_id_of(1)).is_none()); - (2..=10).for_each(|i| assert!(Staking::nominator_of(account_id_of(i)).is_none())); + assert!(Staking::collator_of(AccountId(1)).is_none()); + (2..=10).for_each(|i| assert!(Staking::nominator_of(AccountId(i)).is_none())); }); } @@ -321,7 +307,7 @@ fn chill_should_work() { fn set_collator_count_should_work() { ExtBuilder::default().build().execute_with(|| { assert_noop!( - Staking::set_collator_count(RuntimeOrigin::signed(account_id_of(1)), 1), + Staking::set_collator_count(RuntimeOrigin::signed(AccountId(1)), 1), DispatchError::BadOrigin ); assert_noop!( @@ -337,31 +323,25 @@ fn elect_should_work() { ExtBuilder::default().collator_count(3).build().execute_with(|| { (1..=5).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), i as Balance * UNIT, Vec::new() )); - assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(i)), Perbill::zero())); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i) - )); + assert_ok!(Staking::collect(RuntimeOrigin::signed(AccountId(i)), Perbill::zero())); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); }); (6..=10).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), i as Balance * UNIT, Vec::new() )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i - 5) - )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 5))); }); assert_eq!( Staking::elect(Staking::collator_count()).unwrap(), - vec![account_id_of(5), account_id_of(4), account_id_of(3)] + vec![AccountId(5), AccountId(4), AccountId(3)] ); }); } @@ -371,48 +351,42 @@ fn payout_should_work() { ExtBuilder::default().collator_count(5).build().execute_with(|| { (1..=5).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), i as Balance * UNIT, Vec::new() )); assert_ok!(Staking::collect( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), Perbill::from_percent(i as u32 * 10) )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i) - )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); }); (6..=10).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), (11 - i as Balance) * UNIT, Vec::new() )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i - 5) - )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 5))); }); new_session(); (1..=10).for_each(|i| { assert_eq!( - Balances::free_balance(account_id_of(i)), + 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()); + Balances::free_balance(>::get().unwrap()); Efflux::time(session_duration - >::get() as Moment); Staking::note_authors(&[ - account_id_of(1), - account_id_of(2), - account_id_of(3), - account_id_of(4), - account_id_of(5), + AccountId(1), + AccountId(2), + AccountId(3), + AccountId(4), + AccountId(5), ]); new_session(); new_session(); @@ -435,16 +409,15 @@ fn payout_should_work() { / 2; assert_eq_error_rate!(half_reward, rewards.iter().sum::(), UNIT); assert_eq_error_rate!( - // Multiplied by 2 because there are 2 sessions. - half_reward * 2, - Balances::free_balance(>::get()) + half_reward, + Balances::free_balance(>::get().unwrap()) - kton_staking_contract_balance, UNIT ); assert_eq!( rewards.as_slice(), (1..=10) - .map(|i| Balances::free_balance(account_id_of(i)) + .map(|i| Balances::free_balance(AccountId(i)) - (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT) .collect::>() ); @@ -453,35 +426,29 @@ fn payout_should_work() { ExtBuilder::default().inflation_type(1).collator_count(5).build().execute_with(|| { (1..=5).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), i as Balance * UNIT, Vec::new() )); assert_ok!(Staking::collect( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), Perbill::from_percent(i as u32 * 10) )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i) - )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); }); (6..=10).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), (11 - i as Balance) * UNIT, Vec::new() )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i - 5) - )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 5))); }); new_session(); new_session(); (1..=10).for_each(|i| { assert_eq!( - Balances::free_balance(account_id_of(i)), + Balances::free_balance(AccountId(i)), (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT ) }); @@ -490,11 +457,11 @@ fn payout_should_work() { let session_duration = Duration::new(12 * 600, 0).as_millis(); Efflux::time(session_duration - >::get() as Moment); Staking::note_authors(&[ - account_id_of(1), - account_id_of(2), - account_id_of(3), - account_id_of(4), - account_id_of(5), + AccountId(1), + AccountId(2), + AccountId(3), + AccountId(4), + AccountId(5), ]); new_session(); payout(); @@ -514,7 +481,7 @@ fn payout_should_work() { assert_eq!( rewards.as_slice(), (1..=10) - .map(|i| Balances::free_balance(account_id_of(i)) + .map(|i| Balances::free_balance(AccountId(i)) - (1_000 - if i < 6 { i } else { 11 - i }) as Balance * UNIT) .collect::>() ); @@ -523,10 +490,10 @@ fn payout_should_work() { assert_ok!(Balances::transfer_all( RuntimeOrigin::signed(Treasury::account_id()), - Default::default(), + AccountId(0), false )); - Staking::note_authors(&[account_id_of(1)]); + Staking::note_authors(&[AccountId(1)]); System::reset_events(); new_session(); payout(); @@ -541,9 +508,9 @@ fn payout_should_work() { .collect::>(), vec![ // Pay to collator failed. - Event::Unpaid { who: account_id_of(6), amount: 7499999997000000000000 }, + Event::Unpaid { who: AccountId(6), amount: 7499999997000000000000 }, // Pay to nominator failed. - Event::Unpaid { who: account_id_of(1), amount: 2499999994000000000000 } + Event::Unpaid { who: AccountId(1), amount: 2499999994000000000000 } ] ); }); @@ -554,39 +521,33 @@ fn auto_payout_should_work() { ExtBuilder::default().collator_count(2).build().execute_with(|| { (1..=2).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), i as Balance * UNIT, Vec::new() )); assert_ok!(Staking::collect( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), Perbill::from_percent(i as u32 * 10) )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i) - )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i))); }); (3..=4).for_each(|i| { assert_ok!(Staking::stake( - RuntimeOrigin::signed(account_id_of(i)), + RuntimeOrigin::signed(AccountId(i)), (5 - i as Balance) * UNIT, Vec::new() )); - assert_ok!(Staking::nominate( - RuntimeOrigin::signed(account_id_of(i)), - account_id_of(i - 2) - )); + assert_ok!(Staking::nominate(RuntimeOrigin::signed(AccountId(i)), AccountId(i - 2))); }); new_session(); new_session(); Efflux::time(>::get() as Moment); - Staking::note_authors(&[account_id_of(1), account_id_of(2)]); + Staking::note_authors(&[AccountId(1), AccountId(2)]); new_session(); (1..=4).for_each(|i| { assert_eq!( - Balances::free_balance(account_id_of(i)), + Balances::free_balance(AccountId(i)), (1_000 - if i < 3 { i } else { 5 - i }) as Balance * UNIT ) }); @@ -594,10 +555,10 @@ fn auto_payout_should_work() { Efflux::block(1); assert_eq!( [ - Balances::free_balance(account_id_of(1)), - Balances::free_balance(account_id_of(2)), - Balances::free_balance(account_id_of(3)), - Balances::free_balance(account_id_of(4)), + Balances::free_balance(AccountId(1)), + Balances::free_balance(AccountId(2)), + Balances::free_balance(AccountId(3)), + Balances::free_balance(AccountId(4)), ], [ 999000607164541135398, @@ -610,10 +571,10 @@ fn auto_payout_should_work() { Efflux::block(1); assert_eq!( [ - Balances::free_balance(account_id_of(1)), - Balances::free_balance(account_id_of(2)), - Balances::free_balance(account_id_of(3)), - Balances::free_balance(account_id_of(4)), + Balances::free_balance(AccountId(1)), + Balances::free_balance(AccountId(2)), + Balances::free_balance(AccountId(3)), + Balances::free_balance(AccountId(4)), ], [ 999000607164541135398, @@ -626,10 +587,10 @@ fn auto_payout_should_work() { Efflux::block(1); assert_eq!( [ - Balances::free_balance(account_id_of(1)), - Balances::free_balance(account_id_of(2)), - Balances::free_balance(account_id_of(3)), - Balances::free_balance(account_id_of(4)), + Balances::free_balance(AccountId(1)), + Balances::free_balance(AccountId(2)), + Balances::free_balance(AccountId(3)), + Balances::free_balance(AccountId(4)), ], [ 999000607164541135398, @@ -646,74 +607,74 @@ fn on_new_session_should_work() { ExtBuilder::default().collator_count(2).genesis_collator().build().execute_with(|| { assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(2)] + [AccountId(1), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(2)] + [AccountId(1), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(2)] + [AccountId(1), AccountId(2)] ); - assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(3)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(3)), 2, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(account_id_of(3)), account_id_of(3))); + 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()); new_session(); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(2)] + [AccountId(1), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(2)] + [AccountId(1), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(2), account_id_of(3)] + [AccountId(3), AccountId(2)] ); - assert_ok!(Staking::chill(RuntimeOrigin::signed(account_id_of(3)))); - assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(4)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(4)), 2, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(account_id_of(4)), account_id_of(4))); + 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_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(1), account_id_of(2)] + [AccountId(1), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(2), account_id_of(3)] + [AccountId(3), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(4), account_id_of(2)] + [AccountId(4), AccountId(2)] ); - assert_ok!(Staking::chill(RuntimeOrigin::signed(account_id_of(4)))); - assert_ok!(Staking::collect(RuntimeOrigin::signed(account_id_of(5)), Perbill::zero())); - assert_ok!(Staking::stake(RuntimeOrigin::signed(account_id_of(5)), 2, Vec::new())); - assert_ok!(Staking::nominate(RuntimeOrigin::signed(account_id_of(5)), account_id_of(5))); + 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!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(2), account_id_of(3)] + [AccountId(3), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(4), account_id_of(2)] + [AccountId(4), AccountId(2)] ); assert_eq!( crate::call_on_exposure!(>::iter_keys().collect::>()).unwrap(), - [account_id_of(5), account_id_of(2)] + [AccountId(5), AccountId(2)] ); }); } @@ -841,11 +802,8 @@ fn hybrid_election_should_work() { new_session(); assert_eq!( - (10..20).rev().collect::>(), + (10..20).rev().map(AccountId).collect::>(), >::get() - .into_iter() - .map(u64_of) - .collect::>() ); Timestamp::set_timestamp(15 * DAY_IN_MILLIS); @@ -853,11 +811,8 @@ fn hybrid_election_should_work() { new_session(); assert_eq!( - (100..103).chain((12..20).rev()).collect::>(), + (100..103).map(AccountId).chain((12..20).rev().map(AccountId)).collect::>(), >::get() - .into_iter() - .map(u64_of) - .collect::>() ); Timestamp::set_timestamp(30 * DAY_IN_MILLIS); @@ -865,11 +820,8 @@ fn hybrid_election_should_work() { new_session(); assert_eq!( - (100..106).chain((15..20).rev()).collect::>(), + (100..106).map(AccountId).chain((15..20).rev().map(AccountId)).collect::>(), >::get() - .into_iter() - .map(u64_of) - .collect::>() ); Timestamp::set_timestamp(45 * DAY_IN_MILLIS); @@ -877,11 +829,8 @@ fn hybrid_election_should_work() { new_session(); assert_eq!( - (100..108).chain((17..20).rev()).collect::>(), + (100..108).map(AccountId).chain((17..20).rev().map(AccountId)).collect::>(), >::get() - .into_iter() - .map(u64_of) - .collect::>() ); Timestamp::set_timestamp(60 * DAY_IN_MILLIS); @@ -889,11 +838,8 @@ fn hybrid_election_should_work() { new_session(); assert_eq!( - (100..=110).collect::>(), + (100..=110).map(AccountId).collect::>(), >::get() - .into_iter() - .map(u64_of) - .collect::>() ); }); } diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index bf366c783..737704398 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -89,6 +89,8 @@ impl darwinia_deposit::Config for Runtime { type MinLockingAmount = frame_support::traits::ConstU128<100>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; + type Treasury = (); + type DepositMigrator = (); type WeightInfo = (); } diff --git a/precompile/staking/src/mock.rs b/precompile/staking/src/mock.rs index 541d64426..ddcd0f520 100644 --- a/precompile/staking/src/mock.rs +++ b/precompile/staking/src/mock.rs @@ -67,6 +67,9 @@ impl pallet_timestamp::Config for Runtime { 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; @@ -79,13 +82,14 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { Ok(()) } } - impl darwinia_deposit::Config for Runtime { + type DepositMigrator = (); type Kton = KtonMinting; type MaxDeposits = frame_support::traits::ConstU32<512>; type MinLockingAmount = frame_support::traits::ConstU128<100>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; + type Treasury = TreasuryAcct; type WeightInfo = (); } @@ -158,9 +162,6 @@ impl pallet_evm::Config for Runtime { type WithdrawOrigin = pallet_evm::EnsureAddressNever; } -frame_support::parameter_types! { - pub const PayoutFraction: sp_runtime::Perbill = sp_runtime::Perbill::from_percent(40); -} pub enum RingStaking {} impl darwinia_staking::Stake for RingStaking { type AccountId = AccountId; @@ -194,6 +195,7 @@ impl darwinia_staking::Config for Runtime { type RingStaking = (); type RuntimeEvent = RuntimeEvent; type ShouldEndSession = (); + type Treasury = TreasuryAcct; type UnixTime = Timestamp; type WeightInfo = (); } diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index 652172fb4..d6c8a16a9 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -22,8 +22,6 @@ macro_rules! impl_account_migration_tests { mod account_migration { // darwinia use super::mock::*; - use darwinia_account_migration::OldLedger; - use darwinia_deposit::Deposit as DepositS; // polkadot-sdk use frame_support::{ assert_err, assert_ok, migration, Blake2_128Concat, StorageHasher, @@ -269,58 +267,6 @@ macro_rules! impl_account_migration_tests { assert_eq!(actual_accounts as u32, asset_details.accounts); }); } - - #[test] - fn staking_should_work() { - let (from, from_pk) = alice(); - let init = H160::from_low_u64_be(254).into(); - let to = H160::from_low_u64_be(255).into(); - - ExtBuilder::default() - .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) - .build() - .execute_with(|| { - preset_state_of(&from); - - >::insert( - &from_pk, - vec![ - DepositS { - id: 1, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - DepositS { - id: 2, - value: 10, - start_time: 1000, - expired_time: 2000, - in_use: true, - }, - ], - ); - >::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(&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/src/pallets/deposit.rs b/runtime/crab/src/pallets/deposit.rs index bdfdbd804..f8e9081b6 100644 --- a/runtime/crab/src/pallets/deposit.rs +++ b/runtime/crab/src/pallets/deposit.rs @@ -44,10 +44,12 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { } impl darwinia_deposit::Config for Runtime { + type DepositMigrator = darwinia_deposit::DepositMigrator; type Kton = KtonMinting; type MaxDeposits = ConstU32<512>; type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; + type Treasury = pallet_config::TreasuryAccount; type WeightInfo = weights::darwinia_deposit::WeightInfo; } diff --git a/runtime/crab/src/pallets/staking.rs b/runtime/crab/src/pallets/staking.rs index 8e4c8b89a..87568aca1 100644 --- a/runtime/crab/src/pallets/staking.rs +++ b/runtime/crab/src/pallets/staking.rs @@ -80,6 +80,7 @@ impl darwinia_staking::Config for Runtime { 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; } diff --git a/runtime/crab/src/weights/darwinia_deposit.rs b/runtime/crab/src/weights/darwinia_deposit.rs index 5d62a886b..22ac53331 100644 --- a/runtime/crab/src/weights/darwinia_deposit.rs +++ b/runtime/crab/src/weights/darwinia_deposit.rs @@ -111,4 +111,10 @@ impl darwinia_deposit::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } + fn migrate() -> Weight { + 0.into() + } + fn set_deposit_contract() -> Weight { + 0.into() + } } diff --git a/runtime/darwinia/src/pallets/deposit.rs b/runtime/darwinia/src/pallets/deposit.rs index a4f6a672a..169e1ffe3 100644 --- a/runtime/darwinia/src/pallets/deposit.rs +++ b/runtime/darwinia/src/pallets/deposit.rs @@ -44,10 +44,12 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { } impl darwinia_deposit::Config for Runtime { + type DepositMigrator = darwinia_deposit::DepositMigrator; type Kton = KtonMinting; type MaxDeposits = ConstU32<512>; type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; + type Treasury = pallet_config::TreasuryAccount; type WeightInfo = weights::darwinia_deposit::WeightInfo; } diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 181316c39..5548d4a87 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -76,6 +76,7 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = darwinia_staking::BalanceIssuing; type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; + type Treasury = pallet_config::TreasuryAccount; type Ring = RingStaking; type RingStaking = darwinia_staking::RingStaking; type RuntimeEvent = RuntimeEvent; diff --git a/runtime/darwinia/src/weights/darwinia_deposit.rs b/runtime/darwinia/src/weights/darwinia_deposit.rs index 5228a0629..cf09d4b7f 100644 --- a/runtime/darwinia/src/weights/darwinia_deposit.rs +++ b/runtime/darwinia/src/weights/darwinia_deposit.rs @@ -111,4 +111,10 @@ impl darwinia_deposit::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } + fn migrate() -> Weight { + 0.into() + } + fn set_deposit_contract() -> Weight { + 0.into() + } } diff --git a/runtime/koi/src/pallets/deposit.rs b/runtime/koi/src/pallets/deposit.rs index ad51b2ba0..69fba65e9 100644 --- a/runtime/koi/src/pallets/deposit.rs +++ b/runtime/koi/src/pallets/deposit.rs @@ -44,10 +44,12 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { } impl darwinia_deposit::Config for Runtime { + type DepositMigrator = darwinia_deposit::DepositMigrator; type Kton = KtonMinting; type MaxDeposits = ConstU32<512>; type MinLockingAmount = ConstU128; type Ring = Balances; type RuntimeEvent = RuntimeEvent; + type Treasury = pallet_config::TreasuryAccount; type WeightInfo = weights::darwinia_deposit::WeightInfo; } diff --git a/runtime/koi/src/pallets/staking.rs b/runtime/koi/src/pallets/staking.rs index 14a333e99..e444a9029 100644 --- a/runtime/koi/src/pallets/staking.rs +++ b/runtime/koi/src/pallets/staking.rs @@ -53,6 +53,7 @@ impl darwinia_staking::Config for Runtime { 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; } diff --git a/runtime/koi/src/weights/darwinia_deposit.rs b/runtime/koi/src/weights/darwinia_deposit.rs index 103ffa4c3..3da009b5a 100644 --- a/runtime/koi/src/weights/darwinia_deposit.rs +++ b/runtime/koi/src/weights/darwinia_deposit.rs @@ -111,4 +111,10 @@ impl darwinia_deposit::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) } + fn migrate() -> Weight { + 0.into() + } + fn set_deposit_contract() -> Weight { + 0.into() + } } From 7646bf059500d554f0d83853541d2c4cd30ab2a0 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 2 Aug 2024 14:41:40 +0800 Subject: [PATCH 11/20] Migrate test --- pallet/deposit/src/lib.rs | 5 +++- pallet/deposit/src/mock.rs | 32 +++++++++++++------- pallet/deposit/src/tests.rs | 39 +++++++++++++++++++++---- precompile/deposit/src/mock.rs | 2 +- runtime/darwinia/src/pallets/staking.rs | 2 +- 5 files changed, 60 insertions(+), 20 deletions(-) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 78fb12a2e..1376cdfb1 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -275,13 +275,16 @@ pub mod pallet { 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); *maybe_ds = None; } - >::Ok(d) + Ok::<_, DispatchError>(d) })?; let now = Self::now(); diff --git a/pallet/deposit/src/mock.rs b/pallet/deposit/src/mock.rs index 6f3d0cd2e..3689e8a12 100644 --- a/pallet/deposit/src/mock.rs +++ b/pallet/deposit/src/mock.rs @@ -16,9 +16,9 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -pub use crate as darwinia_deposit; -pub use dc_types::{Balance, Moment, UNIT}; - +// darwinia +use crate::*; +use dc_types::{Balance, Moment, UNIT}; // polkadot-sdk use frame_support::derive_impl; use sp_io::TestExternalities; @@ -71,7 +71,7 @@ impl pallet_assets::Config for Runtime { } pub enum KtonMinting {} -impl darwinia_deposit::SimpleAsset for KtonMinting { +impl crate::SimpleAsset for KtonMinting { type AccountId = ::AccountId; fn mint(beneficiary: &Self::AccountId, amount: Balance) -> sp_runtime::DispatchResult { @@ -86,7 +86,7 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { Assets::burn(RuntimeOrigin::signed(0), 0.into(), *who, amount) } } -impl darwinia_deposit::Config for Runtime { +impl crate::Config for Runtime { type DepositMigrator = (); type Kton = KtonMinting; type MaxDeposits = frame_support::traits::ConstU32<16>; @@ -103,15 +103,11 @@ frame_support::construct_runtime! { Timestamp: pallet_timestamp, Balances: pallet_balances, Assets: pallet_assets, - Deposit: darwinia_deposit, + Deposit: crate, } } -pub(crate) fn efflux(milli_secs: Moment) { - Timestamp::set_timestamp(Timestamp::now() + milli_secs); -} - -pub(crate) fn new_test_ext() -> TestExternalities { +pub fn new_test_ext() -> TestExternalities { let mut storage = >::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { @@ -129,3 +125,17 @@ pub(crate) fn new_test_ext() -> TestExternalities { 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 f38551f64..f6e71714c 100644 --- a/pallet/deposit/src/tests.rs +++ b/pallet/deposit/src/tests.rs @@ -22,6 +22,7 @@ use crate::{ 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; @@ -31,18 +32,18 @@ fn lock_should_work() { new_test_ext().execute_with(|| { assert_eq!(System::account(1).consumers, 0); assert_eq!( - Balances::free_balance(darwinia_deposit::account_id::< - ::AccountId, - >()), + 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(darwinia_deposit::account_id::< - ::AccountId, - >()), + Balances::free_balance( + crate::account_id::<::AccountId>() + ), 10 * UNIT ); assert_eq!(Balances::free_balance(1), 990 * UNIT); @@ -331,6 +332,15 @@ fn claim_with_penalty_should_work() { ); 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); @@ -346,3 +356,20 @@ fn claim_with_penalty_should_work() { ); }); } + +#[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)), >::DepositInUse); + + mock::set_in_use(1, false); + + assert_ok!(Deposit::migrate(RuntimeOrigin::signed(1))); + assert!(Deposit::deposit_of(1).is_none()); + }); +} diff --git a/precompile/deposit/src/mock.rs b/precompile/deposit/src/mock.rs index 737704398..58bbd1cb5 100644 --- a/precompile/deposit/src/mock.rs +++ b/precompile/deposit/src/mock.rs @@ -84,13 +84,13 @@ impl darwinia_deposit::SimpleAsset for KtonMinting { } impl darwinia_deposit::Config for Runtime { + type DepositMigrator = (); type Kton = KtonMinting; type MaxDeposits = frame_support::traits::ConstU32<16>; type MinLockingAmount = frame_support::traits::ConstU128<100>; type Ring = Balances; type RuntimeEvent = RuntimeEvent; type Treasury = (); - type DepositMigrator = (); type WeightInfo = (); } diff --git a/runtime/darwinia/src/pallets/staking.rs b/runtime/darwinia/src/pallets/staking.rs index 5548d4a87..191bbdbc7 100644 --- a/runtime/darwinia/src/pallets/staking.rs +++ b/runtime/darwinia/src/pallets/staking.rs @@ -76,11 +76,11 @@ impl darwinia_staking::Config for Runtime { type IssuingManager = darwinia_staking::BalanceIssuing; type KtonStaking = darwinia_staking::KtonStaking; type MaxDeposits = ::MaxDeposits; - type Treasury = pallet_config::TreasuryAccount; 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; } From 7877b5d67de07b86407efe95c67beaba9a33beb0 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 2 Aug 2024 14:46:20 +0800 Subject: [PATCH 12/20] Pass msg value --- pallet/deposit/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 1376cdfb1..7d395e9a1 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -338,7 +338,7 @@ pub mod pallet { 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.2); + T::DepositMigrator::migrate(who.clone(), to_migrate.0, to_migrate.2); Self::deposit_event(Event::DepositsClaimed { owner: who.clone(), @@ -461,7 +461,7 @@ where T: Config, { /// Migrate to contract. - fn migrate(_: T::AccountId, _: Vec<(Balance, Moment, Moment)>) {} + fn migrate(_: T::AccountId, _: Balance, _: Vec<(Balance, Moment, Moment)>) {} } impl MigrateToContract for () where T: Config {} @@ -487,7 +487,7 @@ where T: Config + darwinia_ethtx_forwarder::Config, T::AccountId: Into, { - fn migrate(who: T::AccountId, deposits: Vec<(Balance, Moment, Moment)>) { + fn migrate(who: T::AccountId, total: Balance, deposits: Vec<(Balance, Moment, Moment)>) { let Some(dc) = >::get() else { log::error!("deposit contract must be some; qed"); @@ -536,7 +536,7 @@ where ), ], dc, - 0.into(), + total.into(), 1_000_000.into(), ) } From 50a73f499a7158c02f6b9b82fea49b4917b9ea7e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 2 Aug 2024 14:47:48 +0800 Subject: [PATCH 13/20] Fix features Signed-off-by: Xavier Lau --- pallet/deposit/Cargo.toml | 2 ++ pallet/staking/Cargo.toml | 1 + runtime/crab/Cargo.toml | 1 + runtime/darwinia/Cargo.toml | 1 + runtime/koi/Cargo.toml | 1 + 5 files changed, 6 insertions(+) diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index ae5c0edbf..bce8c17a8 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -41,6 +41,7 @@ std = [ # crates.io "codec/std", "ethabi/std", + "log/std", "scale-info/std", # darwinia @@ -61,6 +62,7 @@ std = [ runtime-benchmarks = [ # darwinia + "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-staking-traits/runtime-benchmarks", # polkadot-sdk diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index b22f41898..91ab8d74a 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -85,6 +85,7 @@ std = [ runtime-benchmarks = [ # darwinia "darwinia-deposit", + "darwinia-ethtx-forwarder/runtime-benchmarks", "darwinia-staking-traits/runtime-benchmarks", # polkadot-sdk diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index a750c1dd5..f0b95255a 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -227,6 +227,7 @@ runtime-benchmarks = [ "darwinia-account-migration/runtime-benchmarks", "darwinia-common-runtime/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", diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index 2499b6ebc..8468aab32 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -246,6 +246,7 @@ runtime-benchmarks = [ "darwinia-account-migration/runtime-benchmarks", "darwinia-common-runtime/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", diff --git a/runtime/koi/Cargo.toml b/runtime/koi/Cargo.toml index f6337df57..0ec28b268 100644 --- a/runtime/koi/Cargo.toml +++ b/runtime/koi/Cargo.toml @@ -238,6 +238,7 @@ runtime-benchmarks = [ # darwinia "darwinia-common-runtime/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", From a5c31c4913cab23b43560bbbab70935769736005 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 5 Aug 2024 10:06:32 +0800 Subject: [PATCH 14/20] Fix build --- node/src/service/mod.rs | 2 +- pallet/ethtx-forwarder/src/lib.rs | 2 +- precompile/staking/src/tests.rs | 8 ++++---- runtime/common/src/migration_helper.rs | 2 +- runtime/common/src/test.rs | 16 ++++++++-------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/node/src/service/mod.rs b/node/src/service/mod.rs index a4dedec3d..2207ef42c 100644 --- a/node/src/service/mod.rs +++ b/node/src/service/mod.rs @@ -747,7 +747,7 @@ where network_provider: network.clone(), is_validator: config.role.is_authority(), enable_http_requests: false, - custom_extensions: move |_| vec![], + custom_extensions: move |_| Vec::new(), }) .run(client.clone(), task_manager.spawn_handle()) .boxed(), diff --git a/pallet/ethtx-forwarder/src/lib.rs b/pallet/ethtx-forwarder/src/lib.rs index 7f003fc43..0f01756f2 100644 --- a/pallet/ethtx-forwarder/src/lib.rs +++ b/pallet/ethtx-forwarder/src/lib.rs @@ -143,7 +143,7 @@ impl Pallet { None, None, Some(who.nonce), - vec![], + Vec::new(), false, // non-transactional true, None, diff --git a/precompile/staking/src/tests.rs b/precompile/staking/src/tests.rs index b8aa2c494..e2c5ec7c6 100644 --- a/precompile/staking/src/tests.rs +++ b/precompile/staking/src/tests.rs @@ -52,7 +52,7 @@ fn stake_unstake_restake() { .prepare_test( alice, precompile, - PCall::stake { ring_amount: 200.into(), deposits: vec![] }, + PCall::stake { ring_amount: 200.into(), deposits: Vec::new() }, ) .execute_returns(true); assert_eq!(Staking::ledger_of(alice).unwrap().ring, 200); @@ -62,7 +62,7 @@ fn stake_unstake_restake() { .prepare_test( alice, precompile, - PCall::unstake { ring_amount: 200.into(), deposits: vec![] }, + PCall::unstake { ring_amount: 200.into(), deposits: Vec::new() }, ) .execute_returns(true); assert!(Staking::ledger_of(alice).is_none()); @@ -82,7 +82,7 @@ fn nominate() { .prepare_test( alice, precompile, - PCall::stake { ring_amount: 200.into(), deposits: vec![] }, + PCall::stake { ring_amount: 200.into(), deposits: Vec::new() }, ) .execute_returns(true); @@ -97,7 +97,7 @@ fn nominate() { .prepare_test( bob, precompile, - PCall::stake { ring_amount: 200.into(), deposits: vec![] }, + PCall::stake { ring_amount: 200.into(), deposits: Vec::new() }, ) .execute_returns(true); diff --git a/runtime/common/src/migration_helper.rs b/runtime/common/src/migration_helper.rs index 7e9c02b4d..d7e2ebcfd 100644 --- a/runtime/common/src/migration_helper.rs +++ b/runtime/common/src/migration_helper.rs @@ -164,7 +164,7 @@ fn identity_codec_should_work() { judgements: vec![(1, Judgement::KnownGood)], deposit: 100_025_800_000_000_000_000, info: IdentityInfo { - additional: vec![], + 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()), diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index d6c8a16a9..5d0cda3a1 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -312,13 +312,13 @@ macro_rules! impl_evm_tests { RuntimeOrigin::signed(H160::default().into()), H160::default(), H160::default(), - vec![], + Vec::new(), U256::default(), 1000000, U256::from(1_000_000), None, None, - vec![], + Vec::new(), ), DispatchError::BadOrigin ); @@ -327,13 +327,13 @@ macro_rules! impl_evm_tests { RuntimeOrigin::root(), H160::default(), H160::default(), - vec![], + Vec::new(), U256::default(), 1000000, U256::from(1_000_000), None, None, - vec![], + Vec::new(), ) { // Ignore the pallet index. let DispatchError::Module(e) = dispatch_info_with_err.error else { @@ -350,7 +350,7 @@ macro_rules! impl_evm_tests { ExtBuilder::default().build().execute_with(|| { assert!(DarwiniaDispatchValidator::validate_before_dispatch( &H160::default().into(), - &RuntimeCall::System(frame_system::Call::remark { remark: vec![] }) + &RuntimeCall::System(frame_system::Call::remark { remark: Vec::new() }) ) .is_none()); @@ -360,13 +360,13 @@ macro_rules! impl_evm_tests { &RuntimeCall::EVM(pallet_evm::Call::call { source: H160::default(), target: H160::default(), - input: vec![], + input: Vec::new(), value: U256::default(), gas_limit: 1000000, max_fee_per_gas: U256::from(1_000_000), max_priority_fee_per_gas: None, nonce: None, - access_list: vec![], + access_list: Vec::new(), }) ) .is_some()); @@ -379,7 +379,7 @@ macro_rules! impl_evm_tests { // Default class assert!(DarwiniaDispatchValidator::validate_before_dispatch( &H160::default().into(), - &RuntimeCall::System(frame_system::Call::remark { remark: vec![] }) + &RuntimeCall::System(frame_system::Call::remark { remark: Vec::new() }) ) .is_none()); From 1c4156c9ea7b6aed5e64fb5eac02b601c5723bb6 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 7 Aug 2024 10:32:31 +0800 Subject: [PATCH 15/20] Fix compile --- pallet/deposit/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index 7d395e9a1..e7e7693c1 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -58,6 +58,7 @@ use frame_support::{ use frame_system::pallet_prelude::*; use sp_core::H160; use sp_runtime::traits::AccountIdConversion; +use sp_std::prelude::*; #[frame_support::pallet] pub mod pallet { From 0bc3d9cc04a7ca65e818d1bcb2f0e8851b45d23e Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 8 Aug 2024 11:37:03 +0800 Subject: [PATCH 16/20] Benchmark --- pallet/deposit/src/benchmarking.rs | 33 +++++ pallet/deposit/src/weights.rs | 122 ++++++++++++++---- pallet/staking/src/weights.rs | 121 +++++++---------- runtime/crab/src/lib.rs | 1 - .../cumulus_pallet_parachain_system.rs | 8 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 18 +-- .../src/weights/darwinia_account_migration.rs | 55 +++----- runtime/crab/src/weights/darwinia_deposit.rs | 49 +++++-- runtime/crab/src/weights/darwinia_staking.rs | 51 +++----- runtime/crab/src/weights/frame_system.rs | 48 +++---- runtime/crab/src/weights/pallet_assets.rs | 102 ++++++++------- runtime/crab/src/weights/pallet_balances.rs | 30 ++--- runtime/crab/src/weights/pallet_collective.rs | 100 +++++++------- .../src/weights/pallet_conviction_voting.rs | 38 +++--- .../crab/src/weights/pallet_message_queue.rs | 20 +-- runtime/crab/src/weights/pallet_preimage.rs | 62 ++++----- runtime/crab/src/weights/pallet_proxy.rs | 86 ++++++------ runtime/crab/src/weights/pallet_referenda.rs | 120 ++++++++--------- runtime/crab/src/weights/pallet_scheduler.rs | 46 +++---- runtime/crab/src/weights/pallet_session.rs | 4 +- runtime/crab/src/weights/pallet_timestamp.rs | 4 +- runtime/crab/src/weights/pallet_treasury.rs | 36 +++--- runtime/crab/src/weights/pallet_tx_pause.rs | 10 +- runtime/crab/src/weights/pallet_utility.rs | 22 ++-- runtime/crab/src/weights/pallet_whitelist.rs | 18 +-- runtime/darwinia/src/lib.rs | 1 - .../cumulus_pallet_parachain_system.rs | 6 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 8 +- .../src/weights/darwinia_account_migration.rs | 59 +++------ .../darwinia/src/weights/darwinia_deposit.rs | 49 +++++-- .../darwinia/src/weights/darwinia_staking.rs | 41 +++--- runtime/darwinia/src/weights/frame_system.rs | 42 +++--- .../src/weights/pallet_asset_manager.rs | 38 +++--- runtime/darwinia/src/weights/pallet_assets.rs | 96 +++++++------- .../darwinia/src/weights/pallet_balances.rs | 30 ++--- .../darwinia/src/weights/pallet_collective.rs | 106 ++++++++------- .../src/weights/pallet_conviction_voting.rs | 38 +++--- .../src/weights/pallet_message_queue.rs | 14 +- .../darwinia/src/weights/pallet_preimage.rs | 66 +++++----- runtime/darwinia/src/weights/pallet_proxy.rs | 82 ++++++------ .../darwinia/src/weights/pallet_referenda.rs | 94 +++++++------- .../darwinia/src/weights/pallet_scheduler.rs | 46 +++---- .../darwinia/src/weights/pallet_session.rs | 4 +- .../darwinia/src/weights/pallet_timestamp.rs | 6 +- .../darwinia/src/weights/pallet_treasury.rs | 42 +++--- .../darwinia/src/weights/pallet_utility.rs | 26 ++-- .../darwinia/src/weights/pallet_whitelist.rs | 16 +-- runtime/koi/src/lib.rs | 1 - .../cumulus_pallet_parachain_system.rs | 6 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 14 +- runtime/koi/src/weights/darwinia_deposit.rs | 49 +++++-- runtime/koi/src/weights/darwinia_staking.rs | 61 ++++----- runtime/koi/src/weights/frame_system.rs | 50 +++---- .../koi/src/weights/pallet_asset_manager.rs | 34 ++--- runtime/koi/src/weights/pallet_assets.rs | 100 +++++++------- runtime/koi/src/weights/pallet_balances.rs | 28 ++-- runtime/koi/src/weights/pallet_collective.rs | 110 ++++++++-------- .../src/weights/pallet_conviction_voting.rs | 38 +++--- .../koi/src/weights/pallet_message_queue.rs | 28 ++-- runtime/koi/src/weights/pallet_preimage.rs | 66 +++++----- runtime/koi/src/weights/pallet_proxy.rs | 82 ++++++------ runtime/koi/src/weights/pallet_referenda.rs | 84 ++++++------ runtime/koi/src/weights/pallet_scheduler.rs | 46 +++---- runtime/koi/src/weights/pallet_session.rs | 4 +- runtime/koi/src/weights/pallet_timestamp.rs | 2 +- runtime/koi/src/weights/pallet_treasury.rs | 28 ++-- runtime/koi/src/weights/pallet_tx_pause.rs | 6 +- runtime/koi/src/weights/pallet_utility.rs | 24 ++-- runtime/koi/src/weights/pallet_whitelist.rs | 20 +-- 69 files changed, 1547 insertions(+), 1448 deletions(-) diff --git a/pallet/deposit/src/benchmarking.rs b/pallet/deposit/src/benchmarking.rs index 61a490ef5..6cebd619a 100644 --- a/pallet/deposit/src/benchmarking.rs +++ b/pallet/deposit/src/benchmarking.rs @@ -114,6 +114,39 @@ mod benchmarks { } } + #[benchmark] + fn migrate() { + let a = frame_benchmarking::whitelisted_caller::(); + 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); + + // 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() + }); + + #[extrinsic_call] + _(RawOrigin::Signed(a)); + } + + #[benchmark] + fn set_deposit_contract() { + let a = frame_benchmarking::whitelisted_caller(); + + // Worst-case scenario: + // + // Set successfully. + #[extrinsic_call] + _(RawOrigin::Root, a); + } + frame_benchmarking::impl_benchmark_test_suite!( Pallet, crate::mock::new_test_ext(), diff --git a/pallet/deposit/src/weights.rs b/pallet/deposit/src/weights.rs index 9654858f9..cd6aeeb2e 100644 --- a/pallet/deposit/src/weights.rs +++ b/pallet/deposit/src/weights.rs @@ -18,8 +18,8 @@ //! Autogenerated weights for darwinia_deposit //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! 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: `[]` //! WORST CASE MAP SIZE: `1000000` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("koi-dev"), DB CACHE: 1024 @@ -74,10 +74,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) fn lock() -> Weight { // Proof Size summary in bytes: - // Measured: `26848` + // Measured: `26812` // Estimated: `29615` - // Minimum execution time: 66_573 nanoseconds. - Weight::from_parts(69_229_000, 0) + // 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)) @@ -90,10 +90,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) fn claim() -> Weight { // Proof Size summary in bytes: - // Measured: `26578` + // Measured: `26541` // Estimated: `29615` - // Minimum execution time: 1_188_888 nanoseconds. - Weight::from_parts(1_240_611_000, 0) + // 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)) @@ -106,21 +106,54 @@ impl WeightInfo for SubstrateWeight { /// 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: `26704` + // Measured: `26863` // Estimated: `29615` - // Minimum execution time: 45_943 nanoseconds. - Weight::from_parts(48_619_000, 0) + // 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(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) + .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) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Deposit::DepositContract` (r:1 w:0) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) + /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `EVM::AccountCodes` (r:2 w:0) + /// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:0) + /// 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 { - 0.into() + // Proof Size summary in bytes: + // Measured: `27516` + // Estimated: `33456` + // Minimum execution time: 4_057_000 nanoseconds. + Weight::from_parts(4_577_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)) } + /// Storage: `Deposit::DepositContract` (r:0 w:1) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_deposit_contract() -> Weight { - 0.into() + // 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)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -138,10 +171,10 @@ impl WeightInfo for () { /// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) fn lock() -> Weight { // Proof Size summary in bytes: - // Measured: `26848` + // Measured: `26812` // Estimated: `29615` - // Minimum execution time: 66_573 nanoseconds. - Weight::from_parts(69_229_000, 0) + // 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)) @@ -154,10 +187,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) fn claim() -> Weight { // Proof Size summary in bytes: - // Measured: `26578` + // Measured: `26541` // Estimated: `29615` - // Minimum execution time: 1_188_888 nanoseconds. - Weight::from_parts(1_240_611_000, 0) + // 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)) @@ -170,20 +203,53 @@ impl WeightInfo for () { /// 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: `26704` + // Measured: `26863` // Estimated: `29615` - // Minimum execution time: 45_943 nanoseconds. - Weight::from_parts(48_619_000, 0) + // 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(4_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) + .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) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Deposit::DepositContract` (r:1 w:0) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) + /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `EVM::AccountCodes` (r:2 w:0) + /// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:0) + /// 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 { - 0.into() + // Proof Size summary in bytes: + // Measured: `27516` + // Estimated: `33456` + // Minimum execution time: 4_057_000 nanoseconds. + Weight::from_parts(4_577_000_000, 0) + .saturating_add(Weight::from_parts(33456, 0)) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } + /// Storage: `Deposit::DepositContract` (r:0 w:1) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_deposit_contract() -> Weight { - 0.into() + // 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)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/pallet/staking/src/weights.rs b/pallet/staking/src/weights.rs index 4c8c26f06..f38a97552 100644 --- a/pallet/staking/src/weights.rs +++ b/pallet/staking/src/weights.rs @@ -18,8 +18,8 @@ //! Autogenerated weights for darwinia_staking //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-04-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! 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: `[]` //! WORST CASE MAP SIZE: `1000000` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("koi-dev"), DB CACHE: 1024 @@ -59,7 +59,6 @@ pub trait WeightInfo { fn chill() -> Weight; fn payout() -> Weight; fn set_rate_limit() -> Weight; - fn set_ring_staking_contract() -> Weight; fn set_kton_staking_contract() -> Weight; fn set_collator_count() -> Weight; } @@ -82,11 +81,11 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `7088 + x * (25 ±0)` // Estimated: `29615` - // Minimum execution time: 60_000 nanoseconds. - Weight::from_parts(992_585_597, 0) + // Minimum execution time: 47_000 nanoseconds. + Weight::from_parts(859_853_520, 0) .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 297_913 - .saturating_add(Weight::from_parts(13_623_433, 0).saturating_mul(x.into())) + // 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)) } @@ -105,11 +104,11 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `7415 + x * (26 ±0)` // Estimated: `29615` - // Minimum execution time: 54_000 nanoseconds. - Weight::from_parts(908_132_841, 0) + // Minimum execution time: 50_000 nanoseconds. + Weight::from_parts(643_370_535, 0) .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 231_565 - .saturating_add(Weight::from_parts(11_600_487, 0).saturating_mul(x.into())) + // 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)) } @@ -119,8 +118,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3497` - // Minimum execution time: 11_000 nanoseconds. - Weight::from_parts(11_000_000, 0) + // 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)) @@ -133,10 +132,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn nominate() -> Weight { // Proof Size summary in bytes: - // Measured: `574` + // Measured: `600` // Estimated: `4543` - // Minimum execution time: 12_000 nanoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 13_000 nanoseconds. + Weight::from_parts(14_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)) @@ -150,7 +149,7 @@ impl WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 4_000 nanoseconds. - Weight::from_parts(4_000_000, 0) + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -160,17 +159,17 @@ impl WeightInfo for SubstrateWeight { /// 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) + /// 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: `1845` - // Estimated: `5310` - // Minimum execution time: 205_000 nanoseconds. - Weight::from_parts(207_000_000, 0) - .saturating_add(Weight::from_parts(5310, 0)) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) + // 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`) @@ -183,19 +182,8 @@ impl WeightInfo for SubstrateWeight { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - // Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_ring_staking_contract() -> 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)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - // Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// 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: // Measured: `0` @@ -235,11 +223,11 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `7088 + x * (25 ±0)` // Estimated: `29615` - // Minimum execution time: 60_000 nanoseconds. - Weight::from_parts(992_585_597, 0) + // Minimum execution time: 47_000 nanoseconds. + Weight::from_parts(859_853_520, 0) .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 297_913 - .saturating_add(Weight::from_parts(13_623_433, 0).saturating_mul(x.into())) + // 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)) } @@ -258,11 +246,11 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `7415 + x * (26 ±0)` // Estimated: `29615` - // Minimum execution time: 54_000 nanoseconds. - Weight::from_parts(908_132_841, 0) + // Minimum execution time: 50_000 nanoseconds. + Weight::from_parts(643_370_535, 0) .saturating_add(Weight::from_parts(29615, 0)) - // Standard Error: 231_565 - .saturating_add(Weight::from_parts(11_600_487, 0).saturating_mul(x.into())) + // 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)) } @@ -272,8 +260,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3497` - // Minimum execution time: 11_000 nanoseconds. - Weight::from_parts(11_000_000, 0) + // 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)) @@ -286,10 +274,10 @@ impl WeightInfo for () { /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn nominate() -> Weight { // Proof Size summary in bytes: - // Measured: `574` + // Measured: `600` // Estimated: `4543` - // Minimum execution time: 12_000 nanoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 13_000 nanoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(4543, 0)) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -303,7 +291,7 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 4_000 nanoseconds. - Weight::from_parts(4_000_000, 0) + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -313,17 +301,17 @@ impl WeightInfo for () { /// 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) + /// 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: `1845` - // Estimated: `5310` - // Minimum execution time: 205_000 nanoseconds. - Weight::from_parts(207_000_000, 0) - .saturating_add(Weight::from_parts(5310, 0)) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + // 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`) @@ -336,19 +324,8 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } - /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_ring_staking_contract() -> 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)) - .saturating_add(RocksDbWeight::get().writes(1)) - } /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// 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: // Measured: `0` diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index c6339dda8..a93a40be7 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -243,7 +243,6 @@ frame_benchmarking::define_benchmarks! { [pallet_balances, Balances] [pallet_collective, TechnicalCommittee] [pallet_conviction_voting, ConvictionVoting] - [pallet_evm, EVM] [pallet_message_queue, MessageQueue] [pallet_preimage, Preimage] [pallet_proxy, Proxy] diff --git a/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs b/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs index bd50a06fb..b7291e855 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(2_000_000, 0) + Weight::from_parts(3_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) - // Standard Error: 25_931 - .saturating_add(Weight::from_parts(93_644_619, 0).saturating_mul(n.into())) + // Standard Error: 59_482 + .saturating_add(Weight::from_parts(104_042_533, 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 4da21d6d7..32cf82370 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(11_000_000, 0) + Weight::from_parts(13_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: 3_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(4_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(4_000_000, 0) + Weight::from_parts(5_000_000, 0) .saturating_add(Weight::from_parts(0, 1562)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(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: 42_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(49_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: 27_000_000 picoseconds. - Weight::from_parts(32_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(31_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 b02563407..944bc8df1 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -61,27 +61,19 @@ 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: `AccountMigration::Ledgers` (r:1 w:1) - /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(1845), added: 4320, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:3) + /// Storage: `System::Account` (r:0 w:1) /// 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: `28401` - // Estimated: `31866` - // Minimum execution time: 116_000_000 picoseconds. - Weight::from_parts(121_000_000, 0) - .saturating_add(Weight::from_parts(0, 31866)) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(11)) + // 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)) } /// Storage: `AccountMigration::Multisigs` (r:0 w:1) /// Proof: `AccountMigration::Multisigs` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -91,34 +83,25 @@ 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: `AccountMigration::Ledgers` (r:1 w:1) - /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(1845), added: 4320, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:3) + /// Storage: `System::Account` (r:0 w:1) /// 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: `2 + x * (161 ±0) + z * (161 ±0)` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(18_311_896, 0) - .saturating_add(Weight::from_parts(0, 2)) - // Standard Error: 9_962 - .saturating_add(Weight::from_parts(19_788, 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())) + // Estimated: `0 + x * (18 ±0) + z * (18 ±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())) } /// 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 22ac53331..199eb5453 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -69,8 +69,8 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26712` // Estimated: `29615` - // Minimum execution time: 76_000_000 picoseconds. - Weight::from_parts(83_000_000, 0) + // 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)) @@ -85,8 +85,8 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26441` // Estimated: `29615` - // Minimum execution time: 928_000_000 picoseconds. - Weight::from_parts(962_000_000, 0) + // 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)) @@ -105,16 +105,47 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26763` // Estimated: `29615` - // Minimum execution time: 84_000_000 picoseconds. - Weight::from_parts(91_000_000, 0) + // 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) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Deposit::DepositContract` (r:1 w:0) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) + /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `EVM::AccountCodes` (r:2 w:0) + /// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:0) + /// 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 { - 0.into() + // 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) + .saturating_add(Weight::from_parts(0, 33265)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: `Deposit::DepositContract` (r:0 w:1) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_deposit_contract() -> Weight { - 0.into() + // 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)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/crab/src/weights/darwinia_staking.rs b/runtime/crab/src/weights/darwinia_staking.rs index dbd416deb..6b8189cdd 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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 darwinia_staking::WeightInfo for WeightInfo { // Measured: `7021 + x * (25 ±0)` // Estimated: `29615` // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(672_333_775, 0) + Weight::from_parts(673_923_539, 0) .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 237_459 - .saturating_add(Weight::from_parts(11_911_464, 0).saturating_mul(x.into())) + // 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)) } @@ -93,11 +93,11 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `7348 + x * (26 ±0)` // Estimated: `29615` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(641_792_186, 0) + // Minimum execution time: 55_000_000 picoseconds. + Weight::from_parts(691_873_667, 0) .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 237_475 - .saturating_add(Weight::from_parts(12_048_394, 0).saturating_mul(x.into())) + // 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)) } @@ -107,8 +107,8 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3497` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // 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)) @@ -121,10 +121,10 @@ impl darwinia_staking::WeightInfo for WeightInfo { /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn nominate() -> Weight { // Proof Size summary in bytes: - // Measured: `574` + // Measured: `600` // Estimated: `4543` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 4543)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -137,8 +137,8 @@ impl darwinia_staking::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: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -154,8 +154,8 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `1811` // Estimated: `5276` - // Minimum execution time: 133_000_000 picoseconds. - Weight::from_parts(136_000_000, 0) + // 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)) @@ -167,29 +167,18 @@ impl darwinia_staking::WeightInfo for WeightInfo { // 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)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_ring_staking_contract() -> Weight { - // Proof Size summary in bytes: - // 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)) } /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// 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: // 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/crab/src/weights/frame_system.rs b/runtime/crab/src/weights/frame_system.rs index 18d8a534e..c3b3b0ac0 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -61,21 +61,21 @@ impl frame_system::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_839_585, 0) + Weight::from_parts(4_970_413, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(145, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(156, 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. - Weight::from_parts(4_000_000, 0) + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(895, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_000, 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(3_000_000, 0) + Weight::from_parts(4_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: 59_823_000_000 picoseconds. - Weight::from_parts(60_726_000_000, 0) + // Minimum execution time: 69_455_000_000 picoseconds. + Weight::from_parts(74_530_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: 1_000_000 picoseconds. + // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_060 - .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(i.into())) + // Standard Error: 2_908 + .saturating_add(Weight::from_parts(800_499, 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: 1_000_000 picoseconds. + // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 822 - .saturating_add(Weight::from_parts(510_498, 0).saturating_mul(i.into())) + // Standard Error: 1_502 + .saturating_add(Weight::from_parts(558_522, 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: 3_000_000 picoseconds. - Weight::from_parts(3_000_000, 0) + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 100)) - // Standard Error: 809 - .saturating_add(Weight::from_parts(938_486, 0).saturating_mul(p.into())) + // Standard Error: 3_203 + .saturating_add(Weight::from_parts(1_046_988, 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,8 +163,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_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: 62_898_000_000 picoseconds. - Weight::from_parts(63_339_000_000, 0) + // Minimum execution time: 75_039_000_000 picoseconds. + Weight::from_parts(79_857_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 58f674ac3..8c55b3e3d 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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_assets::WeightInfo for WeightInfo { // Measured: `157` // Estimated: `3631` // 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, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -105,8 +105,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 8_479 - .saturating_add(Weight::from_parts(10_170_840, 0).saturating_mul(c.into())) + // Standard Error: 18_699 + .saturating_add(Weight::from_parts(11_439_479, 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: 12_000_000 picoseconds. - Weight::from_parts(80_268_905, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 16_839 - .saturating_add(Weight::from_parts(3_729_918, 0).saturating_mul(a.into())) + // Standard Error: 10_481 + .saturating_add(Weight::from_parts(4_273_951, 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(12_000_000, 0) + 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(1)) @@ -155,8 +155,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(23_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: 25_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(33_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: 34_000_000 picoseconds. - Weight::from_parts(36_000_000, 0) + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(44_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: 31_000_000 picoseconds. - Weight::from_parts(31_000_000, 0) + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(33_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: 35_000_000 picoseconds. - Weight::from_parts(36_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: 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)) @@ -246,7 +246,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `410` // Estimated: `3631` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_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)) @@ -258,7 +258,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // 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, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -270,7 +270,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // 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, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -283,8 +283,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_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)) @@ -295,7 +295,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // 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, 3631)) .saturating_add(T::DbWeight::get().reads(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(11_711_844, 0) + Weight::from_parts(12_861_969, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 1_106 - .saturating_add(Weight::from_parts(306, 0).saturating_mul(n.into())) - // Standard Error: 1_106 - .saturating_add(Weight::from_parts(3_079, 0).saturating_mul(s.into())) + // 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())) .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: 12_000_000 picoseconds. - Weight::from_parts(12_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)) @@ -341,13 +341,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: 10_000_000 picoseconds. - Weight::from_parts(11_234_739, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_154_297, 0) .saturating_add(Weight::from_parts(0, 3631)) + // Standard Error: 2_748 + .saturating_add(Weight::from_parts(8_426, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -359,8 +361,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 12_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)) @@ -371,7 +373,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // 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, 3631)) .saturating_add(T::DbWeight::get().reads(1)) @@ -385,8 +387,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + 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)) @@ -403,8 +405,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `599` // Estimated: `6168` - // Minimum execution time: 41_000_000 picoseconds. - Weight::from_parts(42_000_000, 0) + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(51_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -417,8 +419,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `457` // Estimated: `3631` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 16_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)) @@ -431,8 +433,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `457` // Estimated: `3631` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + 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)) @@ -489,8 +491,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: 31_000_000 picoseconds. + Weight::from_parts(36_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -504,7 +506,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `448` // Estimated: `3631` // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + 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/crab/src/weights/pallet_balances.rs b/runtime/crab/src/weights/pallet_balances.rs index 26ca547d4..8be80ee34 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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_balances::WeightInfo for WeightInfo { // Measured: `39` // Estimated: `3581` // Minimum execution time: 43_000_000 picoseconds. - Weight::from_parts(44_000_000, 0) + Weight::from_parts(45_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: 36_000_000 picoseconds. - Weight::from_parts(38_000_000, 0) + // Minimum execution time: 39_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)) @@ -85,8 +85,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `162` // Estimated: `3581` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(16_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(20_000_000, 0) + Weight::from_parts(23_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: 45_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -122,7 +122,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Measured: `39` // Estimated: `3581` // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(47_000_000, 0) + Weight::from_parts(48_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,8 +133,8 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `162` // Estimated: `3581` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -146,11 +146,11 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `91 + u * (124 ±0)` // Estimated: `990 + u * (2591 ±0)` - // Minimum execution time: 15_000_000 picoseconds. + // Minimum execution time: 16_000_000 picoseconds. Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 12_953 - .saturating_add(Weight::from_parts(12_353_948, 0).saturating_mul(u.into())) + // Standard Error: 22_072 + .saturating_add(Weight::from_parts(13_949_592, 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/crab/src/weights/pallet_collective.rs b/runtime/crab/src/weights/pallet_collective.rs index 1f54955c9..7f2cbee6b 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(11_000_000, 0) + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 12200)) - // Standard Error: 43_919 - .saturating_add(Weight::from_parts(2_400_988, 0).saturating_mul(m.into())) - // Standard Error: 43_919 - .saturating_add(Weight::from_parts(5_149_399, 0).saturating_mul(p.into())) + // 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())) .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(13_154_191, 0) + Weight::from_parts(12_540_883, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 38 - .saturating_add(Weight::from_parts(767, 0).saturating_mul(b.into())) - // Standard Error: 394 - .saturating_add(Weight::from_parts(3_491, 0).saturating_mul(m.into())) + // 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())) .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(14_546_634, 0) + Weight::from_parts(16_238_739, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 40 - .saturating_add(Weight::from_parts(1_165, 0).saturating_mul(b.into())) - // Standard Error: 413 - .saturating_add(Weight::from_parts(6_158, 0).saturating_mul(m.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -143,15 +143,13 @@ 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: 16_000_000 picoseconds. - Weight::from_parts(17_790_958, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(22_299_777, 0) .saturating_add(Weight::from_parts(0, 3751)) - // Standard Error: 56 - .saturating_add(Weight::from_parts(754, 0).saturating_mul(b.into())) - // Standard Error: 592 - .saturating_add(Weight::from_parts(7_595, 0).saturating_mul(m.into())) - // Standard Error: 585 - .saturating_add(Weight::from_parts(111_810, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -167,10 +165,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(14_670_830, 0) + Weight::from_parts(17_457_013, 0) .saturating_add(Weight::from_parts(0, 4296)) - // Standard Error: 803 - .saturating_add(Weight::from_parts(6_942, 0).saturating_mul(m.into())) + // Standard Error: 3_368 + .saturating_add(Weight::from_parts(25_662, 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())) @@ -190,10 +188,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: 18_000_000 picoseconds. - Weight::from_parts(18_802_178, 0) + Weight::from_parts(20_865_732, 0) .saturating_add(Weight::from_parts(0, 3854)) - // Standard Error: 587 - .saturating_add(Weight::from_parts(112_449, 0).saturating_mul(p.into())) + // 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())) .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,13 +216,11 @@ 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: 28_000_000 picoseconds. - Weight::from_parts(29_779_778, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(36_446_790, 0) .saturating_add(Weight::from_parts(0, 4032)) - // Standard Error: 104 - .saturating_add(Weight::from_parts(789, 0).saturating_mul(b.into())) - // Standard Error: 1_073 - .saturating_add(Weight::from_parts(128_305, 0).saturating_mul(p.into())) + // Standard Error: 5_509 + .saturating_add(Weight::from_parts(182_123, 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())) @@ -245,11 +243,11 @@ 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: 20_000_000 picoseconds. - Weight::from_parts(20_815_416, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(25_330_921, 0) .saturating_add(Weight::from_parts(0, 3874)) - // Standard Error: 689 - .saturating_add(Weight::from_parts(113_104, 0).saturating_mul(p.into())) + // Standard Error: 4_098 + .saturating_add(Weight::from_parts(120_401, 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())) @@ -274,13 +272,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: 30_000_000 picoseconds. - Weight::from_parts(32_855_426, 0) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(31_661_426, 0) .saturating_add(Weight::from_parts(0, 4052)) - // Standard Error: 1_179 - .saturating_add(Weight::from_parts(1_316, 0).saturating_mul(m.into())) - // Standard Error: 1_150 - .saturating_add(Weight::from_parts(126_969, 0).saturating_mul(p.into())) + // 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())) .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 +298,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: 11_000_000 picoseconds. - Weight::from_parts(11_369_868, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_462_960, 0) .saturating_add(Weight::from_parts(0, 1711)) - // Standard Error: 556 - .saturating_add(Weight::from_parts(102_481, 0).saturating_mul(p.into())) + // Standard Error: 2_892 + .saturating_add(Weight::from_parts(121_652, 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 454b22dcf..357351a7e 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 78_000_000 picoseconds. - Weight::from_parts(81_000_000, 0) + // Minimum execution time: 88_000_000 picoseconds. + Weight::from_parts(109_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: 113_000_000 picoseconds. - Weight::from_parts(117_000_000, 0) + // Minimum execution time: 131_000_000 picoseconds. + Weight::from_parts(145_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: 86_000_000 picoseconds. - Weight::from_parts(88_000_000, 0) + // Minimum execution time: 103_000_000 picoseconds. + Weight::from_parts(119_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: 40_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(60_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: 40_000_000 picoseconds. - Weight::from_parts(127_759_577, 0) + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(91_282_789, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 247_296 - .saturating_add(Weight::from_parts(31_633_691, 0).saturating_mul(r.into())) + // Standard Error: 346_446 + .saturating_add(Weight::from_parts(37_516_946, 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: 17_000_000 picoseconds. - Weight::from_parts(153_324_605, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(55_128_879, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 263_649 - .saturating_add(Weight::from_parts(30_778_339, 0).saturating_mul(r.into())) + // Standard Error: 314_940 + .saturating_add(Weight::from_parts(37_330_071, 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: 64_000_000 picoseconds. - Weight::from_parts(67_000_000, 0) + // Minimum execution time: 71_000_000 picoseconds. + Weight::from_parts(82_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 5f45a3634..bec801e1a 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -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)) @@ -101,8 +101,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `72` // Estimated: `69050` - // Minimum execution time: 5_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(7_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -128,7 +128,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `0` // Estimated: `0` // Minimum execution time: 79_000_000 picoseconds. - Weight::from_parts(80_000_000, 0) + Weight::from_parts(92_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -154,8 +154,8 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `65667` // Estimated: `69050` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(38_000_000, 0) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(43_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: 44_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -183,7 +183,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `65667` // Estimated: `69050` // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(50_000_000, 0) + Weight::from_parts(59_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 da8869f11..170dae6cc 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 44_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(50_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_007, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_118, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -90,8 +90,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Minimum execution time: 12_000_000 picoseconds. Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_003, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_120, 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: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_126, 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: 40_000_000 picoseconds. - Weight::from_parts(41_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(52_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: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(30_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,8 +156,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 15_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(1)) @@ -170,8 +170,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(18_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: 9_000_000 picoseconds. - Weight::from_parts(10_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)) @@ -199,7 +199,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + 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)) @@ -214,8 +214,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(13_000_000, 0) + // Minimum execution time: 17_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)) @@ -229,7 +229,7 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Measured: `106` // Estimated: `3544` // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + 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)) @@ -242,8 +242,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(8_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + 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)) @@ -261,11 +261,11 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `181 + n * (203 ±0)` // Estimated: `990 + n * (2591 ±0)` - // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(53_000_000, 0) + // Minimum execution time: 55_000_000 picoseconds. + Weight::from_parts(58_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 22_653 - .saturating_add(Weight::from_parts(50_300_431, 0).saturating_mul(n.into())) + // Standard Error: 47_893 + .saturating_add(Weight::from_parts(57_129_527, 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 36bf65747..d99a916e8 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -65,10 +65,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `153 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(13_135_940, 0) + Weight::from_parts(13_868_651, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_839 - .saturating_add(Weight::from_parts(1_292, 0).saturating_mul(p.into())) + // Standard Error: 6_453 + .saturating_add(Weight::from_parts(55_112, 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: 29_000_000 picoseconds. - Weight::from_parts(29_778_618, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(34_034_765, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_462 - .saturating_add(Weight::from_parts(121_996, 0).saturating_mul(a.into())) - // Standard Error: 2_544 - .saturating_add(Weight::from_parts(13_681, 0).saturating_mul(p.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -101,15 +101,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: 18_000_000 picoseconds. - Weight::from_parts(19_593_958, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(20_696_926, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 1_731 - .saturating_add(Weight::from_parts(93_827, 0).saturating_mul(a.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -123,11 +125,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `329 + a * (56 ±0)` // Estimated: `5302` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_112_704, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(21_877_742, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 1_910 - .saturating_add(Weight::from_parts(108_487, 0).saturating_mul(a.into())) + // Standard Error: 7_182 + .saturating_add(Weight::from_parts(138_873, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -144,12 +146,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(24_595_286, 0) + Weight::from_parts(27_954_010, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_019 - .saturating_add(Weight::from_parts(126_646, 0).saturating_mul(a.into())) - // Standard Error: 2_086 - .saturating_add(Weight::from_parts(24_659, 0).saturating_mul(p.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -161,10 +163,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_200_551, 0) + Weight::from_parts(21_897_500, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 2_421 - .saturating_add(Weight::from_parts(14_139, 0).saturating_mul(p.into())) + // Standard Error: 8_123 + .saturating_add(Weight::from_parts(29_671, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -175,39 +177,39 @@ 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(20_074_833, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(22_418_603, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 2_738 - .saturating_add(Weight::from_parts(17_987, 0).saturating_mul(p.into())) + // Standard Error: 7_503 + .saturating_add(Weight::from_parts(14_007, 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: 18_000_000 picoseconds. - Weight::from_parts(19_694_090, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(22_214_453, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 3_886 - .saturating_add(Weight::from_parts(38_911, 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: 19_000_000 picoseconds. - Weight::from_parts(21_849_560, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(22_971_370, 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)) } @@ -219,10 +221,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `174 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_947_736, 0) + Weight::from_parts(22_291_424, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_368 - .saturating_add(Weight::from_parts(5_527, 0).saturating_mul(p.into())) + // Standard Error: 7_580 + .saturating_add(Weight::from_parts(1_967, 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 fbf1154d0..07b3722cd 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 29_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(41_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: 37_000_000 picoseconds. - Weight::from_parts(37_000_000, 0) + // Minimum execution time: 39_000_000 picoseconds. + Weight::from_parts(45_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: `3276` + // Measured: `3309` // Estimated: `42428` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(41_000_000, 0) + // Minimum execution time: 43_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)) @@ -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: `3296` + // Measured: `3329` // Estimated: `42428` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(41_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(51_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: 43_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(53_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: 42_000_000 picoseconds. - Weight::from_parts(43_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)) @@ -159,8 +159,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `425` // Estimated: `4377` - // Minimum execution time: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_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: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(31_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: 24_000_000 picoseconds. - Weight::from_parts(25_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(29_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: 80_000_000 picoseconds. - Weight::from_parts(81_000_000, 0) + // Minimum execution time: 83_000_000 picoseconds. + Weight::from_parts(87_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: 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, 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: `3162` + // Measured: `3209` // Estimated: `42428` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(34_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: `3162` + // Measured: `3195` // Estimated: `42428` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(35_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: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(16_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: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(17_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: 15_000_000 picoseconds. - Weight::from_parts(16_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)) @@ -309,8 +309,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3044` // Estimated: `5477` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(21_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -323,8 +323,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `354` // Estimated: `42428` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_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)) @@ -337,8 +337,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `42428` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_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)) @@ -365,8 +365,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `42428` - // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(22_000_000, 0) + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -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: 18_000_000 picoseconds. - Weight::from_parts(19_000_000, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(25_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,8 +409,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `42428` - // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(19_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)) @@ -423,8 +423,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `42428` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 18_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)) @@ -437,8 +437,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `447` // Estimated: `42428` - // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 18_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)) @@ -453,8 +453,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `447` // Estimated: `83866` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(34_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: 19_000_000 picoseconds. - Weight::from_parts(19_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)) @@ -485,8 +485,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `4377` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(20_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 b5a94f598..00e8f0842 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -74,11 +74,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 2_000_000 picoseconds. - Weight::from_parts(5_467_868, 0) + // Minimum execution time: 3_000_000 picoseconds. + Weight::from_parts(6_061_103, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_549 - .saturating_add(Weight::from_parts(358_732, 0).saturating_mul(s.into())) + // Standard Error: 3_856 + .saturating_add(Weight::from_parts(389_514, 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: 15_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 3644)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(423, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(486, 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())) @@ -144,7 +144,7 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_000_000 picoseconds. + // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) } @@ -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(10_470_823, 0) + Weight::from_parts(11_517_176, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_522 - .saturating_add(Weight::from_parts(349_517, 0).saturating_mul(s.into())) + // Standard Error: 5_666 + .saturating_add(Weight::from_parts(402_645, 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_154_775, 0) + Weight::from_parts(11_836_816, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_155 - .saturating_add(Weight::from_parts(570_400, 0).saturating_mul(s.into())) + // Standard Error: 7_709 + .saturating_add(Weight::from_parts(653_066, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -189,11 +189,11 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `255 + s * (185 ±0)` // Estimated: `42428` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(13_980_235, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(15_472_235, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_964 - .saturating_add(Weight::from_parts(358_521, 0).saturating_mul(s.into())) + // Standard Error: 7_183 + .saturating_add(Weight::from_parts(429_623, 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_459_673, 0) + Weight::from_parts(13_326_693, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 2_778 - .saturating_add(Weight::from_parts(588_797, 0).saturating_mul(s.into())) + // Standard Error: 7_954 + .saturating_add(Weight::from_parts(699_188, 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 aef597f56..648610786 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-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(10_000_000, 0) + Weight::from_parts(12_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 169352220..4933c5da1 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -61,7 +61,7 @@ impl pallet_timestamp::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `6` // Estimated: `1493` - // 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, 1493)) .saturating_add(T::DbWeight::get().reads(1)) diff --git a/runtime/crab/src/weights/pallet_treasury.rs b/runtime/crab/src/weights/pallet_treasury.rs index 62c4e44b3..deaa9b1ad 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -79,8 +79,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `208` // Estimated: `1489` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(23_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,8 +93,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `470` // Estimated: `6172` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(37_000_000, 0) + // Minimum execution time: 37_000_000 picoseconds. + Weight::from_parts(38_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: `470 + p * (8 ±0)` // Estimated: `3549` // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(8_639_558, 0) + Weight::from_parts(10_154_898, 0) .saturating_add(Weight::from_parts(0, 3549)) - // Standard Error: 707 - .saturating_add(Weight::from_parts(18_205, 0).saturating_mul(p.into())) + // Standard Error: 2_396 + .saturating_add(Weight::from_parts(34_416, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -122,7 +122,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127` // Estimated: `1887` - // Minimum execution time: 5_000_000 picoseconds. + // Minimum execution time: 6_000_000 picoseconds. Weight::from_parts(6_000_000, 0) .saturating_add(Weight::from_parts(0, 1887)) .saturating_add(T::DbWeight::get().reads(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(149_309_488, 0) + Weight::from_parts(18_314_921, 0) .saturating_add(Weight::from_parts(0, 3581)) - // Standard Error: 228_094 - .saturating_add(Weight::from_parts(2_150_806, 0).saturating_mul(p.into())) + // Standard Error: 32_528 + .saturating_add(Weight::from_parts(2_782_967, 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: `42` // Estimated: `1489` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(12_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,8 +175,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `315` // Estimated: `6172` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(48_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)) @@ -188,7 +188,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `148` // Estimated: `3522` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + Weight::from_parts(13_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(10_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)) diff --git a/runtime/crab/src/weights/pallet_tx_pause.rs b/runtime/crab/src/weights/pallet_tx_pause.rs index e0fe27272..9da3fe68f 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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_tx_pause::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `4` // Estimated: `3997` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // Minimum execution time: 9_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)) @@ -73,8 +73,8 @@ impl pallet_tx_pause::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `566` // Estimated: `3997` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(17_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 f7f48c85e..b2d7dfdb7 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(14_705_375, 0) + Weight::from_parts(20_124_325, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 2_279 - .saturating_add(Weight::from_parts(4_479_733, 0).saturating_mul(c.into())) + // Standard Error: 20_837 + .saturating_add(Weight::from_parts(4_967_840, 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: 6_000_000 picoseconds. + // Minimum execution time: 7_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(14_269_732, 0) + Weight::from_parts(11_330_409, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 2_782 - .saturating_add(Weight::from_parts(4_694_927, 0).saturating_mul(c.into())) + // Standard Error: 19_792 + .saturating_add(Weight::from_parts(5_257_682, 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(19_242_416, 0) + Weight::from_parts(2_679_311, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 3_223 - .saturating_add(Weight::from_parts(4_480_011, 0).saturating_mul(c.into())) + // Standard Error: 21_388 + .saturating_add(Weight::from_parts(5_053_368, 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 af7e39822..142bb54ba 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("crab-dev")`, DB CACHE: 1024 @@ -66,7 +66,7 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Measured: `48` // Estimated: `3544` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -81,7 +81,7 @@ impl pallet_whitelist::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // 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, 3544)) .saturating_add(T::DbWeight::get().reads(3)) @@ -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: 22_000_000 picoseconds. + // Minimum execution time: 23_000_000 picoseconds. Weight::from_parts(23_000_000, 0) .saturating_add(Weight::from_parts(0, 3716)) - // Standard Error: 0 - .saturating_add(Weight::from_parts(418, 0).saturating_mul(n.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(506, 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(17_227_831, 0) + Weight::from_parts(19_545_715, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 5 - .saturating_add(Weight::from_parts(976, 0).saturating_mul(n.into())) + // Standard Error: 34 + .saturating_add(Weight::from_parts(949, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index 4be4e2128..3b2aeab24 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -252,7 +252,6 @@ frame_benchmarking::define_benchmarks! { [pallet_balances, Balances] [pallet_collective, TechnicalCommittee] [pallet_conviction_voting, ConvictionVoting] - [pallet_evm, EVM] [pallet_message_queue, MessageQueue] [pallet_preimage, Preimage] [pallet_proxy, Proxy] diff --git a/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs b/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs index c067e3540..eef5c2bcb 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 37_263 - .saturating_add(Weight::from_parts(100_294_011, 0).saturating_mul(n.into())) + // Standard Error: 57_770 + .saturating_add(Weight::from_parts(104_402_544, 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 6c21b1c52..ef97eb03c 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(12_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)) @@ -138,7 +138,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Measured: `65677` // Estimated: `69142` // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(48_000_000, 0) + 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,7 +151,7 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for WeightIn // Proof Size summary in bytes: // Measured: `65676` // Estimated: `69141` - // Minimum execution time: 28_000_000 picoseconds. + // Minimum execution time: 30_000_000 picoseconds. Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 69141)) .saturating_add(T::DbWeight::get().reads(2)) diff --git a/runtime/darwinia/src/weights/darwinia_account_migration.rs b/runtime/darwinia/src/weights/darwinia_account_migration.rs index 322ec6de7..e74294041 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -61,27 +61,19 @@ 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: `AccountMigration::Ledgers` (r:1 w:1) - /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(1845), added: 4320, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:3) + /// Storage: `System::Account` (r:0 w:1) /// 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: `28434` - // Estimated: `31899` - // Minimum execution time: 118_000_000 picoseconds. - Weight::from_parts(120_000_000, 0) - .saturating_add(Weight::from_parts(0, 31899)) - .saturating_add(T::DbWeight::get().reads(7)) - .saturating_add(T::DbWeight::get().writes(11)) + // 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)) } /// Storage: `AccountMigration::Multisigs` (r:0 w:1) /// Proof: `AccountMigration::Multisigs` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -91,34 +83,25 @@ 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: `AccountMigration::Ledgers` (r:1 w:1) - /// Proof: `AccountMigration::Ledgers` (`max_values`: None, `max_size`: Some(1845), added: 4320, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:3) + /// Storage: `System::Account` (r:0 w:1) /// 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: `2 + x * (161 ±0) + z * (161 ±0)` - // Minimum execution time: 7_000_000 picoseconds. - Weight::from_parts(19_533_534, 0) - .saturating_add(Weight::from_parts(0, 2)) - // Standard Error: 10_492 - .saturating_add(Weight::from_parts(14_924, 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())) + // 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())) } /// Storage: `AccountMigration::Multisigs` (r:1 w:1) /// Proof: `AccountMigration::Multisigs` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -128,8 +111,8 @@ impl darwinia_account_migration::WeightInfo for WeightI // Proof Size summary in bytes: // Measured: `3499` // Estimated: `6964` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(13_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 cf09d4b7f..10e8bffe9 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -69,8 +69,8 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26812` // Estimated: `29615` - // Minimum execution time: 77_000_000 picoseconds. - Weight::from_parts(85_000_000, 0) + // 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)) @@ -85,8 +85,8 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26541` // Estimated: `29615` - // Minimum execution time: 927_000_000 picoseconds. - Weight::from_parts(1_003_000_000, 0) + // 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)) @@ -105,16 +105,47 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26863` // Estimated: `29615` - // Minimum execution time: 87_000_000 picoseconds. - Weight::from_parts(97_000_000, 0) + // 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) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Deposit::DepositContract` (r:1 w:0) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) + /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `EVM::AccountCodes` (r:2 w:0) + /// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:0) + /// 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 { - 0.into() + // 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) + .saturating_add(Weight::from_parts(0, 33424)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: `Deposit::DepositContract` (r:0 w:1) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_deposit_contract() -> Weight { - 0.into() + // 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)) + .saturating_add(T::DbWeight::get().writes(1)) } } diff --git a/runtime/darwinia/src/weights/darwinia_staking.rs b/runtime/darwinia/src/weights/darwinia_staking.rs index 654162255..c163ff458 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -70,11 +70,11 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `7088 + x * (25 ±0)` // Estimated: `29615` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(646_150_780, 0) + // Minimum execution time: 52_000_000 picoseconds. + Weight::from_parts(770_181_918, 0) .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 240_459 - .saturating_add(Weight::from_parts(12_288_123, 0).saturating_mul(x.into())) + // 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)) } @@ -94,10 +94,10 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Measured: `7415 + x * (26 ±0)` // Estimated: `29615` // Minimum execution time: 51_000_000 picoseconds. - Weight::from_parts(683_421_871, 0) + Weight::from_parts(755_853_947, 0) .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 245_535 - .saturating_add(Weight::from_parts(12_549_577, 0).saturating_mul(x.into())) + // 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)) } @@ -121,10 +121,10 @@ impl darwinia_staking::WeightInfo for WeightInfo { /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn nominate() -> Weight { // Proof Size summary in bytes: - // Measured: `574` + // Measured: `600` // Estimated: `4543` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 4543)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -154,8 +154,8 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `2184` // Estimated: `83902` - // Minimum execution time: 520_000_000 picoseconds. - Weight::from_parts(537_000_000, 0) + // 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)) @@ -171,25 +171,14 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_ring_staking_contract() -> 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)) - .saturating_add(T::DbWeight::get().writes(1)) - } /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// 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: // 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/darwinia/src/weights/frame_system.rs b/runtime/darwinia/src/weights/frame_system.rs index 0b7cacf31..3febf6169 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -61,21 +61,21 @@ impl frame_system::WeightInfo for WeightInfo { // Measured: `0` // Estimated: `0` // Minimum execution time: 1_000_000 picoseconds. - Weight::from_parts(1_295_116, 0) + Weight::from_parts(2_022_883, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(150, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(158, 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: 0 - .saturating_add(Weight::from_parts(939, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_004, 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: 67_266_000_000 picoseconds. - Weight::from_parts(70_085_000_000, 0) + // Minimum execution time: 68_735_000_000 picoseconds. + Weight::from_parts(75_159_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_360 - .saturating_add(Weight::from_parts(760_657, 0).saturating_mul(i.into())) + // Standard Error: 2_238 + .saturating_add(Weight::from_parts(796_198, 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: 1_000_000 picoseconds. + // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 840 - .saturating_add(Weight::from_parts(536_307, 0).saturating_mul(i.into())) + // Standard Error: 1_484 + .saturating_add(Weight::from_parts(567_851, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -146,13 +146,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `99 + p * (69 ±0)` - // Estimated: `101 + p * (70 ±0)` + // Measured: `97 + p * (69 ±0)` + // Estimated: `102 + p * (70 ±0)` // Minimum execution time: 3_000_000 picoseconds. Weight::from_parts(4_000_000, 0) - .saturating_add(Weight::from_parts(0, 101)) - // Standard Error: 1_241 - .saturating_add(Weight::from_parts(983_046, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 102)) + // Standard Error: 3_104 + .saturating_add(Weight::from_parts(1_048_017, 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(8_000_000, 0) + Weight::from_parts(11_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: 69_629_000_000 picoseconds. - Weight::from_parts(74_577_000_000, 0) + // Minimum execution time: 70_228_000_000 picoseconds. + Weight::from_parts(79_493_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 218905813..e4081918f 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -67,8 +67,8 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `276` // Estimated: `3741` - // 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, 3741)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) @@ -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: 16_000_000 picoseconds. - Weight::from_parts(16_810_363, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_795_668, 0) .saturating_add(Weight::from_parts(0, 3983)) - // Standard Error: 2_082 - .saturating_add(Weight::from_parts(329_481, 0).saturating_mul(x.into())) + // Standard Error: 5_207 + .saturating_add(Weight::from_parts(392_816, 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: 24_000_000 picoseconds. - Weight::from_parts(25_440_012, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(28_440_466, 0) .saturating_add(Weight::from_parts(0, 4303)) - // Standard Error: 3_740 - .saturating_add(Weight::from_parts(336_831, 0).saturating_mul(x.into())) + // Standard Error: 6_795 + .saturating_add(Weight::from_parts(386_150, 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())) @@ -124,11 +124,11 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `196 + x * (5 ±0)` // Estimated: `1678 + x * (5 ±0)` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(9_832_398, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(11_889_301, 0) .saturating_add(Weight::from_parts(0, 1678)) - // Standard Error: 1_647 - .saturating_add(Weight::from_parts(290_226, 0).saturating_mul(x.into())) + // Standard Error: 4_468 + .saturating_add(Weight::from_parts(336_614, 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())) @@ -146,11 +146,11 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `486 + x * (10 ±0)` // Estimated: `3949 + x * (10 ±0)` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(17_425_346, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_650_636, 0) .saturating_add(Weight::from_parts(0, 3949)) - // Standard Error: 4_402 - .saturating_add(Weight::from_parts(311_738, 0).saturating_mul(x.into())) + // Standard Error: 5_638 + .saturating_add(Weight::from_parts(331_744, 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 b1c98a9d2..1e2943cb0 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -73,7 +73,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: `571 + c * (183 ±0)` + // Measured: `577 + c * (183 ±0)` // Estimated: `3631 + c * (2591 ±0)` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 10_861 - .saturating_add(Weight::from_parts(10_816_720, 0).saturating_mul(c.into())) + // Standard Error: 19_912 + .saturating_add(Weight::from_parts(11_438_394, 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: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 4_003 - .saturating_add(Weight::from_parts(4_025_329, 0).saturating_mul(a.into())) + // Standard Error: 9_699 + .saturating_add(Weight::from_parts(4_253_783, 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(11_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)) @@ -169,8 +169,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(32_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: 36_000_000 picoseconds. - Weight::from_parts(37_000_000, 0) + Weight::from_parts(42_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: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 0) + // Minimum execution time: 32_000_000 picoseconds. + Weight::from_parts(33_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: 37_000_000 picoseconds. - Weight::from_parts(38_000_000, 0) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(45_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: 14_000_000 picoseconds. - Weight::from_parts(14_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(1)) @@ -246,7 +246,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `410` // Estimated: `3631` // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_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(1)) @@ -257,8 +257,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + 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)) @@ -284,7 +284,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `350` // Estimated: `3631` // 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, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .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(10_000_000, 0) + Weight::from_parts(12_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_858_895, 0) + Weight::from_parts(12_129_697, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 848 - .saturating_add(Weight::from_parts(1_298, 0).saturating_mul(n.into())) - // Standard Error: 848 - .saturating_add(Weight::from_parts(1_897, 0).saturating_mul(s.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -329,8 +329,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // 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(18_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -341,13 +341,17 @@ 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: 10_000_000 picoseconds. - Weight::from_parts(11_598_205, 0) + Weight::from_parts(10_891_526, 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())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -359,8 +363,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(13_000_000, 0) + // Minimum execution time: 14_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(1)) @@ -386,7 +390,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `307` // Estimated: `3631` // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_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)) @@ -404,7 +408,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `599` // Estimated: `6168` // Minimum execution time: 43_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + Weight::from_parts(47_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -417,7 +421,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `457` // Estimated: `3631` - // Minimum execution time: 17_000_000 picoseconds. + // Minimum execution time: 16_000_000 picoseconds. Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -443,7 +447,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: 11_000_000 picoseconds. Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) @@ -459,7 +463,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 30_000_000 picoseconds. + // Minimum execution time: 29_000_000 picoseconds. Weight::from_parts(31_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) @@ -473,8 +477,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(29_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)) @@ -490,7 +494,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `556` // Estimated: `3631` // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + Weight::from_parts(28_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -503,7 +507,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `448` // Estimated: `3631` - // Minimum execution time: 27_000_000 picoseconds. + // 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)) @@ -517,7 +521,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 14_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)) diff --git a/runtime/darwinia/src/weights/pallet_balances.rs b/runtime/darwinia/src/weights/pallet_balances.rs index 6c40404ca..9c332b819 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 44_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(53_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(38_000_000, 0) + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(43_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: 14_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_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: `195` // Estimated: `3581` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_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: `234` // Estimated: `6172` - // Minimum execution time: 46_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 45_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)) @@ -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: `156 + u * (124 ±0)` + // Measured: `190 + 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: 16_859 - .saturating_add(Weight::from_parts(13_076_232, 0).saturating_mul(u.into())) + // Standard Error: 21_312 + .saturating_add(Weight::from_parts(13_977_832, 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/darwinia/src/weights/pallet_collective.rs b/runtime/darwinia/src/weights/pallet_collective.rs index d96a4247d..a2bba17a5 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -69,14 +69,14 @@ impl pallet_collective::WeightInfo for WeightInfo { fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + m * (2021 ±0) + p * (2026 ±0)` - // Estimated: `12200 + m * (1231 ±15) + p * (3660 ±15)` + // Estimated: `12200 + m * (1231 ±14) + p * (3660 ±14)` // Minimum execution time: 10_000_000 picoseconds. Weight::from_parts(11_000_000, 0) .saturating_add(Weight::from_parts(0, 12200)) - // Standard Error: 59_966 - .saturating_add(Weight::from_parts(2_724_746, 0).saturating_mul(m.into())) - // Standard Error: 59_966 - .saturating_add(Weight::from_parts(5_047_021, 0).saturating_mul(p.into())) + // 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())) .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(11_281_809, 0) + Weight::from_parts(12_240_775, 0) .saturating_add(Weight::from_parts(0, 1554)) - // Standard Error: 40 - .saturating_add(Weight::from_parts(1_264, 0).saturating_mul(b.into())) - // Standard Error: 420 - .saturating_add(Weight::from_parts(4_440, 0).saturating_mul(m.into())) + // 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())) .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(12_974_317, 0) + Weight::from_parts(14_648_786, 0) .saturating_add(Weight::from_parts(0, 3534)) - // Standard Error: 44 - .saturating_add(Weight::from_parts(1_235, 0).saturating_mul(b.into())) - // Standard Error: 457 - .saturating_add(Weight::from_parts(7_401, 0).saturating_mul(m.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -140,14 +140,14 @@ impl pallet_collective::WeightInfo for WeightInfo { // 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(18_523_259, 0) + Weight::from_parts(19_890_728, 0) .saturating_add(Weight::from_parts(0, 3751)) - // Standard Error: 69 - .saturating_add(Weight::from_parts(948, 0).saturating_mul(b.into())) - // Standard Error: 727 - .saturating_add(Weight::from_parts(7_919, 0).saturating_mul(m.into())) - // Standard Error: 718 - .saturating_add(Weight::from_parts(117_169, 0).saturating_mul(p.into())) + // 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())) .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 +163,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(15_359_237, 0) + Weight::from_parts(18_419_291, 0) .saturating_add(Weight::from_parts(0, 4296)) - // Standard Error: 720 - .saturating_add(Weight::from_parts(8_818, 0).saturating_mul(m.into())) + // Standard Error: 3_323 + .saturating_add(Weight::from_parts(11_124, 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 +186,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(18_928_975, 0) + Weight::from_parts(21_904_391, 0) .saturating_add(Weight::from_parts(0, 3854)) - // Standard Error: 858 - .saturating_add(Weight::from_parts(10_089, 0).saturating_mul(m.into())) - // Standard Error: 837 - .saturating_add(Weight::from_parts(117_526, 0).saturating_mul(p.into())) + // 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())) .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,15 +212,13 @@ 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: 27_000_000 picoseconds. - Weight::from_parts(28_636_530, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(31_689_539, 0) .saturating_add(Weight::from_parts(0, 4028)) - // Standard Error: 92 - .saturating_add(Weight::from_parts(584, 0).saturating_mul(b.into())) - // Standard Error: 976 - .saturating_add(Weight::from_parts(2_264, 0).saturating_mul(m.into())) - // Standard Error: 952 - .saturating_add(Weight::from_parts(127_220, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -243,13 +241,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: 20_000_000 picoseconds. - Weight::from_parts(21_425_355, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(22_644_454, 0) .saturating_add(Weight::from_parts(0, 3874)) - // Standard Error: 673 - .saturating_add(Weight::from_parts(3_424, 0).saturating_mul(m.into())) - // Standard Error: 656 - .saturating_add(Weight::from_parts(116_574, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -272,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: 29_000_000 picoseconds. - Weight::from_parts(31_047_662, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(34_238_646, 0) .saturating_add(Weight::from_parts(0, 4048)) - // Standard Error: 130 - .saturating_add(Weight::from_parts(587, 0).saturating_mul(b.into())) - // Standard Error: 1_349 - .saturating_add(Weight::from_parts(138_483, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -297,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(11_835_833, 0) + Weight::from_parts(12_804_007, 0) .saturating_add(Weight::from_parts(0, 1711)) - // Standard Error: 615 - .saturating_add(Weight::from_parts(109_439, 0).saturating_mul(p.into())) + // Standard Error: 2_831 + .saturating_add(Weight::from_parts(128_548, 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 61f408759..3fc1ec2c1 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 82_000_000 picoseconds. - Weight::from_parts(86_000_000, 0) + // Minimum execution time: 90_000_000 picoseconds. + Weight::from_parts(100_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: 115_000_000 picoseconds. - Weight::from_parts(118_000_000, 0) + // Minimum execution time: 124_000_000 picoseconds. + Weight::from_parts(149_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: 93_000_000 picoseconds. - Weight::from_parts(97_000_000, 0) + // Minimum execution time: 96_000_000 picoseconds. + Weight::from_parts(111_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: 45_000_000 picoseconds. - Weight::from_parts(47_000_000, 0) + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(57_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: 41_000_000 picoseconds. - Weight::from_parts(99_814_644, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(107_491_225, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 303_431 - .saturating_add(Weight::from_parts(34_505_600, 0).saturating_mul(r.into())) + // Standard Error: 345_022 + .saturating_add(Weight::from_parts(37_023_763, 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: 18_000_000 picoseconds. - Weight::from_parts(63_087_454, 0) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(49_135_530, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 340_241 - .saturating_add(Weight::from_parts(34_766_287, 0).saturating_mul(r.into())) + // Standard Error: 355_033 + .saturating_add(Weight::from_parts(37_751_665, 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: 72_000_000 picoseconds. - Weight::from_parts(79_000_000, 0) + // Minimum execution time: 74_000_000 picoseconds. + Weight::from_parts(90_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 f40205bce..f6a0c3bef 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 5_000_000 picoseconds. + // Minimum execution time: 4_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: 81_000_000 picoseconds. - Weight::from_parts(82_000_000, 0) + // Minimum execution time: 83_000_000 picoseconds. + Weight::from_parts(91_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) .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: 44_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 42_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) .saturating_add(Weight::from_parts(0, 69050)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -183,7 +183,7 @@ impl pallet_message_queue::WeightInfo for WeightInfo // Measured: `65667` // Estimated: `69050` // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(57_000_000, 0) + Weight::from_parts(63_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 56241dc51..97f95ceeb 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 47_000_000 picoseconds. - Weight::from_parts(48_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_090, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(1_165, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -90,8 +90,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_080, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_164, 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: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_045, 0).saturating_mul(s.into())) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_124, 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: 44_000_000 picoseconds. - Weight::from_parts(45_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(53_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: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(27_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,8 +156,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // Minimum execution time: 12_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 16_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(1)) @@ -170,8 +170,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(16_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: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + 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)) @@ -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(9_000_000, 0) + // Minimum execution time: 9_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)) @@ -214,8 +214,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(15_000_000, 0) + // Minimum execution time: 16_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)) @@ -228,8 +228,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(9_000_000, 0) + // Minimum execution time: 9_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)) @@ -242,8 +242,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(9_000_000, 0) + // Minimum execution time: 9_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)) @@ -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: `249 + n * (203 ±0)` + // Measured: `270 + n * (203 ±0)` // Estimated: `990 + n * (2591 ±0)` - // Minimum execution time: 56_000_000 picoseconds. - Weight::from_parts(56_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: 22_480 - .saturating_add(Weight::from_parts(52_910_356, 0).saturating_mul(n.into())) + // Standard Error: 51_485 + .saturating_add(Weight::from_parts(57_512_634, 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 b6e2b080b..f384a61bb 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(12_023_213, 0) + Weight::from_parts(13_108_108, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_162 - .saturating_add(Weight::from_parts(2_112, 0).saturating_mul(p.into())) + // Standard Error: 5_981 + .saturating_add(Weight::from_parts(7_080, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Proxy::Proxies` (r:1 w:0) @@ -77,17 +77,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 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: 29_000_000 picoseconds. - Weight::from_parts(29_924_775, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(33_686_226, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_717 - .saturating_add(Weight::from_parts(119_376, 0).saturating_mul(a.into())) - // Standard Error: 2_808 - .saturating_add(Weight::from_parts(16_783, 0).saturating_mul(p.into())) + // Standard Error: 11_152 + .saturating_add(Weight::from_parts(104_511, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -102,10 +100,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `329 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_851_030, 0) + Weight::from_parts(22_564_195, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_110 - .saturating_add(Weight::from_parts(119_938, 0).saturating_mul(a.into())) + // Standard Error: 8_176 + .saturating_add(Weight::from_parts(135_367, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -120,12 +118,12 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `329 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(20_304_126, 0) + Weight::from_parts(21_930_472, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_237 - .saturating_add(Weight::from_parts(133_692, 0).saturating_mul(a.into())) - // Standard Error: 2_311 - .saturating_add(Weight::from_parts(5_486, 0).saturating_mul(p.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -141,13 +139,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: 27_000_000 picoseconds. - Weight::from_parts(27_284_753, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(29_590_481, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_221 - .saturating_add(Weight::from_parts(119_893, 0).saturating_mul(a.into())) - // Standard Error: 2_294 - .saturating_add(Weight::from_parts(12_747, 0).saturating_mul(p.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -158,11 +156,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `149 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(21_921_957, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(22_575_376, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_693 - .saturating_add(Weight::from_parts(9_667, 0).saturating_mul(p.into())) + // Standard Error: 7_376 + .saturating_add(Weight::from_parts(34_705, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -174,10 +172,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_865_165, 0) + Weight::from_parts(22_895_966, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_852 - .saturating_add(Weight::from_parts(7_270, 0).saturating_mul(p.into())) + // Standard Error: 7_963 + .saturating_add(Weight::from_parts(11_728, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -189,38 +187,38 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `149 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(20_898_631, 0) + Weight::from_parts(21_817_261, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 2_130 - .saturating_add(Weight::from_parts(23_928, 0).saturating_mul(p.into())) + // Standard Error: 7_639 + .saturating_add(Weight::from_parts(17_057, 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: 22_000_000 picoseconds. - Weight::from_parts(22_881_540, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(24_370_900, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_227 - .saturating_add(Weight::from_parts(9_307, 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 `[0, 30]`. - fn kill_pure(_p: u32, ) -> Weight { + fn kill_pure(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `174 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_935_467, 0) + Weight::from_parts(22_602_233, 0) .saturating_add(Weight::from_parts(0, 4310)) + // Standard Error: 10_018 + .saturating_add(Weight::from_parts(38_000, 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 274a53a03..a3f428328 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 0) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(38_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -80,7 +80,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `516` // Estimated: `83866` // Minimum execution time: 37_000_000 picoseconds. - Weight::from_parts(39_000_000, 0) + Weight::from_parts(38_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: `3314` // Estimated: `42428` - // Minimum execution time: 43_000_000 picoseconds. - Weight::from_parts(43_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(55_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: `3334` // Estimated: `42428` - // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(43_000_000, 0) + // Minimum execution time: 44_000_000 picoseconds. + Weight::from_parts(54_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -132,7 +132,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `516` // Estimated: `83866` // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(47_000_000, 0) + Weight::from_parts(52_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(47_000_000, 0) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(52_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -160,7 +160,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `425` // Estimated: `4377` // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + 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: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -203,8 +203,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `880` // Estimated: `83866` - // Minimum execution time: 85_000_000 picoseconds. - Weight::from_parts(86_000_000, 0) + // Minimum execution time: 82_000_000 picoseconds. + Weight::from_parts(96_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: 7_000_000 picoseconds. - Weight::from_parts(8_000_000, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(10_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: `3195` + // Measured: `3179` // Estimated: `42428` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 29_000_000 picoseconds. + Weight::from_parts(37_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: `3209` + // Measured: `3165` // Estimated: `42428` // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(30_000_000, 0) + 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)) @@ -263,8 +263,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(14_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(17_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: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(16_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: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(19_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: 16_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(19_000_000, 0) .saturating_add(Weight::from_parts(0, 5477)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -338,7 +338,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `390` // Estimated: `42428` // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(17_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)) @@ -350,7 +350,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `299` // Estimated: `4377` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + Weight::from_parts(16_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,8 +381,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `42428` - // 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, 42428)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -395,8 +395,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: 21_000_000 picoseconds. + Weight::from_parts(25_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(19_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)) @@ -423,8 +423,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `42428` - // Minimum execution time: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 18_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)) @@ -453,8 +453,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `447` // Estimated: `83866` - // Minimum execution time: 27_000_000 picoseconds. - Weight::from_parts(28_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(33_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(4)) @@ -486,7 +486,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `443` // Estimated: `4377` // Minimum execution time: 16_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + Weight::from_parts(21_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: 12_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(16_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 f95c1b1ed..5258d51fa 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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_597_112, 0) + Weight::from_parts(5_871_990, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_626 - .saturating_add(Weight::from_parts(378_421, 0).saturating_mul(s.into())) + // Standard Error: 3_474 + .saturating_add(Weight::from_parts(391_272, 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(5_444_460, 0) + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 3644)) - // Standard Error: 3 - .saturating_add(Weight::from_parts(444, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(515, 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(4_000_000, 0) + Weight::from_parts(5_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(2_000_000, 0) + Weight::from_parts(3_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: 8_000_000 picoseconds. - Weight::from_parts(10_836_235, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(11_255_764, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_646 - .saturating_add(Weight::from_parts(362_847, 0).saturating_mul(s.into())) + // Standard Error: 5_709 + .saturating_add(Weight::from_parts(409_315, 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: 12_000_000 picoseconds. - Weight::from_parts(11_572_734, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(12_321_142, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_374 - .saturating_add(Weight::from_parts(578_559, 0).saturating_mul(s.into())) + // Standard Error: 6_710 + .saturating_add(Weight::from_parts(633_210, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -187,10 +187,10 @@ impl pallet_scheduler::WeightInfo for WeightInfo { // Measured: `255 + s * (185 ±0)` // Estimated: `42428` // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(14_313_176, 0) + Weight::from_parts(16_528_470, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 2_166 - .saturating_add(Weight::from_parts(373_829, 0).saturating_mul(s.into())) + // Standard Error: 12_470 + .saturating_add(Weight::from_parts(416_144, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -204,10 +204,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_578_285, 0) + Weight::from_parts(15_350_612, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_137 - .saturating_add(Weight::from_parts(596_067, 0).saturating_mul(s.into())) + // Standard Error: 6_616 + .saturating_add(Weight::from_parts(618_093, 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 d6a8fa96f..cc8cfb9df 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(10_000_000, 0) + Weight::from_parts(13_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 2a5e60e17..862242cad 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 3_000_000 picoseconds. - Weight::from_parts(4_000_000, 0) + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(5_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 cf11f06d2..0b38fdc7b 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1887` - // Minimum execution time: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(12_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: 23_000_000 picoseconds. - Weight::from_parts(24_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)) @@ -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: 6_000_000 picoseconds. - Weight::from_parts(8_680_628, 0) + // Minimum execution time: 8_000_000 picoseconds. + Weight::from_parts(10_364_812, 0) .saturating_add(Weight::from_parts(0, 3549)) - // Standard Error: 794 - .saturating_add(Weight::from_parts(17_204, 0).saturating_mul(p.into())) + // Standard Error: 2_150 + .saturating_add(Weight::from_parts(24_626, 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(5_000_000, 0) + Weight::from_parts(6_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: 18_000_000 picoseconds. - Weight::from_parts(16_684_026, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(30_538_237, 0) .saturating_add(Weight::from_parts(0, 3581)) - // Standard Error: 5_581 - .saturating_add(Weight::from_parts(2_419_379, 0).saturating_mul(p.into())) + // Standard Error: 72_753 + .saturating_add(Weight::from_parts(2_692_855, 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,7 +161,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1489` - // Minimum execution time: 8_000_000 picoseconds. + // Minimum execution time: 7_000_000 picoseconds. Weight::from_parts(8_000_000, 0) .saturating_add(Weight::from_parts(0, 1489)) .saturating_add(T::DbWeight::get().reads(1)) @@ -175,8 +175,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `416` // Estimated: `6172` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(51_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -187,8 +187,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: 11_000_000 picoseconds. + Weight::from_parts(13_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: 9_000_000 picoseconds. - Weight::from_parts(10_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)) diff --git a/runtime/darwinia/src/weights/pallet_utility.rs b/runtime/darwinia/src/weights/pallet_utility.rs index 9497861fe..881e6aaa0 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -60,11 +60,11 @@ impl pallet_utility::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_000_000 picoseconds. - Weight::from_parts(8_163_691, 0) + // Minimum execution time: 4_000_000 picoseconds. + Weight::from_parts(13_536_226, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_661 - .saturating_add(Weight::from_parts(3_516_152, 0).saturating_mul(c.into())) + // Standard Error: 15_122 + .saturating_add(Weight::from_parts(3_778_643, 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(8_605_755, 0) + Weight::from_parts(1_695_457, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 3_441 - .saturating_add(Weight::from_parts(3_778_083, 0).saturating_mul(c.into())) + // Standard Error: 18_788 + .saturating_add(Weight::from_parts(4_094_435, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + // Minimum execution time: 7_000_000 picoseconds. + Weight::from_parts(7_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_000_000, 0) + Weight::from_parts(4_366_648, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 2_282 - .saturating_add(Weight::from_parts(3_563_062, 0).saturating_mul(c.into())) + // Standard Error: 17_973 + .saturating_add(Weight::from_parts(3_855_063, 0).saturating_mul(c.into())) } } diff --git a/runtime/darwinia/src/weights/pallet_whitelist.rs b/runtime/darwinia/src/weights/pallet_whitelist.rs index a4d6fa928..6b70d94c2 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("darwinia-dev")`, DB CACHE: 1024 @@ -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(25_000_000, 0) + Weight::from_parts(24_000_000, 0) .saturating_add(Weight::from_parts(0, 3716)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(466, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(550, 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(17_439_358, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_290_598, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 5 - .saturating_add(Weight::from_parts(992, 0).saturating_mul(n.into())) + // Standard Error: 39 + .saturating_add(Weight::from_parts(1_090, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } diff --git a/runtime/koi/src/lib.rs b/runtime/koi/src/lib.rs index decb99e28..a5ee27962 100644 --- a/runtime/koi/src/lib.rs +++ b/runtime/koi/src/lib.rs @@ -208,7 +208,6 @@ frame_benchmarking::define_benchmarks! { [pallet_balances, Balances] [pallet_collective, TechnicalCommittee] [pallet_conviction_voting, ConvictionVoting] - [pallet_evm, EVM] [pallet_message_queue, MessageQueue] [pallet_preimage, Preimage] [pallet_proxy, Proxy] diff --git a/runtime/koi/src/weights/cumulus_pallet_parachain_system.rs b/runtime/koi/src/weights/cumulus_pallet_parachain_system.rs index 4f633cfa4..00d8cb921 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-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(3_000_000, 0) .saturating_add(Weight::from_parts(0, 3517)) - // Standard Error: 43_768 - .saturating_add(Weight::from_parts(100_147_420, 0).saturating_mul(n.into())) + // Standard Error: 58_621 + .saturating_add(Weight::from_parts(104_049_044, 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 835628f87..c11528041 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(12_000_000, 0) + Weight::from_parts(14_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(10_000_000, 0) + Weight::from_parts(9_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: 50_000_000 picoseconds. + Weight::from_parts(58_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: 28_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(33_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 3da009b5a..172164848 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -69,8 +69,8 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26812` // Estimated: `29615` - // Minimum execution time: 82_000_000 picoseconds. - Weight::from_parts(93_000_000, 0) + // 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)) @@ -85,8 +85,8 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26541` // Estimated: `29615` - // Minimum execution time: 943_000_000 picoseconds. - Weight::from_parts(968_000_000, 0) + // 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)) @@ -105,16 +105,47 @@ impl darwinia_deposit::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `26863` // Estimated: `29615` - // Minimum execution time: 86_000_000 picoseconds. - Weight::from_parts(99_000_000, 0) + // 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) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`) + /// Storage: `Deposit::DepositContract` (r:1 w:0) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) + /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `EVM::AccountCodes` (r:2 w:0) + /// Proof: `EVM::AccountCodes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Digest` (r:1 w:0) + /// 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 { - 0.into() + // 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) + .saturating_add(Weight::from_parts(0, 33456)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(4)) } + /// Storage: `Deposit::DepositContract` (r:0 w:1) + /// Proof: `Deposit::DepositContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) fn set_deposit_contract() -> Weight { - 0.into() + // 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)) + .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 e007206f4..f2f82455f 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -70,11 +70,11 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `7088 + x * (25 ±0)` // Estimated: `29615` - // Minimum execution time: 47_000_000 picoseconds. - Weight::from_parts(653_462_438, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(713_221_476, 0) .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 242_063 - .saturating_add(Weight::from_parts(12_354_738, 0).saturating_mul(x.into())) + // 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)) } @@ -93,11 +93,11 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `7415 + x * (26 ±0)` // Estimated: `29615` - // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(690_303_938, 0) + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(754_642_664, 0) .saturating_add(Weight::from_parts(0, 29615)) - // Standard Error: 243_509 - .saturating_add(Weight::from_parts(12_382_062, 0).saturating_mul(x.into())) + // 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)) } @@ -107,8 +107,8 @@ impl darwinia_staking::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `388` // Estimated: `3497` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // 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)) @@ -121,10 +121,10 @@ impl darwinia_staking::WeightInfo for WeightInfo { /// Proof: `DarwiniaStaking::Nominators` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn nominate() -> Weight { // Proof Size summary in bytes: - // Measured: `574` + // Measured: `600` // Estimated: `4543` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) .saturating_add(Weight::from_parts(0, 4543)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -148,17 +148,17 @@ impl darwinia_staking::WeightInfo for WeightInfo { /// 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) + /// 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: `1845` - // Estimated: `5310` - // Minimum execution time: 135_000_000 picoseconds. - Weight::from_parts(143_000_000, 0) - .saturating_add(Weight::from_parts(0, 5310)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(2)) + // 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`) @@ -167,29 +167,18 @@ impl darwinia_staking::WeightInfo for WeightInfo { // 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)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_ring_staking_contract() -> Weight { - // Proof Size summary in bytes: - // 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)) } /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) - /// Proof: `DarwiniaStaking::KtonStakingContract` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// 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: // 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/frame_system.rs b/runtime/koi/src/weights/frame_system.rs index cec635839..c10888f71 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 1_000_000 picoseconds. - Weight::from_parts(2_268_293, 0) + // Minimum execution time: 2_000_000 picoseconds. + Weight::from_parts(4_417_236, 0) .saturating_add(Weight::from_parts(0, 0)) // Standard Error: 0 - .saturating_add(Weight::from_parts(150, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(156, 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: 0 - .saturating_add(Weight::from_parts(945, 0).saturating_mul(b.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(993, 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: 67_336_000_000 picoseconds. - Weight::from_parts(71_187_000_000, 0) + // Minimum execution time: 70_989_000_000 picoseconds. + Weight::from_parts(74_848_000_000, 0) .saturating_add(Weight::from_parts(0, 1683)) .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: 1_000_000 picoseconds. + // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 4_764 - .saturating_add(Weight::from_parts(774_928, 0).saturating_mul(i.into())) + // Standard Error: 2_331 + .saturating_add(Weight::from_parts(804_469, 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: 1_000_000 picoseconds. + // Minimum execution time: 2_000_000 picoseconds. Weight::from_parts(2_000_000, 0) .saturating_add(Weight::from_parts(0, 0)) - // Standard Error: 867 - .saturating_add(Weight::from_parts(532_385, 0).saturating_mul(i.into())) + // Standard Error: 1_491 + .saturating_add(Weight::from_parts(567_168, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -146,13 +146,13 @@ impl frame_system::WeightInfo for WeightInfo { /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `88 + p * (69 ±0)` - // Estimated: `92 + p * (70 ±0)` - // Minimum execution time: 4_000_000 picoseconds. + // Measured: `89 + p * (69 ±0)` + // Estimated: `94 + p * (70 ±0)` + // Minimum execution time: 3_000_000 picoseconds. Weight::from_parts(4_000_000, 0) - .saturating_add(Weight::from_parts(0, 92)) - // Standard Error: 1_084 - .saturating_add(Weight::from_parts(975_384, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 94)) + // Standard Error: 2_915 + .saturating_add(Weight::from_parts(1_044_881, 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,8 +163,8 @@ impl frame_system::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_000_000 picoseconds. - Weight::from_parts(7_000_000, 0) + // Minimum execution time: 5_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: 68_599_000_000 picoseconds. - Weight::from_parts(73_876_000_000, 0) + // Minimum execution time: 75_450_000_000 picoseconds. + Weight::from_parts(80_770_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 d3ab9406a..4041fbc12 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -67,8 +67,8 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `276` // Estimated: `3741` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(29_000_000, 0) + // Minimum execution time: 30_000_000 picoseconds. + Weight::from_parts(30_000_000, 0) .saturating_add(Weight::from_parts(0, 3741)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) @@ -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(16_313_288, 0) + Weight::from_parts(20_209_116, 0) .saturating_add(Weight::from_parts(0, 3983)) - // Standard Error: 2_365 - .saturating_add(Weight::from_parts(333_385, 0).saturating_mul(x.into())) + // Standard Error: 5_727 + .saturating_add(Weight::from_parts(344_576, 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: 24_000_000 picoseconds. - Weight::from_parts(25_074_438, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(28_993_534, 0) .saturating_add(Weight::from_parts(0, 4303)) - // Standard Error: 2_774 - .saturating_add(Weight::from_parts(338_361, 0).saturating_mul(x.into())) + // Standard Error: 6_928 + .saturating_add(Weight::from_parts(386_014, 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())) @@ -124,11 +124,11 @@ impl pallet_asset_manager::WeightInfo for WeightInfo // Proof Size summary in bytes: // Measured: `196 + x * (5 ±0)` // Estimated: `1678 + x * (5 ±0)` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(10_468_267, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(11_943_329, 0) .saturating_add(Weight::from_parts(0, 1678)) - // Standard Error: 2_533 - .saturating_add(Weight::from_parts(296_419, 0).saturating_mul(x.into())) + // Standard Error: 4_562 + .saturating_add(Weight::from_parts(325_272, 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(19_047_312, 0) + Weight::from_parts(20_951_661, 0) .saturating_add(Weight::from_parts(0, 3949)) - // Standard Error: 2_328 - .saturating_add(Weight::from_parts(282_558, 0).saturating_mul(x.into())) + // Standard Error: 5_591 + .saturating_add(Weight::from_parts(333_493, 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 866d6aafe..0e27ae2c5 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(10_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)) @@ -74,7 +74,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `157` // Estimated: `3631` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -85,7 +85,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)) @@ -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: `821 + c * (183 ±0)` + // Measured: `820 + c * (183 ±0)` // Estimated: `3631 + c * (2591 ±0)` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(57_779_552, 0) + Weight::from_parts(18_889_041, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 39_269 - .saturating_add(Weight::from_parts(10_801_270, 0).saturating_mul(c.into())) + // Standard Error: 36_945 + .saturating_add(Weight::from_parts(11_531_247, 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)) @@ -125,8 +125,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Minimum execution time: 13_000_000 picoseconds. Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 9_351 - .saturating_add(Weight::from_parts(4_038_535, 0).saturating_mul(a.into())) + // Standard Error: 10_046 + .saturating_add(Weight::from_parts(4_316_338, 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)) @@ -169,8 +169,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // 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, 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: `449` // Estimated: `6168` - // Minimum execution time: 35_000_000 picoseconds. - Weight::from_parts(36_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)) @@ -201,8 +201,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `449` // Estimated: `6168` - // Minimum execution time: 33_000_000 picoseconds. - Weight::from_parts(34_000_000, 0) + // Minimum execution time: 32_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)) @@ -217,8 +217,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `449` // Estimated: `6168` - // Minimum execution time: 36_000_000 picoseconds. - Weight::from_parts(37_000_000, 0) + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(45_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,8 +245,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `410` // Estimated: `3631` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 12_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)) @@ -257,8 +257,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + Weight::from_parts(12_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: 9_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + // Minimum execution time: 10_000_000 picoseconds. + 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)) @@ -283,7 +283,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `350` // Estimated: `3631` - // Minimum execution time: 12_000_000 picoseconds. + // Minimum execution time: 11_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(10_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)) @@ -307,17 +307,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 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(12_101_009, 0) + Weight::from_parts(13_246_244, 0) .saturating_add(Weight::from_parts(0, 3631)) - // Standard Error: 1_067 - .saturating_add(Weight::from_parts(1_795, 0).saturating_mul(n.into())) - // Standard Error: 1_067 - .saturating_add(Weight::from_parts(2_337, 0).saturating_mul(s.into())) + // 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)) } @@ -329,8 +327,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // 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(17_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -345,8 +343,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `237` // Estimated: `3631` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(11_725_066, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(13_511_667, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -359,8 +357,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `478` // Estimated: `3631` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 13_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(1)) @@ -385,7 +383,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `307` // Estimated: `3631` - // Minimum execution time: 14_000_000 picoseconds. + // Minimum execution time: 15_000_000 picoseconds. Weight::from_parts(15_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) @@ -404,7 +402,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `599` // Estimated: `6168` // Minimum execution time: 42_000_000 picoseconds. - Weight::from_parts(43_000_000, 0) + Weight::from_parts(44_000_000, 0) .saturating_add(Weight::from_parts(0, 6168)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(5)) @@ -417,8 +415,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `457` // Estimated: `3631` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + 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)) @@ -443,8 +441,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: 11_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -459,8 +457,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `512` // Estimated: `3631` - // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(31_000_000, 0) + // Minimum execution time: 31_000_000 picoseconds. + Weight::from_parts(35_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -473,8 +471,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(27_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(33_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -503,8 +501,8 @@ impl pallet_assets::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `448` // Estimated: `3631` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(32_000_000, 0) .saturating_add(Weight::from_parts(0, 3631)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -518,7 +516,7 @@ impl pallet_assets::WeightInfo for WeightInfo { // Measured: `410` // Estimated: `3631` // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + 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(1)) diff --git a/runtime/koi/src/weights/pallet_balances.rs b/runtime/koi/src/weights/pallet_balances.rs index 1e7127c3b..12556b5f9 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 43_000_000 picoseconds. - Weight::from_parts(44_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(53_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,7 +73,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `39` // Estimated: `3581` - // Minimum execution time: 36_000_000 picoseconds. + // Minimum execution time: 37_000_000 picoseconds. Weight::from_parts(39_000_000, 0) .saturating_add(Weight::from_parts(0, 3581)) .saturating_add(T::DbWeight::get().reads(1)) @@ -86,7 +86,7 @@ impl pallet_balances::WeightInfo for WeightInfo { // Measured: `195` // Estimated: `3581` // 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, 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: 46_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(57_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: 48_000_000 picoseconds. - Weight::from_parts(49_000_000, 0) + // Minimum execution time: 49_000_000 picoseconds. + Weight::from_parts(54_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: `424 + u * (124 ±0)` + // Measured: `458 + 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: 19_096 - .saturating_add(Weight::from_parts(13_003_237, 0).saturating_mul(u.into())) + // Standard Error: 22_067 + .saturating_add(Weight::from_parts(14_037_134, 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(6_000_000, 0) + Weight::from_parts(5_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 3a9d25476..b7b0c6e18 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 11_000_000 picoseconds. - Weight::from_parts(11_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 12200)) - // Standard Error: 70_896 - .saturating_add(Weight::from_parts(3_167_004, 0).saturating_mul(m.into())) - // Standard Error: 70_896 - .saturating_add(Weight::from_parts(4_540_655, 0).saturating_mul(p.into())) + // 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())) .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,10 @@ 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(14_244_966, 0) + Weight::from_parts(15_709_724, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 40 - .saturating_add(Weight::from_parts(728, 0).saturating_mul(b.into())) - // Standard Error: 412 - .saturating_add(Weight::from_parts(2_042, 0).saturating_mul(m.into())) + // Standard Error: 172 + .saturating_add(Weight::from_parts(375, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -117,12 +115,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(15_664_697, 0) + Weight::from_parts(16_328_339, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 43 - .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(b.into())) - // Standard Error: 445 - .saturating_add(Weight::from_parts(5_419, 0).saturating_mul(m.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(Weight::from_parts(0, 20).saturating_mul(m.into())) } @@ -143,15 +141,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: 16_000_000 picoseconds. - Weight::from_parts(18_038_161, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_702_013, 0) .saturating_add(Weight::from_parts(0, 3751)) - // Standard Error: 77 - .saturating_add(Weight::from_parts(1_328, 0).saturating_mul(b.into())) - // Standard Error: 806 - .saturating_add(Weight::from_parts(9_593, 0).saturating_mul(m.into())) - // Standard Error: 796 - .saturating_add(Weight::from_parts(116_562, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -166,11 +164,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: 14_000_000 picoseconds. - Weight::from_parts(15_243_118, 0) + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(18_888_620, 0) .saturating_add(Weight::from_parts(0, 4296)) - // Standard Error: 729 - .saturating_add(Weight::from_parts(9_936, 0).saturating_mul(m.into())) + // Standard Error: 3_932 + .saturating_add(Weight::from_parts(7_792, 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())) @@ -189,13 +187,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: 19_000_000 picoseconds. - Weight::from_parts(19_230_367, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(22_509_197, 0) .saturating_add(Weight::from_parts(0, 3854)) - // Standard Error: 625 - .saturating_add(Weight::from_parts(3_816, 0).saturating_mul(m.into())) - // Standard Error: 609 - .saturating_add(Weight::from_parts(119_137, 0).saturating_mul(p.into())) + // Standard Error: 3_630 + .saturating_add(Weight::from_parts(134_361, 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())) @@ -219,14 +215,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(29_705_330, 0) + Weight::from_parts(30_157_309, 0) .saturating_add(Weight::from_parts(0, 4032)) - // Standard Error: 123 - .saturating_add(Weight::from_parts(1_678, 0).saturating_mul(b.into())) - // Standard Error: 1_301 - .saturating_add(Weight::from_parts(10_568, 0).saturating_mul(m.into())) - // Standard Error: 1_268 - .saturating_add(Weight::from_parts(142_999, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -250,12 +246,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(21_064_164, 0) + Weight::from_parts(23_366_099, 0) .saturating_add(Weight::from_parts(0, 3874)) - // Standard Error: 853 - .saturating_add(Weight::from_parts(6_630, 0).saturating_mul(m.into())) - // Standard Error: 832 - .saturating_add(Weight::from_parts(118_190, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -280,13 +276,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: 32_000_000 picoseconds. - Weight::from_parts(34_768_602, 0) + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(33_127_380, 0) .saturating_add(Weight::from_parts(0, 4052)) - // Standard Error: 108 - .saturating_add(Weight::from_parts(362, 0).saturating_mul(b.into())) - // Standard Error: 1_114 - .saturating_add(Weight::from_parts(134_128, 0).saturating_mul(p.into())) + // 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())) .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())) @@ -305,10 +303,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_143_115, 0) + Weight::from_parts(12_796_290, 0) .saturating_add(Weight::from_parts(0, 1711)) - // Standard Error: 637 - .saturating_add(Weight::from_parts(103_056, 0).saturating_mul(p.into())) + // Standard Error: 2_932 + .saturating_add(Weight::from_parts(136_419, 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 c3ea2b80d..1a9c1f4c8 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 79_000_000 picoseconds. - Weight::from_parts(84_000_000, 0) + // Minimum execution time: 85_000_000 picoseconds. + Weight::from_parts(105_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: 114_000_000 picoseconds. - Weight::from_parts(122_000_000, 0) + // Minimum execution time: 125_000_000 picoseconds. + Weight::from_parts(151_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: 95_000_000 picoseconds. - Weight::from_parts(98_000_000, 0) + // Minimum execution time: 104_000_000 picoseconds. + Weight::from_parts(124_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: 46_000_000 picoseconds. - Weight::from_parts(48_000_000, 0) + // Minimum execution time: 48_000_000 picoseconds. + Weight::from_parts(58_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: 41_000_000 picoseconds. - Weight::from_parts(145_986_544, 0) + // Minimum execution time: 51_000_000 picoseconds. + Weight::from_parts(94_354_931, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 350_650 - .saturating_add(Weight::from_parts(34_511_418, 0).saturating_mul(r.into())) + // Standard Error: 349_326 + .saturating_add(Weight::from_parts(37_658_543, 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: 18_000_000 picoseconds. - Weight::from_parts(123_366_820, 0) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(53_657_365, 0) .saturating_add(Weight::from_parts(0, 83866)) - // Standard Error: 344_454 - .saturating_add(Weight::from_parts(33_701_114, 0).saturating_mul(r.into())) + // Standard Error: 323_752 + .saturating_add(Weight::from_parts(37_507_322, 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: 67_000_000 picoseconds. - Weight::from_parts(73_000_000, 0) + // Minimum execution time: 75_000_000 picoseconds. + Weight::from_parts(80_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 069e39a35..c398d7157 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 11_000_000 picoseconds. + // Minimum execution time: 10_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(10_000_000, 0) + Weight::from_parts(9_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: 5_000_000 picoseconds. - Weight::from_parts(6_000_000, 0) + // Minimum execution time: 6_000_000 picoseconds. + Weight::from_parts(8_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: 81_000_000 picoseconds. - Weight::from_parts(96_000_000, 0) + // Minimum execution time: 84_000_000 picoseconds. + Weight::from_parts(93_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(7_000_000, 0) + Weight::from_parts(8_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: 32_000_000 picoseconds. - Weight::from_parts(34_000_000, 0) + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(42_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: 42_000_000 picoseconds. - Weight::from_parts(43_000_000, 0) + // Minimum execution time: 41_000_000 picoseconds. + Weight::from_parts(48_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: 49_000_000 picoseconds. - Weight::from_parts(50_000_000, 0) + // Minimum execution time: 50_000_000 picoseconds. + Weight::from_parts(61_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 aa2dd2a99..7a4d5a244 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 46_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 45_000_000 picoseconds. + Weight::from_parts(45_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_067, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_154, 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(13_000_000, 0) + Weight::from_parts(12_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_049, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_133, 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(13_000_000, 0) + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_096, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_128, 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: 44_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(58_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: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(25_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,8 +156,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `176` // Estimated: `3544` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 14_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(1)) @@ -170,8 +170,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(16_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(11_000_000, 0) + Weight::from_parts(16_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(9_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + 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)) @@ -214,8 +214,8 @@ impl pallet_preimage::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3544` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(21_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: 8_000_000 picoseconds. - Weight::from_parts(9_000_000, 0) + // Minimum execution time: 9_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)) @@ -242,8 +242,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(9_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + 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)) @@ -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: `504 + n * (203 ±0)` + // Measured: `532 + n * (203 ±0)` // Estimated: `990 + n * (2591 ±0)` - // Minimum execution time: 54_000_000 picoseconds. - Weight::from_parts(54_000_000, 0) + // Minimum execution time: 56_000_000 picoseconds. + Weight::from_parts(60_000_000, 0) .saturating_add(Weight::from_parts(0, 990)) - // Standard Error: 22_013 - .saturating_add(Weight::from_parts(53_066_920, 0).saturating_mul(n.into())) + // Standard Error: 47_697 + .saturating_add(Weight::from_parts(57_455_847, 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 06b2d90bb..6f6ad95a3 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -64,11 +64,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `119 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(13_336_147, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(14_095_571, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 2_057 - .saturating_add(Weight::from_parts(23_701, 0).saturating_mul(p.into())) + // Standard Error: 7_508 + .saturating_add(Weight::from_parts(48_610, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: `Proxy::Proxies` (r:1 w:0) @@ -86,12 +86,12 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `371 + a * (56 ±0) + p * (25 ±0)` // Estimated: `5302` // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(32_332_960, 0) + Weight::from_parts(34_463_299, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 3_478 - .saturating_add(Weight::from_parts(97_301, 0).saturating_mul(a.into())) - // Standard Error: 3_594 - .saturating_add(Weight::from_parts(92, 0).saturating_mul(p.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -101,15 +101,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: `295 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_257_306, 0) + Weight::from_parts(21_259_863, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_249 - .saturating_add(Weight::from_parts(114_708, 0).saturating_mul(a.into())) + // 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())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -124,10 +126,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `295 + a * (56 ±0)` // Estimated: `5302` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_576_197, 0) + Weight::from_parts(21_964_838, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_256 - .saturating_add(Weight::from_parts(111_775, 0).saturating_mul(a.into())) + // Standard Error: 7_084 + .saturating_add(Weight::from_parts(143_488, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -139,17 +141,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 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: 26_000_000 picoseconds. - Weight::from_parts(26_129_689, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(27_807_662, 0) .saturating_add(Weight::from_parts(0, 5302)) - // Standard Error: 2_000 - .saturating_add(Weight::from_parts(128_553, 0).saturating_mul(a.into())) - // Standard Error: 2_066 - .saturating_add(Weight::from_parts(19_273, 0).saturating_mul(p.into())) + // Standard Error: 8_462 + .saturating_add(Weight::from_parts(180_035, 0).saturating_mul(a.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -160,11 +160,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `115 + p * (25 ±0)` // Estimated: `4310` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(20_919_041, 0) + // Minimum execution time: 19_000_000 picoseconds. + Weight::from_parts(21_111_983, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_398 - .saturating_add(Weight::from_parts(7_664, 0).saturating_mul(p.into())) + // Standard Error: 6_929 + .saturating_add(Weight::from_parts(64_047, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -176,10 +176,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `115 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(21_056_854, 0) + Weight::from_parts(22_347_148, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_550 - .saturating_add(Weight::from_parts(1_491, 0).saturating_mul(p.into())) + // Standard Error: 9_039 + .saturating_add(Weight::from_parts(33_946, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -191,10 +191,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `115 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(19_917_339, 0) + Weight::from_parts(20_953_276, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 1_989 - .saturating_add(Weight::from_parts(17_568, 0).saturating_mul(p.into())) + // Standard Error: 7_731 + .saturating_add(Weight::from_parts(38_577, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -205,11 +205,11 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `127` // Estimated: `4310` - // Minimum execution time: 21_000_000 picoseconds. - Weight::from_parts(21_964_308, 0) + // Minimum execution time: 20_000_000 picoseconds. + Weight::from_parts(22_926_728, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 930 - .saturating_add(Weight::from_parts(1_655, 0).saturating_mul(p.into())) + // 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 +221,10 @@ impl pallet_proxy::WeightInfo for WeightInfo { // Measured: `140 + p * (25 ±0)` // Estimated: `4310` // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_169_474, 0) + Weight::from_parts(21_780_110, 0) .saturating_add(Weight::from_parts(0, 4310)) - // Standard Error: 2_189 - .saturating_add(Weight::from_parts(29_788, 0).saturating_mul(p.into())) + // Standard Error: 7_638 + .saturating_add(Weight::from_parts(17_761, 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 4e5eab939..fc0f78cfd 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 30_000_000 picoseconds. - Weight::from_parts(31_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)) @@ -97,8 +97,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3350` // Estimated: `42428` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 46_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)) @@ -115,8 +115,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3370` // Estimated: `42428` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(46_000_000, 0) + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(53_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(31_000_000, 0) + Weight::from_parts(32_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -157,8 +157,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `425` // Estimated: `4377` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(27_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -169,8 +169,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `384` // Estimated: `4377` - // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(33_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: 26_000_000 picoseconds. + // 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)) @@ -201,7 +201,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `880` // Estimated: `83866` - // Minimum execution time: 85_000_000 picoseconds. + // Minimum execution time: 84_000_000 picoseconds. Weight::from_parts(87_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(5)) @@ -231,8 +231,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `3137` // Estimated: `42428` - // Minimum execution time: 26_000_000 picoseconds. - Weight::from_parts(27_000_000, 0) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(32_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: 32_000_000 picoseconds. - Weight::from_parts(33_000_000, 0) + // Minimum execution time: 34_000_000 picoseconds. + Weight::from_parts(41_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: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(16_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: 13_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(18_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: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(19_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: 16_000_000 picoseconds. - Weight::from_parts(17_000_000, 0) + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(20_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: 17_000_000 picoseconds. - Weight::from_parts(18_000_000, 0) + // Minimum execution time: 18_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)) @@ -335,7 +335,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `390` // Estimated: `42428` - // 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, 42428)) .saturating_add(T::DbWeight::get().reads(2)) @@ -347,8 +347,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `299` // Estimated: `4377` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(12_000_000, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) .saturating_add(Weight::from_parts(0, 4377)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -363,7 +363,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: 22_000_000 picoseconds. Weight::from_parts(23_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(3)) @@ -380,7 +380,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Measured: `390` // Estimated: `42428` // Minimum execution time: 25_000_000 picoseconds. - Weight::from_parts(26_000_000, 0) + 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)) @@ -393,8 +393,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)) @@ -407,8 +407,8 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `426` // Estimated: `42428` - // Minimum execution time: 19_000_000 picoseconds. - Weight::from_parts(20_000_000, 0) + // Minimum execution time: 21_000_000 picoseconds. + Weight::from_parts(22_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(19_000_000, 0) + Weight::from_parts(22_000_000, 0) .saturating_add(Weight::from_parts(0, 42428)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) @@ -451,7 +451,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `447` // Estimated: `83866` - // Minimum execution time: 29_000_000 picoseconds. + // Minimum execution time: 28_000_000 picoseconds. Weight::from_parts(29_000_000, 0) .saturating_add(Weight::from_parts(0, 83866)) .saturating_add(T::DbWeight::get().reads(4)) @@ -465,7 +465,7 @@ impl pallet_referenda::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `443` // Estimated: `42428` - // Minimum execution time: 20_000_000 picoseconds. + // 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)) @@ -483,8 +483,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(16_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_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/koi/src/weights/pallet_scheduler.rs b/runtime/koi/src/weights/pallet_scheduler.rs index 22687ea78..ef3bbdff8 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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_646_595, 0) + Weight::from_parts(5_834_698, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_323 - .saturating_add(Weight::from_parts(375_098, 0).saturating_mul(s.into())) + // Standard Error: 3_784 + .saturating_add(Weight::from_parts(398_666, 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(16_000_000, 0) + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_000_000, 0) .saturating_add(Weight::from_parts(0, 3644)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(443, 0).saturating_mul(s.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(521, 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(4_000_000, 0) + Weight::from_parts(5_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: 9_000_000 picoseconds. - Weight::from_parts(11_112_705, 0) + Weight::from_parts(12_251_764, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_384 - .saturating_add(Weight::from_parts(364_052, 0).saturating_mul(s.into())) + // Standard Error: 5_910 + .saturating_add(Weight::from_parts(397_968, 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: 12_000_000 picoseconds. - Weight::from_parts(11_587_346, 0) + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(12_843_673, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_259 - .saturating_add(Weight::from_parts(598_064, 0).saturating_mul(s.into())) + // Standard Error: 6_444 + .saturating_add(Weight::from_parts(612_797, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -189,11 +189,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(14_706_823, 0) + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(15_768_000, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_946 - .saturating_add(Weight::from_parts(377_925, 0).saturating_mul(s.into())) + // Standard Error: 6_871 + .saturating_add(Weight::from_parts(402_285, 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_150_285, 0) + Weight::from_parts(14_722_204, 0) .saturating_add(Weight::from_parts(0, 42428)) - // Standard Error: 1_300 - .saturating_add(Weight::from_parts(602_890, 0).saturating_mul(s.into())) + // Standard Error: 7_510 + .saturating_add(Weight::from_parts(657_325, 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 a3a2319f5..ac496a87b 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-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(10_000_000, 0) + Weight::from_parts(13_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 a36f142c3..47c9b0cba 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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 e6af41735..dbfb9ac96 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("koi-dev")`, DB CACHE: 1024 @@ -66,7 +66,7 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Measured: `109` // Estimated: `1887` // Minimum execution time: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + Weight::from_parts(12_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: 23_000_000 picoseconds. - Weight::from_parts(24_000_000, 0) + // Minimum execution time: 25_000_000 picoseconds. + Weight::from_parts(29_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: 38_000_000 picoseconds. - Weight::from_parts(39_000_000, 0) + // Minimum execution time: 40_000_000 picoseconds. + Weight::from_parts(45_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(8_698_281, 0) + Weight::from_parts(10_074_563, 0) .saturating_add(Weight::from_parts(0, 3549)) - // Standard Error: 822 - .saturating_add(Weight::from_parts(26_269, 0).saturating_mul(p.into())) + // Standard Error: 2_320 + .saturating_add(Weight::from_parts(34_382, 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: `328 + p * (97 ±0)` // Estimated: `3581 + p * (2559 ±0)` // Minimum execution time: 18_000_000 picoseconds. - Weight::from_parts(127_084_382, 0) + Weight::from_parts(28_697_260, 0) .saturating_add(Weight::from_parts(0, 3581)) - // Standard Error: 161_920 - .saturating_add(Weight::from_parts(1_326_267, 0).saturating_mul(p.into())) + // Standard Error: 77_972 + .saturating_add(Weight::from_parts(2_780_716, 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: 49_000_000 picoseconds. - Weight::from_parts(50_000_000, 0) + // Minimum execution time: 55_000_000 picoseconds. + Weight::from_parts(59_000_000, 0) .saturating_add(Weight::from_parts(0, 6172)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) diff --git a/runtime/koi/src/weights/pallet_tx_pause.rs b/runtime/koi/src/weights/pallet_tx_pause.rs index d1f423e77..2bcf92130 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 10_000_000 picoseconds. - Weight::from_parts(10_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(11_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 2b45ea21f..78e3e3106 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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(8_246_607, 0) + Weight::from_parts(4_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 3_195 - .saturating_add(Weight::from_parts(5_004_046, 0).saturating_mul(c.into())) + // Standard Error: 12_721 + .saturating_add(Weight::from_parts(5_456_832, 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(8_000_000, 0) + Weight::from_parts(9_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(32_524_056, 0) + Weight::from_parts(5_000_000, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 5_851 - .saturating_add(Weight::from_parts(5_138_356, 0).saturating_mul(c.into())) + // Standard Error: 9_960 + .saturating_add(Weight::from_parts(5_916_048, 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(6_000_000, 0) + Weight::from_parts(7_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(2_073_409, 0) + Weight::from_parts(19_124_290, 0) .saturating_add(Weight::from_parts(0, 3997)) - // Standard Error: 3_686 - .saturating_add(Weight::from_parts(4_893_358, 0).saturating_mul(c.into())) + // Standard Error: 20_179 + .saturating_add(Weight::from_parts(5_499_270, 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 c23beed87..56dc70aba 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-06-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-08-08, 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: 15_000_000 picoseconds. - Weight::from_parts(16_000_000, 0) + // Minimum execution time: 16_000_000 picoseconds. + Weight::from_parts(18_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(16_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(24_000_000, 0) + Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 3716)) - // Standard Error: 1 - .saturating_add(Weight::from_parts(445, 0).saturating_mul(n.into())) + // Standard Error: 2 + .saturating_add(Weight::from_parts(543, 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(17_689_949, 0) + Weight::from_parts(20_605_827, 0) .saturating_add(Weight::from_parts(0, 3544)) - // Standard Error: 13 - .saturating_add(Weight::from_parts(1_015, 0).saturating_mul(n.into())) + // Standard Error: 26 + .saturating_add(Weight::from_parts(1_150, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) } From a8eca99440766493528ff83ae88a2c3d18ffb180 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 8 Aug 2024 14:55:52 +0800 Subject: [PATCH 17/20] Add missing weighter --- pallet/staking/src/weights.rs | 23 +++++++++++++++++++ runtime/crab/src/weights/darwinia_staking.rs | 12 +++++++++- .../darwinia/src/weights/darwinia_staking.rs | 12 +++++++++- runtime/koi/src/weights/darwinia_staking.rs | 12 +++++++++- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/pallet/staking/src/weights.rs b/pallet/staking/src/weights.rs index f38a97552..ffa10a6b9 100644 --- a/pallet/staking/src/weights.rs +++ b/pallet/staking/src/weights.rs @@ -59,6 +59,7 @@ pub trait WeightInfo { fn chill() -> Weight; fn payout() -> Weight; fn set_rate_limit() -> Weight; + fn set_ring_staking_contract() -> Weight; fn set_kton_staking_contract() -> Weight; fn set_collator_count() -> Weight; } @@ -182,6 +183,17 @@ impl WeightInfo for SubstrateWeight { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } /// 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 { @@ -324,6 +336,17 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } /// 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 { diff --git a/runtime/crab/src/weights/darwinia_staking.rs b/runtime/crab/src/weights/darwinia_staking.rs index 6b8189cdd..ab85d14e4 100644 --- a/runtime/crab/src/weights/darwinia_staking.rs +++ b/runtime/crab/src/weights/darwinia_staking.rs @@ -171,7 +171,17 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(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/darwinia_staking.rs b/runtime/darwinia/src/weights/darwinia_staking.rs index c163ff458..cddebe04b 100644 --- a/runtime/darwinia/src/weights/darwinia_staking.rs +++ b/runtime/darwinia/src/weights/darwinia_staking.rs @@ -171,7 +171,17 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(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/darwinia_staking.rs b/runtime/koi/src/weights/darwinia_staking.rs index f2f82455f..365b6fc7b 100644 --- a/runtime/koi/src/weights/darwinia_staking.rs +++ b/runtime/koi/src/weights/darwinia_staking.rs @@ -171,7 +171,17 @@ impl darwinia_staking::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `DarwiniaStaking::KtonStakingContract` (r:0 w:1) + /// Storage: `DarwiniaStaking::RingStakingContract` (r:0 w:1) + /// Proof: `DarwiniaStaking::RingStakingContract` (`max_values`: Some(1), `max_size`: Some(20), added: 515, mode: `MaxEncodedLen`) + fn set_ring_staking_contract() -> 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)) + .saturating_add(T::DbWeight::get().writes(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: From 3562869f8dc5b2b91149641fd5bc862295c46e5b Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 8 Aug 2024 15:13:07 +0800 Subject: [PATCH 18/20] Adjust account migration --- Cargo.lock | 2 + pallet/account-migration/Cargo.toml | 12 +++++ pallet/account-migration/src/lib.rs | 66 +++++++++++++++++++++++- pallet/account-migration/src/mock.rs | 76 ++++++++++++++++++++++++---- pallet/deposit/Cargo.toml | 5 +- runtime/common/src/test.rs | 54 ++++++++++++++++++++ 6 files changed, 200 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 80819f40c..fcb7aeb2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2709,6 +2709,8 @@ name = "darwinia-account-migration" version = "6.6.3" dependencies = [ "array-bytes 6.2.3", + "darwinia-deposit", + "darwinia-staking", "dc-primitives", "frame-benchmarking", "frame-support", diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index cb8ab345c..9b4273974 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -13,6 +13,8 @@ codec = { workspace = true, package = "parity-scale-codec" } scale-info = { workspace = true } # darwinia +darwinia-deposit = { workspace = true } +darwinia-staking = { workspace = true } dc-primitives = { workspace = true } # polkadot-sdk @@ -40,6 +42,8 @@ std = [ "scale-info/std", # darwinia + "darwinia-deposit/std", + "darwinia-staking/std", "dc-primitives/std", # polkadot-sdk @@ -56,6 +60,10 @@ std = [ ] runtime-benchmarks = [ + # darwinia + "darwinia-deposit/runtime-benchmarks", + "darwinia-staking/runtime-benchmarks", + # polkadot-sdk "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", @@ -66,6 +74,10 @@ runtime-benchmarks = [ ] try-runtime = [ + # darwinia + "darwinia-deposit/try-runtime", + "darwinia-staking/try-runtime", + # polkadot-sdk "frame-support/try-runtime", "frame-system/try-runtime", diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index 280fe8896..337f9b19d 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -55,9 +55,16 @@ mod weights; pub use weights::WeightInfo; // darwinia -use dc_primitives::{AccountId as AccountId20, AssetId, Balance, Nonce}; +use darwinia_deposit::{Deposit, DepositId}; +use darwinia_staking::Ledger; +use dc_primitives::{AccountId as AccountId20, AssetId, Balance, BlockNumber, Nonce}; // polkadot-sdk -use frame_support::{migration, pallet_prelude::*, StorageHasher}; +use frame_support::{ + migration, + pallet_prelude::*, + traits::{Currency, ExistenceRequirement::AllowDeath}, + StorageHasher, +}; use frame_system::{pallet_prelude::*, AccountInfo}; use pallet_balances::AccountData; use sp_core::{ @@ -100,6 +107,11 @@ pub mod pallet { Lookup = IdentityLookup, > + 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>; @@ -143,6 +155,17 @@ pub mod pallet { #[pallet::getter(fn kton_account_of)] pub type KtonAccounts = StorageMap<_, Blake2_128Concat, AccountId32, AssetAccount>; + /// [`darwinia_deposit::Deposits`] data. + #[pallet::storage] + #[pallet::unbounded] + #[pallet::getter(fn deposit_of)] + pub type Deposits = StorageMap<_, Blake2_128Concat, AccountId32, Vec>; + + /// [`darwinia_staking::migration::v2::OldLedger`] data. + #[pallet::storage] + #[pallet::getter(fn ledger_of)] + pub type Ledgers = StorageMap<_, Blake2_128Concat, AccountId32, OldLedger>; + /// Multisig migration caches. #[pallet::storage] #[pallet::unbounded] @@ -397,6 +420,34 @@ 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( + to, + Ledger { ring: l.staked_ring, deposits: l.staked_deposits }, + ); + } } Ok(()) @@ -454,6 +505,17 @@ pub(crate) enum AssetStatus { Destroying, } +#[allow(missing_docs)] +#[derive(Default, PartialEq, Eq, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)] +pub struct OldLedger { + pub staked_ring: Balance, + pub staked_kton: Balance, + pub staked_deposits: BoundedVec>, + pub unstaking_ring: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, + pub unstaking_kton: BoundedVec<(Balance, BlockNumber), ConstU32<512>>, + pub unstaking_deposits: BoundedVec<(DepositId, BlockNumber), ConstU32<512>>, +} + #[allow(missing_docs)] #[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct MultisigParams { diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index dfdb060de..573e9f6c1 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -16,7 +16,6 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . -pub use crate as darwinia_account_migration; pub use dc_primitives::*; // polkadot-sdk @@ -24,6 +23,31 @@ 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"), @@ -92,7 +116,42 @@ impl pallet_assets::Config for Runtime { type WeightInfo = (); } -impl darwinia_account_migration::Config for Runtime { +frame_support::parameter_types! { + pub UnvestedFundsAllowedWithdrawReasons: frame_support::traits::WithdrawReasons = + frame_support::traits::WithdrawReasons::except( + frame_support::traits::WithdrawReasons::TRANSFER | frame_support::traits::WithdrawReasons::RESERVE + ); +} + +impl darwinia_deposit::Config for Runtime { + type DepositMigrator = (); + type Kton = Dummy; + type MaxDeposits = frame_support::traits::ConstU32<512>; + type MinLockingAmount = (); + 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 = (); } @@ -103,7 +162,9 @@ frame_support::construct_runtime! { Timestamp: pallet_timestamp, Balances: pallet_balances, Assets: pallet_assets, - AccountMigration: darwinia_account_migration, + AccountMigration: crate, + Deposit: darwinia_deposit, + Staking: darwinia_staking, } } @@ -111,13 +172,8 @@ pub(crate) fn new_test_ext() -> TestExternalities { let mut storage = >::default().build_storage().unwrap(); pallet_assets::GenesisConfig:: { - assets: vec![(darwinia_account_migration::KTON_ID, [0; 20].into(), true, 1)], - metadata: vec![( - darwinia_account_migration::KTON_ID, - b"KTON".to_vec(), - b"KTON".to_vec(), - 18, - )], + assets: vec![(crate::KTON_ID, [0; 20].into(), true, 1)], + metadata: vec![(crate::KTON_ID, b"KTON".to_vec(), b"KTON".to_vec(), 18)], ..Default::default() } .assimilate_storage(&mut storage) diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index bce8c17a8..a2bb5fd63 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -25,9 +25,9 @@ frame-system = { workspace = true } pallet-timestamp = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } +sp-std = { workspace = true } # polkadot-sdk optional frame-benchmarking = { workspace = true, optional = true } -sp-std = { workspace = true, optional = true } [dev-dependencies] # polkadot-sdk @@ -55,9 +55,9 @@ std = [ "pallet-timestamp/std", "sp-core/std", "sp-runtime/std", + "sp-std/std", # polkadot-sdk optional "frame-benchmarking?/std", - "sp-std?/std", ] runtime-benchmarks = [ @@ -72,7 +72,6 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", # polkadot-sdk optional "frame-benchmarking/runtime-benchmarks", - "sp-std", ] try-runtime = [ diff --git a/runtime/common/src/test.rs b/runtime/common/src/test.rs index 5d0cda3a1..c8822474d 100644 --- a/runtime/common/src/test.rs +++ b/runtime/common/src/test.rs @@ -22,6 +22,8 @@ macro_rules! impl_account_migration_tests { mod account_migration { // darwinia use super::mock::*; + use darwinia_account_migration::OldLedger; + use darwinia_deposit::Deposit as DepositS; // polkadot-sdk use frame_support::{ assert_err, assert_ok, migration, Blake2_128Concat, StorageHasher, @@ -267,6 +269,58 @@ macro_rules! impl_account_migration_tests { assert_eq!(actual_accounts as u32, asset_details.accounts); }); } + + #[test] + fn staking_should_work() { + let (from, from_pk) = alice(); + let init = H160::from_low_u64_be(254).into(); + let to = H160::from_low_u64_be(255).into(); + + ExtBuilder::default() + .with_assets_accounts(vec![(KTON_ID, init, KTON_AMOUNT)]) + .build() + .execute_with(|| { + preset_state_of(&from); + + >::insert( + &from_pk, + vec![ + DepositS { + id: 1, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + DepositS { + id: 2, + value: 10, + start_time: 1000, + expired_time: 2000, + in_use: true, + }, + ], + ); + >::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(&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); + }); + } } }; } From 4acc840fb56fc1e2318abe50333006d7ffa24679 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 8 Aug 2024 15:13:48 +0800 Subject: [PATCH 19/20] Naming --- pallet/deposit/Cargo.toml | 2 +- pallet/staking/Cargo.toml | 4 ++-- pallet/staking/traits/Cargo.toml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index a2bb5fd63..1f2b2cdf1 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -19,7 +19,7 @@ darwinia-staking-traits = { workspace = true } dc-inflation = { workspace = true } dc-types = { workspace = true } -# subtrate +# polkadot-sdk frame-support = { workspace = true } frame-system = { workspace = true } pallet-timestamp = { workspace = true } diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index 91ab8d74a..4e05913fe 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -24,7 +24,7 @@ darwinia-deposit = { workspace = true, optional = true } # frontier fp-evm = { workspace = true } -# subtrate +# polkadot-sdk frame-support = { workspace = true } frame-system = { workspace = true } pallet-authorship = { workspace = true } @@ -69,7 +69,7 @@ std = [ # frontier "fp-evm/std", - # subtrate + # polkadot-sdk "frame-support/std", "frame-system/std", "pallet-authorship/std", diff --git a/pallet/staking/traits/Cargo.toml b/pallet/staking/traits/Cargo.toml index f243055fd..e1cd88ffd 100644 --- a/pallet/staking/traits/Cargo.toml +++ b/pallet/staking/traits/Cargo.toml @@ -11,7 +11,7 @@ version.workspace = true codec = { workspace = true, package = "parity-scale-codec" } scale-info = { workspace = true } -# subtrate +# polkadot-sdk sp-runtime = { workspace = true } [features] @@ -21,7 +21,7 @@ std = [ "codec/std", "scale-info/std", - # subtrate + # polkadot-sdk "sp-runtime/std", ] From 7a2e09b872a1b5c4bf75cbae9eb27d9f40fb0ccb Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Tue, 13 Aug 2024 10:48:43 +0800 Subject: [PATCH 20/20] Merge --- pallet/account-migration/src/benchmarking.rs | 32 +++++++++++ pallet/account-migration/src/mock.rs | 2 +- pallet/staking/src/lib.rs | 2 - pallet/staking/src/migration.rs | 58 -------------------- runtime/crab/src/migration.rs | 17 +----- runtime/darwinia/src/migration.rs | 23 +------- runtime/koi/src/migration.rs | 7 +-- 7 files changed, 38 insertions(+), 103 deletions(-) delete mode 100644 pallet/staking/src/migration.rs diff --git a/pallet/account-migration/src/benchmarking.rs b/pallet/account-migration/src/benchmarking.rs index 52b5abe57..6dce09416 100644 --- a/pallet/account-migration/src/benchmarking.rs +++ b/pallet/account-migration/src/benchmarking.rs @@ -69,6 +69,38 @@ mod benchmarks { extra: Default::default(), }, ); + >::insert( + from, + vec![ + Deposit { + id: Default::default(), + value: 1, + start_time: Default::default(), + expired_time: Default::default(), + in_use: Default::default(), + }; + ::MaxDeposits::get() as usize + ], + ); + >::insert( + from, + OldLedger { + staked_ring: 1, + staked_deposits: BoundedVec::truncate_from(vec![ + Default::default(); + ::MaxDeposits::get() + as usize + ]), + unstaking_ring: BoundedVec::truncate_from(vec![ + ( + Default::default(), + Default::default() + ); + 16 + ]), + ..Default::default() + }, + ); } #[benchmark] diff --git a/pallet/account-migration/src/mock.rs b/pallet/account-migration/src/mock.rs index bc6434bc8..656158ed0 100644 --- a/pallet/account-migration/src/mock.rs +++ b/pallet/account-migration/src/mock.rs @@ -162,9 +162,9 @@ frame_support::construct_runtime! { Timestamp: pallet_timestamp, Balances: pallet_balances, Assets: pallet_assets, - AccountMigration: crate, Deposit: darwinia_deposit, Staking: darwinia_staking, + AccountMigration: crate, } } diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index 89e83a8cd..99ba28bab 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -33,8 +33,6 @@ #![deny(missing_docs)] #![allow(clippy::needless_borrows_for_generic_args)] -pub mod migration; - #[cfg(test)] mod mock; #[cfg(test)] diff --git a/pallet/staking/src/migration.rs b/pallet/staking/src/migration.rs deleted file mode 100644 index 9228bf1bc..000000000 --- a/pallet/staking/src/migration.rs +++ /dev/null @@ -1,58 +0,0 @@ -//! Pallet migrations. - -// darwinia -use crate::*; -// polkadot-sdk -use sp_core::H160; - -/// Migrate `StakingRewardDistribution` contract. -/// -/// https://github.com/darwinia-network/KtonDAO/blob/722bdf62942868de2eeaf19bc70d7a165fc031af/src/Owned.sol#L5. -/// https://github.com/darwinia-network/KtonDAO/blob/045b5b59d56b426cb8b06b9da912d0a3ad0a636d/src/staking/KtonDAOVault.sol#L36. -pub fn migrate_staking_reward_distribution_contract(kton_staking_contract: T::AccountId) -where - T: Config + darwinia_ethtx_forwarder::Config, - T::AccountId: Into, -{ - let treasury = ::Treasury::get().into(); - let ksc = kton_staking_contract.into(); - // 0x000000000Ae5DB7BDAf8D071e680452e33d91Dd5. - let ksc_old = H160([ - 0, 0, 0, 0, 10, 229, 219, 123, 218, 248, 208, 113, 230, 128, 69, 46, 51, 217, 29, 213, - ]); - - #[allow(deprecated)] - darwinia_ethtx_forwarder::quick_forward_transact::( - treasury, - Function { - name: "nominateNewOwner".into(), - inputs: vec![Param { - name: "_owner".into(), - kind: ParamType::Address, - internal_type: None, - }], - outputs: Vec::new(), - constant: None, - state_mutability: StateMutability::Payable, - }, - &[Token::Address(ksc)], - ksc_old, - 0.into(), - 1_000_000.into(), - ); - #[allow(deprecated)] - darwinia_ethtx_forwarder::quick_forward_transact::( - treasury, - Function { - name: "acceptOwnershipFromOldDistribution".into(), - inputs: Vec::new(), - outputs: Vec::new(), - constant: None, - state_mutability: StateMutability::Payable, - }, - &[], - ksc, - 0.into(), - 1_000_000.into(), - ); -} diff --git a/runtime/crab/src/migration.rs b/runtime/crab/src/migration.rs index 5351fcc33..f36834591 100644 --- a/runtime/crab/src/migration.rs +++ b/runtime/crab/src/migration.rs @@ -45,19 +45,6 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - frame_support::traits::StorageVersion::new(2) - .put::>(); - - const KTON_DAO_VAULT_ADDR: &str = "0x652182C6aBc0bBE41b5702b05a26d109A405EAcA"; - - #[cfg(feature = "try-runtime")] - assert!(array_bytes::hex_n_into::<_, AccountId, 20>(KTON_DAO_VAULT_ADDR).is_ok()); - - if let Ok(w) = array_bytes::hex_n_into::<_, _, 20>(KTON_DAO_VAULT_ADDR) { - >::put(w); - darwinia_staking::migration::migrate_staking_reward_distribution_contract::(w); - } - - // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(10, 10) + frame_support::weights::Weight::zero() + // ::DbWeight::get().reads_writes(10, 10) } diff --git a/runtime/darwinia/src/migration.rs b/runtime/darwinia/src/migration.rs index 5eabcef42..29ced7b78 100644 --- a/runtime/darwinia/src/migration.rs +++ b/runtime/darwinia/src/migration.rs @@ -45,9 +45,6 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - frame_support::traits::StorageVersion::new(2) - .put::>(); - let _ = migration::clear_storage_prefix( b"BridgeKusamaGrandpa", b"ImportedHeaders", @@ -55,25 +52,7 @@ fn migrate() -> frame_support::weights::Weight { Some(100), None, ); - let mut n = 100; - - n += migration_helper::PalletCleaner { - name: b"EthereumXcm", - values: &[b"Nonce", b"EthereumXcmSuspended"], - maps: &[], - } - .remove_storage_values(); - - const KTON_DAO_VAULT_ADDR: &str = "0x652182C6aBc0bBE41b5702b05a26d109A405EAcA"; - - #[cfg(feature = "try-runtime")] - assert!(array_bytes::hex_n_into::<_, AccountId, 20>(KTON_DAO_VAULT_ADDR).is_ok()); - - if let Ok(w) = array_bytes::hex_n_into::<_, _, 20>(KTON_DAO_VAULT_ADDR) { - >::put(w); - darwinia_staking::migration::migrate_staking_reward_distribution_contract::(w); - } // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(10, n + 10) + ::DbWeight::get().reads_writes(0, 100) } diff --git a/runtime/koi/src/migration.rs b/runtime/koi/src/migration.rs index 2df0bfd6d..5047bc277 100644 --- a/runtime/koi/src/migration.rs +++ b/runtime/koi/src/migration.rs @@ -45,9 +45,6 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - frame_support::traits::StorageVersion::new(2) - .put::>(); - - // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(0, 1) + frame_support::weights::Weight::zero() + // ::DbWeight::get().reads_writes(0, 1) }