mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Update Block- and Extrinsic base weights (#5202)
* Remove constants:: module Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update block+extrinsic weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fmt Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Sanity check full block price Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Spellcheck on Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0e3f36224a
commit
cb8cf97cd2
@@ -96,7 +96,7 @@ pub mod fee {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
currency::{CENTS, MILLICENTS},
|
||||
currency::{CENTS, MILLICENTS, UNITS},
|
||||
fee::WeightToFee,
|
||||
};
|
||||
use crate::weights::ExtrinsicBaseWeight;
|
||||
@@ -104,13 +104,12 @@ mod tests {
|
||||
use runtime_common::MAXIMUM_BLOCK_WEIGHT;
|
||||
|
||||
#[test]
|
||||
// This function tests that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight is correct
|
||||
// Test that the fee for `MAXIMUM_BLOCK_WEIGHT` of weight has sane bounds.
|
||||
fn full_block_fee_is_correct() {
|
||||
// A full block should cost 1,600 CENTS
|
||||
println!("Base: {}", ExtrinsicBaseWeight::get());
|
||||
let x = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT);
|
||||
let y = 16 * 100 * CENTS;
|
||||
assert!(x.max(y) - x.min(y) < MILLICENTS);
|
||||
// A full block should cost between 10 and 100 UNITS.
|
||||
let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT);
|
||||
assert!(full_block >= 10 * UNITS);
|
||||
assert!(full_block <= 100 * UNITS);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -15,32 +15,64 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-03-24 (Y/M/D)
|
||||
//!
|
||||
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Development`
|
||||
//! WARMUPS: `10`, REPEAT: `100`
|
||||
//! WEIGHT-PATH: `runtime/westend/constants/src/weights/`
|
||||
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0`
|
||||
|
||||
parameter_types! {
|
||||
/// Importing a block with 0 Extrinsics.
|
||||
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot
|
||||
// benchmark-overhead
|
||||
// --chain
|
||||
// westend-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --weight-path
|
||||
// runtime/westend/constants/src/weights/
|
||||
// --warmup
|
||||
// 10
|
||||
// --repeat
|
||||
// 100
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants::WEIGHT_PER_NANOS, Weight},
|
||||
};
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::BlockExecutionWeight::get();
|
||||
parameter_types! {
|
||||
/// Time to execute an empty block.
|
||||
/// Calculated by multiplying the *Average* with `1` and adding `0`.
|
||||
///
|
||||
/// Stats [NS]:
|
||||
/// Min, Max: 3_553_100, 3_737_847
|
||||
/// Average: 3_592_873
|
||||
/// Median: 3_573_460
|
||||
/// Std-Dev: 34948.46
|
||||
///
|
||||
/// Percentiles [NS]:
|
||||
/// 99th: 3_699_717
|
||||
/// 95th: 3_660_927
|
||||
/// 75th: 3_608_068
|
||||
pub const BlockExecutionWeight: Weight = 3_592_873 * WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
// At least 100 µs.
|
||||
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||
// At most 50 ms.
|
||||
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::BlockExecutionWeight::get();
|
||||
|
||||
// At least 100 µs.
|
||||
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||
// At most 50 ms.
|
||||
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,32 +15,64 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-03-24 (Y/M/D)
|
||||
//!
|
||||
//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Development`
|
||||
//! WARMUPS: `10`, REPEAT: `100`
|
||||
//! WEIGHT-PATH: `runtime/westend/constants/src/weights/`
|
||||
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0`
|
||||
|
||||
parameter_types! {
|
||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot
|
||||
// benchmark-overhead
|
||||
// --chain
|
||||
// westend-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --weight-path
|
||||
// runtime/westend/constants/src/weights/
|
||||
// --warmup
|
||||
// 10
|
||||
// --repeat
|
||||
// 100
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants::WEIGHT_PER_NANOS, Weight},
|
||||
};
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||
parameter_types! {
|
||||
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
||||
/// Calculated by multiplying the *Average* with `1` and adding `0`.
|
||||
///
|
||||
/// Stats [NS]:
|
||||
/// Min, Max: 72_528, 72_806
|
||||
/// Average: 72_650
|
||||
/// Median: 72_642
|
||||
/// Std-Dev: 62.3
|
||||
///
|
||||
/// Percentiles [NS]:
|
||||
/// 99th: 72_767
|
||||
/// 95th: 72_755
|
||||
/// 75th: 72_700
|
||||
pub const ExtrinsicBaseWeight: Weight = 72_650 * WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
// At least 10 µs.
|
||||
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||
// At most 1 ms.
|
||||
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::ExtrinsicBaseWeight::get();
|
||||
|
||||
// At least 10 µs.
|
||||
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||
// At most 1 ms.
|
||||
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ pub mod extrinsic_weights;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
pub use block_weights::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::ExtrinsicBaseWeight;
|
||||
pub use paritydb_weights::constants::ParityDbWeight;
|
||||
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||
|
||||
Reference in New Issue
Block a user