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:
Shawn Tabrizi
2022-09-01 20:25:05 +01:00
committed by GitHub
parent 8679e42068
commit 9faf9b1e4f
66 changed files with 583 additions and 565 deletions
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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(|| {
+7 -4
View File
@@ -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);
});
}