Skip to content
Snippets Groups Projects
Unverified Commit 41f9ed72 authored by bgallois's avatar bgallois
Browse files

Fix block_weights benchmark

parent af021cba
No related branches found
No related tags found
1 merge request!167Storage benchmark
......@@ -909,6 +909,7 @@ dependencies = [
"sp-runtime",
"sp-staking",
"sp-std",
"sp-weights",
]
[[package]]
......
......@@ -53,11 +53,10 @@ by `--wasm-execution=interpreted-i-know-what-i-do`.
2. Run base block benchmarks command:
```
duniter benchmark overhead --chain=gdev --execution=wasm --wasm-execution=interpreted-i-know-what-i-do --weight-path=. --warmup=10 --repeat=100
duniter benchmark overhead --chain=gdev-benchmark --execution=wasm --wasm-execution=compiled --weight-path=./runtime/common/src/weights/ --warmup=10 --repeat=100
```
3. Copy the generated file `block_weights.rs` in the codebase in folder `runtime/common/src/weights/`.
4. Commit changes and open an MR.
3. Commit changes and open an MR.
## Generate storage benchmarking
......
......@@ -58,6 +58,7 @@ std = [
'sp-membership/std',
'sp-runtime/std',
'sp-std/std',
'sp-weights/std',
]
try-runtime = [
"frame-support/try-runtime",
......@@ -110,6 +111,7 @@ sp-consensus-babe = { git = 'https://github.com/duniter/substrate', branch = 'du
sp-core = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false }
sp-runtime = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false }
sp-std = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false }
sp-weights = { git = 'https://github.com/duniter/substrate', branch = 'duniter-substrate-v0.9.32', default-features = false }
# substrate benchmarks
......
......@@ -177,7 +177,10 @@ macro_rules! pallets_config {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = OneshotAccount;
type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>;
#[cfg(not(feature = "runtime-benchmarks"))]
type WeightToFee = common_runtime::fees::WeightToFeeImpl<Balance>;
#[cfg(feature = "runtime-benchmarks")]
type WeightToFee = frame_support::weights::ConstantMultiplier::<u64, sp_core::ConstU64<0u64>>;
type LengthToFee = common_runtime::fees::LengthToFeeImpl<Balance>;
type FeeMultiplierUpdate = ();
type RuntimeEvent = RuntimeEvent;
......
// Copyright 2021 Axiom-Team
//
// This file is part of Duniter-v2S.
//
// Duniter-v2S is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Duniter-v2S is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-11-18 (Y/M/D)
//! HOSTNAME: `raspberrypi`, CPU: `ARMv7 Processor rev 3 (v7l)`
//! DATE: 2023-05-19 (Y/M/D)
//! HOSTNAME: `benjamin-xps139380`, CPU: `Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz`
//!
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Ğdev`
//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Development`
//! WARMUPS: `10`, REPEAT: `100`
//! WEIGHT-PATH: `.`
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1`, WEIGHT-ADD: `0`
//! WEIGHT-PATH: `runtime/common/src/weights/`
//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0`
// Executed Command:
// ./duniter
// target/release/duniter
// benchmark
// overhead
// --chain=gdev
// --chain=gdev-benchmark
// --execution=wasm
// --wasm-execution=interpreted-i-know-what-i-do
// --weight-path=.
// --wasm-execution=compiled
// --weight-path=runtime/common/src/weights/
// --warmup=10
// --repeat=100
use frame_support::{
parameter_types,
weights::{constants::WEIGHT_PER_NANOS, Weight},
};
use sp_core::parameter_types;
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
parameter_types! {
/// Time to execute an empty block.
/// Calculated by multiplying the *Average* with `1` and adding `0`.
/// Calculated by multiplying the *Average* with `1.0` and adding `0`.
///
/// Stats nanoseconds:
/// Min, Max: 23_866_638, 90_077_105
/// Average: 24_871_527
/// Median: 23_915_377
/// Std-Dev: 6645558.32
/// Min, Max: 698_202, 838_988
/// Average: 709_232
/// Median: 704_251
/// Std-Dev: 15664.54
///
/// Percentiles nanoseconds:
/// 99th: 30_529_787
/// 95th: 27_134_555
/// 75th: 23_951_395
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(24_871_527);
/// 99th: 738_574
/// 95th: 729_596
/// 75th: 709_823
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(709_232);
}
#[cfg(test)]
mod test_weights {
use frame_support::weights::constants;
use sp_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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment