Commit Graph

7079 Commits

Author SHA1 Message Date
Michal Kucharczyk dcd56b1ffd Trivial BlockId::Number => Hash (#12490) 2022-10-13 13:22:57 +00:00
Koute 1b3f211efa Enable the wasmtime-based WASM executor by default (#12486) 2022-10-13 10:31:00 +00:00
Sergej Sakac 9dd89e7fa3 pallet-mmr: RPC API and Runtime API work with block numbers (#12345)
* pallet-mmr: RPC API works with block_numbers

* fixes

* update rpc

* fmt

* final touches in the rpc

* temporary fix

* fix

* fmt

* docs

* Update lib.rs

* use NumberFor

* validate input

* update runtime

* convert block_number to u64

* small edit

* update runtime api

* test fix

* runtime fix

* update test function

* fmt

* fix nits

* remove block_num_to_leaf_index from runtime api

* Update frame/merkle-mountain-range/src/lib.rs

Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>

* fix tests

* get the code to compile after merge

* get the tests to compile

* fix in tests?

* fix test

* Update frame/merkle-mountain-range/src/tests.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update frame/merkle-mountain-range/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update primitives/merkle-mountain-range/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* fix errors & nits

* change block_num_to_leaf_index

* don't make any assumptions

* Update frame/merkle-mountain-range/src/tests.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update frame/merkle-mountain-range/src/tests.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update frame/merkle-mountain-range/src/tests.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* fix

* small fix

* use best_known_block_number

* best_known_block_number instead of leaves_count

* more readable?

* remove warning

* Update frame/merkle-mountain-range/src/lib.rs

Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>

* simplify

* update docs

* nits

* fmt & fix

* merge fixes

* fix

* small fix

* docs & nit fixes

* Nit fixes

* remove leaf_indices_to_block_numbers()

* fmt

Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
2022-10-13 10:13:56 +00:00
Aaro Altonen 09164dbced Introduce mockable ChainSync object for testing (#12480)
* Introduce mockable `ChainSync` object for testing

`mockall` allows to mock `ChainSync` and to verify that the calls made
to `ChaiSync` are firstly executed at all, that they're executed in
correct order and with correct parameters.

This allows to verify, e.g., that delegating calls directly to
`ChainSync` from `NetworkService` still calls the correct functions with
correct arguments even if `Protocol` middleman is removed.

* Add Cargo.lock

* Fix tests

* Update client/network/Cargo.toml

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

* Update Cargo.lock

* Fix clippy and documentation

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
2022-10-13 09:37:09 +00:00
Dmitrii Markin b0b2b6799c Punish peers for duplicate GRANDPA neighbor messages (#12462)
* Decrease peer reputation for duplicate GRANDPA neighbor messages.

* Fix comparison

* Fix update_peer_state() validity condition

* Add negative test

* Rework update_peer_state() validity condition, add tests

* update_peer_state() validity condition: invert comparison

* Split InvalidViewChange and DuplicateNeighborMessage misbehaviors

* Enforce rate-limiting of duplicate GRANDPA neighbor packets

* Update client/finality-grandpa/src/communication/gossip.rs

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

* Make rolling clock back in a test safer

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
2022-10-13 09:24:31 +00:00
Shawn Tabrizi b38c4165a4 Dont use benchmark range on constant functions (#12456)
* dont use benchmark range on constant function

* update weights

* fix

* new weights

* Update frame/examples/basic/src/benchmarking.rs

Co-authored-by: parity-processbot <>
2022-10-12 16:32:10 +00:00
Michal Kucharczyk 09748f1b28 BlockId::Number refactor: trivial changes to BlockId::Hash (#12471)
* Trivial BlockId::Number => Hash

* missed BlockId::Hash added
2022-10-12 16:10:31 +00:00
Pierre Krieger 8920b1c5b3 Clarify the "direction" field of block requests (#12438) 2022-10-12 13:01:54 +00:00
Michal Kucharczyk 453b9ef235 tx-pool: failing tests fixed (#12481) 2022-10-12 08:06:22 +00:00
Michal Kucharczyk 62bca87f3a Finalized block event triggers tx maintanance (#12305)
* finalized block event triggers tx maintanance

* tx-pool: enactment helper introduced

* tx-pool: ChainApi: added tree_route method

* enactment logic implemented + tests

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

* Some additional tests

* minor improvements

* trigger CI job

* fix compilation errors

ChainApi::tree_route return type changed to Result<Option<..>>, as some
implementations (tests) are not required to provide this tree route.

* formatting

* trait removed

* implementation slightly simplified

(thanks to @koute)

* get rid of Arc<> in EnactmentState return value

* minor improvement

* Apply suggestions from code review

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

* Apply suggestions from code review

* comment updated + formatting

* Apply suggestions from code review

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Davide Galassi <davxy@datawok.net>

* formatting

* finalization notification bug fix

+ new test case
+ log::warn message when finalized block is being retracted by new event

* added error message on tree_route failure

* Apply suggestions from code review

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

* use provided tree_route in Finalized event

* Option removed from ChainApi::tree_route

* doc added, test and logs improved

* handle_enactment aligned with original implementation

* use async-await

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* formatting + warn->debug

* compilation error fix

* enactment_state initializers added

* enactment_state: Option removed

* manual-seal: compilation & tests fix

* manual-seal: tests fixed

* tests cleanup

* another compilation error fixed

* TreeRoute::new added

* get rid of pub hack

* one more test added

* formatting

* TreeRoute::new doc added + formatting

* Apply suggestions from code review

Co-authored-by: Davide Galassi <davxy@datawok.net>

* (bool,Option) simplified to Option

* log message improved

* yet another review suggestions applied

* get rid of hash in handle_enactment

* Apply suggestions from code review

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

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

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

* minor corrections

* EnactmentState moved to new file

* File header corrected

* error formatting aligned with codebase

* Apply suggestions from code review

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

* remove commented code

* small nits

Signed-off-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: André Silva <andrerfosilva@gmail.com>
2022-10-11 20:20:13 +00:00
Shawn Tabrizi 023aa03fea Avoid Unstable Sort (#12455)
* dont use unstable sort

* remove comment

* add clippy rule
2022-10-11 18:41:43 +00:00
Keith Yeung fbdfa84cd7 Rename from_components to from_parts (#12473)
* Rename `from_components` to `from_parts`

* Fixes

* Spelling
2022-10-11 16:35:54 +00:00
Aaro Altonen e1e5b7037a Fix flaky service test (#12472)
Sometimes `NotificationStreamOpenened` would be received for the
other protocol before `SyncConnected` was received so when the
connection was closed, an incorrect event was read from the event
stream.
2022-10-11 15:25:12 +00:00
Pierre Krieger d61b0866ed Remove the unused light client requests (#12470)
* Remove the unused light client requests

* Add comment about new ids
2022-10-11 13:56:18 +00:00
Alexandru Vasile 5f18aaadcd rpc: Implement transaction RPC API (#12328)
* rpc/tx: Add transaction structures for serialization

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

* rpc/tx: Add public facing `TransactionEvent`

To circumvent the fact that serde does not allow mixing
`#[serde(tag = "event")]` with
`#[serde(tag = "event", content = "block")]`
the public facing subscription structure is serialized
and deserialized to an intermmediate representation.

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

* rpc/tx: Add trait for the `transaction` API

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

* rpc/tx: Convert RPC errors to transaction events

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

* rpc/tx: Implement `transaction` RPC methods

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

* tx-pool: Propagate tx index to events

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

* tx-pool: Adjust testing to reflect tx index in events

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

* rpc/tx: Convert tx-pool events for the new RPC spec

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

* rpc/tx: Convert tx-pool `FinalityTimeout` event to `Dropped`

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

* service: Enable the `transaction` API

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

* rpc/tx: Add tests for tx event encoding and decoding

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

* tx: Add indentation for subscriptions

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

* rpc/tx: Fix documentation

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

* rpc/tx: Serialize usize to hex

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

* tx-pool: Rename closure parameters

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

* service: Separate RPC spec versions

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

* rpc/tx: Use `H256` for testing block's hash

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

* rpc/tx: Serialize numbers as string

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

* tx-pool: Backward compatibility with RPC v1

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

* Update client/rpc-spec-v2/src/transaction/transaction.rs

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>

* rpc/tx: Remove comment about serde clone

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

* rpc/tx: Use RPC custom error code for invalid tx format

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

* Update client/rpc-spec-v2/src/transaction/event.rs

Co-authored-by: James Wilson <james@jsdw.me>

* rpc/tx: Adjust internal structures for serialization/deserialization

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

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Co-authored-by: James Wilson <james@jsdw.me>
2022-10-11 08:49:12 +00:00
Vlad 896a9fc7cb Update UI tests for Rust 1.64 (#12440)
* Update UI tests for Rust 1.64

* Test with the staging image

* Switch back to production
2022-10-10 20:04:51 +02:00
Oliver Tale-Yazdi 54c3e7f55f Dont ignore errors in pallet benchmarking (#12449)
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-10-10 14:25:11 +00:00
Aaro Altonen ce9ce49bc6 Move block announcement protocol config out of Protocol (#12441)
* Move Role(s) to `sc-network-common`

* Introduce `NotificationHandshake` type

* Move block announce protocol config creation to `ChainSync`

* Include block announcement into `notification_protocols`

* Apply review comments

* Remove unneeded include

* Add missing include

* Apply review comments
2022-10-10 07:10:53 +00:00
Leszek Wiesner 0b77060986 Vesting pallet - make WithdrawReasons configurable (#12109)
* Vesting pallet - make WithdrawReasons configurable

* Update `pallet-vesting` README

Co-authored-by: parity-processbot <>
2022-10-09 09:22:43 +00:00
Pierre Krieger 4a6c7aaf5b Remove "to_block" field from BlockRequests (#12447)
* Remove "to_block" field from BlockRequests

* Maybe fix the tests
2022-10-08 21:15:25 +00:00
Dan Shields f55a6c9689 fix comment math (#12452) 2022-10-08 19:26:31 +00:00
Serban Iorga 56a9f55c81 BEEFY: Define a BeefyVerify trait for signatures (#12299)
* Define CustomVerify trait

Signed-off-by: Serban Iorga <serban@parity.io>

* Use ECDSA CustomVerify for MultiSignature

Signed-off-by: Serban Iorga <serban@parity.io>

* beefy: small simplifications

Signed-off-by: Serban Iorga <serban@parity.io>

* Revert "Use ECDSA CustomVerify for MultiSignature"

This reverts commit 136cff82505662dd92c864491814629d2bc349f0.

* Revert "Define CustomVerify trait"

This reverts commit adf91e9e6d1bdea6f00831f6067b74c3d945f9a2.

* Define BeefyAuthorityId and BeefyVerify traits

* Improve BeefyVerify unit tests

Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>

* fmt & import sp_core::blake2_256

* Renamings

* remove SignerToAccountId

* fix

Signed-off-by: Serban Iorga <serban@parity.io>
Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
2022-10-07 14:19:10 +00:00
Koute eee79a1fa4 Extend the lower bounds of some of the benchmarks to also include 0 (#12386)
* Extend the lower bounds of some of the benchmarks to also include `0`

* Fix verify snippet for `pallet_bounties/spend_funds`
2022-10-07 14:16:41 +00:00
Bastian Köcher fc3f9268f6 Upgrade pin-project (#12426)
This fixes some warnings on latest nightly.
2022-10-07 10:46:57 +00:00
Sam Johnson af58e8e842 macro stubs for all pallet:: macros to improve documentation visibility and discovery + revamp of pallet macro documentation (#12334)
* proof of concept working for pallet::whitelist_storage

* fix comments

* pallet macros docs rewrite WIP

* fix issue with cargo fmt cobbling links

* tweak capitalization

* fix docs for storage_version

* fix docs for pallet::hooks

* fix several comments

* fix invalid link

* fix wrapping and add missing links for pallet::hooks docs

* run rewrap on all text blocks in frame_support::pallet docs

* cargo fmt

* fix up pallet::call_index docs

* fix docs for pallet::extra_constants

* fix docs for pallet::error

* fix docs for pallet::event

* fix docs for pallet::event

* * fix docs for pallet::storage
* fix docs for pallet::getter
* fix docs for pallet::storage_prefix
* fix docs for pallet::unbounded
* fix docs for pallet::whitelist_storage
* fix docs for #[cfg(..)] (for storage items and attributes)
* fix docs for pallet::storage macro expansion

* fix docs for pallet::type_value

* fix docs for pallet::genesis_config

* fix docs for pallet::genesis_build

* fix docs for pallet::inherent

* fix docs for pallet::validate_unsigned

* fix docs for pallet::origin

* fix docs for general notes on instantiable pallets

* fix docs for example of a non-instantiable pallet

* fix docs for example of an instantiable pallet

* fix docs for upgrade guidelines

* fix docs for upgrade guidelines

* fix docs for upgrade checking and final notes

* fix some examples near the beginning

* extract docs for `pallet::whitelist_storage`

* add docs for pallet_macro_stub

* fix order of pallet::config and pallet::constant

* set up stub for pallet::config

* set up stub for pallet::constant

* fix

* set up stub for pallet::disable_frame_system_supertrait_check

* set up stub for pallet::generate_storage_info

* set up stub for pallet::storage_version

* set up stub for pallet::hooks

* set up stub for pallet::weight

* set up stub for pallet::compact

* set up stub for pallet::call_index

* set up stub for pallet::extra_constants

* set up stub for pallet::error

* set up stub for pallet::event

* set up stub for pallet::generate_deposit

* set up stub for pallet::storage

* set up stub for pallet::getter

* set up stub for pallet::storage_prefix

* set up stub for pallet::unbounded

* set up stub for pallet::type_value

* set up stub for pallet::genesis_config

* set up stub for pallet::genesis_build

* set up stub for pallet::inherent

* set up stub for pallet::validate_unsigned

* set up stub for pallet::origin

* fix comment

* cargo fmt

* tweak error message

* Update frame/support/procedural/src/lib.rs

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

* Update frame/support/procedural/src/lib.rs

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

* switch order of derives

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

* tweak wording

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

* add more context info about `MAX_MODULE_ERROR_ENCODED_SIZE`

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

* tweak wording about where clause

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

* clarify wording about system/events key

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

* use "The Event enum" instead of "item"

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

* fix bad wording

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

* use enum instead of type

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

* expect => expects

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

* add additional note about storage prefix

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

* clearer note about GenesisConfig

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

* Use "The impl" instead of "The item"

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

* add note and link to tight-coupling docs

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

* cargo fmt

* remove spaces around parenthesis

* fix missing text for pallet::config

* fix issue with pallet::constant intro

* fix wording about codec index

* fix pallet::error wording

* fix comment about 1 byte => 256 errors

* fix where clause comment

* fix comment about where pallet events are stored

* rewrap some text

* fix pallet::storage docs

* fix pallet::storage_prefix docs

* tweak docs for pallet::genesis_build

* tweak docs for pallet::config

* specify that pallet::event must be present if pallet::config is present

* add note about why we would want to bypass the supertrait check

* mention that pallet::generate_store attribute is only valid on pallet struct

* add note about adding new calls to the end to maintain existing order

* add note about pallet::type_value and pallet::storage

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

* add note about using pallet::type_value alongside pallet::storage

* include warning about modifying disaptchables on other pallet::call_index docs page

* fix incorrect comment

* add much more information for pallet::inherent

* move pallet::pallet macro expansion notes back to their rightful place

* re-run CI

* fix macro expansion appearing in wrong place for pallet::pallet

* replicate pallet::pallet docs on the pallet::pallet macro stub

* force CI re-run

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Squirrel <gilescope@gmail.com>
Co-authored-by: parity-processbot <>
2022-10-06 20:31:56 +00:00
Sergej Sakac 4bf7097732 Maximum value for MultiplierUpdate (#12282)
* Maximum value for MultiplierUpdate

* Update frame/transaction-payment/src/lib.rs

Co-authored-by: Stephen Shelton <steve@brewcraft.org>

* Update lib.rs

* return constant

* fix in runtime

* Update frame/transaction-payment/src/lib.rs

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

* Update frame/transaction-payment/src/lib.rs

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

* fixes

* remove unused import

* Update lib.rs

* more readable

* fix

* fix nits

Co-authored-by: Stephen Shelton <steve@brewcraft.org>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2022-10-06 12:12:51 +00:00
Adrian Catangiu b91d2dfdc1 Add pluggable BEEFY payload constructors (#12428)
* primitives/beefy: move Payload to its own file

* primitives/beefy: add Payload tests

* primitives/beefy: add MmrRootProvider as custom BEEFY payload provider

* client/beefy: use generic BEEFY 'PayloadProvider'

* primitives/beefy: rename Payload::new to Payload::from_single_entry for clarity

* fix visibility

* fix cargo doc
2022-10-06 09:20:27 +00:00
Alexander Theißen 261c5fd6dd Use Option<Weight> for contract dry-runs (#12429) 2022-10-06 08:11:53 +00:00
Andronik 9e423925f6 update kvdb & co (#12312)
* upgrade kvdb & co

* remove patch

* update Cargo.lock

* upgrade impl-serde

* fix parsing test

* actually fix it

* FFS
2022-10-05 21:07:15 +00:00
Gavin Wood 93e8ffed55 Bound uses of Call (#11649)
* Introduce preimages module in traits

* Multisize Preimages

* Len not actually necessary

* Tweaks to the preimage API

* Fixes

* Get Scheduler building with new API

* Scheduler tests pass

* Bounded Scheduler 🎉

* Use Agenda holes and introduce IncompleteSince to avoid need to reschedule

* Tests pass with new weight system

* New benchmarks

* Add missing file

* Drop preimage when permenantly overeight

* Drop preimage when permenantly overeight

* Referenda uses latest preimage API

* Testing ok

* Adding tests

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

* fmt

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

* Add preimage migration

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

* Docs

* Remove dbg

* Refactor Democracy

* Refactor Democracy

* Add final MEL

* Remove silly maps

* Fixes

* Minor refactor

* Formatting

* Fixes

* Fixes

* Fixes

* Update frame/preimage/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Add migrations to Democracy

* WIP

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

* Resolve conflicts

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

* Revert "Resolve conflicts"

This reverts commit 734d66d69e54553471ffa54fa52e3e304dc8f106.

* Undo wrong resolves...

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

* WIP

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

* Make compile

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

* massage clippy

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

* More clippy

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

* clippy annoyance

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

* clippy annoyance

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

* Fix benchmarks

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

* add missing file

* Test <Preimage as QueryPreimage>

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

* More tests

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

* Clippy harassment

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

* Add test

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

* clippy

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

* Fixup tests

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

* Remove old stuff

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

* fmt

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

* Test <Scheduler as Anon> trait functions

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

* Update pallet-ui tests

Why is this needed? Should not be the case unless master is broken...

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

* More scheduler trait test

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

* More tests

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

* Apply review suggestion

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

* Beauty fixes

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

* Add Scheduler test migration_v3_to_v4_works

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

* Merge fixup

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

* Keep referenda benchmarks instantiatable

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

* Update weights

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

* Use new scheduler weight functions

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

* Use new democracy weight functions

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

* Use weight compare functions

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

* Update pallet-ui tests

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

* More renaming…

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

* More renaming…

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

* Add comment

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

* Implement OnRuntimeUpgrade for scheduler::v3_to_v4 migration

Put the migration into a proper `MigrateToV4` struct and implement
the OnRuntimeUpgrade hooks for it. Also move the test to use that
instead.

This should make it easier for adding it to Polkadot.

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

* Clippy

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

* Handle undecodable Agendas

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

* Remove trash

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

* Fix test

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

* Use new OnRuntimeUpgrade functions

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

* fix test

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

* Fix BoundedSlice::truncate_from

Co-authored-by: jakoblell

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

* Fix pre_upgrade hook return values

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

* Add more error logging

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

* Find too large preimages in the pre_upgrade hook

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

* Test that too large Calls in agendas are ignored

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

* Use new OnRuntimeUpgrade hooks

Why did the CI not catch this?!

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

* works fine - just more logs

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

* Fix staking migration

Causing issues on Kusama...

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

* Fix UI tests

No idea why this is needed. This is actually undoing an earlier change.
Maybe the CI has different rustc versions!?

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

* Remove multisig's Calls (#12072)

* Remove multisig's Calls

* Multisig: Fix tests and re-introduce reserve logic (#12241)

* Fix tests and re-introduce reserve logic

* fix benches

* add todo

* remove irrelevant bench

* [Feature] Add a migration that drains and refunds stored calls (#12313)

* [Feature] Add a migration that drains and refunds stored calls

* migration fixes

* fixes

* address review comments

* consume the whole block weight

* fix assertions

* license header

* fix interface

Co-authored-by: parity-processbot <>

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

* Fix test

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

* Fix multisig benchmarks

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

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

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

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

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: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: parity-processbot <>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
2022-10-05 19:21:37 +01:00
s0me0ne-unkn0wn 24f0c3601c Implement Clone and Default for Config (#12397)
* Implement `Clone` and `Default` for `Config`

* `cargo fmt`

* Remove default config implementation
2022-10-05 15:11:05 +00:00
Pierre Krieger d6f1bb8932 Don't send back empty proofs if light request fails (#12372) 2022-10-05 14:45:56 +00:00
Serban Iorga 6f9ae78d30 MMR: impl TypeInfo for some structures (#12423)
* BEEFY client: avoid unnecessary clone

* MMR: impl TypeInfo for some structures
2022-10-05 17:11:50 +03:00
Alexander Theißen b135a0fae4 Adapt pallet-contracts to WeightV2 (#12421)
* Replace contract access weight by proper PoV component

* Return the whole weight struct from dry-runs

* Fixup `seal_call` and `seal_instantiate`

* Fix duplicate extrinsics

* Remove ContractAccessWeight from runtime

* Fix doc link

* Remove leftover debugging output
2022-10-05 11:10:20 +00:00
Sergej Sakac 8f048cf522 Improved election pallet testing (#12327)
* Improved election pallet testing

* fmt

* remove comment

* more checks

* fixes in logic

* roll_to_signed

* switch to roll_to_signed

* Update frame/election-provider-multi-phase/src/mock.rs

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

* remove useless checks

* remove warning

* add checks to signed.rs

* add some checks to unsigned.rs

* fmt

* use roll_to_signed and roll_to_unsigned

* remove nonsense

* remove even more nonsense

* fix

* fix

* remove useless checks

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: parity-processbot <>
2022-10-04 22:16:07 +00:00
Chevdor 0e388ac5b7 Bump prost to 0.11+ (#12419) 2022-10-04 21:30:45 +02:00
Muharem Ismailov b668e196b4 Use saturating add for alliance::disband witness data (#12418) 2022-10-04 13:15:57 +00:00
Roman Useinov e60e7caebd [Fix] Rename VoterBagsList -> VoterList to match pdot (#12416) 2022-10-04 12:26:14 +00:00
Adrian Catangiu b572116aea client/beefy: small code improvements (#12414)
* client/beefy: remove bounds on type definitions

* client/beefy: remove gossip protocol legacy name

* client/beefy: simplify justification request response engine

Signed-off-by: Adrian Catangiu <adrian@parity.io>
2022-10-04 14:34:54 +03:00
Serban Iorga a35da130ce BEEFY: Simplify hashing for pallet-beefy-mmr (#12393)
* beefy-mmr: reuse sp_runtime::traits::Keccak256

* beefy-mmr: use sp_runtime::traits:Hash for generating merkle proofs

* beefy-mmr: use sp_runtime::traits:Hash for validating merkle proofs

* beefy-mmr: remove primitives::Hasher and primitives::Hash

* fixes

* beefy-mmr: reduce the number of generic parameters for merkle_root()

* fix

* compute upper Vec capacity more accurately
2022-10-04 08:47:13 +00:00
Koute ecc4d5f258 Add @koute to docs/CODEOWNERS and update stale paths (#12408) 2022-10-04 10:01:50 +02:00
Adrian Catangiu 1e2c0f2d99 docs/CODEOWNERS: add @acatangiu as MMR owner (#12406) 2022-10-04 09:58:05 +03:00
Keith Yeung f64fccdd6c Remove unnecessary Clone trait bounds on CountedStorageMap (#12402)
* Remove unnecessary Clone trait bounds on CountedStorageMap

* cargo fmt
2022-10-03 15:50:00 +00:00
Oliver Tale-Yazdi 8596339b49 Fix Weight::is_zero (#12396)
* Fix Weight::is_zero

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

* Add test

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

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-10-03 13:17:59 +00:00
Adrian Catangiu 2a27545afe Beefy on-demand justifications as a custom RequestResponse protocol (#12124)
* client/beefy: create communication module and move gossip there

* client/beefy: move beefy_protocol_name module to communication

* client/beefy: move notification module under communication

* client/beefy: add incoming request_response protocol handler

* client/beefy: keep track of connected peers and their progress

* client/beefy: add logic for generating Justif requests

* client/beefy: cancel outdated on-demand justification requests

* try Andre's suggestion for JustificationEngine

* justif engine add justifs validation

* client/beefy: impl OnDemandJustificationsEngine async next()

* move beefy proto name test

* client/beefy: initialize OnDemandJustificationsEngine

* client/tests: allow for custom req-resp protocols

* client/beefy: on-demand-justif: implement simple peer selection strategy

* client/beefy: fix voter initialization

Fix corner case where voter gets a single burst of finality
notifications just when it starts.

The notification stream was consumed by "wait_for_pallet" logic,
then main loop would subscribe to finality notifications, but by that
time some notifications might've been lost.

Fix this by subscribing the main loop to notifications before waiting
for pallet to become available. Share the same stream with the main loop
so that notifications for blocks before pallet available are ignored,
while _all_ notifications after pallet available are processed.

Add regression test for this.

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

* client/beefy: make sure justif requests are always out for mandatory blocks

* client/beefy: add test for on-demand justifications sync

* client/beefy: tweak main loop event processing order

* client/beefy: run on-demand-justif-handler under same async task as voter

* client/beefy: add test for known-peers

* client/beefy: reorg request-response module

* client/beefy: add issue references for future work todos

* client/beefy: consolidate on-demand-justifications engine state machine

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

* client/beefy: fix for polkadot companion

* client/beefy: implement review suggestions

* cargo fmt and clippy

* fix merge damage

* fix rust-doc

* fix merge damage

* fix merge damage

* client/beefy: add test for justif proto name

Signed-off-by: acatangiu <adrian@parity.io>
2022-10-03 13:00:57 +00:00
Alexander Theißen bb9d2fa75a Remove contracts RPCs (#12358)
* Remove contracts RPCs

* Remove serde as RPC serialization is no longer needed

* Rename folder to match crate name

* Compile fix

* Remove Byte wrapper
2022-10-02 15:16:45 +00:00
Serban Iorga 54713ca17a pallet-mmr: generate historical proofs (#12324)
* BEEFY: generate historical proofs

Signed-off-by: Serban Iorga <serban@parity.io>

* Update frame/merkle-mountain-range/rpc/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update primitives/merkle-mountain-range/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* Update frame/merkle-mountain-range/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* cargo fmt

* fix off-by-one in leaves powerset generation

* test all possible mmr sizes for historical proofs

* remove now redundant simple_historical_proof

* cargo fmt

Signed-off-by: Serban Iorga <serban@parity.io>
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
2022-09-30 12:46:48 +02:00
Michal Kucharczyk 5e00d361cc unsafe_pruning flag removed (#12385) 2022-09-30 12:06:46 +02:00
Keith Yeung af579524ac Carry over where clauses defined in Config to Call and Hook (#12388) 2022-09-30 03:14:13 +00:00
Keith Yeung a4fb1d7096 Properly set the max proof size weight on defaults and tests (#12383)
* Properly set the max proof size weight on defaults and tests

* cargo fmt

* Set proper max proof size for contracts pallet tests

* Properly set max proof size for node

* Properly set max proof size for frame system mock

* Update test expectations

* Update test expectations

* Properly set max proof size for balances mock

* Update test expectations

* Update test expectations

* Properly set max proof size for democracy mock

* Properly set max proof size for scheduler mock

* Properly set max proof size for fast unstake mock

* Properly set max proof size for tx payment mock

* Properly set max proof size for elections phragmen mock

* Properly set max proof size for node template
2022-09-29 15:48:10 +00:00