mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
Refactor weight constants, Update to remove redundant overhead (#5884)
* Move weight values to `frame_support` * more accurate comment * update balances * vesting * update util * Add weight to time constants * use weight constants in weights * update tests
This commit is contained in:
@@ -23,7 +23,10 @@
|
||||
use sp_std::prelude::*;
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types, debug,
|
||||
weights::{Weight, RuntimeDbWeight},
|
||||
weights::{
|
||||
Weight,
|
||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
||||
},
|
||||
traits::{Currency, Randomness, OnUnbalanced, Imbalance, LockIdentifier},
|
||||
};
|
||||
use sp_core::u32_trait::{_1, _2, _3, _4};
|
||||
@@ -119,18 +122,10 @@ impl OnUnbalanced<NegativeImbalance> for DealWithFees {
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: BlockNumber = 250;
|
||||
/// We allow for 2 seconds of compute with a 6 second average block time.
|
||||
pub const MaximumBlockWeight: Weight = 2_000_000_000_000;
|
||||
/// Executing 10,000 System remarks (no-op) txs takes ~1.26 seconds -> ~125 µs per tx
|
||||
pub const ExtrinsicBaseWeight: Weight = 125_000_000;
|
||||
pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
|
||||
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: 25_000_000, // ~25 µs @ 200,000 items
|
||||
write: 100_000_000, // ~100 µs @ 200,000 items
|
||||
};
|
||||
/// Importing a block with 0 txs takes ~5 ms
|
||||
pub const BlockExecutionWeight: Weight = 5_000_000_000;
|
||||
}
|
||||
|
||||
impl frame_system::Trait for Runtime {
|
||||
@@ -146,7 +141,7 @@ impl frame_system::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
type DbWeight = DbWeight;
|
||||
type DbWeight = RocksDbWeight;
|
||||
type BlockExecutionWeight = BlockExecutionWeight;
|
||||
type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
|
||||
Reference in New Issue
Block a user