mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Companion for Weight v1.5 Follow Up (#1584)
* fixes
* oopsie
* [ci] Apply cargo-fmt
* fixes
* [ci] Apply cargo-fmt
* fixes
* fix cumulus template
* fix merge
* update lockfile for {"polkadot", "substrate"}
Co-authored-by: paritytech-ci <paritytech-ci@parity.io>
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -42,8 +42,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
Weight::from_ref_time(18_563_000 as RefTimeWeight)
|
||||
// Standard Error: 0
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(68_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(b as RefTimeWeight),
|
||||
Weight::from_ref_time(68_000 as RefTimeWeight).saturating_mul(b as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
@@ -59,8 +58,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
Weight::from_ref_time(71_196_000 as RefTimeWeight)
|
||||
// Standard Error: 0
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(198_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(c as RefTimeWeight),
|
||||
Weight::from_ref_time(198_000 as RefTimeWeight).saturating_mul(c as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
@@ -69,8 +67,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
Weight::from_ref_time(55_336_000 as RefTimeWeight)
|
||||
// Standard Error: 0
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(151_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(c as RefTimeWeight),
|
||||
Weight::from_ref_time(151_000 as RefTimeWeight).saturating_mul(c as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
|
||||
@@ -85,12 +82,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Standard Error: 1_010_000
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(109_961_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(r as RefTimeWeight),
|
||||
.saturating_mul(r as RefTimeWeight),
|
||||
)
|
||||
// Standard Error: 1_010_000
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(151_952_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(c as RefTimeWeight),
|
||||
.saturating_mul(c as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(
|
||||
T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)),
|
||||
@@ -113,8 +110,7 @@ impl WeightInfo for () {
|
||||
Weight::from_ref_time(18_563_000 as RefTimeWeight)
|
||||
// Standard Error: 0
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(68_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(b as RefTimeWeight),
|
||||
Weight::from_ref_time(68_000 as RefTimeWeight).saturating_mul(b as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
|
||||
}
|
||||
@@ -130,8 +126,7 @@ impl WeightInfo for () {
|
||||
Weight::from_ref_time(71_196_000 as RefTimeWeight)
|
||||
// Standard Error: 0
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(198_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(c as RefTimeWeight),
|
||||
Weight::from_ref_time(198_000 as RefTimeWeight).saturating_mul(c as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
|
||||
@@ -140,8 +135,7 @@ impl WeightInfo for () {
|
||||
Weight::from_ref_time(55_336_000 as RefTimeWeight)
|
||||
// Standard Error: 0
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(151_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(c as RefTimeWeight),
|
||||
Weight::from_ref_time(151_000 as RefTimeWeight).saturating_mul(c as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
|
||||
@@ -156,12 +150,12 @@ impl WeightInfo for () {
|
||||
// Standard Error: 1_010_000
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(109_961_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(r as RefTimeWeight),
|
||||
.saturating_mul(r as RefTimeWeight),
|
||||
)
|
||||
// Standard Error: 1_010_000
|
||||
.saturating_add(
|
||||
Weight::from_ref_time(151_952_000 as RefTimeWeight)
|
||||
.scalar_saturating_mul(c as RefTimeWeight),
|
||||
.saturating_mul(c as RefTimeWeight),
|
||||
)
|
||||
.saturating_add(
|
||||
RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)),
|
||||
|
||||
@@ -43,7 +43,7 @@ pub struct ConfigData {
|
||||
impl Default for ConfigData {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
max_individual: 10 * WEIGHT_PER_MILLIS, // 10 ms of execution time maximum by default
|
||||
max_individual: 10u64 * WEIGHT_PER_MILLIS, // 10 ms of execution time maximum by default
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ pub mod pallet {
|
||||
/// Exactly equivalent to `service_queue` but expects a mutable `page_index` to be passed
|
||||
/// in and any changes stored.
|
||||
fn do_service_queue(limit: Weight, page_index: &mut PageIndexData) -> Weight {
|
||||
let mut used = Weight::new();
|
||||
let mut used = Weight::zero();
|
||||
while page_index.begin_used < page_index.end_used {
|
||||
let page = Pages::<T>::take(page_index.begin_used);
|
||||
for (i, &(sent_at, ref data)) in page.iter().enumerate() {
|
||||
|
||||
@@ -269,7 +269,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
||||
let mut weight = Weight::new();
|
||||
let mut weight = Weight::zero();
|
||||
|
||||
// To prevent removing `NewValidationCode` that was set by another `on_initialize`
|
||||
// like for example from scheduler, we only kill the storage entry if it was not yet
|
||||
@@ -808,7 +808,7 @@ impl<T: Config> Pallet<T> {
|
||||
let dm_count = downward_messages.len() as u32;
|
||||
let mut dmq_head = <LastDmqMqcHead<T>>::get();
|
||||
|
||||
let mut weight_used = Weight::new();
|
||||
let mut weight_used = Weight::zero();
|
||||
if dm_count != 0 {
|
||||
Self::deposit_event(Event::DownwardMessagesReceived { count: dm_count });
|
||||
let max_weight =
|
||||
|
||||
@@ -25,7 +25,7 @@ pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
|
||||
/// Call this during the next runtime upgrade for this module.
|
||||
pub fn on_runtime_upgrade<T: Config>() -> Weight {
|
||||
let mut weight: Weight = Weight::new();
|
||||
let mut weight: Weight = Weight::zero();
|
||||
|
||||
if StorageVersion::get::<Pallet<T>>() == 0 {
|
||||
weight = weight
|
||||
|
||||
@@ -111,7 +111,7 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> {
|
||||
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
|
||||
limit: Weight,
|
||||
) -> Weight {
|
||||
let mut used = Weight::new();
|
||||
let mut used = Weight::zero();
|
||||
for (_sent_at, data) in iter {
|
||||
let id = sp_io::hashing::twox_64(&data[..]);
|
||||
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
@@ -144,7 +144,7 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
|
||||
iter: impl Iterator<Item = (RelayBlockNumber, Vec<u8>)>,
|
||||
limit: Weight,
|
||||
) -> Weight {
|
||||
let mut used = Weight::new();
|
||||
let mut used = Weight::zero();
|
||||
for (_sent_at, data) in iter {
|
||||
let id = sp_io::hashing::twox_64(&data[..]);
|
||||
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
|
||||
@@ -451,7 +451,7 @@ impl Default for QueueConfigData {
|
||||
resume_threshold: 1,
|
||||
threshold_weight: Weight::from_ref_time(100_000),
|
||||
weight_restrict_decay: Weight::from_ref_time(2),
|
||||
xcmp_max_individual_weight: 20 * WEIGHT_PER_MILLIS,
|
||||
xcmp_max_individual_weight: 20u64 * WEIGHT_PER_MILLIS,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -795,8 +795,8 @@ impl<T: Config> Pallet<T> {
|
||||
} = <QueueConfig<T>>::get();
|
||||
|
||||
let mut shuffled = Self::create_shuffle(status.len());
|
||||
let mut weight_used = Weight::new();
|
||||
let mut weight_available = Weight::new();
|
||||
let mut weight_used = Weight::zero();
|
||||
let mut weight_available = Weight::zero();
|
||||
|
||||
// We don't want the possibility of a chain sending a series of really heavy messages and
|
||||
// tying up the block's execution time from other chains. Therefore we execute any remaining
|
||||
|
||||
@@ -25,7 +25,7 @@ pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
/// Migrates the pallet storage to the most recent version, checking and setting the
|
||||
/// `StorageVersion`.
|
||||
pub fn migrate_to_latest<T: Config>() -> Weight {
|
||||
let mut weight = Weight::new();
|
||||
let mut weight = Weight::zero();
|
||||
|
||||
if StorageVersion::get::<Pallet<T>>() == 0 {
|
||||
weight += migrate_to_v1::<T>();
|
||||
@@ -103,7 +103,7 @@ mod tests {
|
||||
drop_threshold: 12,
|
||||
resume_threshold: 3,
|
||||
threshold_weight: Weight::from_ref_time(333_333),
|
||||
weight_restrict_decay: Weight::one(),
|
||||
weight_restrict_decay: Weight::from_ref_time(1),
|
||||
};
|
||||
|
||||
new_test_ext().execute_with(|| {
|
||||
|
||||
@@ -225,17 +225,20 @@ fn update_weight_restrict_decay_works() {
|
||||
fn update_xcmp_max_individual_weight() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
assert_eq!(data.xcmp_max_individual_weight, 20 * WEIGHT_PER_MILLIS);
|
||||
assert_eq!(data.xcmp_max_individual_weight, 20u64 * WEIGHT_PER_MILLIS);
|
||||
assert_ok!(XcmpQueue::update_xcmp_max_individual_weight(
|
||||
Origin::root(),
|
||||
30 * WEIGHT_PER_MILLIS
|
||||
30u64 * WEIGHT_PER_MILLIS
|
||||
));
|
||||
assert_noop!(
|
||||
XcmpQueue::update_xcmp_max_individual_weight(Origin::signed(3), 10 * WEIGHT_PER_MILLIS),
|
||||
XcmpQueue::update_xcmp_max_individual_weight(
|
||||
Origin::signed(3),
|
||||
10u64 * WEIGHT_PER_MILLIS
|
||||
),
|
||||
BadOrigin
|
||||
);
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
|
||||
assert_eq!(data.xcmp_max_individual_weight, 30 * WEIGHT_PER_MILLIS);
|
||||
assert_eq!(data.xcmp_max_individual_weight, 30u64 * WEIGHT_PER_MILLIS);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user