Assign DB weights for node runtime (#5703)

This commit is contained in:
Nikolay Volf
2020-04-23 12:51:52 +03:00
committed by GitHub
parent e84b06a8c0
commit ff9c88d21c
4 changed files with 18 additions and 8 deletions
@@ -34,7 +34,7 @@ pub use sp_runtime::{Permill, Perbill};
pub use frame_support::{
StorageValue, construct_runtime, parameter_types,
traits::Randomness,
weights::Weight,
weights::{Weight, RuntimeDbWeight},
};
/// Importing a template pallet
@@ -126,6 +126,12 @@ parameter_types! {
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
pub const Version: RuntimeVersion = VERSION;
/// This probably should not be changed unless you have specific
/// disk i/o conditions for the node.
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 60_000_000, // ~0.06 ms = ~60 µs
write: 200_000_000, // ~0.2 ms = 200 µs
};
}
impl system::Trait for Runtime {
@@ -154,7 +160,7 @@ impl system::Trait for Runtime {
/// Maximum weight of each block.
type MaximumBlockWeight = MaximumBlockWeight;
/// The weight of database operations that the runtime can invoke.
type DbWeight = ();
type DbWeight = DbWeight;
/// Maximum size of all encoded transactions (in bytes) that are allowed in one block.
type MaximumBlockLength = MaximumBlockLength;
/// Portion of the block weight that is available to all normal transactions.