Skip to main content
12 votes
Accepted

What is the possible minimum block time?

There is not a way to deterministically calculate a minimum block time, since it is ultimately a soft metric. To help with your decision process, you should understand the breakdown of the current ...
Shawn Tabrizi's user avatar
  • 16.1k
10 votes
Accepted

How to generate `WeightInfo` for pallets?

On a production chain, you should always re-calculate your weights by running benchmarks on the final runtime. The point of benchmarking is that your runtime can be configured in different ways, and ...
Shawn Tabrizi's user avatar
  • 16.1k
8 votes

Performance tuning of Substrate node

I will try to respond with my findings and hopefully others will join with their tips & tricks as well Compile for concrete CPU - you can find out type of CPU of your target machine via rustc --...
Petr Mensik's user avatar
8 votes
Accepted

Logging in benchmarking mode

You can use the info! macro or similar from frame_support::log as such: use frame_support::log::info; benchmarks! { something { info!("Logging works!"); }: _(args...) } ...
Oliver Tale-Yazdi's user avatar
8 votes
Accepted

How do I get weight for my pallet?

Weight Weight is an absolute unit of execution time. The longer your extrinsic runs, the more Weight it has. Substrate uses this to know in advance how many transactions fit in a block. This is ...
Oliver Tale-Yazdi's user avatar
7 votes

Missing `successful_origin` in implementation when running runtime-benchmarks

Thanks for reporting the issue. The problem here was a missing feature flag which enabled the runtime-benchmarks features in downstream dependencies. The solution for you should simply be to simply ...
Shawn Tabrizi's user avatar
  • 16.1k
7 votes

Logging in benchmarking mode

I would probably not put logs in your production benchmarks, but if you are trying to debug things, you can add a println! statement and then run the benchmark tests: cargo test -p pallet-name --...
Shawn Tabrizi's user avatar
  • 16.1k
7 votes
Accepted

Benchmarking whitelist

Part of benchmarking is counting the number of storage reads and writes that happen in the runtime storage, because the runtime storage is a merkle trie, and operations on the merkle trie is very ...
Shawn Tabrizi's user avatar
  • 16.1k
6 votes
Accepted

Benchmark FRAME pallets

Answering your questions one by one: Benchmarking the Pallets is always necessary since the results depend on your runtime configuration. Each variable that you change in the runtime config can lead ...
Oliver Tale-Yazdi's user avatar
6 votes

Proof Skipped in benchmark

Good question and sorry for the confusion - the comment is poorly chosen. It indicates that the worst-case Proof Size limit could not be estimated. This can come from either: The pallet of the ...
Oliver Tale-Yazdi's user avatar
6 votes
Accepted

How to benchmark frame-system on parachain?

