diff --git a/polkadot/runtime/kusama/constants/src/lib.rs b/polkadot/runtime/kusama/constants/src/lib.rs index 29448302b48c5b0d4e59a824a90f727ba76ea24c..71aab9c989bd3ad03f17e190a48f279421d545df 100644 --- a/polkadot/runtime/kusama/constants/src/lib.rs +++ b/polkadot/runtime/kusama/constants/src/lib.rs @@ -103,13 +103,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 1,000 and 10,000 CENTS. + let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT); + assert!(full_block >= 1_000 * CENTS); + assert!(full_block <= 10_000 * CENTS); } #[test] diff --git a/polkadot/runtime/kusama/constants/src/weights/block_weights.rs b/polkadot/runtime/kusama/constants/src/weights/block_weights.rs index 4db90f0c0207a4d5b3ecb145e15cec41e6c6f159..9dc978e494be5f402c2885ec20f0ad6f544074de 100644 --- a/polkadot/runtime/kusama/constants/src/weights/block_weights.rs +++ b/polkadot/runtime/kusama/constants/src/weights/block_weights.rs @@ -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}, - }; - - parameter_types! { - /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS; - } +//! 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/kusama/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/production/polkadot +// benchmark-overhead +// --chain +// kusama-dev +// --execution=wasm +// --wasm-execution=compiled +// --weight-path +// runtime/kusama/constants/src/weights/ +// --warmup +// 10 +// --repeat +// 100 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +parameter_types! { + /// Time to execute an empty block. + /// Calculated by multiplying the *Average* with `1` and adding `0`. + /// + /// Stats [NS]: + /// Min, Max: 4_118_220, 4_438_558 + /// Average: 4_168_174 + /// Median: 4_158_502 + /// Std-Dev: 47195.34 + /// + /// Percentiles [NS]: + /// 99th: 4_279_128 + /// 95th: 4_249_714 + /// 75th: 4_180_317 + pub const BlockExecutionWeight: Weight = 4_168_174 * WEIGHT_PER_NANOS; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/kusama/constants/src/weights/extrinsic_weights.rs b/polkadot/runtime/kusama/constants/src/weights/extrinsic_weights.rs index 158ba99c6a4c12985b9996bdab13ce8248043c24..693034fcdb7ff6ce22ea14e5fee87201ffe12a7a 100644 --- a/polkadot/runtime/kusama/constants/src/weights/extrinsic_weights.rs +++ b/polkadot/runtime/kusama/constants/src/weights/extrinsic_weights.rs @@ -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}, - }; - - parameter_types! { - /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS; - } +//! 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/kusama/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/production/polkadot +// benchmark-overhead +// --chain +// kusama-dev +// --execution=wasm +// --wasm-execution=compiled +// --weight-path +// runtime/kusama/constants/src/weights/ +// --warmup +// 10 +// --repeat +// 100 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +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: 80_176, 81_558 + /// Average: 80_350 + /// Median: 80_335 + /// Std-Dev: 136.56 + /// + /// Percentiles [NS]: + /// 99th: 80_492 + /// 95th: 80_459 + /// 75th: 80_377 + pub const ExtrinsicBaseWeight: Weight = 80_350 * WEIGHT_PER_NANOS; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/kusama/constants/src/weights/mod.rs b/polkadot/runtime/kusama/constants/src/weights/mod.rs index ed0b4dbcd47fbffb125bda4b337099ae69e51ce2..3f8bc612c06428e50714e8857fc2b329981e41c9 100644 --- a/polkadot/runtime/kusama/constants/src/weights/mod.rs +++ b/polkadot/runtime/kusama/constants/src/weights/mod.rs @@ -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; diff --git a/polkadot/runtime/polkadot/constants/src/lib.rs b/polkadot/runtime/polkadot/constants/src/lib.rs index 27f8ab9f08e089ed6510d86619456e7a0e6a2da3..6b9c57df3b69b07fec227e68a88fca96382caf33 100644 --- a/polkadot/runtime/polkadot/constants/src/lib.rs +++ b/polkadot/runtime/polkadot/constants/src/lib.rs @@ -105,13 +105,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 16 DOLLARS - println!("Base: {}", ExtrinsicBaseWeight::get()); - let x = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT); - let y = 16 * DOLLARS; - assert!(x.max(y) - x.min(y) < MILLICENTS); + // A full block should cost between 10 and 100 DOLLARS. + let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT); + assert!(full_block >= 10 * DOLLARS); + assert!(full_block <= 100 * DOLLARS); } #[test] diff --git a/polkadot/runtime/polkadot/constants/src/weights/block_weights.rs b/polkadot/runtime/polkadot/constants/src/weights/block_weights.rs index 4db90f0c0207a4d5b3ecb145e15cec41e6c6f159..1d19dcd25af6cb5ed888b63b25ea1159d4a934ae 100644 --- a/polkadot/runtime/polkadot/constants/src/weights/block_weights.rs +++ b/polkadot/runtime/polkadot/constants/src/weights/block_weights.rs @@ -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}, - }; - - parameter_types! { - /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS; - } +//! 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/polkadot/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/production/polkadot +// benchmark-overhead +// --chain +// polkadot-dev +// --execution=wasm +// --wasm-execution=compiled +// --weight-path +// runtime/polkadot/constants/src/weights/ +// --warmup +// 10 +// --repeat +// 100 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +parameter_types! { + /// Time to execute an empty block. + /// Calculated by multiplying the *Average* with `1` and adding `0`. + /// + /// Stats [NS]: + /// Min, Max: 4_435_555, 4_779_868 + /// Average: 4_503_502 + /// Median: 4_486_327 + /// Std-Dev: 59779.5 + /// + /// Percentiles [NS]: + /// 99th: 4_723_698 + /// 95th: 4_609_303 + /// 75th: 4_543_258 + pub const BlockExecutionWeight: Weight = 4_503_502 * WEIGHT_PER_NANOS; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/polkadot/constants/src/weights/extrinsic_weights.rs b/polkadot/runtime/polkadot/constants/src/weights/extrinsic_weights.rs index 158ba99c6a4c12985b9996bdab13ce8248043c24..7f88e4a70f5b709214f201ec685f3f9cd1350023 100644 --- a/polkadot/runtime/polkadot/constants/src/weights/extrinsic_weights.rs +++ b/polkadot/runtime/polkadot/constants/src/weights/extrinsic_weights.rs @@ -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}, - }; - - parameter_types! { - /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS; - } +//! 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/polkadot/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/production/polkadot +// benchmark-overhead +// --chain +// polkadot-dev +// --execution=wasm +// --wasm-execution=compiled +// --weight-path +// runtime/polkadot/constants/src/weights/ +// --warmup +// 10 +// --repeat +// 100 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +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: 82_602, 83_486 + /// Average: 82_855 + /// Median: 82_831 + /// Std-Dev: 118.86 + /// + /// Percentiles [NS]: + /// 99th: 83_135 + /// 95th: 83_080 + /// 75th: 82_890 + pub const ExtrinsicBaseWeight: Weight = 82_855 * WEIGHT_PER_NANOS; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/polkadot/constants/src/weights/mod.rs b/polkadot/runtime/polkadot/constants/src/weights/mod.rs index ed0b4dbcd47fbffb125bda4b337099ae69e51ce2..3f8bc612c06428e50714e8857fc2b329981e41c9 100644 --- a/polkadot/runtime/polkadot/constants/src/weights/mod.rs +++ b/polkadot/runtime/polkadot/constants/src/weights/mod.rs @@ -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; diff --git a/polkadot/runtime/rococo/constants/src/lib.rs b/polkadot/runtime/rococo/constants/src/lib.rs index af0318e8eb52cad26e47a82bf500abf3e4df09e9..180b2c726a48275371038ed926bb250881eb677f 100644 --- a/polkadot/runtime/rococo/constants/src/lib.rs +++ b/polkadot/runtime/rococo/constants/src/lib.rs @@ -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 16 DOLLARS - println!("Base: {}", ExtrinsicBaseWeight::get()); - let x = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT); - let y = 16 * DOLLARS; - assert!(x.max(y) - x.min(y) < MILLICENTS); + // A full block should cost between 10 and 100 DOLLARS. + let full_block = WeightToFee::calc(&MAXIMUM_BLOCK_WEIGHT); + assert!(full_block >= 10 * DOLLARS); + assert!(full_block <= 100 * DOLLARS); } #[test] diff --git a/polkadot/runtime/rococo/constants/src/weights/block_weights.rs b/polkadot/runtime/rococo/constants/src/weights/block_weights.rs index 4db90f0c0207a4d5b3ecb145e15cec41e6c6f159..66abd9b22c2ced18e6af654525584fcfcf5eb0e1 100644 --- a/polkadot/runtime/rococo/constants/src/weights/block_weights.rs +++ b/polkadot/runtime/rococo/constants/src/weights/block_weights.rs @@ -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}, - }; - - parameter_types! { - /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS; - } +//! 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/rococo/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/production/polkadot +// benchmark-overhead +// --chain +// rococo-dev +// --execution=wasm +// --wasm-execution=compiled +// --weight-path +// runtime/rococo/constants/src/weights/ +// --warmup +// 10 +// --repeat +// 100 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +parameter_types! { + /// Time to execute an empty block. + /// Calculated by multiplying the *Average* with `1` and adding `0`. + /// + /// Stats [NS]: + /// Min, Max: 3_063_393, 3_278_407 + /// Average: 3_098_278 + /// Median: 3_076_394 + /// Std-Dev: 46158.3 + /// + /// Percentiles [NS]: + /// 99th: 3_266_514 + /// 95th: 3_205_264 + /// 75th: 3_101_379 + pub const BlockExecutionWeight: Weight = 3_098_278 * WEIGHT_PER_NANOS; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/rococo/constants/src/weights/extrinsic_weights.rs b/polkadot/runtime/rococo/constants/src/weights/extrinsic_weights.rs index 158ba99c6a4c12985b9996bdab13ce8248043c24..f47b6d1717c5d49240bb453dba7046590e7a2f97 100644 --- a/polkadot/runtime/rococo/constants/src/weights/extrinsic_weights.rs +++ b/polkadot/runtime/rococo/constants/src/weights/extrinsic_weights.rs @@ -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}, - }; - - parameter_types! { - /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS; - } +//! 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/rococo/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/production/polkadot +// benchmark-overhead +// --chain +// rococo-dev +// --execution=wasm +// --wasm-execution=compiled +// --weight-path +// runtime/rococo/constants/src/weights/ +// --warmup +// 10 +// --repeat +// 100 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +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: 73_999, 74_403 + /// Average: 74_171 + /// Median: 74_161 + /// Std-Dev: 85.56 + /// + /// Percentiles [NS]: + /// 99th: 74_375 + /// 95th: 74_309 + /// 75th: 74_241 + pub const ExtrinsicBaseWeight: Weight = 74_171 * WEIGHT_PER_NANOS; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/rococo/constants/src/weights/mod.rs b/polkadot/runtime/rococo/constants/src/weights/mod.rs index ed0b4dbcd47fbffb125bda4b337099ae69e51ce2..3f8bc612c06428e50714e8857fc2b329981e41c9 100644 --- a/polkadot/runtime/rococo/constants/src/weights/mod.rs +++ b/polkadot/runtime/rococo/constants/src/weights/mod.rs @@ -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; diff --git a/polkadot/runtime/westend/constants/src/lib.rs b/polkadot/runtime/westend/constants/src/lib.rs index 5464aaf5c003ef55e256810f3961814453753ab9..1093dad220fc22718870a43509bff8a2f60b55f5 100644 --- a/polkadot/runtime/westend/constants/src/lib.rs +++ b/polkadot/runtime/westend/constants/src/lib.rs @@ -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] diff --git a/polkadot/runtime/westend/constants/src/weights/block_weights.rs b/polkadot/runtime/westend/constants/src/weights/block_weights.rs index 4db90f0c0207a4d5b3ecb145e15cec41e6c6f159..4e956694df516b9ad6a39e0a2f1c445be5601541 100644 --- a/polkadot/runtime/westend/constants/src/weights/block_weights.rs +++ b/polkadot/runtime/westend/constants/src/weights/block_weights.rs @@ -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}, - }; - - parameter_types! { - /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS; - } +//! 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` + +// 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 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +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; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/westend/constants/src/weights/extrinsic_weights.rs b/polkadot/runtime/westend/constants/src/weights/extrinsic_weights.rs index 158ba99c6a4c12985b9996bdab13ce8248043c24..0dee70e51ec9e9bf8f548a1e993161f73b80a2ce 100644 --- a/polkadot/runtime/westend/constants/src/weights/extrinsic_weights.rs +++ b/polkadot/runtime/westend/constants/src/weights/extrinsic_weights.rs @@ -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}, - }; - - parameter_types! { - /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS; - } +//! 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` + +// 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 + +use frame_support::{ + parameter_types, + weights::{constants::WEIGHT_PER_NANOS, Weight}, +}; + +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; +} + +#[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(); - #[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::constants::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."); - } + // 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."); } } diff --git a/polkadot/runtime/westend/constants/src/weights/mod.rs b/polkadot/runtime/westend/constants/src/weights/mod.rs index ed0b4dbcd47fbffb125bda4b337099ae69e51ce2..3f8bc612c06428e50714e8857fc2b329981e41c9 100644 --- a/polkadot/runtime/westend/constants/src/weights/mod.rs +++ b/polkadot/runtime/westend/constants/src/weights/mod.rs @@ -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;