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
+3 -3
View File
@@ -359,7 +359,7 @@ fn full_native_block_import_works() {
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
DispatchInfo { weight: 200_000_000, ..Default::default() }
DispatchInfo { weight: 460_000_000, ..Default::default() }
)),
topics: vec![],
},
@@ -414,7 +414,7 @@ fn full_native_block_import_works() {
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
DispatchInfo { weight: 200_000_000, ..Default::default() }
DispatchInfo { weight: 460_000_000, ..Default::default() }
)),
topics: vec![],
},
@@ -437,7 +437,7 @@ fn full_native_block_import_works() {
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
DispatchInfo { weight: 200_000_000, ..Default::default() }
DispatchInfo { weight: 460_000_000, ..Default::default() }
)),
topics: vec![],
},
@@ -229,7 +229,7 @@ fn submitted_transaction_should_be_valid() {
let res = Executive::validate_transaction(source, extrinsic);
assert_eq!(res.unwrap(), ValidTransaction {
priority: 2_410_600_000_000,
priority: 2_411_380_000_000,
requires: vec![],
provides: vec![(address, 0).encode()],
longevity: 128,
+6 -2
View File
@@ -23,7 +23,7 @@
use sp_std::prelude::*;
use frame_support::{
construct_runtime, parameter_types, debug,
weights::Weight,
weights::{Weight, RuntimeDbWeight},
traits::{Currency, Randomness, OnUnbalanced, Imbalance},
};
use sp_core::u32_trait::{_1, _2, _3, _4};
@@ -123,6 +123,10 @@ parameter_types! {
pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
pub const Version: RuntimeVersion = VERSION;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 60_000_000, // ~0.06 ms = ~60 µs
write: 200_000_000, // ~0.2 ms = 200 µs
};
}
impl frame_system::Trait for Runtime {
@@ -138,7 +142,7 @@ impl frame_system::Trait for Runtime {
type Event = Event;
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type DbWeight = DbWeight;
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = Version;