Questions tagged [benchmarking]
The benchmarking tag has no usage guidance.
119
questions
10
votes
3
answers
282
views
How to generate `WeightInfo` for pallets?
Some pallets configure this field like so : type WeightInfo = pallet_pallet_name::weights::SubstrateWeight<Runtime>;
However I've seen some runtimes in which they have an extra WeightInfo module ...
9
votes
1
answer
212
views
Single node performance
I've a couple of questions:
I'm running a the node-template on a machine that has 8 cores and 64GB of RAM and its using an SSD. I have some pallets working there and I'm using the python client to ...
8
votes
2
answers
200
views
Logging in benchmarking mode
I am implementing benchmark to calculate weight in my pallet and need to print some data
I was trying to use if_std println! but got nothing.
What the best way to make printouts for debugging ...
8
votes
1
answer
184
views
Performance tuning of Substrate node
I was recently wondering what kind of performance tuning options can be specified while building a Substrate node. Motivation for doing this is based on the benchmark I ran on machines that utilize ...
7
votes
1
answer
66
views
Proof Skipped in benchmark
We're updating our weights to weights 2.0 but we're getting a lot of Proof Skipped lines in the output. What is the impact of this, and how do we fix it?
Example output:
/// Proof Skipped: Escrow ...
7
votes
1
answer
151
views
How does the benchmark calculate the proof size?
I have no idea why this call uses such a lot proof size (around 4MB).
It looks like it doesn't change too many storage items.
https://github.com/darwinia-network/darwinia-messages-substrate/blob/...
6
votes
1
answer
374
views
What is the possible minimum block time?
Is there a way to determine/calculate what the minimum block time would be? If not, what could we consider before lowering the block time, and how to monitor the side effects of small block time?
I ...
6
votes
1
answer
112
views
How do I get weight for my pallet?
I developed a pallet with one extrinsic:
#[pallet::weight(0)]
pub fn sum(_: OriginFor<T>, values: Vec<u64>) {
// Sum up `values`
}
The Extrinsic accepts a vector and uses it. ...
6
votes
1
answer
66
views
Benchmarking multiple instances
We have two instances of a pallet with different runtime configurations. How can we run the benchmarks separately to generate two distinct sets of weights?
As far as I can tell this is not possible ...
6
votes
1
answer
108
views
cannot create module: instance allocation for this module requires 74376 bytes which exceeds the configured maximum of 65536 bytes
Try in to benchmark node pallets after Polkadot upgrade from 0.9.36 to 0.9.38 and get cannot create module: instance allocation for this module requires 74376 bytes which exceeds the configured ...
5
votes
2
answers
152
views
Hardware: Benchmark Standard vs Ecosystem Nodes
During the last Substrate Builders Program Office Hours, the Mangata team raised awareness around some potential confusion around the Substrate Benchmarking System and how it is being applied in the ...
5
votes
1
answer
160
views
Benchmark FRAME pallets
Hello Substrate Experts,
at the moment I try to figure out how to benchmark FRAME pallets for our runtime and I have basically three points that are not 100% clear to me.
Based on my understanding it'...
5
votes
1
answer
133
views
Benchmark session pallet fails without pallet_staking
my lovely Substrate-Heros,
at the moment I try to benchmark the FRAME pallets of our custom runtime. Unfortunately, I ran into an error while benchmarking the session pallet. I copied the ...
5
votes
2
answers
120
views
Large event payloads unsafe?
Premise
Substrate will, by default, store every event in a block in a storage value Event of type Vec<EventRecord> in the system module, which involves reading & writing this full vector ...
5
votes
1
answer
163
views
Unable to run election provider multiphase benchmark
I am trying to benchmark pallet_election_provider_multi_phase and after quite some time of normal running I get this error which halts the benchmark:
Running Benchmark: ...
5
votes
1
answer
215
views
How to weight `on_initialize`?
Is there any best practice how to count the weights in on_initialize correctly?
I read through the Polkadot and Substrate on_initialize weight calculations and couldn't always figure out: When to ...
5
votes
1
answer
48
views
frame-benchmarking::v2 doesn't work for force_origin
In Config of my pallet I have:
type FilteredOrigin: EnsureOriginWithArg<
Self::RuntimeOrigin,
SomeEnum,
Success = Self::AccountId
>;
And there is an ...
5
votes
0
answers
33
views
Benchmarks not getting skipped with Err(BenchmarkError::Skip)
I am using the pallet_xcm_benchmarks, in the config for pallet_xcm_benchmarks::generic,
I have used
impl pallet_xcm_benchmarks::generic::Config for Runtime {
fn worst_case_asset_exchange() -> ...
5
votes
2
answers
109
views
Runtime api not available just after client creation? Exported method is not found
I am trying to incorporate benchmark overhead command to our parachain. The issue i have is that runtime api methods are not available right away after client is created.
https://github.com/mangata-...
4
votes
1
answer
65
views
How to create a bunch of key pairs when benchmarking?
I want to benchmark verifying sr25519 signatures and for that I need to create a bunch of key pairs, sign some data, then benchmark the verification process, however using sp_core::sr25519::Pair is ...
4
votes
1
answer
34
views
Associated types in benchmark `where` bound
I'm trying to constrain the value of an associated type of a trait inside a benchmark's where bound, like this:
#[benchmarks(where T: currency::Config<Balance = u128>)]
pub mod benchmarks {
...
4
votes
1
answer
60
views
Benchmarking generates files with possibly missing or unnecessary trait impls
After building my node (tag monthly-10-2021) with --features runtime-benchmarks and/or --all-features, I tried to run benchmarks for the pallets and then use them for WeightInfo on various pallet ...
4
votes
1
answer
76
views
Missing XCM benchmark `reserve_asset_deposited`
I'm upgrading our parachain based on Polkadot 0.9.40 here. Now in the process of benchmarking xcm operations, I notice there is no benchmark for reserve_asset_deposited in XCM fungible benchmarks! I ...
4
votes
1
answer
29
views
Can we use std crates in benchmarking?
For benchmarking I can see a need to use random number generators for maybe verification of a random storage or such. Do we have utilities provided by the frame_benchmarking framework itself or is it ...
3
votes
3
answers
128
views
How to create and mint assets in benchmarks
I am building a pallet which uses assets in a loosely-coupled manner. In the pallet's Config, there's an associated type Assets with Inspect and Transfer bounds.
Now, when writing benchmarks, I need ...
3
votes
1
answer
151
views
Missing `successful_origin` in implementation when running runtime-benchmarks
With a fresh substrate-parachain-template
I ran cargo build --features runtime-benchmarks
I got errors from a deep dependency in pallet_society, which doesn't seem relevant to the parachain-template's ...
3
votes
1
answer
53
views
How to benchmark frame-system on parachain?
After upgrading the Substrate to polkadot-v0.9.43.
I got the following error while running the runtime benchmarks.
2023-07-21 19:55:56 Starting benchmark: frame_system::set_code
Error: Input("...
3
votes
2
answers
57
views
benchmarks: Significant different between 99th and worst case
I'm running benchmark-cli storage tool to calculate average weights for DB read and writes and one thing that I've noticed is that there are significant difference between even 99th percentile and ...
3
votes
1
answer
111
views
How to see the hardware benchmark results?
Substrate has introduced a flag called --no-hardware-benchmarks to disable automatic hardware benchmarks. This implies if the flag is not set, the benchmark should run automatically at startup and ...
3
votes
1
answer
98
views
Using another pallet calls for FRAME-based benchmarking
I need to mint an NFT and create metaverse for our auction pallet benchmarking. Both of these are handled by external pallet functionality and wondered if there is a FRAME-base benchmarking solution ...
3
votes
1
answer
167
views
How to mock trait in benchmarking
Can you tell me how to mock a trait in benchmarking?
We have a pallet which takes NFTTrait as one of the configs. See below.
#[pallet::config]
pub trait Config: frame_system::Config {
...
3
votes
2
answers
52
views
How to use bounded_vec macro in benchmarking.rs
I was using substrate-node-template, and created some benchmarking functions.
I was able to use bounded_vec macro in tests.rs but, can't able to use it in the benchmarking.rs file
my code
#![cfg(...
3
votes
1
answer
52
views
Benchmark failing extrinsics
Is there a way to benchmark an extrinsic whose expected behavior is to trigger an error?
I stumbled on a project where we have two instances of the same pallet. Instance1 will proceed normally for a ...
3
votes
1
answer
56
views
Can't write to StorageMap when benchmarking, EncodeLike is not implemented for any type even if it's the same in pallet
I have the following StorageMap defined in my pallet:
#[pallet::storage]
pub(super) type Signatures<T: Config> = StorageMap<
_,
Blake2_128Concat,
T::Hash,
BoundedBTreeMap<...
3
votes
1
answer
67
views
Why would benchmarking a simple setter has a linear behaviour
I came across this basic example in the substrate repo, where a range 1..1000 is used when benchmarking it. The generated weights.rs shows
fn set_dummy_benchmark(b: u32, ) -> Weight {
Weight::...
3
votes
1
answer
72
views
How to read the benchmark result?
A benchmark test for function with a param like this:
runner_execute {
let x in 1..10000000;
...
let gas_limit_call = x as u64;
}: {
...
let call_runner_results = T::Runner::...
3
votes
1
answer
94
views
Error running benchmarks on substrate node
Hello guys I've been trying to benchmark my runtime but I keep stumbling on this error, so far I've tested it with balances, collective and babe, and I get the same error message. Most likely it's ...
3
votes
1
answer
74
views
Quadratic complexity in Benchmarking
I am trying to understand if quadratic complexity is bad (gives inaccurate results) when used for benchmarking:
I have a pallet whose weight would ideally depend on x * y where x and y are lengths of ...
3
votes
2
answers
27
views
Does substrate offer benchmarking utilities in outer node?
I have some heavy computation done off-chain (in outer node) and i want to benchmark those functions, does substrate offer tools for doing it or should i rely on a third party library to do that?
3
votes
3
answers
82
views
Custom benchmarks for external pallets
We use some external pallets that are highly configurable. The weight of the extrinsics in these pallets is highly dependent on the callback supplied in the config, and the existing benchmarks don't ...
3
votes
1
answer
56
views
`Currency::create_deposit` of `pallet_balance` fail on actual runtime but passes on mock rutime
The benchmark is written as:
one_extrinsic {
let caller: <T as frame_system::Config>::AccountId = make_account::<T>(1);
assert_eq!(
<T as crate::Config&...
3
votes
1
answer
46
views
Block number in the benchmark code is 0, but is 1 in the running code
If I'm running a benchmark and I get the current block number from inside the benchmark code (i.e. in the setup before I actually call the call I'm trying to benchmark) using frame_system::Pallet::<...
3
votes
2
answers
68
views
Get results of some std operations in benchmarks
We faced a situation the other day where we needed some result of std operations inside of our benchmarks. Specifically, we were looking to generate key pairs and signatures from types given by ...
3
votes
1
answer
41
views
Error: "Did not find the benchmarking metadata" after building runtime for benchmarking
After upgrading our chain to polkadot 0.9.38 I managed to build the benchmarking using cargo build --release --features runtime-benchmarks but when I try to benchmark any pallet after the build I ...
3
votes
2
answers
73
views
Using Autogenerated Weights
I'm wondering about weights. The docs are quite outdated here and I do not understand what is going on. I've managed to create benchmarks and generate a weight.rs.
https://github.com/paritytech/...
3
votes
0
answers
101
views
Cannot create a runtime on benchmark run
Using polkadot-v0.9.19 branch I've created benchmarks for a pallet, added it into runtime, compiled.
On run of any of created benchmarks getting this error:
Error:
Service(Client(RuntimeApiError(...
2
votes
2
answers
62
views
How to reference the function with udf type parameters from another pallet in benchmarking
Pallet token:
#[pallet::config]
pub trait Config: frame_system::Config + pallet_balances::Config {
type TokenId: Member
+ Parameter
+ AtLeast32BitUnsigned
...
2
votes
1
answer
40
views
Weight selection for extrinsic in case of multiple bechmarks
In my benchmarks, I've written multiple benchmarks for an extrinsic to cover different scenarios, which gave me WeightIinfo for each of my benchmarks.
Now the question here is how I can pick the worst ...
2
votes
1
answer
68
views
Benchmark extra macro
What does the #[extra] macro do in benchmarks?
I was looking at how benchmarks are being implemented on the Balances pallet. I notice the following benchmarks:
benchmarks_instance_pallet {
transfer {...
2
votes
1
answer
79
views
Use BoundedVec in benchmark
I have some code that benchmarks one of my extrinsic.
benchmarks! {
create_supersig {
let z in 0 .. 10;
let alice: T::AccountId = get_account::<T>("ALICE");
...