Companion for paritytech/substrate#12868 (#1970)

* Replace WEIGHT_PER_* with WEIGHT_REF_TIME_PER_*

* Fixes

* Fixes

* update lockfile for {"substrate", "polkadot"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Keith Yeung
2022-12-09 02:36:30 +09:00
committed by GitHub
parent 97bc16ba7c
commit f3847ead3c
49 changed files with 505 additions and 480 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ use cumulus_primitives_core::{
};
use frame_support::{
traits::EnsureOrigin,
weights::{constants::WEIGHT_PER_MILLIS, Weight},
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
};
use rand_chacha::{
rand_core::{RngCore, SeedableRng},
@@ -464,7 +464,7 @@ impl Default for QueueConfigData {
threshold_weight: Weight::from_ref_time(100_000),
weight_restrict_decay: Weight::from_ref_time(2),
xcmp_max_individual_weight: Weight::from_parts(
20u64 * WEIGHT_PER_MILLIS.ref_time(),
20u64 * WEIGHT_REF_TIME_PER_MILLIS,
DEFAULT_POV_SIZE,
),
}
+2 -2
View File
@@ -20,7 +20,7 @@ use crate::{Config, Pallet, Store, DEFAULT_POV_SIZE};
use frame_support::{
pallet_prelude::*,
traits::StorageVersion,
weights::{constants::WEIGHT_PER_MILLIS, Weight},
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
};
use xcm::latest::Weight as XcmWeight;
@@ -62,7 +62,7 @@ mod v1 {
resume_threshold: 1,
threshold_weight: 100_000,
weight_restrict_decay: 2,
xcmp_max_individual_weight: 20u64 * WEIGHT_PER_MILLIS.ref_time(),
xcmp_max_individual_weight: 20u64 * WEIGHT_REF_TIME_PER_MILLIS,
}
}
}
+7 -4
View File
@@ -220,21 +220,24 @@ fn update_xcmp_max_individual_weight() {
let data: QueueConfigData = <QueueConfig<Test>>::get();
assert_eq!(
data.xcmp_max_individual_weight,
Weight::from_parts(20u64 * WEIGHT_PER_MILLIS.ref_time(), DEFAULT_POV_SIZE),
Weight::from_parts(20u64 * WEIGHT_REF_TIME_PER_MILLIS, DEFAULT_POV_SIZE),
);
assert_ok!(XcmpQueue::update_xcmp_max_individual_weight(
RuntimeOrigin::root(),
30u64 * WEIGHT_PER_MILLIS.ref_time()
30u64 * WEIGHT_REF_TIME_PER_MILLIS
));
assert_noop!(
XcmpQueue::update_xcmp_max_individual_weight(
RuntimeOrigin::signed(3),
10u64 * WEIGHT_PER_MILLIS.ref_time()
10u64 * WEIGHT_REF_TIME_PER_MILLIS
),
BadOrigin
);
let data: QueueConfigData = <QueueConfig<Test>>::get();
assert_eq!(data.xcmp_max_individual_weight, 30u64 * WEIGHT_PER_MILLIS);
assert_eq!(
data.xcmp_max_individual_weight,
Weight::from_ref_time(30u64 * WEIGHT_REF_TIME_PER_MILLIS)
);
});
}