Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

[contracts] Adapt storage reading host functions to Weights V2 #12976

Merged
merged 11 commits into from
Jan 18, 2023

Conversation

agryaznov
Copy link
Contributor

@agryaznov agryaznov commented Dec 19, 2022

Follow up to #12421

We charge weight for PoV size assuming its 1-to-1 ratio to the size of the storage being read.

Functions adapted to Weights V2

  • get_storage
  • take_storage
  • contains_storage
  • clear_storage
  • set_storage

Functions not yet adapted to Weights V2

Until paritytech/polkadot-sdk#398 is shipped we can't have proper benchmarks for it anyways, which also holds us from implementing the Weights V2 compatible versions of

  • instantiate
  • call
  • weight_to_fee
  • gas_left

@agryaznov agryaznov added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Dec 19, 2022
Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the proper approach would be to convert all u64 in HostFnWeights to Weight. Once the benchmarking catches up we need to do that anyways and we need to revert those changes to RuntimeCosts. I suppose adding new macros to schedule.rs that let you specify the proof_size would be the easiest way. This way we can get away with a smaller diff (we still need to change all those u64).

frame/contracts/src/wasm/runtime.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/mod.rs Outdated Show resolved Hide resolved
frame/contracts/src/tests.rs Outdated Show resolved Hide resolved
frame/contracts/src/tests.rs Outdated Show resolved Hide resolved
Copy link
Member

@athei athei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nits left

frame/contracts/src/tests.rs Outdated Show resolved Hide resolved
frame/contracts/src/wasm/runtime.rs Outdated Show resolved Hide resolved
frame/contracts/src/lib.rs Outdated Show resolved Hide resolved
@athei athei added D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited and removed D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Jan 17, 2023
frame/contracts/src/schedule.rs Outdated Show resolved Hide resolved
frame/contracts/src/schedule.rs Outdated Show resolved Hide resolved
@athei athei requested a review from xermicus January 17, 2023 20:20
@athei
Copy link
Member

athei commented Jan 18, 2023

bot merge

@paritytech-processbot paritytech-processbot bot merged commit a447f03 into master Jan 18, 2023
@paritytech-processbot paritytech-processbot bot deleted the ag-weights-v2 branch January 18, 2023 10:36
rossbulat pushed a commit that referenced this pull request Feb 3, 2023
* update RuntimeCosts to Weights V2, update tests

* improve docs

* clearer naming and docs to compat_weight helper

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* save before master merge

* HostFnWeights to Weight

* added to_weight! macro

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* RuntimeCosts::ChainExtension to weight_v2

* chain extension to weight v2

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
ltfschoen pushed a commit to ltfschoen/substrate that referenced this pull request Feb 22, 2023
…ytech#12976)

* update RuntimeCosts to Weights V2, update tests

* improve docs

* clearer naming and docs to compat_weight helper

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* save before master merge

* HostFnWeights to Weight

* added to_weight! macro

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* RuntimeCosts::ChainExtension to weight_v2

* chain extension to weight v2

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
…ytech#12976)

* update RuntimeCosts to Weights V2, update tests

* improve docs

* clearer naming and docs to compat_weight helper

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* save before master merge

* HostFnWeights to Weight

* added to_weight! macro

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* RuntimeCosts::ChainExtension to weight_v2

