* 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
* 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>
* 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`
* Don't start evicting peers right after `SyncingEngine` is started
Parachain collators may need to wait to receive a relaychain block before
they can start producing blocks which can cause `SyncingEngine` to
incorrectly evict them.
When `SyncingEngine` is started, wait 2 minutes before the eviction is
activated to give collators a chance to produce a block.
* fix doc
* Use `continue` instead of `break`
* Trigger CI
---------
Co-authored-by: parity-processbot <>
BEEFY consensus can be restarted by resetting "genesisBlock" in
pallet-beefy, but we don't want to also reset authority set IDs so
that they are uniquely identified across the entire chain history
regardless of how many times BEEFY consensus has been reset/restarted.
This is why the client now also accepts initial authority_set_id != 0.
BEEFY client now detects pallet-beefy reset/reinit and errors-out and
asks for a restart.
BEEFY client persisted state should be discarded on client restarts
following pallet-beefy reset/reinit.
End result is BEEFY client/voter can now completely reinitialize using
"new" on-chain info following pallet-beefy reset/reinit, discarding old state.
Fixes#14203Fixes#14204
Signed-off-by: acatangiu <adrian@parity.io>
* HoldReason: Improve usage
`HoldReason` was switched recently to use the `composite_enum` attribute that will merge the enums
from all pallets in the runtime to `RuntimeHoldReason`. `pallet-nis` was still requiring that the
variant was passed as constant to call `hold`. The proper implementation is to use the `HoldReason`
from inside the pallet directly when calling `hold`. This is done by adding a `RuntimeHoldReason` as
type to the `Config` trait and requiring that `Currency` is using the same reason. Besides that the
pr changes the name `HoldIdentifier` in `pallet_balances::Config` to `RuntimeHoldReason`.
* Update frame/nis/src/lib.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Review comment
* Fixes
---------
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* RevertCmd: Expose database params via CLI
This exposes the database params for the `RevertCmd` via CLI. So, users can use `revert` with ParityDb.
* ".git/.scripts/commands/fmt/fmt.sh"
---------
Co-authored-by: command-bot <>
* client/network: upgrade to libp2p 0.51.0
* make discovery.rs compile
* make peer_info.rs compile
* changes to notifications and request-response proto
* make service.rs compile
* towards making request_responses.rs compile
* make request_responses.rs compile
* make request_responses.rs compile
* fix notifications/behaviour.rs tests
* fix warnings
* remove old code
* allow deprecated code (temporary)
* upgrade to libp2p 0.51.1
* add TODO for behaviour tests
* return empty vec if peer_id is absent
https://github.com/paritytech/substrate/pull/13587#discussion_r1141695167
fyi: I don't really know what the old behaviour was.
* update comment to reflect new defaults
Closes#13338
* Revert "update comment to reflect new defaults"
This reverts commit 7a981abd69308e9d522ec94905f181439a1b1dba.
* remove config.rs (from wrong merge)
* upgrade to libp2p 0.51.2
* fix formatting
* use handle_pending_outbound_connection in networt_state RPC
* update deps
* use re-exports when we use other libp2p packages
* Apply suggestions from code review
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
* format code
* handle potential errors in network_state RPC
* only update libp2p crate
* update libp2p-core
* fix docs
* use libp2p-identity instead of libp2p
where it's possible. libp2p-identity is much smaller, hence makes sense
to use it instead of larger libp2p crate.
* Update client/network/src/discovery.rs
Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
* update Cargo.lock
* add comment for per_connection_event_buffer_size
current value is somewhat arbitrary and needs to be tweaked depending on
memory usage and network worker sleep stats.
* fix link format
* update Cargo.lock
* upgrade to libp2p 0.51.3
* deprecate mplex
* Revert "deprecate mplex"
This reverts commit 9e25820e706e464a0e962a8604861fcb2a7641eb.
* Revert "upgrade to libp2p 0.51.3"
This reverts commit 6544dd4138e2f89517bd7c7281fc78a638ec7040.
* use new libp2p version in `statement` crate
* pin version temporarily
* libp2p 0.51.3
* deprecate mplex
* deprecate legacy noise handshake
* fix build error
* update libp2p-identity
* enable libp2p-identity:ed25519 feature in sc-consensus
* enable ed25519 for peerset as well
---------
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Aaro Altonen <48052676+altonen@users.noreply.github.com>
Co-authored-by: parity-processbot <>
* Prepare `sc-network` for `ProtocolController`/`NotificationService`
The upcoming notification protocol refactoring requires that protocols
are able to communicate with `sc-network` over unique and direct links.
This means that `sc-network` side of the link has to be created before
`sc-network` is initialized and that it is allowed to consume the object
as the receiver half of the link may not implement `Clone`.
Remove request-response and notification protocols from `NetworkConfiguration`
and create a new object that contains the configurations of these protocols
and which is consumable by `sc-network`. This is needed needed because, e.g.,
the receiver half of `NotificationService` is not clonable so `sc-network`
must consume it when it's initializing the protocols in `Notifications`.
Similar principe applies to `PeerStore`/`ProtocolController`: as per current
design, protocols are created before the network so `Protocol` cannot be
the one creating the `PeerStore` object. `FullNetworkConfiguration` will be
used to store the objects that `sc-network` will use to communicate with
protocols and it will also allow protocols to allocate handles so they
can directly communicate with `sc-network`.
* Fixes
* Update client/service/src/builder.rs
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
* Updates
* Doc updates + cargo-fmt
---------
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
* Cherry pick all crypto related changes from pull-request #13311
applied to master's head
* Import some stuff just if 'full_crypto' is on
* Remove copyright year
* Cleanup
* First generic BLS draft
* Finalize generic implementation
* Restore tests
* Fix rust docs
* Fix after master merge
* Fix after master merge
* Use double bls with G1 as signature group and verify individual signatures using DLEQ proof.
* Fix inclusions and types used within substrate
* Remove unused cruft
* Restore usage of upstream crates
* Fix test
* Reduce the diff by aligning Cargo.lock to master
* Application-crypto provides bls381
* Implement bls381 for local keystore
* Use new generic keystore features
* import DoublePublickey[Scheme] from the bls-like root to be less confusing.
* fix compilation
* Apply suggestions from code review
Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
* Clean leftovers
* - update bls test vector after applying spec change recommendation.
- send message as ref.
* Different hard junction ids for different bls12 types
* update to new bls-like
* bls-like → w3f-bls
* Make clippy happy
* update test vector after replacing hash and crop with hash to field.
* cargo fmt
* account for #13972
* hide BLS behind "bls_non_production" feature flag
* Remove Cargo.lock entries duplicated in merge
* add bls377 to primitives/keystore and client/keystore
add bls377 to primitives/application-crypto/
add bls_non_production to primitives/keystore and client/keystore
bump up w3f-bls version
* rename feature `bls_non_production` to `bls-experimental`
---------
Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: André Silva <andrerfosilva@gmail.com>
Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
After warp syncing a node it still downloads the block history. If the node is stopped and then
started later while downloading the block history, the node first needs to do a major sync to sync
to the tip of the chain. Before informant was showing `Block history` as sync state, while we
actually were doing a major sync. This pr is fixing this.
* Pin ci-linux image for rust 1.69
* Update ui tests for rust 1.69
* Address new rust 1.69 clippy lints
* `derive_hash_xor_eq` has been renamed to `derived_hash_with_manual_eq`
* The new `extra-unused-type-parameters` complains about a bunch of
callsites where extraneous type parameters are used for consistency
with other functions.
* substrate-test-runtime migrated to pure-frame based
* test block builder: helpers added
* simple renaming
* basic_authorship test adjusted
* block_building storage_proof test adjusted
* babe: tests: should_panic expected added
* babe: tests adjusted
ConsensusLog::NextEpochData is now added by pallet_babe as
pallet_babe::SameAuthoritiesForever trigger is used in runtime config.
* beefy: tests adjusted
test-substrate-runtime is now using frame::executive to finalize the
block. during finalization the digests stored during block execution are
checked against header digests:
https://github.com/paritytech/substrate/blob/91bb2d29ca905599098a5b35eaf24867c4fbd60a/frame/executive/src/lib.rs#L585-L591
It makes impossible to directly manipulate header's digets, w/o
depositing logs into system pallet storage `Digest<T: Config>`.
Instead of this dedicated extrinsic allowing to store logs items
(MmrRoot / AuthoritiesChange) is used.
* grandpa: tests adjusted
test-substrate-runtime is now using frame::executive to finalize the
block. during finalization the digest logs stored during block execution are
checked against header digest logs:
https://github.com/paritytech/substrate/blob/91bb2d29ca905599098a5b35eaf24867c4fbd60a/frame/executive/src/lib.rs#L585-L591
It makes impossible to directly manipulate header's digets, w/o
depositing logs into system pallet storage `Digest<T: Config>`.
Instead of this dedicated extrinsic allowing to store logs items
(ScheduledChange / ForcedChange and DigestItem::Other) is used.
* network:bitswap: test adjusted
The size of unchecked extrinsic was increased. The pattern used in test will
be placed at the end of scale-encoded buffer.
* runtime apis versions adjusted
* storage keys used in runtime adjusted
* wasm vs native tests removed
* rpc tests: adjusted
Transfer transaction processing was slightly improved, test was
adjusted.
* tests: sizes adjusted
Runtime extrinsic size was increased. Size of data read during block
execution was also increased due to usage of new pallets in runtime.
Sizes were adjusted in tests.
* cargo.lock update
cargo update -p substrate-test-runtime -p substrate-test-runtime-client
* warnings fixed
* builders cleanup: includes / std
* extrinsic validation cleanup
* txpool: benches performance fixed
* fmt
* spelling
* Apply suggestions from code review
Co-authored-by: Davide Galassi <davxy@datawok.net>
* Apply code review suggestions
* Apply code review suggestions
* get rid of 1063 const
* renaming: UncheckedExtrinsic -> Extrinsic
* test-utils-runtime: further step to pure-frame
* basic-authorship: tests OK
* CheckSubstrateCall added + tests fixes
* test::Transfer call removed
* priority / propagate / no sudo+root-testing
* fixing warnings + format
* cleanup: build2/nonce + format
* final tests fixes
all tests are passing
* logs/comments removal
* should_not_accept_old_signatures test removed
* make txpool benches work again
* Cargo.lock reset
* format
* sudo hack removed
* txpool benches fix+cleanup
* .gitignore reverted
* rebase fixing + unsigned cleanup
* Cargo.toml/Cargo.lock cleanup
* force-debug feature removed
* mmr tests fixed
* make cargo-clippy happy
* network sync test uses unsigned extrinsic
* cleanup
* ".git/.scripts/commands/fmt/fmt.sh"
* push_storage_change signed call remove
* GenesisConfig cleanup
* fix
* fix
* GenesisConfig simplified
* storage_keys_works: reworked
* storage_keys_works: expected keys in vec
* storage keys list moved to substrate-test-runtime
* substrate-test: some sanity tests + GenesisConfigBuilder rework
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* Apply suggestions from code review
* Review suggestions
* fix
* fix
* beefy: generate_blocks_and_sync block_num sync with actaul value
* Apply suggestions from code review
Co-authored-by: Davide Galassi <davxy@datawok.net>
* Update test-utils/runtime/src/genesismap.rs
Co-authored-by: Davide Galassi <davxy@datawok.net>
* cargo update -p sc-rpc -p sc-transaction-pool
* Review suggestions
* fix
* doc added
* slot_duration adjusted for Babe::slot_duration
* small doc fixes
* array_bytes::hex used instead of hex
* tiny -> medium name fix
* Apply suggestions from code review
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* TransferData::try_from_unchecked_extrinsic -> try_from
* Update Cargo.lock
---------
Co-authored-by: parity-processbot <>
Co-authored-by: Davide Galassi <davxy@datawok.net>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* Allow extra signing data
* Fix tests after renaming
* Rename VrfSecret/VrfVerifier to VrfSecret/VrfPublic
* Further encrapsulation of 'transcript' type to the sr25519 implementation
* Keystore sr25519 pre-output
* Leave additional custom input field hidden in the associated VrfInput type
* Fix test
* More ergonomic output_bytes
* Trigger pipeline
* Define a separated type for vrf signature data
* Fix docs
* Fix doc
* Remove annotation
* Directly use dleq_proove and dleq_verify in sr25519
* Trigger CI
* Remove cruft before merge
* Only calculate tree route when there are multiple leaves
* Update client/service/src/client/client.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
---------
Co-authored-by: Bastian Köcher <git@kchr.de>
* rpc/chain_head: Add backend to subscription management
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Pin blocks internally and adjust testing
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* client/in_mem: Reference for the number of pinned blocks
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/tests: Check in-memory references to pinned blocks
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Remove unused comment
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Place subscription handle under `Arc` and unpin blocks on drop
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/tests: Check all pinned blocks are unpinned on drop
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <git@kchr.de>
* Update client/rpc-spec-v2/src/chain_head/subscription.rs
Co-authored-by: Bastian Köcher <git@kchr.de>
* rpc/tests: Retry fetching the pinned references for CI correctness
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* client/service: Use 512 as maximum number of pinned blocks
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* chain_head: Fix merging conflicts
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Adjust subscriptions to use pinning API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head/tests: Test subscription management
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Adjust chain_head follow to the new API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Adjust chain_head.rs to the new API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head/tests: Adjust test.rs to the new API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* client/builder: Use new chainHead API
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Fix documentation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* rpc/chain_head: Fix clippy
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* client/in_mem: ChainHead no longer uses `in_mem::children`
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update client/rpc-spec-v2/src/chain_head/subscription.rs
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* Update client/rpc-spec-v2/src/chain_head/subscription.rs
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* Update client/rpc-spec-v2/src/chain_head/subscription.rs
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* Update client/rpc-spec-v2/src/chain_head/subscription.rs
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
* chain_head: Add block state machine
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Address feedback
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Use new_native_or_wasm_executor
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* chain_head: Remove 'static on Backend
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* chain_head: Add documentation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* chain_head: Lock blocks before async blocks
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* chain_head_follower: Remove static on backend
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* Update client/service/src/builder.rs
Co-authored-by: Davide Galassi <davxy@datawok.net>
* Update client/service/src/builder.rs
Co-authored-by: Davide Galassi <davxy@datawok.net>
* chain_head: Add BlockHeaderAbsent to the PartialEq impl
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* client: Add better documentation around pinning constants
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* chain_head: Move subscription to dedicated module
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
* subscription: Rename global pin / unpin functions
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
Co-authored-by: Davide Galassi <davxy@datawok.net>