Commit Graph

2421 Commits

Author SHA1 Message Date
Alexandru Vasile 1fef5ee4a4 chainHead_storage: Backport queries for value types (#14551)
* chainHead/events: Add storage params and events

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

* chainHead/tests: Check storage events serialization / deserialization

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

* chainHead/error: Add error for invalid WaitForContinue storage call

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

* chainHead/storage: Use new items params

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

* chainHead/tests: Adjust storage tests to the new API

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

* chainHead/events: Generalize StorageQuery by provided key

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

* chain_head: Add dedicated ChainHeadStorage client for queries

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

* chainHead/storage: Implement queries for hashes of values

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

* chainHead/tests: Check storage queries for hashes of values

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

* chainHead: Improve API documentation wrt multiple entries

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

* chainHead/event: Rename StorageQueue ty to queue_ty

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

* chianHead: Add helper to encode chainHead results as hex str

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

* Update client/rpc-spec-v2/src/chain_head/error.rs

Co-authored-by: Sebastian Kunert <skunert49@gmail.com>

* chainHead: Change the `queryResult` to a plain `Result`

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

* chainHead: Stop producing events after the first error

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

* chainHead: Change child_key to child_trie API param

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

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
2023-07-21 19:56:40 +03:00
Dmitry Markin 0b2e7d4df5 Fix crash when --in-peers & --out-peers both 0 (#14598) 2023-07-20 18:19:19 +03:00
Aaro Altonen 6ee66e9895 Improve logging for the request-response protocol (#14596)
Co-authored-by: parity-processbot <>
2023-07-20 10:40:52 +03:00
Kian Paimani 817c97d65d add doc-only substrate entry point crate (#14581)
* add doc-only substrate entry point crate

* document a few more things

* add more

* fix width

* Update primitives/io/src/lib.rs

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

* add link

* update cargo toml file

* fix sp-io docs

* improve

* small update

* add license

* satisfy license job

* add a line about FRAME

* CI happy now

* make CI more happy

* Let the check run for the whole workspace

* Forward the substrate node again as default run

* update binary names

* upate verison test

* Fix fix fix

* Fix

* rename to substrate-node in more places

* Revert "rename to substrate-node in more places"

This reverts commit 66960f84a1b6f1f7c638b4040e28e9fbabb8adf5.

* fix

* Fix build pipeline

* Fix properly plus add some docs

---------

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
2023-07-19 18:36:50 +00:00
Sebastian Kunert b6b1952fc6 Make trie-cache resettable from backend (#14516)
* Add ability to reset trie-cache

* comment

* Update client/db/src/lib.rs

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

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
2023-07-18 17:05:40 +02:00
André Silva 856727bf52 client: fix invalid node name pattern regex (#14593)
* client: fix invalid name pattern regex

* Update client/cli/src/commands/run_cmd.rs

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

* client: test node name is non-empty

* client: add more tests to is_node_name_valid

---------

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2023-07-18 05:56:40 +00:00
Arkadiy Paronyan d6d9bd9ea3 Encryption support for the statement store (#14440)
* Added ECIES encryption

* tweaks

* fmt

* Make clippy happy

* Use local keystore

* qed
2023-07-17 18:41:41 +00:00
André Silva c761d4c39e grandpa: avoid importing unnecessary justifications (#14423)
* grandpa: avoid importing unnecessary justifications

* grandpa: make justification_import_period configurable

* grandpa: keep the first justification

* grandpa: add test for justification import period

* grandpa: fix test
2023-07-17 17:38:34 +00:00
Vsevolod Stakhov 242e31ec2d Remove redundant sync primitives for metrics (#14564)
* Remove redundant locks

* Re-enable warning for a sender when a queue got processed

* Apply suggestions from code review

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

* Use debug for subsequent logging

* Update client/network/src/service/out_events.rs

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

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: parity-processbot <>
2023-07-14 10:47:38 +00:00
Aten Jin d908e9bebe do not filter word www in is_node_name_valid check (#14575) 2023-07-14 12:07:07 +02:00
Juan 6a29a70a92 Replace system config Index for Nonce (#14290)
* replace Index by Nonce

* replace Index by Nonce

* replace Index by Nonce

* replace Index by Nonce

* replace Index by Nonce

* wip

* remove index in lieu of nonce

* wip

* remove accountnonce in lieu of nonce

* add minor improvement

* rebase and merge conflicts
2023-07-14 06:56:48 +00:00
Francisco Gamundi 0fbeb31d50 WasmExecutor flag to ignore onchain heappages value (#14508)
* WasmExecutor flag to ignore onchain heappages value

* fmt
2023-07-14 06:14:14 +00:00
Bastian Köcher 5eb816d7a6 Removal of execution strategies (#14387)
* Start

* More work!

* Moar

* More changes

* More fixes

* More worrk

* More fixes

* More fixes to make it compile

* Adds `NoOffchainStorage`

* Pass the extensions

* Small basti making small progress

* Fix merge errors and remove `ExecutionContext`

* Move registration of `ReadRuntimeVersionExt` to `ExecutionExtension`

Instead of registering `ReadRuntimeVersionExt` in `sp-state-machine` it is moved to
`ExecutionExtension` which provides the default extensions.

* Fix compilation

* Register the global extensions inside runtime api instance

* Fixes

* Fix `generate_initial_session_keys` by passing the keystore extension

* Fix the grandpa tests

* Fix more tests

* Fix more tests

* Don't set any heap pages if there isn't an override

* Fix small fallout

* FMT

* Fix tests

* More tests

* Offchain worker custom extensions

* More fixes

* Make offchain tx pool creation reusable

Introduces an `OffchainTransactionPoolFactory` for creating offchain transactions pools that can be
registered in the runtime externalities context. This factory will be required for a later pr to
make the creation of offchain transaction pools easier.

* Fixes

* Fixes

* Set offchain transaction pool in BABE before using it in the runtime

* Add the `offchain_tx_pool` to Grandpa as well

* Fix the nodes

* Print some error when using the old warnings

* Fix merge issues

* Fix compilation

* Rename `babe_link`

* Rename to `offchain_tx_pool_factory`

* Cleanup

* FMT

* Fix benchmark name

* Fix `try-runtime`

* Remove `--execution` CLI args

* Make clippy happy

* Forward bls functions

* Fix docs

* Update UI tests

* Update client/api/src/execution_extensions.rs

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

* Apply suggestions from code review

Co-authored-by: Koute <koute@users.noreply.github.com>

* Update client/cli/src/params/import_params.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Update client/api/src/execution_extensions.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Pass the offchain storage to the MMR RPC

* Update client/api/src/execution_extensions.rs

Co-authored-by: Sebastian Kunert <skunert49@gmail.com>

* Review comments

* Fixes

---------

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
2023-07-11 14:21:38 +00:00
Qinxuan Chen 6d2c1ed719 replace lru with schnellru (#14539) 2023-07-09 23:24:23 +02:00
Qinxuan Chen e8e2048b88 chore: update some deps to prune duplicated deps (#14515)
* chore: update some deps to prune duplicated deps

- array-bytes: 4.1.0 => 6.1.0
- cid: 0.8.6 => 0.9.0

* fix
2023-07-06 16:46:44 +02:00
Bastian Köcher 1bf2504ebf sc-cli: Remove SubstrateCli::native_runtime_version function (#14511)
The native runtime will be removed in the near future and thus this function will not be required
anymore.

\# Code changes

Downstream users just need to remove `native_runtime_version` from their implementation of the
`SubstrateCli` trait.
2023-07-05 07:38:06 +00:00
Bastian Köcher d124c90734 sc-tracing: Only print events for whitelisted targets (#14487)
* sc-tracing: Only print events for whitelisted targets

We should only print events for whitelisted targets, otherwise we may run into some stack overflow
while printing the event.

* Update client/tracing/src/lib.rs

Co-authored-by: Koute <koute@users.noreply.github.com>

* Fix

---------

Co-authored-by: Koute <koute@users.noreply.github.com>
2023-07-03 09:47:42 +00:00
Bastian Köcher 83caca85b6 frame-benchmarking-cli: Remove native dispatch requirement (#14474)
* frame-benchmarking-cli: Remove native dispatch requirement

No need for this, we can just use the `WasmExecutor` directly.

* Fixes

* Pass benchmarking host functions

* Ensure we can pass custom host functions
2023-06-29 17:56:25 +02:00
Aaro Altonen 0e58bd91b6 Inject FromSwarm::NewListenAddr to mDNS (#14478) 2023-06-29 17:28:32 +02:00
Nazar Mokrynskyi ff7e8b6b17 Unify SyncMode data structures under one (#14465) 2023-06-29 17:25:41 +02:00
Bastian Köcher b4e863c472 sc-network: Improve invalid boot node reporting (#14455)
This improves the reporting of invalid boot nodes. First, it will only report each boot node once
as invalid and not every time we try to connect to the node. Second, the node will only report for
addresses that we added as startup and not for addresses of the boot node that the node learned from
other nodes.

Closes: https://github.com/paritytech/substrate/issues/13584
Closes: https://github.com/paritytech/polkadot/issues/7385
2023-06-28 13:21:05 +02:00
Sebastian Kunert ede49c7ae6 Remove unused dependencies (#14464) 2023-06-27 13:33:42 +00:00
Davide Galassi 13cb7ccc57 Added missing BLS feature (#14461) 2023-06-26 19:10:16 +02:00
Squirrel 0750b03300 once_cell in std from 1.70 (#14402)
* once_cell now stable

* cargo fmt

---------

Co-authored-by: parity-processbot <>
2023-06-24 06:45:28 +00:00
Dmitry Markin 7d4fd6a442 [minor] Extend logging with SetId in ProtocolController where missing (#14433) 2023-06-22 15:23:21 +03:00
klbrvik 1d2f16ab1f expose setting kademlia replication factor through node CLI (#14391)
* expose kademlia replication factor through node CLI

* set default CLI flag value for kademlia_replication_factor

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

* wrap CLI value as Option

* make kademlia replication factor non-optional

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
2023-06-22 00:21:54 +02:00
Koute 9d1741eb3c Bump parity-scale-codec to 3.6.1 (#14428) 2023-06-21 11:37:11 +00:00
Oliver Tale-Yazdi 05592a84eb Refactor BlockBuilder::propose_with (#14405)
* Add log target

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

* Factor out apply_inherents

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

* Factor out apply_extrinsics

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

* Factor out print_summary

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

* Pimp print_summary

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

* Cleanup

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

* Fixes

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

* Update client/basic-authorship/src/basic_authorship.rs

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

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
2023-06-19 10:12:43 +00:00
Dmitry Markin 4652eaeef8 [network] Extend Notifications logs with SetId where missing (#14406)
* Extend `Notifications` logs with `SetId` where missing

* Downgrade "Ignoring request to disconnect reserved peer"

* minor: log formatting
2023-06-16 17:01:26 +00:00
Adrian Catangiu 4311411133 sc-consensus-beefy: fix flaky test beefy_reports_equivocations (#14382)
Test was using too small a timeout of 250ms to verify equivocation is reported.

If the test machine is loaded with many async tasks running, the voters work
and subsequent gossiping does not fit within the 250ms window.

Do multiple tries to verify equivocation reporting with exponential timeouts,
most times it will be within 250ms, but the test will retry several times up
to 5seconds total before giving up.

Signed-off-by: Adrian Catangiu <adrian@parity.io>
2023-06-16 10:00:11 +03:00
Anton 6cd2c8b395 [frame/im-online] remove network state from heartbeats (#14251)
* [frame/im-online] remove `external_addresses` from heartbeats

Users should use DHT for discovering new nodes. The reason for adding external addresses was
unstable work of authority discovery (see https://github.com/paritytech/substrate/issues/2719),
which is now stable. Hence we can safely remove `external_addresses`.

Refs https://github.com/paritytech/polkadot/issues/7181

* remove unused import

* run benchmark

* remove external_addresses from offchain NetworkState

* add missing fn to TestNetwork

* Revert "run benchmark"

This reverts commit a282042c2d6bf8bae2c383f6e2699c3fe2970a3d.

* update weights

* address @bkchr comments

* remove duplicate fn

* cleanup benchmarking.rs

* fix executor tests

* remove peer_id from hearbeat as well

https://github.com/paritytech/substrate/pull/14251#discussion_r1210887220

* remove MaxPeerDataEncodingSize

* change storage value type to `()`

https://github.com/paritytech/substrate/pull/14251#discussion_r1214268931

* scaffold storage migration

* no need to check the type actually

* remove unnecessary types from v0 mod

* add a test for migration

* expose Config types

+ pre_upgrade and post_upgrade working fn

* fix test

* replace dummy type with ConstU32

* add some comments to migration test

* fix comment

* respond to @bkchr comments

* use BoundedOpaqueNetworkState::default

intead of using default for each field
2023-06-15 09:42:36 +00:00
Bastian Köcher 1eb3b31ad0 sc-executor-wasmtime: Do not use absolute path to Cargo.toml in test (#14370)
* sc-executor-wasmtime: Do not use absolute path to `Cargo.toml` in test

As the test is executed inside the workspace, `cargo metadata` will automatically detect the correct
`Cargo.toml`. This is required for the mono repo.

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

---------

Co-authored-by: command-bot <>
2023-06-13 21:14:53 +02:00
dependabot[bot] 11cf3e0b10 Bump hyper-rustls from 0.23.2 to 0.24.0 (#14233)
Bumps [hyper-rustls](https://github.com/ctz/hyper-rustls) from 0.23.2 to 0.24.0.
- [Commits](https://github.com/ctz/hyper-rustls/compare/v/0.23.2...v/0.24.0)

---
updated-dependencies:
- dependency-name: hyper-rustls
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: parity-processbot <>
2023-06-13 13:27:47 +00:00
Squirrel cadc92b893 fix new warning in nightly (#14334)
* fix new warning

* Too soon

* Explicitly import
2023-06-13 09:36:54 +02:00
Arkadiy Paronyan 881fd1e0dc Fix RPC error code conflict (#14315)
* Base error code module

* Base error code module

* fmt
2023-06-09 18:24:49 +02:00
yjh ddb46a8aa0 refactor: define trait HashOutput for some Hash associate type (#14220)
* define trait `HashOutput`

* improve

* improve

* Update primitives/runtime/src/traits.rs

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

* remove `Block::Hash: Ord`

* fmt

* add `MaybeFromStr`

* cleanup

* fix

* remove useless `HashOutput`

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
2023-06-08 02:02:13 +00:00
Davide Galassi b14238cb7d Finalized should be before best (#14308)
* Finalized block should not be after best block

* Remove unwrap

* Apply code review suggestion

Co-authored-by: Koute <koute@users.noreply.github.com>

* Add test

---------

Co-authored-by: Koute <koute@users.noreply.github.com>
2023-06-07 11:17:45 +02:00
Bastian Köcher 51c87d8525 sc-transaction-pool: Always use best block to check if we should skip enactment (#14285)
We will calculate the tree route always against the best block and thus, we also should use this one
to check if we should skip the checks.
2023-06-02 19:37:35 +01:00
Dmitry Markin 186423b695 Reduce logging verbosity when disconnecting an unknown peer (#14274) 2023-06-01 12:53:52 +03:00
dependabot[bot] 688ac3d1c7 Bump serde from 1.0.162 to 1.0.163 (#14271)
* Bump serde from 1.0.162 to 1.0.163

Bumps [serde](https://github.com/serde-rs/serde) from 1.0.162 to 1.0.163.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.162...v1.0.163)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* bump ci

* bump ci for cumulus

* bump ci again

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sam Johnson <sam@durosoft.com>
2023-05-31 17:10:00 +00:00
Liu-Cheng Xu 968795db28 Expose build_system_rpc_future and TransactionPoolAdapator in sc-service (#14238)
* Make block sync service customizable

This change allows user to have their own network block logic, for example, we'd like to disable
the builtin block sync service when using another syncing approach.

* Remove unnecessary Box

* Revert network_block

* Expose build_system_rpc_future() and TransactionPoolAdaptor

* fmt
2023-05-31 15:27:06 +01:00
Alexandru Vasile 3da9449067 Bump sp-crates from latest crates.io version + release (#14265)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-05-31 12:11:01 +00:00
Bastian Köcher 00e5ecdcf7 Make offchain tx pool creation reusable (#14230)
* Make offchain tx pool creation reusable

Introduces an `OffchainTransactionPoolFactory` for creating offchain transactions pools that can be
registered in the runtime externalities context. This factory will be required for a later pr to
make the creation of offchain transaction pools easier.

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

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

---------

Co-authored-by: Anton <anton.kalyaev@gmail.com>
2023-05-31 01:12:53 +00:00
dependabot[bot] a8edaf47d5 Bump quote from 1.0.27 to 1.0.28 (#14253)
* Bump quote from 1.0.27 to 1.0.28

Bumps [quote](https://github.com/dtolnay/quote) from 1.0.27 to 1.0.28.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.27...1.0.28)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* bump ci

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sam Johnson <sam@durosoft.com>
2023-05-29 18:13:48 +00:00
Dmitry Markin d4b2bf7394 Incorporate sc-peerset into sc-network (#14236) 2023-05-29 20:56:57 +03:00
Alexandru Vasile 98a0550ea2 Release: Bump SP crates to release on crates.io (#14237)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-05-29 10:40:59 +00:00
Dmitry Markin ee3f2e1ebd minor: fix misleading comment in Notifications (#14239) 2023-05-29 13:16:49 +03:00
Bastian Köcher 6947b334b4 wasm-builder: Enforce runtime_version wasm section (#14228)
* wasm-builder: Enforce `runtime_version` wasm section

This pr changes the `wasm-builder` to enforce the `runtime_version` wasm section. This wasm section
is being created by the `sp_version::runtime_version` attribute macro. This attribute macro now
exists since quite some time and `runtime_version` also is the only way for parachains to support
reading the `RuntimeVersion` from the runtime.

\# Disabling the check

By default the `WasmBuilder` will now check for this wasm section and if not found, exit with an
error. However, there are situations where you may want to disable this check (like for tests). In
this case there exists the `disable_runtime_version_section_check` function.

```
WasmBuilder::new()
   ...
   ...
   ...
   .disable_runtime_version_section_check()
   .build()
```

By using this method you get back the old behavior.

* Review comment

* Fix

* Fix issue with `enum-as-inner`
2023-05-28 23:52:10 +00:00
dependabot[bot] 5402212358 Bump lru from 0.8.1 to 0.10.0 (#14211)
Bumps [lru](https://github.com/jeromefroe/lru-rs) from 0.8.1 to 0.10.0.
- [Changelog](https://github.com/jeromefroe/lru-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jeromefroe/lru-rs/compare/0.8.1...0.10.0)

---
updated-dependencies:
- dependency-name: lru
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-28 13:17:10 +00:00
Alexandru Vasile ed499bdec1 chain_head: Rename runtimeUpdates flag to withRuntime (#14244)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
2023-05-27 22:13:00 +02:00