* Convert `NetworkWorker::poll()` into async `next_action()`
* Use `NetworkWorker::next_action` instead of `poll` in `sc-network-test`
* Revert "Use `NetworkWorker::next_action` instead of `poll` in `sc-network-test`"
This reverts commit 4b5d851ec864f78f9d083a18a618fbe117c896d2.
* Fix `sc-network-test` to poll `NetworkWorker::next_action`
* Fix `sc_network::service` tests to poll `NetworkWorker::next_action`
* Fix docs
* kick CI
* Factor out `next_worker_message()` & `next_swarm_event()`
* Error handling: replace `futures::pending!()` with `expect()`
* Simplify stream polling in `select!`
* Replace `NetworkWorker::next_action()` with `run()`
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* minor: comment
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* Print debug log when network future is shut down
* Evaluate `NetworkWorker::run()` future once before the loop
* Fix client code to match new `NetworkService` interfaces
* Make clippy happy
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* Revert "Apply suggestions from code review"
This reverts commit 9fa646d0ed613e5f8623d3d37d1d59ec0a535850.
* Make `NetworkWorker::run()` consume `self`
* Terminate system RPC future if RPC rx stream has terminated.
* Rewrite with let-else
* Fix comments
* Get `best_seen_block` and call `on_block_finalized` via `ChainSync` instead of `NetworkService`
* rustfmt
* make clippy happy
* Tests: schedule wake if `next_action()` returned true
* minor: comment
* minor: fix `NetworkWorker` rustdoc
* minor: amend the rustdoc
* Fix bug that caused `on_demand_beefy_justification_sync` test to hang
* rustfmt
* Apply review suggestions
---------
Co-authored-by: Bastian Köcher <git@kchr.de>
* state-db: Print warning when using large pruning window on RocksDb
This pr changes state-db to print a warning when using a large pruning window and running with a
database that isn't supporting ref-counting like RocksDb. This makes the user aware of potential out
of memory errors because this option together with RocksDb etc puts the entire pruning window into
memory. Besides that the pr introduces `LOG_TARGET` for having the target declared central!
* Review comments
* BlockId removal: Client::runtime_version_at
It changes the arguments of `Client::runtime_version_at` from: `BlockId<Block>` to: `Block::Hash`
* Apply suggestions from code review
Co-authored-by: Anton <anton.kalyaev@gmail.com>
---------
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: parity-processbot <>
* Avoid reading contract code when it is supplied in the extrinsic
* Remove custom proof size injection from schedule
* Set benchmarks pov_mode to Measure
* Reduce overestimation of code size on re-instrument
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Do not override proof size from benchmark
* Do not charge proof size for basic block
* Incrase gas limit for tests
* Fix deletion queue to also use `proof_size`
* Fix tests
* Update frame/contracts/src/schedule.rs
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
* Fix wrong schedule macro invocations
* Remove stale docs
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Handle zero components
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Fix instruction weight
---------
Co-authored-by: command-bot <>
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
* Removed assumptions about ancestry from fork tree prune method
* Tests improvement
* Fork tree prune refactory
* Code refactory
* Correctly handle borderline, but legit, case
* Apply suggestions from code review
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Removed duplicated test
---------
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* 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>
* 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>
* 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
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>
* 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
* 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>
* [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>
* 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
* 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>
* 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 <>
* 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
* 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>