* chain extension to weight v2

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
devdanco added a commit to gasp-xyz/substrate that referenced this pull request May 25, 2023
* Use the balance trait as we have one (#13136)

* CI: Code mark to request a pipeline failure (#13139)

* Annotate thiserror for sp_core::crypto::SecretStringError (#13144)

* pallet-offences-benchmarking: Box events in verify (#13151)

* pallet-offences-benchmarking: Box events in verify

Events in frame are represented by an enum in the pallet and the runtime. The size of an enum in
Rust depends on the size of biggest variant. This means we always need to allocate memory for the
biggest variant when allocating memory for an event. The offences benchmarking is verifying the
benchmarking results by checking the events. To check the events it is generating all the expected
events. With the recent changes in Polkadot the events are too big and lead to issues when running
this verify functions. The solution is to box each event, as the vector holding all the events will
then only need to hold fat pointers * expected events, instead of size_of(event) * expected events.
This issue isn't a problem in production, as we never read the events on chain. When we are reading
the events, it is done in an offchain context and they are only decoded one by one.

Besides that this also enables the benchmarking verification for everyone running these benchmarks.

* FMT

* Disable checking again

* More improvements for the crate publishing pipeline (#13153)

* more improvements for the crate publishing pipeline

* move default definitions to the publish-crates script

* add script to check the crate publishing pipeline at the start

* fix yaml references

* move more variables to .crates-publishing-pipeline

* separate .crates-publishing-pipeline from .crates-publishing-variables

* clean up redundant and unused code

* txpool: don't maintain the pool during major sync (#13004)

* txpool: don't maintain the pool during major sync

Fix shall prevent from wasting the CPU during the major sync. No actions
are actually required in transaction pool during the major sync.

Fixes: #12903

* passing sync_oracle to maintain method

* fixed: builder, txpool tests

* do not maintain tx-pool if node gone out of sync

* EnactmentAction: all logic moved to EnactmentState

Tests to be done.

* maintain guard logic moved directly to MaintainedTransactionPool

* minor fixes

* EnactmentAction: all logic moved to EnactmentState (again)

* SyncOracle fixes here and there

* Update client/transaction-pool/src/enactment_state.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/transaction-pool/src/enactment_state.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* sync_oracle removed

* spelling + fmt + doc

* Review suggestions applied

* log::info -> debug

* Update client/transaction-pool/src/enactment_state.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <git@kchr.de>

* [client/network] Add support  for `/wss` addresses (#13152)

* join dns with another instance of WS transport

Secure Websocket transport needs unresolved addresses, so we join DNS transport with
yet another instance of Websocket transport.

Closes #12024

* WSS transport itself need to wrap DNS transport

in order to resolve addresses before passing them down to TCP transport

Refs https://github.com/libp2p/rust-libp2p/issues/3330

* reverse order

* simplify code: remove WS from WSS inner DNS transport

* remove the 2nd instance of WS transport

* NIS should retain funds in reserve (#12928)

* Keep funds with receipt holder

* Counterpart is optional

* Use named reserves

* Tests

* Benchmarks

* Fixes

* Update frame/nis/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Update frame/nis/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Update frame/nis/src/tests.rs

* Update frame/nis/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nis/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nis/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Formatting

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Refactory of `next_slot` method (#13155)

Refactory of `next_slot` method

* Prevents slot worker exit if inherent data provider creation fails
* Failure is not possible anymore
* Fix potential failure after warp-sync where block headers of not already downloaded blocks are used by the inherent data provider

* Breakout mock runtimes to separate files (#13150)

* break out moch runtimes to separate files

* tranaction-payment: break out tests & mock runtime to separate files

* frame-benchmarking: Macros should not force a particular env (#13161)

The macros in frame-benchmarking relied on having all the macros imported, which isn't a behavior
for a proper macro :D This pr fixes this by making all internal macro usages absolute.

* Fix the `storage_size`/`state_getStorageSize` RPC call (#13154)

* Have `KeyIterator` clone the `prefix` it receives

* Stream keys in `storage_size` RPC and add a runtime limit

* Update client/rpc/Cargo.toml

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/rpc/src/state/utils.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Rename the types to signify that the cancellation is due to a timeout

* Move the test into a `mod tests`

* Add a comment regarding `biased` in `tokio::select`

* Make the `clone` explicit when calling `KeyIterator::{new, new_child}`

Co-authored-by: Bastian Köcher <git@kchr.de>

* [contracts] Adapt storage reading host functions to Weights V2 (#12976)

* update RuntimeCosts to Weights V2, update tests

* improve docs

* clearer naming and docs to compat_weight helper

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* save before master merge

* HostFnWeights to Weight

* added to_weight! macro

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* RuntimeCosts::ChainExtension to weight_v2

* chain extension to weight v2

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* zobmienet tests are not supposed to fail (#13015)

* zobmienet tests are not supposed to fail

* Update scripts/ci/gitlab/pipeline/zombienet.yml

Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>

Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>

* [contracts] Add integrity checks by pallet hook (#12993)

* integrity test for MaxCodeLen and CallStack::len()

* integrity test for MaxDebugBufferLen

* addressed review comments

* fix append_debug_buffer()

* ci fix

* updated code_len_limit formula after further discussion

* enlarged mem safe margin after discussion

* +doc to Config trait associated types

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* more lil fixes from code review feedback

* lowered max call depth to satisfy mem limits

* fix node runtime pallet params to satisfy integrity check

* fix max call depth value calc

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Expose `UnknownBlock` error via `ApiError` (#12707)

* Expose `UnknownBlock` error via `ApiError`

In [certain cases](https://github.com/paritytech/polkadot/issues/5885) a
runtime api is called for an unknown block. For example a block which is
already pruned or on an abandon fork.

In such cases the correct error is returned but it is wrapped in
`ApiError::Application` and the only way to figure out what is the
problem is to inspect the actual message in the error. In polkadot for
example this usually happens when the runtime api version is being
queried. It's beneficial to be able to clearly separate such errors so i
that when they occur the client side can handle them more gracefully.
E.g. log less stressful error message than `State already discarded for
BlockId` or cancel any pending work related on this block.

* Update primitives/api/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

Co-authored-by: Bastian Köcher <git@kchr.de>

* Notification-based block pinning (#13157)

* Worker

* Reorganize and unpin onnotification drop

* Pin in state-db, pass block number

* Pin blocks in blockchain db

* Switch to reference counted LRU

* Disable pinning when we keep all blocks

* Fix pinning hint for state-db

* Remove pinning from backend layer

* Improve readability

* Add justifications to test

* Fix justification behaviour

* Remove debug prints

* Convert channels to tracing_unbounded

* Add comments to the test

* Documentation and Cleanup

* Move task start to client

* Simplify cache

* Improve test, remove unwanted log

* Add tracing logs, remove expect for block number

* Cleanup

* Add conversion method for unpin handle to Finalitynotification

* Revert unwanted changes

* Improve naming

* Make clippy happy

* Fix docs

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* Use `NumberFor` instead of u64 in API

* Hand over weak reference to unpin worker task

* Unwanted

* &Hash -> Hash

* Remove number from interface, rename `_unpin_handle`, LOG_TARGET

* Move RwLock one layer up

* Apply code style suggestions

* Improve comments

* Replace lru crate by schnellru

* Only insert values for pinned items + better docs

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* Improve comments, log target and test

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Make DispatchError impl MEL (#13169)

* Make DispatchError impl MEL

* Upgrade SCALE codec to support `codec(skip)` for MEL

Co-authored-by: Bastian Köcher <info@kchr.de>

* Remove fixtures from crate (#13181)

* txpool: LOG_TARGET const added (#13180)

* txpool: LOG_TARGET const added

part of: #12873

* LOG_TARGET added to tests mod

* txpool::api for api

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>

* Fix potential huge allocation as a result of `validate_block` output (#13183)

* Fix potential huge allocation as a result of `validate_block` output

* Address review comments; add more tests

* Update client/executor/wasmtime/src/runtime.rs

* Remove unnecessary comments

Co-authored-by: Bastian Köcher <git@kchr.de>

* sc-network: Ensure private addresses are disabled if requested (#13185)

When running with `--no-private-ipv4` the node should not trying to connect to any private ip
addresses. With the switch to libp2p this behavior was broken. Part of this version upgrade was the
following pr: https://github.com/libp2p/rust-libp2p/pull/2995. This pr changed the default cache
size of `libp2p-identity` from `0` aka disabled to `100`. Together with our implementation that was
calling into `identity` to request addresses for a given peer. Before the switch to libp2p 0.50.0
this was returning zero addresses, but now with the cache enabled it started to return addresses.
This pr fixes this by only letting discovery return addresses for a peer. It also ensures that we
filter private addresses if requested. The cache is also disabled to restore the previous caching
behavior, but it will actually not be called anymore.

* Warn validators with slow hardware (#12620)

* move Metric

* run hardware bench if validiator flag is being used

* fix rustdoc & update node-template

* fix

* unused improt

* warn

* move Requirement

* bench_result

* ensure_requirements

* make the code compile

* check if authority

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* nit fixes

* warning signs

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use year 2023 in the License headers (#13193)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Move slow hardware warning print logic to CLI (#13198)

* Move slow hardware warning print logic to CLI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fmt

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: Bastian Köcher <git@kchr.de>

* Fix flaky BABE test (#13199)

The `authoring_blocks` test of BABE was calculating the slot based on the timestamp it sometimes
failed in CI. The problem is that we combine all the notifications and authoring futures in one big
future. This one big future may first polls one authoring future to build a block. Then it polls all
notification futures again to import the block. Then some other authoring future is polled and
builds on the imported block using the same slot and making the import fail. The solution is that we
just artificially increase the slot to make the test work.

* Add debug info in assert_has_event and assert_last_event (#12979)

* improve debug info in assert_has_event and assert_last_event

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

Co-authored-by: Bastian Köcher <git@kchr.de>

* new proc-macro-based benchmarking syntax (#12924)

* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges :boom:

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances :boom:

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well :boom:

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark :boom:

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl :boom:

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working :boom:

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt https://github.com/paritytech/substrate/pull/12924#issuecomment-1372938718

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) :tada:

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

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: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>

* Rename `*-private-ipv4` to `*-private-ip` CLI args (#13208)

* Rename `*-private-ipv4` to `*-private-ip` CLI args

Renames the `*-private-ipv4` to `*-private-ip` in the CLI interface. The old names are staying as
alias, thus it will not break for anyone. Besides that it also fixes the naming in the rest of the code.

* FMT

* Remove dead code (#13213)

* [Fix] CountedMap::set now takes Counter into account (#13214)

* [Fix] CountedMap::set now takes Counter into account

* introduce tests for StorageMap

* debug assert events at genesis (#13217)

* BlockId removal: refactor: CallExecutor trait (#13173)

* BlockId removal: refactor: CallExecutor trait

It changes the arguments of CallExecutor methods:
-  `call`, 'contextual_call', 'runtime_version', 'prove_execution'

from: `BlockId<Block>` to: `Block::Hash`

This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>

* service: storage monitor added (#13082)

* service: storage monitor added

Storage monitor added. It uses `notify` create to get notifications
about any changes to monitored path (which is database path).
Notifications are consumed in essential task which terminates when
available storage space drops below given threshold.

Closes: #12399

* Cargo.lock updated

* misspell

* fs events throttling added

* minor updates

* filter out non mutating events

* misspell

* ".git/.scripts/commands/fmt/fmt.sh"

* Update client/service/src/storage_monitor.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* storage-monitor crate added

* cleanup: configuration + service builder

* storage_monitor in custom service (wip)

* copy-paste bad desc fixed

* notify removed

* storage_monitor added to node

* fix for clippy

* publish = false

* Update bin/node/cli/src/command.rs

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* crate name: storage-monitor -> sc-storage-monitor

* error handling improved

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* publish=false removed

Co-authored-by: command-bot <>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Bastian Köcher <git@kchr.de>

* beefy: Add LOG_TARGET constant (#13222)

* LOG_TARGET const
* fmt

* Upgrade wasm-opt to 0.111.0 (#13038)

* storage-monitor: statvfs arithmetic bug fixed (#13234)

* Bump parity-db (#13226)

* pallet-assets: Rename `total_supply` to `amount` (#13229)

* pallet-assets: Rename `total_supply` to `amount`

We are actually passing the `amount` on assets being minted and not the total supply.

Closes: https://github.com/paritytech/substrate/issues/13210

* ".git/.scripts/commands/fmt/fmt.sh"

* Fix compilation

* FMT

Co-authored-by: command-bot <>

* Babe: bad epoch index with skipped epochs and warp sync (#13135)

* Detect and correct epoch-index for skipped epochs

* Code refactory

* Epoch index should be also be fixed for secondary claims with VRF

* Fix typo

* Make clippy happy

* Fix typo

* Trigger pipeline

* contracts: Deprecate random interface (#13204)

* Deprecate random interface

* Revert change to runtime file

* Fix docs

* Fix tests

* Rename to not_deprecated

* Apply suggestions from code review

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* Deprecate `set_rent_allowance`

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* [contracts] Add upfront weight of merkle trie proofs for storage reading functions (#13236)

* Add upfront weight of merkle trie proofs for storage reading functions

* drive-by fixes

* CI: Rewrite `check-each-crate` in python (#13238)

* CI: Rewrite `check-each-crate` in python

This is a much better readable version of the script and it should also work on Macos and not
siltently fail ;)

* Fix dumb bugs and print everything to stderr

* Don't buffer Python output

* :facepalm:

* :facepalm: :facepalm:

* Use check all until we have more macos runners

* Update scripts/ci/gitlab/check-each-crate.py

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update scripts/ci/gitlab/pipeline/test.yml

Co-authored-by: Vladimir Istyufeev <vladimir@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix try-runtime with create-snapshot (#13223)

* Fix try-runtime with create-snapshot

* Apply review suggestions

* reduce exec time of fast-unstake benchmarks (#13120)

* reduce exec time of fast-unstake benchmarks

* fix test

* fmt

* fix patch the tests

* fix patch the tests

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* add batch size as well

* update some benches to be better

* fix one last test

* fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* reduce time even more

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* fix tests

* nit

* remove

* improve the weight calc further

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* fix benchmarks

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* update

* fix

* fix

* fmt

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* lots of changes again...

* smaller input

* update

* fmt

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* cleanup

* small simplification

* fmt

* reduce exec time a bit

* fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* test

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* increase again

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* review comments

* fmt

* fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

Co-authored-by: command-bot <>

* Rework the trie cache (#12982)

* Rework the trie cache

* Align `state-machine` tests

* Bump `schnellru` to 0.1.1

* Fix off-by-one

* Align to review comments

* Bump `ahash` to 0.8.2

* Bump `schnellru` to 0.2.0

* Bump `schnellru` to 0.2.1

* Remove unnecessary bound

* Remove unnecessary loop when calculating maximum memory usage

* Remove unnecessary `mut`s

* Add task type label to metrics (#13240)

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* upgrade nix to 0.26.1 (#13230)

* Add WeightToFee and LengthToFee impls to transaction-payment Runtime API (#13110)

* Add WeightToFee and LengthToFee impls to RPC

* Remove RPC additions

* Update frame/transaction-payment/rpc/runtime-api/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Add comments to length_to_fee and weight_to_fee

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Correct arithmetical semantic of `PerDispatchClass` (#13194)

* Fix PerDispatchClass arithmetic

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Test PerDispatchClass arithmetic

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add helpers for Weight

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove stale doc

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Dont mention Polkadot in Substrate

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove saturating_ prefix

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix usage

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Aura: Fix warp syncing (#13221)

* Aura: Fix warp syncing

We need to set the fork choice rule! When using Cumulus this is done by the `ParachainsBlockImport`,
but for standalone chains we still need this!

Closes: https://github.com/paritytech/substrate/issues/13220

* Improve fork choice

* Add Proof Size to Weight Output (#11637)

* 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>

* Use non-binary pronouns in comments. (#13209)

* use non binary pronouns in comments

* cargo fmt

* fix the use of "it" with "they" when dealing about an opperations identity

* migrate new benchmarking syntax from `frame_support::benchmarking` to `frame_benchmarking::v2` (#13235)

* * re-export frame_support::benchmarking in frame_benchmarking::
* prefer use frame_benchmarking::*; in examples, etc

* switch to frame_benchmarking::v2

* completely migrate new benchmarking code out of frame_support

* fix doc links

* remove unneeded return

Co-authored-by: Bastian Köcher <git@kchr.de>

* remove another unneeded return

Co-authored-by: Bastian Köcher <git@kchr.de>

* properly export all macros in v1

* refactor existing frame_benchmarking imports to use ::v1

---------

Co-authored-by: Bastian Köcher <git@kchr.de>

* mutate_exists for StorageValue with ValueQuery (#13245)

* mutate_exists for StorageValue with ValueQuery

Signed-off-by: muraca <mmuraca247@gmail.com>

* added `#[crate::storage_alias]` to tests

Signed-off-by: muraca <mmuraca247@gmail.com>

* added StorageEntryMetadata

Signed-off-by: muraca <mmuraca247@gmail.com>

* Update frame/support/src/lib.rs

---------

Signed-off-by: muraca <mmuraca247@gmail.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix derive PassByInner with generics (#13247)

* Fix derive PassByInner with generics

* Update primitives/runtime-interface/proc-macro/src/pass_by/inner.rs

---------

Co-authored-by: Bastian Köcher <git@kchr.de>

* docs: Fix broken documentation links for pallets (#13241)

Fixes broken links to `Config` and `Call`, for READMEs the link has
been fixed by adding the missing "/pallet" path, and for rust docs we
let the compiler figure out the type's link by itself

Signed-off-by: Jonathas-Conceicao <jonathasaoc@gmail.com>

* sc-finality-grandpa: Warp proof generation can not expect justifications (#13249)

When a node is running with `--blocks-pruning` it will also prunes justifications. So, the warp
proof generation can not use `expect` for unwrapping the justification.

* update criterion to v0.4.0 (#13142)

* fix up template (#13205)

* Remove `uncles` related code (#13216)

The code was added without any clear usage. The inherent for example is not benchmarked and not used.

* Implement RIType traits for u8 array with an arbitrary size (#13256)

* grandpa: cleanup stale entries in set id session mapping (#13237)

* grandpa: cleanup stale entries in set id session mapping

* Update frame/grandpa/src/migrations.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* grandpa: remove unused import

* grandpa: migration off-by-one

* Update frame/grandpa/src/lib.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Update frame/grandpa/src/lib.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* grandpa: MaxSetIdSessionEntries as u64

* node-template: fix MaxSetIdSessionEntries type

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Benchmark's successful origin api update (#13146)

* try successful origin unimplemented by default

* error as a default impl for try_successful_origin

* remove successful_origin func of EnsureOrigin trait

* default impl -> unimplemented!()

* update EnsureOriginWithArg

* fix EnsureOriginWithArg

* prefix unused arg with underscore

* use try_successful_origin instead successful_origin, map err to Weightless

* fix tests

* remove default impl

* unwrap for indirect origin dep

* replace unwrap by expect with a message

---------

Co-authored-by: parity-processbot <>

* hooks default impl missing where clause (#13264)

* hooks default impl missing where clause

* add tests

* Update frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs

---------

Co-authored-by: parity-processbot <>

* implemented `contains_prefix` for StorageDoubleMap and StorageNMap (#13232)

* implemented `contains_prefix` for StorageDoubleMap and StorageNMap

Signed-off-by: muraca <mmuraca247@gmail.com>

* match prefix to next_key

Signed-off-by: muraca <mmuraca247@gmail.com>

* warning unexpected behaviour with empty keys

Signed-off-by: muraca <mmuraca247@gmail.com>

* clarifications for unhashed::contains_prefixed_key

Signed-off-by: muraca <mmuraca247@gmail.com>

* added tests for StorageNMap

Signed-off-by: muraca <mmuraca247@gmail.com>

---------

Signed-off-by: muraca <mmuraca247@gmail.com>

* Calling proxy doesn't remove announcement (#13267)

* Calling proxy doesn't remove announcement

* Update frame/proxy/src/tests.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* fmt

---------

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Fee and tip represented as asset ID inside `AssetTxFeePaid` (#13083)

* fee & tip in the asset ID Balance type

* docs

* rewrite

* update runtime config

* docs

* Move beefy-merkle-tree to utils/binary-merkle-tree and make it generic (#13076)

* move BeefyMmrApi to pallet-beefy-mmr

* fix test_utils use pallet-beefy-mmr BeefyMmrApi

* Move beefy-merkle-tree to utils and Rename to Merkle-tree

* fix fmt and test

* Update merkle-tree to binary-merkle-tree and Remove Keccak256 mod from merkle-tree

* change merkle-tree name to binary-merkle-tree

* mirr fix

* Metadata V15: Derive `TypeInfo` for describing runtime types (#13272)

* scale_info: Derive TypeInfo for types present in runtime API

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Update Cargo.lock

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* benchmarks: EnsureRankedMember must add ranked members (#13297)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Minor: Update output validity tests (#13190)

* Minor: Update output validity tests

Quick follow-up to https://github.com/paritytech/substrate/pull/13183.

Mainly, I wanted to double check that the `test_return_max_memory_offset` test doesn't pass just
because the output length is 0.

I also:

- Organized these tests into a module.
- Added a comment explaining why we don't use the `wasm_export_functions` macro.

* Update test based on review comment

* BEEFY: define on-chain beefy-genesis and use it to coordinate voter initialization (#13215)

* beefy: add support to configure BEEFY genesis

* client/beefy: more flexible test runtime api

* client/beefy: add tests for custom BEEFY genesis

* client/beefy: ignore old state that didn't account for pallet genesis

* client/beefy: fix clippy

* frame/beefy: default BEEFY-genesis is block One::one()

* frame/beefy: add extra doc comments

---------

Co-authored-by: parity-processbot <>

* feat: add event SkepticsChosen event in society (#13291)

* feat: add event SkepticsChosen event in society

* feat: add test for SkepticsChosen event

* feat(client): significantly increase wasm instance limits (#13298)

Following https://github.com/paritytech/substrate/issues/11949, this PR will allow parachains with runtimes bigger than Kusama to use the pooling strategy.

* Remove in-tree bounded types and use bounded-collections crate (#13243)

* Remove in-tree bounded types and use bounded-collections crate

* Fixes

* Bump bounded-collections version

* cargo fmt

* Bump bounded-collections

* Only export non-bounded types at the top level

* Fixes

* Bump bounded-collections

* update linregress in frame-benchmarking to 0.5.1 (#13310)

* update nalgebra in frame-benchmarking to 0.5.0

* upgrade to 0.5.1 to incorporate upstream fix in linregress

* [client/network] remove peer entry from `ephemeral_addresses` (#13084)

* [client/network] remove peer entry from `ephemeral_addresses`

if there are no addresses associated with that peer

* refactor as per @bkchr suggestion

https://github.com/paritytech/substrate/pull/13084#discussion_r1068028534

* add missing import

* fix error

* rpc-spec-v2/tx: Fix error typo (#13307)

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* BEEFY: client support for detecting equivocated votes (#13285)

* client/beefy: detect equivocated votes

* client/beefy: make sure to persist state after voting

* client/beefy: drop never-used aux-schema v2 migration

* impl review suggestion

---------

Signed-off-by: Adrian Catangiu <adrian@parity.io>

* Bump `wasmtime` to 5.0.0 (and a few other deps) (#13160)

* Bump `wasmtime` to 4.0.0 (and a few other deps)

* Use `Error::msg` instead of `anyhow!`

* Bump `wasmtime` to 5.0.0

* Update `Cargo.lock`

* Add `wasmtime` feature to `sp-wasm-interface` dependency

* Fix: Off-chain-worker example (#13300)

* fix: divider

* update comment

* Rename `pallet-random-collective-flip` to Insecure... (#13301)

* Rename pallet-random-collective-flip to Insecure...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* `zombienet`: warp-sync tests for validators  (#13078)

* zombienet validators warp sync draft

Sketch of warp-sync test for validators.
Not tested.

Follow-up of: #12769

* yet another warp-sync scenario added

- all validators are synced from DB,
- some full nodes are synced from DB,
- full-node is warp-synced

* fixes

* fixes

* missing files

* path fixed

---------

Co-authored-by: parity-processbot <>

* Disable default features for `strum` (#13326)

* Fix block pruning (#13323)

* Fix block pruning (#13323)

* Referendum proposal's metadata (#12568)

* referenda metadata

* todo comment

* remove TODO, update rustdocs

* referenda clear_metadata origin signed or root

* referenda metadata unit tests

* drop schema type for referenda metadata

* remove metadata type

* referenda metadata benches

* note different preimages

* metadata for democracy pallet

* metadata democracy pallet tests and benches

* fix cargo clippy

* update docs

* ".git/.scripts/bench-bot.sh" pallet dev pallet_democracy

* ".git/.scripts/bench-bot.sh" pallet dev pallet_referenda

* Update the doc frame/democracy/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update the doc frame/democracy/src/lib.rs

Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

* reference instead clone for take

Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

* error rename BadMetadata to PreimageNotExist

* clear metadata within internal_cancel_referendum fn

* remove redundant clone

* collapse metadata api into one set_metadata method

* fmt

* review fixes

* not request preimage on set_metadata

* rename events and update docs

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_democracy

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_referenda

* rename reset_metadata to transfer_metadata

---------

Co-authored-by: command-bot <>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

* Improve test coverage of the `Notifications` protocol (#13033)

* Add handler and upgrade tests

* Add tests for `behaviour.rs`

* Apply review comments

* Update dependencies

* Apply suggestions from code review

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* Apply review comments

* Fix clippy

* Update mockall

* Apply review comment

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* Configurable voting-degree in council elections pallet (#13305)

* configurable council elections pallet

* configurable council elections pallet

* add warning

* reduce sizes

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_elections_phragmen

* fix stuff

* make assert

* fix docs

* fix docs again

* fix docs again

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* fix docs

---------

Co-authored-by: command-bot <>
Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Rework generated API docs (#13178)

* pallet-scheduler: Ensure we request a preimage (#13340)

* pallet-scheduler: Ensure we request a preimage

The scheduler was not requesting a preimage. When a preimage is requested, a user can deposit it
without paying any fees.

* Review changes

* [Fix] Try-state feature-gated for BagsList (#13296)

* [Fix] Try-state feature-gated for BagsList

* fix comment

* fix try_state remote-tests

* feature-gate try-state remote test for bags-list

* remove try-state from a migration

* more SortedListProvider fixes

* more fixes

* more fixes to allow do_try_state usage in other crates

* do-try-state for fuzz

* more fixes

* more fixes

* remove feature-flag

* do-try-state

* fix review comments

* Update frame/bags-list/src/mock.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

---------

Co-authored-by: parity-processbot <>
Co-authored-by: Anton <anton.kalyaev@gmail.com>

* bump version of zombienet and update snaps links (#13359)

* Fix longest chain finalization target lookup (#13289)

* Finalization target should be chosed as some ancestor of SelectChain::best_chain

* More test assertions

* Improve docs

* Removed stale docs

* Rename 'target' to 'base' in lookup method

* Fix typo

* Apply suggestions from code review

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Rename 'target_hash' to 'base_hash' in 'SelectChain::finality_target()'

* Apply suggestions from code review

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Docs improvement

* Doc fix

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* Apply more code suggestions

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* SetMembers configurable origin (#13159)

* SetMembers configurable origin

* root origin comment replaced

* fmt

* grandpa: don't error if best block and finality target are inconsistent (#13364)

* grandpa: don't error if best block and finality target are inconsistent

* grandpa: add test for best block override

* grandpa: make clippy happy

* grandpa: log selectchain override as debug instead of warn

* grandpa: don't error if best block and finality target are inconsistent (#13364)

* grandpa: don't error if best block and finality target are inconsistent

* grandpa: add test for best block override

* grandpa: make clippy happy

* grandpa: log selectchain override as debug instead of warn

* Improve Weight Template and API (#13355)

* improve weights template and api

* follow template

* [ci] Change label checker (#13360)

* [ci] Change label checker

* rm pr autolabel

* fix specs file name to substrate

* client/beefy: request justifs from peers further in consensus (#13343)

For on-demand justifications, peer selection is based on witnessed
gossip votes. This commit changes the condition for selecting a peer
to request justification for `block` from
"last voted on >= `block`" to "peer last voted on strict > `block`".

When allowing `>=` we see nodes continuously spamming unsuccessful
on-demand requests to nodes which are still voting on a block without
having a justification available.

One way to fix the spam would be to add some rate-limiting or backoff
period when requesting justifications.

The other solution (present in this commit) is to simply request
justifications from peers that are voting on future blocks so we know
they're _guaranteed_ to have the wanted mandatory justification
available to send back.

Signed-off-by: acatangiu <adrian@parity.io>

* [ci] Change GHA to add J2 labels instead Z0 (#13375)

* sc-client-db: Fix `PruningMode::ArchiveCanonical` (#13361)

* sc-client-db: Fix `PruningMode::ArchiveCanonical`

When running a node with `--state-pruning archive-canonical` it was directly failing on genesis.
There was an issue in the state-db `pin` implementation. It was not checking the state of a block
correctly when running with archive canonical (and also not for every other block after they are canonicalized).

* FMT

* benchmarks: EnsureRankedMember must add ranked members (#13297) (#13348)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* subkey: only decode hex if requested, CLI `0x` prefixed hex for all `stdout` (#13258)

* Only decode hex if requested

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Cleanup code

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add some tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add license

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Docs

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Clippy

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* bump version, breaking (tiny) change in output.

* Move integration tests to own folder

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: Dan Shields <nukemandan@protonmail.com>

* [Feature] Introduce storage_alias for CountedStorageMap (#13366)

* [Feature] Introduce storagage_alias for CountedStorageMap

* bit more dry

* bit more dry

* address review comments

* some tests and fixes

* fix ui tests

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* compare metadata

---------

Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <git@kchr.de>

* [NFTs] Offchain mint (#13158)

* Allow to mint with the pre-signed signatures

* Another try

* WIP: test encoder

* Fix the deposits

* Refactoring + tests + benchmarks

* Add sp-core/runtime-benchmarks

* Remove sp-core from dev deps

* Enable full_crypto for benchmarks

* Typo

* Fix

* Update frame/nfts/src/mock.rs

Co-authored-by: Squirrel <gilescope@gmail.com>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_nfts

* Add docs

* Add attributes into the pre-signed object & track the deposit owner for attributes

* Update docs

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_nfts

* Add the number of attributes provided to weights

* Apply suggestions

* Remove dead code

* Remove Copy

* Fix docs

* Update frame/nfts/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nfts/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Co-authored-by: Squirrel <gilescope@gmail.com>
Co-authored-by: command-bot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* feat: improve FinalityProofProvider api (#13374)

* feat: improve prove_finality api and export it

* fmt

* fix

* improve prove_finality and kept private

* Update client/finality-grandpa/src/finality_proof.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* add `prove_finality_proof` to `FinalityProofProvider`

* fix some and impl Clone for FinalityProofProvider

* improve by suggestions

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* cleanup `<weight></weight>` from docs comments (#13350)

* cleanup <weight></weight> from docs comments

* Changes to address review commnets

* Fix CI cargo test --docs

---------

Co-authored-by: parity-processbot <>

* zombienet: is up timtout increased to 30s (#13386)

* pallet-timestamp: Remove `ValidAtTimestamp` error variant (#13346)

* pallet-timestamp: Remove `ValidAtTimestamp` error variant

The error variant wasn't that useful and it was also used wrongly in the code. In the code we
returned this variant when the `timestamp < minimum`. The problem of this is that we waited on the
node side some time, but then `set` function rejects the timestamp because of the same check (the
timestamp in the block stays the same). We ensure that the timestamp isn't drifting too much in the
future, but waiting for the timestamp to be "valid" would open some attack vector. The consensus
protocols also compare the slots in the blocks to ensure that there isn't a block from the future
and in the runtime we then ensure that `slot = timestamp / slot_duration`. So, we can just remove
this variant and replace it with a new variant `TimeBetweenBlocksTooShort` to not even try importing
a block which uses a too short delay since the last block.

* Update primitives/timestamp/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Rename to `TooEarly`

* FMT

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* add warp to target block for parachains (#12761)

* add warp to target block for parachains

* fix for failing tests

* format using  `Cargo +nightly fmt`

* Remove blocking based on PR comments and create new `WarpSync` on poll

* remove method from trait

* add tests for wait for target

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* code refactor based on pr comments

* Second round of PR comments

* Third round of pr comments

* add comments to explain logic

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* code refactor based on last PR comments

* move warp sync polling before `process_outbound_requests`

Add error message if target block fails to be retreived

* Update client/network/sync/src/warp.rs

Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fmt after code suggestions

* rebase changes

* Bring down the node if the target block fails to return

* Revert "Bring down the node if the target block fails to return"

This reverts commit c0ecb220d66dd8e7b1a5ee29831b776f4f18d024.

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* use matching on polling to avoid calling poll more than once

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fix typo on comment

* update snapshot with new folder structure

* Upload snapshot

* Bump zombienet

* bump zombienet again

* Improve test

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fix tests

* dummy commit to restart builds

* Converted the target block to an optional value that is set to `None` when an error occurs

* dummy commit to restart builds

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>

* [contracts] make `debug_message` execution outcome invariant to node debug logging setting (#13197)

* update benchmark for seal_debug_message

* add seal_debug_message_per_kb benchmark

* un-fallable debug buffer: silently drops excessive and wrong utf-8 encoded messages

* charge debug_message per byte of the message

* impr…
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D9-needsaudit 👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants