From f1302b0c31bf3adbce4ed99133593855b1a95945 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Thu, 8 Sep 2022 13:29:53 +0800 Subject: [PATCH] Companion for paritytech/substrate#12183 (#1601) * Companion for paritytech/substrate#12183 * Fixes * Update pallets/xcmp-queue/src/lib.rs * Update pallets/xcmp-queue/src/lib.rs * update lockfile for {"substrate", "polkadot"} Co-authored-by: parity-processbot <> --- .../runtime/src/weights/block_weights.rs | 7 +++++-- .../runtime/src/weights/extrinsic_weights.rs | 10 ++++++++-- .../runtime/src/weights/paritydb_weights.rs | 8 ++++---- .../runtime/src/weights/rocksdb_weights.rs | 8 ++++---- .../assets/statemine/src/weights/block_weights.rs | 7 +++++-- .../assets/statemine/src/weights/extrinsic_weights.rs | 10 ++++++++-- .../assets/statemine/src/weights/paritydb_weights.rs | 8 ++++---- .../assets/statemine/src/weights/rocksdb_weights.rs | 8 ++++---- .../assets/statemint/src/weights/block_weights.rs | 7 +++++-- .../assets/statemint/src/weights/extrinsic_weights.rs | 10 ++++++++-- .../assets/statemint/src/weights/paritydb_weights.rs | 8 ++++---- .../assets/statemint/src/weights/rocksdb_weights.rs | 8 ++++---- .../assets/westmint/src/weights/block_weights.rs | 7 +++++-- .../assets/westmint/src/weights/extrinsic_weights.rs | 10 ++++++++-- .../assets/westmint/src/weights/paritydb_weights.rs | 8 ++++---- .../assets/westmint/src/weights/rocksdb_weights.rs | 8 ++++---- .../collectives-polkadot/src/weights/block_weights.rs | 7 +++++-- .../src/weights/extrinsic_weights.rs | 10 ++++++++-- .../src/weights/paritydb_weights.rs | 8 ++++---- .../src/weights/rocksdb_weights.rs | 8 ++++---- .../contracts-rococo/src/weights/block_weights.rs | 7 +++++-- .../contracts-rococo/src/weights/extrinsic_weights.rs | 10 ++++++++-- .../contracts-rococo/src/weights/paritydb_weights.rs | 8 ++++---- .../contracts-rococo/src/weights/rocksdb_weights.rs | 8 ++++---- .../testing/penpal/src/weights/block_weights.rs | 7 +++++-- .../testing/penpal/src/weights/extrinsic_weights.rs | 10 ++++++++-- .../testing/penpal/src/weights/paritydb_weights.rs | 8 ++++---- .../testing/penpal/src/weights/rocksdb_weights.rs | 8 ++++---- 28 files changed, 147 insertions(+), 84 deletions(-) diff --git a/cumulus/parachain-template/runtime/src/weights/block_weights.rs b/cumulus/parachain-template/runtime/src/weights/block_weights.rs index 7d4a931bd1..c004307336 100644 --- a/cumulus/parachain-template/runtime/src/weights/block_weights.rs +++ b/cumulus/parachain-template/runtime/src/weights/block_weights.rs @@ -39,11 +39,14 @@ pub mod constants { // At least 100 µs. assert!( - w >= 100u64 * constants::WEIGHT_PER_MICROS, + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), "Weight should be at least 100 µs." ); // At most 50 ms. - assert!(w <= 50u64 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms."); + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); } } } diff --git a/cumulus/parachain-template/runtime/src/weights/extrinsic_weights.rs b/cumulus/parachain-template/runtime/src/weights/extrinsic_weights.rs index 6c6b4a497d..3ce6b73d58 100644 --- a/cumulus/parachain-template/runtime/src/weights/extrinsic_weights.rs +++ b/cumulus/parachain-template/runtime/src/weights/extrinsic_weights.rs @@ -38,9 +38,15 @@ pub mod constants { let w = super::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. - assert!(w >= 10u64 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs."); + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); // At most 1 ms. - assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms."); + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); } } } diff --git a/cumulus/parachain-template/runtime/src/weights/paritydb_weights.rs b/cumulus/parachain-template/runtime/src/weights/paritydb_weights.rs index 8083ccb400..dca7d34831 100644 --- a/cumulus/parachain-template/runtime/src/weights/paritydb_weights.rs +++ b/cumulus/parachain-template/runtime/src/weights/paritydb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachain-template/runtime/src/weights/rocksdb_weights.rs b/cumulus/parachain-template/runtime/src/weights/rocksdb_weights.rs index 1db87f143f..87867ebfe1 100644 --- a/cumulus/parachain-template/runtime/src/weights/rocksdb_weights.rs +++ b/cumulus/parachain-template/runtime/src/weights/rocksdb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/assets/statemine/src/weights/block_weights.rs b/cumulus/parachains/runtimes/assets/statemine/src/weights/block_weights.rs index 7d4a931bd1..c004307336 100644 --- a/cumulus/parachains/runtimes/assets/statemine/src/weights/block_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemine/src/weights/block_weights.rs @@ -39,11 +39,14 @@ pub mod constants { // At least 100 µs. assert!( - w >= 100u64 * constants::WEIGHT_PER_MICROS, + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), "Weight should be at least 100 µs." ); // At most 50 ms. - assert!(w <= 50u64 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms."); + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/assets/statemine/src/weights/extrinsic_weights.rs b/cumulus/parachains/runtimes/assets/statemine/src/weights/extrinsic_weights.rs index 6c6b4a497d..3ce6b73d58 100644 --- a/cumulus/parachains/runtimes/assets/statemine/src/weights/extrinsic_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemine/src/weights/extrinsic_weights.rs @@ -38,9 +38,15 @@ pub mod constants { let w = super::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. - assert!(w >= 10u64 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs."); + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); // At most 1 ms. - assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms."); + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/assets/statemine/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/assets/statemine/src/weights/paritydb_weights.rs index 8083ccb400..dca7d34831 100644 --- a/cumulus/parachains/runtimes/assets/statemine/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemine/src/weights/paritydb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/assets/statemine/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/assets/statemine/src/weights/rocksdb_weights.rs index 1db87f143f..87867ebfe1 100644 --- a/cumulus/parachains/runtimes/assets/statemine/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemine/src/weights/rocksdb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/assets/statemint/src/weights/block_weights.rs b/cumulus/parachains/runtimes/assets/statemint/src/weights/block_weights.rs index 7d4a931bd1..c004307336 100644 --- a/cumulus/parachains/runtimes/assets/statemint/src/weights/block_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemint/src/weights/block_weights.rs @@ -39,11 +39,14 @@ pub mod constants { // At least 100 µs. assert!( - w >= 100u64 * constants::WEIGHT_PER_MICROS, + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), "Weight should be at least 100 µs." ); // At most 50 ms. - assert!(w <= 50u64 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms."); + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/assets/statemint/src/weights/extrinsic_weights.rs b/cumulus/parachains/runtimes/assets/statemint/src/weights/extrinsic_weights.rs index 6c6b4a497d..3ce6b73d58 100644 --- a/cumulus/parachains/runtimes/assets/statemint/src/weights/extrinsic_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemint/src/weights/extrinsic_weights.rs @@ -38,9 +38,15 @@ pub mod constants { let w = super::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. - assert!(w >= 10u64 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs."); + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); // At most 1 ms. - assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms."); + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/assets/statemint/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/assets/statemint/src/weights/paritydb_weights.rs index 8083ccb400..dca7d34831 100644 --- a/cumulus/parachains/runtimes/assets/statemint/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemint/src/weights/paritydb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/assets/statemint/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/assets/statemint/src/weights/rocksdb_weights.rs index 1db87f143f..87867ebfe1 100644 --- a/cumulus/parachains/runtimes/assets/statemint/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/assets/statemint/src/weights/rocksdb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/assets/westmint/src/weights/block_weights.rs b/cumulus/parachains/runtimes/assets/westmint/src/weights/block_weights.rs index 7d4a931bd1..c004307336 100644 --- a/cumulus/parachains/runtimes/assets/westmint/src/weights/block_weights.rs +++ b/cumulus/parachains/runtimes/assets/westmint/src/weights/block_weights.rs @@ -39,11 +39,14 @@ pub mod constants { // At least 100 µs. assert!( - w >= 100u64 * constants::WEIGHT_PER_MICROS, + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), "Weight should be at least 100 µs." ); // At most 50 ms. - assert!(w <= 50u64 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms."); + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/assets/westmint/src/weights/extrinsic_weights.rs b/cumulus/parachains/runtimes/assets/westmint/src/weights/extrinsic_weights.rs index 6c6b4a497d..3ce6b73d58 100644 --- a/cumulus/parachains/runtimes/assets/westmint/src/weights/extrinsic_weights.rs +++ b/cumulus/parachains/runtimes/assets/westmint/src/weights/extrinsic_weights.rs @@ -38,9 +38,15 @@ pub mod constants { let w = super::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. - assert!(w >= 10u64 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs."); + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); // At most 1 ms. - assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms."); + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/assets/westmint/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/assets/westmint/src/weights/paritydb_weights.rs index 8083ccb400..dca7d34831 100644 --- a/cumulus/parachains/runtimes/assets/westmint/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/assets/westmint/src/weights/paritydb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/assets/westmint/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/assets/westmint/src/weights/rocksdb_weights.rs index 1db87f143f..87867ebfe1 100644 --- a/cumulus/parachains/runtimes/assets/westmint/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/assets/westmint/src/weights/rocksdb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/block_weights.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/block_weights.rs index 7d4a931bd1..c004307336 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/block_weights.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/block_weights.rs @@ -39,11 +39,14 @@ pub mod constants { // At least 100 µs. assert!( - w >= 100u64 * constants::WEIGHT_PER_MICROS, + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), "Weight should be at least 100 µs." ); // At most 50 ms. - assert!(w <= 50u64 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms."); + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/extrinsic_weights.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/extrinsic_weights.rs index 6c6b4a497d..3ce6b73d58 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/extrinsic_weights.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/extrinsic_weights.rs @@ -38,9 +38,15 @@ pub mod constants { let w = super::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. - assert!(w >= 10u64 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs."); + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); // At most 1 ms. - assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms."); + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/paritydb_weights.rs index 8083ccb400..dca7d34831 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/paritydb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/rocksdb_weights.rs index 1db87f143f..87867ebfe1 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-polkadot/src/weights/rocksdb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/block_weights.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/block_weights.rs index 7d4a931bd1..c004307336 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/block_weights.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/block_weights.rs @@ -39,11 +39,14 @@ pub mod constants { // At least 100 µs. assert!( - w >= 100u64 * constants::WEIGHT_PER_MICROS, + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), "Weight should be at least 100 µs." ); // At most 50 ms. - assert!(w <= 50u64 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms."); + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/extrinsic_weights.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/extrinsic_weights.rs index 6c6b4a497d..3ce6b73d58 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/extrinsic_weights.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/extrinsic_weights.rs @@ -38,9 +38,15 @@ pub mod constants { let w = super::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. - assert!(w >= 10u64 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs."); + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); // At most 1 ms. - assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms."); + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/paritydb_weights.rs index 8083ccb400..dca7d34831 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/paritydb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/rocksdb_weights.rs index 1db87f143f..87867ebfe1 100644 --- a/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/contracts/contracts-rococo/src/weights/rocksdb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/testing/penpal/src/weights/block_weights.rs b/cumulus/parachains/runtimes/testing/penpal/src/weights/block_weights.rs index 7d4a931bd1..c004307336 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/weights/block_weights.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/weights/block_weights.rs @@ -39,11 +39,14 @@ pub mod constants { // At least 100 µs. assert!( - w >= 100u64 * constants::WEIGHT_PER_MICROS, + w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(), "Weight should be at least 100 µs." ); // At most 50 ms. - assert!(w <= 50u64 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms."); + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 50 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/testing/penpal/src/weights/extrinsic_weights.rs b/cumulus/parachains/runtimes/testing/penpal/src/weights/extrinsic_weights.rs index 6c6b4a497d..3ce6b73d58 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/weights/extrinsic_weights.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/weights/extrinsic_weights.rs @@ -38,9 +38,15 @@ pub mod constants { let w = super::constants::ExtrinsicBaseWeight::get(); // At least 10 µs. - assert!(w >= 10u64 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs."); + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(), + "Weight should be at least 10 µs." + ); // At most 1 ms. - assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms."); + assert!( + w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), + "Weight should be at most 1 ms." + ); } } } diff --git a/cumulus/parachains/runtimes/testing/penpal/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/testing/penpal/src/weights/paritydb_weights.rs index 8083ccb400..dca7d34831 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/weights/paritydb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); } diff --git a/cumulus/parachains/runtimes/testing/penpal/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/testing/penpal/src/weights/rocksdb_weights.rs index 1db87f143f..87867ebfe1 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/weights/rocksdb_weights.rs @@ -42,20 +42,20 @@ pub mod constants { fn sane() { // At least 1 µs. assert!( - W::get().reads(1) >= constants::WEIGHT_PER_MICROS, + W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Read weight should be at least 1 µs." ); assert!( - W::get().writes(1) >= constants::WEIGHT_PER_MICROS, + W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(), "Write weight should be at least 1 µs." ); // At most 1 ms. assert!( - W::get().reads(1) <= constants::WEIGHT_PER_MILLIS, + W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Read weight should be at most 1 ms." ); assert!( - W::get().writes(1) <= constants::WEIGHT_PER_MILLIS, + W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(), "Write weight should be at most 1 ms." ); }