Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename RuntimeDbWeight to RuntimeDbRefTime #3640

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions bridges/bin/runtime-common/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use bp_runtime::{messages::MessageDispatchResult, Chain, ChainId, Parachain};
use codec::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::{
Expand Down Expand Up @@ -116,7 +116,7 @@ crate::generate_bridge_reject_obsolete_headers_and_messages! {
parameter_types! {
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;
Expand Down
8 changes: 4 additions & 4 deletions bridges/modules/parachains/src/weights_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -58,7 +58,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 {
Expand Down Expand Up @@ -90,14 +90,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)
}
Expand Down
4 changes: 2 additions & 2 deletions bridges/modules/relayers/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use codec::Encode;
use frame_support::{
derive_impl, parameter_types,
traits::fungible::Mutate,
weights::{ConstantMultiplier, IdentityFee, RuntimeDbWeight, Weight},
weights::{ConstantMultiplier, IdentityFee, RuntimeDbRefTime, Weight},
};
use pallet_transaction_payment::Multiplier;
use sp_core::{ConstU64, ConstU8, H256};
Expand Down Expand Up @@ -177,7 +177,7 @@ frame_support::construct_runtime! {

parameter_types! {
pub const BridgedParasPalletName: &'static str = "Paras";
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 1, write: 2 };
pub const DbWeight: RuntimeDbRefTime = RuntimeDbRefTime { read: 1, write: 2 };
pub const ExistentialDeposit: ThisChainBalance = 1;
pub const ReserveId: [u8; 8] = *b"brdgrlrs";
pub const Stake: ThisChainBalance = 1_000;
Expand Down
4 changes: 2 additions & 2 deletions bridges/modules/xcm-bridge-hub/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use codec::Encode;
use frame_support::{
assert_ok, derive_impl, parameter_types,
traits::{EnsureOrigin, Equals, Everything, OriginTrait},
weights::RuntimeDbWeight,
weights::RuntimeDbRefTime,
};
use polkadot_parachain_primitives::primitives::Sibling;
use sp_core::H256;
Expand Down Expand Up @@ -65,7 +65,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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Loading
Loading