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 @@ -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::{
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions bridges/modules/messages/src/outbound_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -143,7 +143,7 @@ impl<S: OutboundLaneStorage> OutboundLane<S> {
/// 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);
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 All @@ -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 {
Expand Down Expand Up @@ -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)
}
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 @@ -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;

Expand Down Expand Up @@ -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;
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 @@ -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,
Expand Down Expand Up @@ -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;
}

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
Loading
Loading