From dce76a862622c5d8fc3b5a09efbdcab39e20c416 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 11 Mar 2024 12:19:11 +0100 Subject: [PATCH 01/12] Rename RuntimeDbWeight to RuntimeDbRefTime --- substrate/primitives/weights/src/lib.rs | 39 ++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/substrate/primitives/weights/src/lib.rs b/substrate/primitives/weights/src/lib.rs index b2c956266e2c..95ebb94bd339 100644 --- a/substrate/primitives/weights/src/lib.rs +++ b/substrate/primitives/weights/src/lib.rs @@ -51,23 +51,54 @@ pub mod constants { /// The weight of database operations that the runtime can invoke. /// -/// NOTE: This is currently only measured in computational time, and will probably -/// be updated all together once proof size is accounted for. +/// NOTE: `RuntimeDbRefTime` formerly `RuntimeDbWeight` can only be used to estimate the +/// computational time component (`ref_time`) of database operations. +/// +/// It is primarily intended for use within benchmark-generated [`Weight`] functions to help +/// calculate the computational cost of these operations. +/// It should NOT be used in any context that is meant to be parachain compatible, where a non-zero +/// `pov_weight` component is expected. #[derive(Clone, Copy, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode, TypeInfo)] -pub struct RuntimeDbWeight { +pub struct RuntimeDbRefTime { pub read: u64, pub write: u64, } -impl RuntimeDbWeight { +#[deprecated(note = "Use `RuntimeDbRefTime` instead.")] +pub type RuntimeDbWeight = RuntimeDbRefTime; + +impl RuntimeDbRefTime { + /// The weight of a read operation. + /// + /// Note: `RuntimeDbRefTime` does not know about `proof_size`. The returned [`Weight`] only has + /// a non-zero computational time component (`ref_time`). + /// + /// This function is primarily intended for use within benchmark-generated [`Weight`] functions + /// to help calculate the computational cost of these operations. + /// It should NOT be used in any context that is meant to be parachain compatible, where a + /// non-zero `pov_weight` component is expected. pub fn reads(self, r: u64) -> Weight { Weight::from_parts(self.read.saturating_mul(r), 0) } + /// The weight of a write operation. + /// + /// Note: `RuntimeDbRefTime` does not know about `proof_size`. The returned [`Weight`] only has + /// a non-zero computational time component (`ref_time`). + /// + /// This function is primarily intended for use within benchmark-generated [`Weight`] functions + /// to help calculate the computational cost of these operations. + /// It should NOT be used in any context that is meant to be parachain compatible, where a + /// non-zero `pov_weight` component is expected. pub fn writes(self, w: u64) -> Weight { Weight::from_parts(self.write.saturating_mul(w), 0) } + /// The weight of a read and write operation. + /// + /// Note: `RuntimeDbRefTime` does not know about `proof_size`. The returned [`Weight`] only has + /// a non-zero computational time component (`ref_time`). + /// This function should only be used in generated benchmark code. pub fn reads_writes(self, r: u64, w: u64) -> Weight { let read_weight = self.read.saturating_mul(r); let write_weight = self.write.saturating_mul(w); From 6769954b08f5d40839d762400cff25c25a8207d8 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 11 Mar 2024 12:21:30 +0100 Subject: [PATCH 02/12] Fix read_write comment --- substrate/primitives/weights/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/substrate/primitives/weights/src/lib.rs b/substrate/primitives/weights/src/lib.rs index 95ebb94bd339..2a3e74906b65 100644 --- a/substrate/primitives/weights/src/lib.rs +++ b/substrate/primitives/weights/src/lib.rs @@ -98,7 +98,11 @@ impl RuntimeDbRefTime { /// /// Note: `RuntimeDbRefTime` does not know about `proof_size`. The returned [`Weight`] only has /// a non-zero computational time component (`ref_time`). - /// This function should only be used in generated benchmark code. + /// + /// This function is primarily intended for use within benchmark-generated [`Weight`] functions + /// to help calculate the computational cost of these operations. + /// It should NOT be used in any context that is meant to be parachain compatible, where a + /// non-zero `pov_weight` component is expected. pub fn reads_writes(self, r: u64, w: u64) -> Weight { let read_weight = self.read.saturating_mul(r); let write_weight = self.write.saturating_mul(w); From 007006984232fc143ab09537249ca37d875b3a5f Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 11 Mar 2024 12:53:56 +0100 Subject: [PATCH 03/12] Update system doc comment --- substrate/frame/system/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 0318f77342e0..4b393a7530c0 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -538,7 +538,8 @@ pub mod pallet { #[pallet::no_default_bounds] type BlockHashCount: Get>; - /// The weight of runtime database operations the runtime can invoke. + /// The computational time component (`ref_time`) of runtime database operations the runtime + /// can invoke. #[pallet::constant] type DbWeight: Get; From a74003e6d15a3e449b5f231bec11bd3a8cd43ac8 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 11 Mar 2024 13:30:45 +0100 Subject: [PATCH 04/12] Add PR doc --- prdoc/pr_3640.prdoc | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 prdoc/pr_3640.prdoc diff --git a/prdoc/pr_3640.prdoc b/prdoc/pr_3640.prdoc new file mode 100644 index 000000000000..8233b9a647a6 --- /dev/null +++ b/prdoc/pr_3640.prdoc @@ -0,0 +1,9 @@ +title: Rename `RuntimeDbWeight` to `RuntimeDbRefTime` +doc: + - audience: Runtime Dev + description: | + The `RuntimeDbWeight` struct was renamed `RuntimeDbRefTime` + to better reflect the fact that it can only be used to generate the `ref_time` component of the weight. + `RuntimeDbWeight` is now a (deprecated) type alias for `RuntimeDbRefTime`. + +crates: [ name: sp-weights ] From e1d6bc2500fc9e099f251ef650a0766439a2c9a4 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 11 Mar 2024 15:40:13 +0100 Subject: [PATCH 05/12] rename all --- bridges/bin/runtime-common/src/mock.rs | 4 ++-- bridges/modules/messages/src/outbound_lane.rs | 4 ++-- bridges/modules/parachains/src/weights_ext.rs | 8 ++++---- bridges/modules/relayers/src/mock.rs | 4 ++-- bridges/modules/xcm-bridge-hub/src/mock.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../src/weights/paritydb_weights.rs | 4 ++-- .../src/weights/rocksdb_weights.rs | 4 ++-- .../penpal/src/weights/paritydb_weights.rs | 4 ++-- .../penpal/src/weights/rocksdb_weights.rs | 4 ++-- .../constants/src/weights/paritydb_weights.rs | 4 ++-- .../constants/src/weights/rocksdb_weights.rs | 4 ++-- .../constants/src/weights/paritydb_weights.rs | 4 ++-- .../constants/src/weights/rocksdb_weights.rs | 4 ++-- .../constants/src/weights/paritydb_weights.rs | 4 ++-- .../constants/src/weights/rocksdb_weights.rs | 4 ++-- prdoc/pr_3640.prdoc | 6 +++--- .../unlock_and_unreserve_all_funds.rs | 4 ++-- .../unlock_and_unreserve_all_funds.rs | 4 ++-- substrate/frame/executive/src/tests.rs | 4 ++-- substrate/frame/support/src/dispatch.rs | 6 +++--- substrate/frame/support/src/migrations.rs | 20 +++++++++---------- .../support/src/storage/generator/mod.rs | 2 +- substrate/frame/support/src/tests/mod.rs | 2 +- .../support/src/weights/paritydb_weights.rs | 4 ++-- .../support/src/weights/rocksdb_weights.rs | 4 ++-- substrate/frame/support/test/src/lib.rs | 2 +- .../support/test/tests/construct_runtime.rs | 6 +++--- substrate/frame/support/test/tests/pallet.rs | 4 ++-- .../support/test/tests/pallet_instance.rs | 2 +- substrate/frame/system/src/lib.rs | 4 ++-- substrate/frame/system/src/mock.rs | 2 +- .../tips/src/migrations/unreserve_deposits.rs | 4 ++-- .../benchmarking-cli/src/storage/weights.hbs | 4 ++-- .../runtime/src/weights/paritydb_weights.rs | 4 ++-- .../runtime/src/weights/rocksdb_weights.rs | 4 ++-- 53 files changed, 114 insertions(+), 114 deletions(-) diff --git a/bridges/bin/runtime-common/src/mock.rs b/bridges/bin/runtime-common/src/mock.rs index f147f1404f06..842b5c8b0ddd 100644 --- a/bridges/bin/runtime-common/src/mock.rs +++ b/bridges/bin/runtime-common/src/mock.rs @@ -40,7 +40,7 @@ use bp_runtime::{ use codec::{Decode, Encode}; use frame_support::{ derive_impl, parameter_types, - weights::{ConstantMultiplier, IdentityFee, RuntimeDbWeight, Weight}, + weights::{ConstantMultiplier, IdentityFee, RuntimeDbRefTime, Weight}, }; use pallet_transaction_payment::Multiplier; use sp_runtime::{ @@ -129,7 +129,7 @@ parameter_types! { pub const BridgedChainId: ChainId = TEST_BRIDGED_CHAIN_ID; pub const BridgedParasPalletName: &'static str = "Paras"; pub const ExistentialDeposit: ThisChainBalance = 500; - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 1, write: 2 }; + pub const DbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 1, write: 2 }; pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); pub const TransactionBaseFee: ThisChainBalance = 0; pub const TransactionByteFee: ThisChainBalance = 1; diff --git a/bridges/modules/messages/src/outbound_lane.rs b/bridges/modules/messages/src/outbound_lane.rs index 431c2cfb7eef..d014fc0a0354 100644 --- a/bridges/modules/messages/src/outbound_lane.rs +++ b/bridges/modules/messages/src/outbound_lane.rs @@ -21,7 +21,7 @@ use crate::{Config, LOG_TARGET}; use bp_messages::{DeliveredMessages, LaneId, MessageNonce, OutboundLaneData, UnrewardedRelayer}; use codec::{Decode, Encode}; use frame_support::{ - weights::{RuntimeDbWeight, Weight}, + weights::{RuntimeDbRefTime, Weight}, BoundedVec, PalletError, }; use num_traits::Zero; @@ -143,7 +143,7 @@ impl OutboundLane { /// Returns weight, consumed by messages pruning and lane state update. pub fn prune_messages( &mut self, - db_weight: RuntimeDbWeight, + db_weight: RuntimeDbRefTime, mut remaining_weight: Weight, ) -> Weight { let write_weight = db_weight.writes(1); diff --git a/bridges/modules/parachains/src/weights_ext.rs b/bridges/modules/parachains/src/weights_ext.rs index 393086a85690..4520a464ab72 100644 --- a/bridges/modules/parachains/src/weights_ext.rs +++ b/bridges/modules/parachains/src/weights_ext.rs @@ -19,7 +19,7 @@ use crate::weights::{BridgeWeight, WeightInfo}; use bp_runtime::Size; -use frame_support::weights::{RuntimeDbWeight, Weight}; +use frame_support::weights::{RuntimeDbRefTime, Weight}; /// Size of the regular parachain head. /// @@ -44,7 +44,7 @@ pub trait WeightInfoExt: WeightInfo { /// Weight of the parachain heads delivery extrinsic. fn submit_parachain_heads_weight( - db_weight: RuntimeDbWeight, + db_weight: RuntimeDbRefTime, proof: &impl Size, parachains_count: u32, ) -> Weight { @@ -73,14 +73,14 @@ pub trait WeightInfoExt: WeightInfo { /// This weight only includes db write operations that happens if parachain head is actually /// updated. All extra weights (weight of storage proof validation, additional checks, ...) is /// not included. - fn parachain_head_storage_write_weight(db_weight: RuntimeDbWeight) -> Weight { + fn parachain_head_storage_write_weight(db_weight: RuntimeDbRefTime) -> Weight { // it's just a couple of operations - we need to write the hash (`ImportedParaHashes`) and // the head itself (`ImportedParaHeads`. Pruning is not included here db_weight.writes(2) } /// Returns weight of single parachain head pruning. - fn parachain_head_pruning_weight(db_weight: RuntimeDbWeight) -> Weight { + fn parachain_head_pruning_weight(db_weight: RuntimeDbRefTime) -> Weight { // it's just one write operation, we don't want any benchmarks for that db_weight.writes(1) } diff --git a/bridges/modules/relayers/src/mock.rs b/bridges/modules/relayers/src/mock.rs index 667b10e5c125..4e2a808b2932 100644 --- a/bridges/modules/relayers/src/mock.rs +++ b/bridges/modules/relayers/src/mock.rs @@ -23,7 +23,7 @@ use bp_relayers::{ PayRewardFromAccount, PaymentProcedure, RewardsAccountOwner, RewardsAccountParams, }; use frame_support::{ - derive_impl, parameter_types, traits::fungible::Mutate, weights::RuntimeDbWeight, + derive_impl, parameter_types, traits::fungible::Mutate, weights::RuntimeDbRefTime, }; use sp_runtime::BuildStorage; @@ -52,7 +52,7 @@ frame_support::construct_runtime! { } parameter_types! { - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 1, write: 2 }; + pub const DbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 1, write: 2 }; pub const ExistentialDeposit: Balance = 1; pub const ReserveId: [u8; 8] = *b"brdgrlrs"; pub const Stake: Balance = 1_000; diff --git a/bridges/modules/xcm-bridge-hub/src/mock.rs b/bridges/modules/xcm-bridge-hub/src/mock.rs index e40e1f9fb651..78128af48393 100644 --- a/bridges/modules/xcm-bridge-hub/src/mock.rs +++ b/bridges/modules/xcm-bridge-hub/src/mock.rs @@ -31,7 +31,7 @@ use bridge_runtime_common::{ messages_xcm_extension::{SenderAndLane, XcmBlobHauler}, }; use codec::Encode; -use frame_support::{derive_impl, parameter_types, traits::ConstU32, weights::RuntimeDbWeight}; +use frame_support::{derive_impl, parameter_types, traits::ConstU32, weights::RuntimeDbRefTime}; use sp_core::H256; use sp_runtime::{ testing::Header as SubstrateHeader, @@ -60,7 +60,7 @@ frame_support::construct_runtime! { } parameter_types! { - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 1, write: 2 }; + pub const DbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 1, write: 2 }; pub const ExistentialDeposit: Balance = 1; } diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/collectives/collectives-westend/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; 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 25679703831a..937ec76ac602 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 @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; 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 3dd817aa6f13..bbc95f513f5c 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 @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/paritydb_weights.rs index 4338d928d807..1f43d5ed4042 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/rocksdb_weights.rs index 1d115d963fac..c914a3f72d6e 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/paritydb_weights.rs index 1c6d2ebe568c..1d314a66f580 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/rocksdb_weights.rs index aa0cb2b4bc37..668c4fbe4395 100644 --- a/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/paritydb_weights.rs index 4338d928d807..1f43d5ed4042 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/rocksdb_weights.rs index 1d115d963fac..c914a3f72d6e 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/paritydb_weights.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/paritydb_weights.rs index 2699f3abbb1f..3a6487071893 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/paritydb_weights.rs @@ -16,13 +16,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/rocksdb_weights.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/rocksdb_weights.rs index 61b48fb2350e..d09ba24d61ed 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/rocksdb_weights.rs @@ -16,13 +16,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; 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 25679703831a..937ec76ac602 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/weights/paritydb_weights.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; 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 3dd817aa6f13..bbc95f513f5c 100644 --- a/cumulus/parachains/runtimes/testing/penpal/src/weights/rocksdb_weights.rs +++ b/cumulus/parachains/runtimes/testing/penpal/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/polkadot/runtime/rococo/constants/src/weights/paritydb_weights.rs b/polkadot/runtime/rococo/constants/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/polkadot/runtime/rococo/constants/src/weights/paritydb_weights.rs +++ b/polkadot/runtime/rococo/constants/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/polkadot/runtime/rococo/constants/src/weights/rocksdb_weights.rs b/polkadot/runtime/rococo/constants/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/polkadot/runtime/rococo/constants/src/weights/rocksdb_weights.rs +++ b/polkadot/runtime/rococo/constants/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/polkadot/runtime/test-runtime/constants/src/weights/paritydb_weights.rs b/polkadot/runtime/test-runtime/constants/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/polkadot/runtime/test-runtime/constants/src/weights/paritydb_weights.rs +++ b/polkadot/runtime/test-runtime/constants/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/polkadot/runtime/test-runtime/constants/src/weights/rocksdb_weights.rs b/polkadot/runtime/test-runtime/constants/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/polkadot/runtime/test-runtime/constants/src/weights/rocksdb_weights.rs +++ b/polkadot/runtime/test-runtime/constants/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/polkadot/runtime/westend/constants/src/weights/paritydb_weights.rs b/polkadot/runtime/westend/constants/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/polkadot/runtime/westend/constants/src/weights/paritydb_weights.rs +++ b/polkadot/runtime/westend/constants/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/polkadot/runtime/westend/constants/src/weights/rocksdb_weights.rs b/polkadot/runtime/westend/constants/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/polkadot/runtime/westend/constants/src/weights/rocksdb_weights.rs +++ b/polkadot/runtime/westend/constants/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/prdoc/pr_3640.prdoc b/prdoc/pr_3640.prdoc index 8233b9a647a6..1cfc3233dea0 100644 --- a/prdoc/pr_3640.prdoc +++ b/prdoc/pr_3640.prdoc @@ -1,9 +1,9 @@ -title: Rename `RuntimeDbWeight` to `RuntimeDbRefTime` +title: Rename `RuntimeDbRefTime` to `RuntimeDbRefTime` doc: - audience: Runtime Dev description: | - The `RuntimeDbWeight` struct was renamed `RuntimeDbRefTime` + The `RuntimeDbRefTime` struct was renamed `RuntimeDbRefTime` to better reflect the fact that it can only be used to generate the `ref_time` component of the weight. - `RuntimeDbWeight` is now a (deprecated) type alias for `RuntimeDbRefTime`. + `RuntimeDbRefTime` is now a (deprecated) type alias for `RuntimeDbRefTime`. crates: [ name: sp-weights ] diff --git a/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs b/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs index 188c475f64d0..21fa30f85069 100644 --- a/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs +++ b/substrate/frame/democracy/src/migrations/unlock_and_unreserve_all_funds.rs @@ -24,7 +24,7 @@ use frame_support::{ pallet_prelude::ValueQuery, storage_alias, traits::{Currency, LockableCurrency, OnRuntimeUpgrade, ReservableCurrency}, - weights::RuntimeDbWeight, + weights::RuntimeDbRefTime, Parameter, Twox64Concat, }; use sp_core::Get; @@ -52,7 +52,7 @@ pub trait UnlockConfig: 'static { /// The maximum deposit as configured previously in the runtime. type MaxDeposits: Get; /// The DB weight as configured in the runtime to calculate the correct weight. - type DbWeight: Get; + type DbWeight: Get; /// The block number as configured in the runtime. type BlockNumber: Parameter + Zero + Copy + Ord; } diff --git a/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs b/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs index 482766ee97f5..78721fc04bd8 100644 --- a/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs +++ b/substrate/frame/elections-phragmen/src/migrations/unlock_and_unreserve_all_funds.rs @@ -23,7 +23,7 @@ use frame_support::{ pallet_prelude::ValueQuery, storage_alias, traits::{Currency, LockIdentifier, LockableCurrency, OnRuntimeUpgrade, ReservableCurrency}, - weights::RuntimeDbWeight, + weights::RuntimeDbRefTime, Parameter, Twox64Concat, }; use sp_core::Get; @@ -52,7 +52,7 @@ pub trait UnlockConfig: 'static { /// runtime. type PalletId: Get; /// The DB weight as configured in the runtime to calculate the correct weight. - type DbWeight: Get; + type DbWeight: Get; } #[storage_alias(dynamic)] diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index a3f70a9fc3c2..61ef76b65e16 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -36,7 +36,7 @@ use frame_support::{ pallet_prelude::*, parameter_types, traits::{fungible, ConstU8, Currency, IsInherent}, - weights::{ConstantMultiplier, IdentityFee, RuntimeDbWeight, Weight, WeightMeter, WeightToFee}, + weights::{ConstantMultiplier, IdentityFee, RuntimeDbRefTime, Weight, WeightMeter, WeightToFee}, }; use frame_system::{pallet_prelude::*, ChainContext, LastRuntimeUpgrade, LastRuntimeUpgradeInfo}; use pallet_balances::Call as BalancesCall; @@ -303,7 +303,7 @@ parameter_types! { .for_class(DispatchClass::all(), |weights| weights.base_extrinsic = Weight::from_parts(5, 0)) .for_class(DispatchClass::non_mandatory(), |weights| weights.max_total = Weight::from_parts(1024, u64::MAX).into()) .build_or_panic(); - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const DbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 10, write: 100, }; diff --git a/substrate/frame/support/src/dispatch.rs b/substrate/frame/support/src/dispatch.rs index 61787a740128..7068767819f2 100644 --- a/substrate/frame/support/src/dispatch.rs +++ b/substrate/frame/support/src/dispatch.rs @@ -647,7 +647,7 @@ mod weight_tests { use super::*; use sp_core::parameter_types; use sp_runtime::{generic, traits::BlakeTwo256}; - use sp_weights::RuntimeDbWeight; + use sp_weights::RuntimeDbRefTime; pub use self::frame_system::{Call, Config}; @@ -682,7 +682,7 @@ mod weight_tests { type RuntimeCall; type RuntimeTask; type PalletInfo: crate::traits::PalletInfo; - type DbWeight: Get; + type DbWeight: Get; } #[pallet::error] @@ -764,7 +764,7 @@ mod weight_tests { ); parameter_types! { - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const DbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 100, write: 1000, }; diff --git a/substrate/frame/support/src/migrations.rs b/substrate/frame/support/src/migrations.rs index 2ceab44cb16b..3505ef6e1b03 100644 --- a/substrate/frame/support/src/migrations.rs +++ b/substrate/frame/support/src/migrations.rs @@ -22,7 +22,7 @@ use crate::{ Defensive, GetStorageVersion, NoStorageVersionSet, PalletInfoAccess, SafeMode, StorageVersion, }, - weights::{RuntimeDbWeight, Weight, WeightMeter}, + weights::{RuntimeDbRefTime, Weight, WeightMeter}, }; use codec::{Decode, Encode, MaxEncodedLen}; use impl_trait_for_tuples::impl_for_tuples; @@ -43,7 +43,7 @@ use sp_std::{marker::PhantomData, vec::Vec}; /// - `To`: The version being upgraded to. /// - `Inner`: An implementation of `OnRuntimeUpgrade`. /// - `Pallet`: The Pallet being upgraded. -/// - `Weight`: The runtime's RuntimeDbWeight implementation. +/// - `Weight`: The runtime's RuntimeDbRefTime implementation. /// /// When a [`VersionedMigration`] `on_runtime_upgrade`, `pre_upgrade`, or `post_upgrade` method is /// called, the on-chain version of the pallet is compared to `From`. If they match, the `Inner` @@ -118,7 +118,7 @@ impl< const TO: u16, Inner: crate::traits::OnRuntimeUpgrade, Pallet: GetStorageVersion + PalletInfoAccess, - DbWeight: Get, + DbWeight: Get, > crate::traits::OnRuntimeUpgrade for VersionedMigration { /// Executes pre_upgrade if the migration will run, and wraps the pre_upgrade bytes in @@ -213,14 +213,14 @@ impl + PalletIn /// Trait used by [`migrate_from_pallet_version_to_storage_version`] to do the actual migration. pub trait PalletVersionToStorageVersionHelper { - fn migrate(db_weight: &RuntimeDbWeight) -> Weight; + fn migrate(db_weight: &RuntimeDbRefTime) -> Weight; } impl PalletVersionToStorageVersionHelper for T where T::InCodeStorageVersion: StoreInCodeStorageVersion, { - fn migrate(db_weight: &RuntimeDbWeight) -> Weight { + fn migrate(db_weight: &RuntimeDbRefTime) -> Weight { const PALLET_VERSION_STORAGE_KEY_POSTFIX: &[u8] = b":__PALLET_VERSION__:"; fn pallet_version_key(name: &str) -> [u8; 32] { @@ -239,7 +239,7 @@ where #[cfg_attr(all(feature = "tuples-96", not(feature = "tuples-128")), impl_for_tuples(96))] #[cfg_attr(feature = "tuples-128", impl_for_tuples(128))] impl PalletVersionToStorageVersionHelper for T { - fn migrate(db_weight: &RuntimeDbWeight) -> Weight { + fn migrate(db_weight: &RuntimeDbRefTime) -> Weight { let mut weight = Weight::zero(); for_tuples!( #( weight = weight.saturating_add(T::migrate(db_weight)); )* ); @@ -254,7 +254,7 @@ impl PalletVersionToStorageVersionHelper for T { pub fn migrate_from_pallet_version_to_storage_version< Pallets: PalletVersionToStorageVersionHelper, >( - db_weight: &RuntimeDbWeight, + db_weight: &RuntimeDbRefTime, ) -> Weight { Pallets::migrate(db_weight) } @@ -265,7 +265,7 @@ pub fn migrate_from_pallet_version_to_storage_version< /// This struct is generic over two parameters: /// - `P` is a type that implements the `Get` trait for a static string, representing the pallet's /// name. -/// - `DbWeight` is a type that implements the `Get` trait for `RuntimeDbWeight`, providing the +/// - `DbWeight` is a type that implements the `Get` trait for `RuntimeDbRefTime`, providing the /// weight for database operations. /// /// On runtime upgrade, the `on_runtime_upgrade` function will clear all storage items associated @@ -314,10 +314,10 @@ pub fn migrate_from_pallet_version_to_storage_version< /// a multi-block scheduler currently under development which will allow for removal of storage /// items (and performing other heavy migrations) over multiple blocks /// (see ). -pub struct RemovePallet, DbWeight: Get>( +pub struct RemovePallet, DbWeight: Get>( PhantomData<(P, DbWeight)>, ); -impl, DbWeight: Get> frame_support::traits::OnRuntimeUpgrade +impl, DbWeight: Get> frame_support::traits::OnRuntimeUpgrade for RemovePallet { fn on_runtime_upgrade() -> frame_support::weights::Weight { diff --git a/substrate/frame/support/src/storage/generator/mod.rs b/substrate/frame/support/src/storage/generator/mod.rs index dd6d622852db..baa330f8048d 100644 --- a/substrate/frame/support/src/storage/generator/mod.rs +++ b/substrate/frame/support/src/storage/generator/mod.rs @@ -65,7 +65,7 @@ mod tests { type RuntimeCall; type RuntimeTask; type PalletInfo: crate::traits::PalletInfo; - type DbWeight: Get; + type DbWeight: Get; } #[pallet::origin] diff --git a/substrate/frame/support/src/tests/mod.rs b/substrate/frame/support/src/tests/mod.rs index c63bfb181c3f..669a6f87dca6 100644 --- a/substrate/frame/support/src/tests/mod.rs +++ b/substrate/frame/support/src/tests/mod.rs @@ -77,7 +77,7 @@ pub mod frame_system { type RuntimeTask: crate::traits::tasks::Task; #[pallet::no_default_bounds] type PalletInfo: crate::traits::PalletInfo; - type DbWeight: Get; + type DbWeight: Get; } #[pallet::error] diff --git a/substrate/frame/support/src/weights/paritydb_weights.rs b/substrate/frame/support/src/weights/paritydb_weights.rs index f69fc0cd93c6..9eea99b25477 100644 --- a/substrate/frame/support/src/weights/paritydb_weights.rs +++ b/substrate/frame/support/src/weights/paritydb_weights.rs @@ -18,12 +18,12 @@ pub mod constants { use frame_support::weights::constants; use sp_core::parameter_types; - use sp_weights::RuntimeDbWeight; + use sp_weights::RuntimeDbRefTime; parameter_types! { /// ParityDB can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/substrate/frame/support/src/weights/rocksdb_weights.rs b/substrate/frame/support/src/weights/rocksdb_weights.rs index 25d2ac1cdec0..7e69ebc42739 100644 --- a/substrate/frame/support/src/weights/rocksdb_weights.rs +++ b/substrate/frame/support/src/weights/rocksdb_weights.rs @@ -18,12 +18,12 @@ pub mod constants { use frame_support::weights::constants; use sp_core::parameter_types; - use sp_weights::RuntimeDbWeight; + use sp_weights::RuntimeDbRefTime; parameter_types! { /// By default, Substrate uses RocksDB, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/substrate/frame/support/test/src/lib.rs b/substrate/frame/support/test/src/lib.rs index a8a723375033..3efb3a9f7468 100644 --- a/substrate/frame/support/test/src/lib.rs +++ b/substrate/frame/support/test/src/lib.rs @@ -60,7 +60,7 @@ pub mod pallet { /// The information about the pallet setup in the runtime. type PalletInfo: frame_support::traits::PalletInfo; /// The db weights. - type DbWeight: Get; + type DbWeight: Get; } #[pallet::call] diff --git a/substrate/frame/support/test/tests/construct_runtime.rs b/substrate/frame/support/test/tests/construct_runtime.rs index 83691451ccdf..57d64247fc94 100644 --- a/substrate/frame/support/test/tests/construct_runtime.rs +++ b/substrate/frame/support/test/tests/construct_runtime.rs @@ -23,7 +23,7 @@ use codec::MaxEncodedLen; use frame_support::{ - derive_impl, parameter_types, traits::PalletInfo as _, weights::RuntimeDbWeight, + derive_impl, parameter_types, traits::PalletInfo as _, weights::RuntimeDbRefTime, }; use frame_system::limits::{BlockLength, BlockWeights}; use scale_info::TypeInfo; @@ -675,8 +675,8 @@ fn test_metadata() { }, PalletConstantMetadata { name: "DbWeight", - ty: meta_type::(), - value: RuntimeDbWeight::default().encode(), + ty: meta_type::(), + value: RuntimeDbRefTime::default().encode(), docs: maybe_docs(vec![" The weight of runtime database operations the runtime can invoke.",]), }, PalletConstantMetadata { diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index 4d2737d411ee..427f0a6eabef 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -27,7 +27,7 @@ use frame_support::{ OnInitialize, OnRuntimeUpgrade, PalletError, PalletInfoAccess, StorageVersion, UnfilteredDispatchable, }, - weights::{RuntimeDbWeight, Weight}, + weights::{RuntimeDbRefTime, Weight}, OrdNoBound, PartialOrdNoBound, }; use scale_info::{meta_type, TypeInfo}; @@ -1358,7 +1358,7 @@ fn migrate_from_pallet_version_to_storage_version() { assert_eq!(Example2::on_chain_storage_version(), StorageVersion::new(0)); assert_eq!(System::on_chain_storage_version(), StorageVersion::new(0)); - let db_weight = RuntimeDbWeight { read: 0, write: 5 }; + let db_weight = RuntimeDbRefTime { read: 0, write: 5 }; let weight = frame_support::migrations::migrate_from_pallet_version_to_storage_version::< AllPalletsWithSystem, >(&db_weight); diff --git a/substrate/frame/support/test/tests/pallet_instance.rs b/substrate/frame/support/test/tests/pallet_instance.rs index 505400a7c217..82163e8c2e6c 100644 --- a/substrate/frame/support/test/tests/pallet_instance.rs +++ b/substrate/frame/support/test/tests/pallet_instance.rs @@ -761,7 +761,7 @@ fn metadata() { }, PalletConstantMetadata { name: "DbWeight", - ty: scale_info::meta_type::(), + ty: scale_info::meta_type::(), value: vec![], docs: vec![], }, diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index 4b393a7530c0..af19582139ed 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -142,7 +142,7 @@ use frame_support::{ }; use scale_info::TypeInfo; use sp_core::storage::well_known_keys; -use sp_weights::{RuntimeDbWeight, Weight}; +use sp_weights::{RuntimeDbRefTime, Weight}; #[cfg(any(feature = "std", test))] use sp_io::TestExternalities; @@ -541,7 +541,7 @@ pub mod pallet { /// The computational time component (`ref_time`) of runtime database operations the runtime /// can invoke. #[pallet::constant] - type DbWeight: Get; + type DbWeight: Get; /// Get the chain's in-code version. #[pallet::constant] diff --git a/substrate/frame/system/src/mock.rs b/substrate/frame/system/src/mock.rs index 7059845a7df3..1fb2477da6ce 100644 --- a/substrate/frame/system/src/mock.rs +++ b/substrate/frame/system/src/mock.rs @@ -42,7 +42,7 @@ parameter_types! { transaction_version: 1, state_version: 1, }; - pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const DbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 10, write: 100, }; diff --git a/substrate/frame/tips/src/migrations/unreserve_deposits.rs b/substrate/frame/tips/src/migrations/unreserve_deposits.rs index 16cb1a80e812..c47e729d9010 100644 --- a/substrate/frame/tips/src/migrations/unreserve_deposits.rs +++ b/substrate/frame/tips/src/migrations/unreserve_deposits.rs @@ -23,7 +23,7 @@ use frame_support::{ pallet_prelude::OptionQuery, storage_alias, traits::{Currency, LockableCurrency, OnRuntimeUpgrade, ReservableCurrency}, - weights::RuntimeDbWeight, + weights::RuntimeDbRefTime, Parameter, Twox64Concat, }; use sp_runtime::{traits::Zero, Saturating}; @@ -57,7 +57,7 @@ pub trait UnlockConfig: 'static { /// [`construct_runtime!`](frame_support::construct_runtime). type PalletName: sp_core::Get<&'static str>; /// The DB weight as configured in the runtime to calculate the correct weight. - type DbWeight: sp_core::Get; + type DbWeight: sp_core::Get; /// The block number as configured in the runtime. type BlockNumber: Parameter + Zero + Copy + Ord; } diff --git a/substrate/utils/frame/benchmarking-cli/src/storage/weights.hbs b/substrate/utils/frame/benchmarking-cli/src/storage/weights.hbs index 135b18b19374..a3df8ebc71c9 100644 --- a/substrate/utils/frame/benchmarking-cli/src/storage/weights.hbs +++ b/substrate/utils/frame/benchmarking-cli/src/storage/weights.hbs @@ -19,7 +19,7 @@ pub mod constants { use frame_support::weights::constants; use sp_core::parameter_types; - use sp_weights::RuntimeDbWeight; + use sp_weights::RuntimeDbRefTime; parameter_types! { {{#if (eq db_name "ParityDb")}} @@ -29,7 +29,7 @@ pub mod constants { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. {{/if}} - pub const {{db_name}}Weight: RuntimeDbWeight = RuntimeDbWeight { + pub const {{db_name}}Weight: RuntimeDbRefTime = RuntimeDbRefTime { /// Time to read one storage item. /// Calculated by multiplying the *{{params.weight_params.weight_metric}}* of all values with `{{params.weight_params.weight_mul}}` and adding `{{params.weight_params.weight_add}}`. /// diff --git a/templates/parachain/runtime/src/weights/paritydb_weights.rs b/templates/parachain/runtime/src/weights/paritydb_weights.rs index 25679703831a..937ec76ac602 100644 --- a/templates/parachain/runtime/src/weights/paritydb_weights.rs +++ b/templates/parachain/runtime/src/weights/paritydb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights /// are available for brave runtime engineers who may want to try this out as default. - pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const ParityDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; diff --git a/templates/parachain/runtime/src/weights/rocksdb_weights.rs b/templates/parachain/runtime/src/weights/rocksdb_weights.rs index 3dd817aa6f13..bbc95f513f5c 100644 --- a/templates/parachain/runtime/src/weights/rocksdb_weights.rs +++ b/templates/parachain/runtime/src/weights/rocksdb_weights.rs @@ -18,13 +18,13 @@ pub mod constants { use frame_support::{ parameter_types, - weights::{constants, RuntimeDbWeight}, + weights::{constants, RuntimeDbRefTime}, }; parameter_types! { /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout /// the runtime. - pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + pub const RocksDbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS, write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS, }; From a891d04fa800e8eff9dc3119e975e9202534f20a Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 11 Mar 2024 15:55:15 +0100 Subject: [PATCH 06/12] fix lint --- substrate/frame/executive/src/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/substrate/frame/executive/src/tests.rs b/substrate/frame/executive/src/tests.rs index 61ef76b65e16..5c246c0e17ef 100644 --- a/substrate/frame/executive/src/tests.rs +++ b/substrate/frame/executive/src/tests.rs @@ -36,7 +36,9 @@ use frame_support::{ pallet_prelude::*, parameter_types, traits::{fungible, ConstU8, Currency, IsInherent}, - weights::{ConstantMultiplier, IdentityFee, RuntimeDbRefTime, Weight, WeightMeter, WeightToFee}, + weights::{ + ConstantMultiplier, IdentityFee, RuntimeDbRefTime, Weight, WeightMeter, WeightToFee, + }, }; use frame_system::{pallet_prelude::*, ChainContext, LastRuntimeUpgrade, LastRuntimeUpgradeInfo}; use pallet_balances::Call as BalancesCall; From 43bcbe8eed3913776e886431e0db41ee137e5a65 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Thu, 29 Aug 2024 11:04:38 +0200 Subject: [PATCH 07/12] Add missing --- .../support/procedural/examples/proc_main/main.rs | 2 +- substrate/frame/support/src/migrations.rs | 12 +++++++----- .../support/test/tests/runtime_legacy_ordering.rs | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/substrate/frame/support/procedural/examples/proc_main/main.rs b/substrate/frame/support/procedural/examples/proc_main/main.rs index 4bdfc76dd92f..b3a42d638360 100644 --- a/substrate/frame/support/procedural/examples/proc_main/main.rs +++ b/substrate/frame/support/procedural/examples/proc_main/main.rs @@ -81,7 +81,7 @@ pub mod frame_system { type RuntimeTask: crate::traits::tasks::Task; #[pallet::no_default_bounds] type PalletInfo: crate::traits::PalletInfo; - type DbWeight: Get; + type DbWeight: Get; } #[pallet::error] diff --git a/substrate/frame/support/src/migrations.rs b/substrate/frame/support/src/migrations.rs index 278fc97e6e8c..7eeb90ceb129 100644 --- a/substrate/frame/support/src/migrations.rs +++ b/substrate/frame/support/src/migrations.rs @@ -377,7 +377,7 @@ impl, DbWeight: Get> frame_support::trait /// name. /// - `S` is a type that implements the [`Get`] trait for a static string, representing the storage /// name. -/// - `DbWeight` is a type that implements the [`Get`] trait for [`RuntimeDbWeight`], providing the +/// - `DbWeight` is a type that implements the [`Get`] trait for [`RuntimeDbRefTime`], providing the /// weight for database operations. /// /// On runtime upgrade, the `on_runtime_upgrade` function will clear the storage from the specified @@ -426,10 +426,12 @@ impl, DbWeight: Get> frame_support::trait /// a multi-block scheduler currently under development which will allow for removal of storage /// items (and performing other heavy migrations) over multiple blocks /// (see ). -pub struct RemoveStorage, S: Get<&'static str>, DbWeight: Get>( - PhantomData<(P, S, DbWeight)>, -); -impl, S: Get<&'static str>, DbWeight: Get> +pub struct RemoveStorage< + P: Get<&'static str>, + S: Get<&'static str>, + DbWeight: Get, +>(PhantomData<(P, S, DbWeight)>); +impl, S: Get<&'static str>, DbWeight: Get> frame_support::traits::OnRuntimeUpgrade for RemoveStorage { fn on_runtime_upgrade() -> frame_support::weights::Weight { diff --git a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs index 4233db21e203..68054632fc86 100644 --- a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs +++ b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs @@ -23,7 +23,7 @@ use codec::MaxEncodedLen; use frame_support::{ - derive_impl, parameter_types, traits::PalletInfo as _, weights::RuntimeDbWeight, + derive_impl, parameter_types, traits::PalletInfo as _, weights::RuntimeDbRefTime, }; use frame_system::limits::{BlockLength, BlockWeights}; use scale_info::TypeInfo; @@ -743,8 +743,8 @@ fn test_metadata() { }, PalletConstantMetadata { name: "DbWeight", - ty: meta_type::(), - value: RuntimeDbWeight::default().encode(), + ty: meta_type::(), + value: RuntimeDbRefTime::default().encode(), docs: maybe_docs(vec![" The weight of runtime database operations the runtime can invoke.",]), }, PalletConstantMetadata { From ce58333f16ad5790d132cc69c29ab1b998fbdca6 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 3 Sep 2024 09:13:39 +0200 Subject: [PATCH 08/12] fix doc test --- substrate/frame/support/test/tests/runtime.rs | 9 ++++++--- .../frame/support/test/tests/runtime_legacy_ordering.rs | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/substrate/frame/support/test/tests/runtime.rs b/substrate/frame/support/test/tests/runtime.rs index 12dfaea4ac65..fdb7ce31a065 100644 --- a/substrate/frame/support/test/tests/runtime.rs +++ b/substrate/frame/support/test/tests/runtime.rs @@ -806,9 +806,12 @@ fn test_metadata() { }, PalletConstantMetadata { name: "DbWeight", - ty: meta_type::(), - value: RuntimeDbRefTime::default().encode(), - docs: maybe_docs(vec![" The weight of runtime database operations the runtime can invoke.",]), + ty: meta_type::(), + value: RuntimeDbWeight::default().encode(), + docs: maybe_docs(vec![ + " The computational time component (`ref_time`) of runtime database operations the runtime", + " can invoke.", + ] }, PalletConstantMetadata { name: "Version", diff --git a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs index 68054632fc86..635a1471f2b1 100644 --- a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs +++ b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs @@ -743,9 +743,12 @@ fn test_metadata() { }, PalletConstantMetadata { name: "DbWeight", - ty: meta_type::(), - value: RuntimeDbRefTime::default().encode(), - docs: maybe_docs(vec![" The weight of runtime database operations the runtime can invoke.",]), + ty: meta_type::(), + value: RuntimeDbWeight::default().encode(), + docs: maybe_docs(vec![ + " The computational time component (`ref_time`) of runtime database operations the runtime", + " can invoke.", + ]), }, PalletConstantMetadata { name: "Version", From 6cfabf19b6a5e8a5cd744baae334ec7270857356 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 3 Sep 2024 09:25:17 +0200 Subject: [PATCH 09/12] update prdoc --- prdoc/pr_3640.prdoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prdoc/pr_3640.prdoc b/prdoc/pr_3640.prdoc index 1cfc3233dea0..a019365cbcc2 100644 --- a/prdoc/pr_3640.prdoc +++ b/prdoc/pr_3640.prdoc @@ -6,4 +6,6 @@ doc: to better reflect the fact that it can only be used to generate the `ref_time` component of the weight. `RuntimeDbRefTime` is now a (deprecated) type alias for `RuntimeDbRefTime`. -crates: [ name: sp-weights ] +crates: + - name: sp-weights + bump: patch From ae6ed4afbeefe1afbd7fc57307a89d167f7ebce4 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 3 Sep 2024 09:33:45 +0200 Subject: [PATCH 10/12] fix symbol names --- substrate/frame/support/test/tests/runtime.rs | 4 ++-- substrate/frame/support/test/tests/runtime_legacy_ordering.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/frame/support/test/tests/runtime.rs b/substrate/frame/support/test/tests/runtime.rs index fdb7ce31a065..74e8a5075e7a 100644 --- a/substrate/frame/support/test/tests/runtime.rs +++ b/substrate/frame/support/test/tests/runtime.rs @@ -806,8 +806,8 @@ fn test_metadata() { }, PalletConstantMetadata { name: "DbWeight", - ty: meta_type::(), - value: RuntimeDbWeight::default().encode(), + ty: meta_type::(), + value: RuntimeDbRefTime::default().encode(), docs: maybe_docs(vec![ " The computational time component (`ref_time`) of runtime database operations the runtime", " can invoke.", diff --git a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs index 635a1471f2b1..6473e198098b 100644 --- a/substrate/frame/support/test/tests/runtime_legacy_ordering.rs +++ b/substrate/frame/support/test/tests/runtime_legacy_ordering.rs @@ -743,8 +743,8 @@ fn test_metadata() { }, PalletConstantMetadata { name: "DbWeight", - ty: meta_type::(), - value: RuntimeDbWeight::default().encode(), + ty: meta_type::(), + value: RuntimeDbRefTime::default().encode(), docs: maybe_docs(vec![ " The computational time component (`ref_time`) of runtime database operations the runtime", " can invoke.", From 4d36f91710fc9ef1d8eaaa830744309510f2668b Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 3 Sep 2024 09:34:36 +0200 Subject: [PATCH 11/12] fix missing ( --- substrate/frame/support/test/tests/runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/frame/support/test/tests/runtime.rs b/substrate/frame/support/test/tests/runtime.rs index 74e8a5075e7a..a1b256fab393 100644 --- a/substrate/frame/support/test/tests/runtime.rs +++ b/substrate/frame/support/test/tests/runtime.rs @@ -811,7 +811,7 @@ fn test_metadata() { docs: maybe_docs(vec![ " The computational time component (`ref_time`) of runtime database operations the runtime", " can invoke.", - ] + ]) }, PalletConstantMetadata { name: "Version", From bce576ddc5df46ce64e0e2258395792414be773e Mon Sep 17 00:00:00 2001 From: pgherveou Date: Tue, 3 Sep 2024 13:02:20 +0200 Subject: [PATCH 12/12] Fix prdoc --- prdoc/pr_3640.prdoc | 76 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/prdoc/pr_3640.prdoc b/prdoc/pr_3640.prdoc index a019365cbcc2..6f3e20ea334b 100644 --- a/prdoc/pr_3640.prdoc +++ b/prdoc/pr_3640.prdoc @@ -9,3 +9,79 @@ doc: crates: - name: sp-weights bump: patch + + - name: bridge-runtime-common + bump: patch + + - name: frame-support + bump: patch + + - name: frame-support-procedural + bump: patch + + - name: frame-system + bump: patch + + - name: frame-executive + bump: patch + + - name: frame-benchmarking-cli + bump: patch + + - name: pallet-democracy + bump: patch + + - name: pallet-elections-phragmen + bump: patch + + - name: pallet-tips + bump: patch + + - name: rococo-runtime-constants + bump: patch + + - name: westend-runtime-constants + bump: patch + + - name: pallet-bridge-parachains + bump: patch + + - name: pallet-bridge-relayers + bump: patch + + - name: pallet-xcm-bridge-hub + bump: patch + + - name: asset-hub-rococo-runtime + bump: patch + + - name: asset-hub-westend-runtime + bump: patch + + - name: bridge-hub-rococo-runtime + bump: patch + + - name: bridge-hub-westend-runtime + bump: patch + + - name: collectives-westend-runtime + bump: patch + + - name: coretime-rococo-runtime + bump: patch + + - name: coretime-westend-runtime + bump: patch + + - name: people-rococo-runtime + bump: patch + + - name: people-westend-runtime + bump: patch + + - name: penpal-runtime + bump: patch + + - name: contracts-rococo-runtime + bump: patch +