I found that I missed an update on Cumulus/Substrate side. - impl frame_system_benchmarking::Config for Runtime {} + impl frame_system_benchmarking::Config for Runtime { + fn ...
AurevoirXavier's user avatar
  • 10.6k
5 votes
Accepted

Benchmark session pallet fails without pallet_staking

You are correct that the benchmarking for the Session pallet depends on the Substrate Staking pallet also be used. If you do not use the Substrate staking pallet, you cannot (and should not) use the ...
Shawn Tabrizi's user avatar
  • 16.1k
5 votes

How to generate `WeightInfo` for pallets?

Write benchmarks and do benchmarks, see https://docs.substrate.io/v3/runtime/benchmarking/ . The following commands will do benchmarks in specified pallet and generate weights.rs. ./target/release/...
Chino Chang's user avatar
5 votes

How to reference the function with udf type parameters from another pallet in benchmarking

The error message is very clear the trait std::convert::From<i32> is not implemented for <T as pallet_fuso_token::Config>::TokenId i.e. It doesn't know how to convert i32 to TokenId Your ...
Bryan Chen's user avatar
5 votes

How to reference the function with udf type parameters from another pallet in benchmarking

This should work: let token: T::TokenId = 1u32;
Gav's user avatar
  • 2,681
5 votes
Accepted

Cannot run benchmarking: "Did not find the benchmarking metadata."

It turned out that I was missing one crucial thing: impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { #[cfg(feature = "runtime-benchmarks")] type ExtendHostFunctions = ...
pmikolajczyk41's user avatar
4 votes

How to mock trait in benchmarking

My guess is that your mock is only accessible when compiling with the test flag, like so: #[cfg(test)] mod mock; So if you want to use this dependency, you must do so with this feature gate: #[cfg(...
Shawn Tabrizi's user avatar
  • 16.1k
4 votes
Accepted

Using another pallet calls for FRAME-based benchmarking

Your code assumes that the pallet you are benchmarking has a tight coupling with pallet_nft, however this is an assumption that you must satsify within the rust trait bounds. The solution, as the ...
Shawn Tabrizi's user avatar
  • 16.1k
4 votes

Hardware: Benchmark Standard vs Ecosystem Nodes

relay validators execute parachain blocks... if parachain collators are benchmarked on HW that's faster than standard, that means relay validators will spend more time than expected executing ...
Bernardo Rodrigues's user avatar
4 votes
Accepted

Hardware: Benchmark Standard vs Ecosystem Nodes

The hardware requirements that you found are correct. There are multiple things to consider when thinking about hardware requirements. Type Of The Node The hardware requirements are aimed at ...
Oliver Tale-Yazdi's user avatar
4 votes

Single node performance

After writing some benchmarks and making some code changes, I was able to make the block production constant. At the time, I'm able to handle ~1000tx per block (6s), which is not bad at all. To make ...
4 votes

Unable to run election provider multiphase benchmark

The cause of the error message failed to submit candidacy may be because when calling the extrinsic function submit_candidacy of the pallet_election_phragmen pallet to add a new endowed account ...
Luke Schoen's user avatar
  • 2,332
4 votes
Accepted

Weight selection for extrinsic in case of multiple bechmarks

Good question! The #[pallet::weight(…)] annotation allows you to do some light compile-time computations. This makes it possible to calculate a maximum like this: #[pallet::weight(T::WeightInfo::slow()...
Oliver Tale-Yazdi's user avatar
4 votes

How to see the hardware benchmark results?

A v0.9.27 Polkadot node will print hardware and performance info on startup. It looks like this: Parity Polkadot ✌️ version 0.9.27-b017bad50d3 ❤️ by Parity Technologies <[email protected]&...
Oliver Tale-Yazdi's user avatar
4 votes

Do `on_finalized` and `on_initialize` impact block weight budget?

Here is the schematical representation of the block weight: ┌────────────────────────────────────────────────────────────────────────────┐ │┌──────────────────┐┌───────────────────────────────────┐┌───...
pepyakin's user avatar
  • 2,184
4 votes

Large event payloads unsafe?

Substrate will, by default, store every event in a block in a storage value Event of type Vec in the system module, which involves reading & writing this full vector each time, as explained here ...
bkchr's user avatar
  • 11.5k
4 votes
Accepted

How to decrease time it takes to benchmark?

I checked your code and the signature generation is very slow. However, the signatures are never verified so you can get away by mocking them which is million times faster. First lets increase the ...
Oliver Tale-Yazdi's user avatar
3 votes

Benchmarking Mock

Benchmarks will use the "mock" when running tests, since that is the runtime environment set up for tests. However, for benchmarks to be accurate in production, when they are actually run, ...
Shawn Tabrizi's user avatar
  • 16.1k
3 votes

Error: Input("InsufficientBalance") when running benchmark

Turns out it was due to insufficient balance. I needed to change the code to: T::Currency::make_free_balance_be(&origin, DepositBalanceOf::<T>::max_value()); Where DepositBalanceOf is (for ...
Brandon Macer's user avatar
3 votes
Accepted

benchmark: "let i in x...y" notation - How to set i as u128?

Benchmark complexity parameters are always u32. Making them more than u32 wouldn't make sense since they're designed to be iterated over to collect timing data for a linear regression algorithm, and ...
Gav's user avatar
  • 2,681

Only top scored, non community-wiki answers of a minimum length are eligible