* Start
* More work!
* Moar
* More changes
* More fixes
* More worrk
* More fixes
* More fixes to make it compile
* Adds `NoOffchainStorage`
* Pass the extensions
* Small basti making small progress
* Fix merge errors and remove `ExecutionContext`
* Move registration of `ReadRuntimeVersionExt` to `ExecutionExtension`
Instead of registering `ReadRuntimeVersionExt` in `sp-state-machine` it is moved to
`ExecutionExtension` which provides the default extensions.
* Fix compilation
* Register the global extensions inside runtime api instance
* Fixes
* Fix `generate_initial_session_keys` by passing the keystore extension
* Fix the grandpa tests
* Fix more tests
* Fix more tests
* Don't set any heap pages if there isn't an override
* Fix small fallout
* FMT
* Fix tests
* More tests
* Offchain worker custom extensions
* More fixes
* Make offchain tx pool creation reusable
Introduces an `OffchainTransactionPoolFactory` for creating offchain transactions pools that can be
registered in the runtime externalities context. This factory will be required for a later pr to
make the creation of offchain transaction pools easier.
* Fixes
* Fixes
* Set offchain transaction pool in BABE before using it in the runtime
* Add the `offchain_tx_pool` to Grandpa as well
* Fix the nodes
* Print some error when using the old warnings
* Fix merge issues
* Fix compilation
* Rename `babe_link`
* Rename to `offchain_tx_pool_factory`
* Cleanup
* FMT
* Fix benchmark name
* Fix `try-runtime`
* Remove `--execution` CLI args
* Make clippy happy
* Forward bls functions
* Fix docs
* Update UI tests
* Update client/api/src/execution_extensions.rs
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Koute <koute@users.noreply.github.com>
* Update client/cli/src/params/import_params.rs
Co-authored-by: Koute <koute@users.noreply.github.com>
* Update client/api/src/execution_extensions.rs
Co-authored-by: Koute <koute@users.noreply.github.com>
* Pass the offchain storage to the MMR RPC
* Update client/api/src/execution_extensions.rs
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* Review comments
* Fixes
---------
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* Benchmarking spellcheck fix
Put everything that could cause spellcheck issues into backticks.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Also in templates
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet-balances
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
* frame-benchmarking-cli: Remove native dispatch requirement
No need for this, we can just use the `WasmExecutor` directly.
* Fixes
* Pass benchmarking host functions
* Ensure we can pass custom host functions
This removes the deprecated batch verification. This was actually never really activated.
Nevertheless, we need to keep the host functions around to support old runtimes which may import
these host functions. However, we do not give access to these functions anymore. This means that any new
runtime can not call them anymore. The host function implementations we keep will not do batch verification and will
instead fall back to the always existing option of directly verifying the passed signature.
`finish_batch_verification` will return the combined result of all the batch verify calls.
This removes the `TaskExecutorExt` which only existed to support the batch verification. So, any
code that used this extension can just remove the registration of them. It also removes
`SignatureBatching` that was used by `frame-executive` to control the batch verification.
However, there wasn't any `Verify` implementation that called the batch verification functions.
* Bump default 'additional_trie_layers' to two
The default here only works for extremely small runtimes, which have
no more than 16 storage prefices. This is changed to a "sane" default
of 2, which is save for runtimes with up to 4096 storage prefices (eg StorageValue).
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Update tests and test weights
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Fix PoV weights
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_message_queue
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_glutton
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_glutton
* Fix sanity check
>0 would also do as a check, but let's try this.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
* Rework storage iterators
* Make sure storage iteration is also accounted for when benchmarking
* Use `trie-db` from crates.io
* Appease clippy
* Bump `trie-bench` to 0.35.0
* Fix tests' compilation
* Update comment to clarify how `IterArgs::start_at` works
* Add extra tests
* Fix iterators on `Client` so that they behave as before
* Add extra `unwrap`s in tests
* More clippy fixes
* Come on clippy, give me a break already
* Rename `allow_missing` to `stop_on_incomplete_database`
* Add `#[inline]` to `with_recorder_and_cache`
* Use `with_recorder_and_cache` in `with_trie_db`; add doc comment
* Simplify code: use `with_trie_db` in `next_storage_key_from_root`
* Remove `expect`s in the benchmarking CLI
* Add extra doc comments
* Move `RawIter` before `TrieBackendEssence` (no code changes; just cut-paste)
* Remove a TODO in tests
* Update comment for `StorageIterator::was_complete`
* Update `trie-db` to 0.25.1
* Change copyright year to 2023 from 2022
* Fix incorrect update of copyright year
* Remove years from copy right header
* Fix remaining files
* Fix typo in a header and remove update-copyright.sh
* BlockId removal: refactor of runtime API
It changes the arguments of:
- `ApiExt` methods: `has_api`, `has_api_with`, `api_version`
- `CallApiAt` method: `runtime_version_at`
from: `BlockId<Block>` to: `Block::Hash`
It also changes the first argument of all generated runtime API calls from: `BlockId<Block>` to: `Block::Hash`
This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)
* BlockId removal: refactor of runtime API - tests
- tests adjusted to new runtime API,
- some tests migrated from block number to block hash
* benchmarking-cli: BlockId(0) migrated to info().genesis_hash
`runtime_api.call()` now requires the block hash instead of BlockId::Number.
To access the genesis hash widely used in benchmarking engine the Client
was constrained to satisfy `sp_blockchain::HeaderBackend<Block>` trait
which provides `info().genesis_hash`.
* trivial: api.call(BlockId) -> api.call(Hash)
- Migrated all `runtime_api.calls` to use Hash
- Noteworthy (?):
-- `validate_transaction_blocking` in transaction pool,
* CallApiAtParams::at changed to Block::Hash
* missed doc updated
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* ".git/.scripts/commands/fmt/fmt.sh"
* BlockId removal: Benchmark::consumed_weight
Little refactor around `Benchmark::consumed_weight`: `BlockId` removed.
* at_hash renamed
* wrong merge fixed
* beefy worker: merged with master
* beefy: tests: missing block problem fixed
* Apply review suggestion
* fix
---------
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>
* initial impl
* add template test
* linear fit proof size
* always record proof when tracking storage
* calculate worst case pov
* remove duplicate worst case
* cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* more comment output
* add cli for worst case map size
* update name
* clap does not support underscores
* rename
* expose worst case map values
* improve some comments
* cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* update template
* cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* fix fmt
* more fmt
* more fmt
* Dont panic when there is no proof
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Fix test features
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Whitelist :extrinsic_index
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Use whitelist when recording proof
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add logs
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add PoV testing pallet
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Deploy PoV testing pallet
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Storage benches reside in the PoV pallet
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Linear regress PoV per component
Splits the PoV calculation into "measured" and "estimated".
The measured part is reported by the Proof recorder and linear
regressed over all components at once.
The estimated part is calculated as worst-case by using the max
PoV size per storage access and calculating one linear regress per
component. This gives each component a (possibly) independent PoV.
For now the measured size will always be lower than the PoV on
Polkadot since it is measured on an empty snapshot. The measured
part is therefor only used as diagnostic for debugging.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Put PoV into the weight templates
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* fmt
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Extra alanysis choise for PoV
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add+Fix tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Make benches faster
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Cleanup
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Use same template comments
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* ".git/.scripts/bench-bot.sh" pallet dev pallet_balances
* ".git/.scripts/bench-bot.sh" pallet dev pallet_democracy
* Update referenda mock BlockWeights
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Take measured value size into account
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* clippy
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* ".git/.scripts/bench-bot.sh" pallet dev pallet_scheduler
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* proof_size: None
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* ugly, but works
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* wup
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* WIP
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add pov_mode attribute to the benchmarks! macro
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Use pov_mode attribute in PoV benchmarking
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Update tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Scheduler, Whitelist: Add pov_mode attr
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Update PoV weights
* Add CLI arg: default-pov-mode
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Fix tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* fmt
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* fix
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Revert "Update PoV weights"
This reverts commit 2f3ac2387396470b118122a6ff8fa4ee12216f4b.
* Revert "WIP"
This reverts commit c34b538cd2bc45da4544e887180184e30957904a.
* Revert first approach
This reverts commit range 8ddaa2fffe5930f225a30bee314d0b7c94c344dd^..4c84f8748e5395852a9e0e25b0404953fee1a59e
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Clippy
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add extra benchmarks
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_alliance
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_whitelist
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_scheduler
* fmt
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Clippy
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Clippy 🤦
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add reference benchmarks
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Fix doc comments
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Undo logging
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Add 'Ignored' pov_mode
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Allow multiple attributes per benchmark
Turns out that the current benchmarking syntax does not support
multiple attributes per bench 🤦. Changing it to support that
since otherwise the `pov_mode` would conflict with the others.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Validate pov_mode syntax
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Ignore PoV for all contract benchmarks
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Test
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* test
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Bump macro recursion limit
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* fmt
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Update contract weights
They dont have a PoV component anymore.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* fix test ffs
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* pov_mode is unsupported in V2 syntax
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Fix pallet ui tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* update pallet ui
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Fix pallet ui tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Update weights
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
Co-authored-by: Your Name <you@example.com>
* Force base weights to be the minimum only when the intercept is negative; emit minimum execution times
* Add an `assert` making sure the intercept is zero when it's supposed to be zero
* Fix template
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* ".git/.scripts/bench-bot.sh" pallet dev pallet_assets
* ".git/.scripts/bench-bot.sh" pallet dev pallet_uniques
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
* Bump clap to 3.2.22
* Replace `from_os_str` with `value_parser`
* Replace `from_str` and `try_from_str` with `value_parser`
* Move possible_values to the new format
* Remove unwanted print
* Add missing match branch
* Update clap to 4.0.9 and make it compile
* Replace deprecated `clap` macro with `command` and `value`
* Move remaining `clap` attributes to `arg`
* Remove no-op value_parsers
* Adjust value_parser for state_version
* Remove "deprecated" feature flag and bump to 4.0.11
* Improve range
Co-authored-by: Bastian Köcher <git@kchr.de>
* Apply suggestions
* Trigger CI
* Fix unused error warning
* Fix doc errors
* Fix ArgGroup naming conflict
* Change default_value to default_value_t
* Use 1.. instead of 0..
Co-authored-by: Bastian Köcher <git@kchr.de>