- Mar 13, 2025
-
-
tmpolaczyk authored
Shouldn't matter much, but this is run on every produced block so free performance
-
- Mar 11, 2025
-
-
Alexandru Vasile authored
This PR makes the litep2p backend the default network backend in Kusama. We performed a gradual rollout in Kusama by asking validators to manually switch to litep2p. The rollout went smoothly, with 250 validators running litep2p without issues. This PR represents the next step in testing the backend at scale. Thanks to everyone who contributed to making this happen! A special shoutout to the validators for their prompt support and cooperation
While at it, the litep2p release is bumped to the latest 0.9.2, which downgrades a spamming log to debug. ### CLI Testing Done ``` ### Kusama without network backend specified RUST_LOG=info ./target/release/polkadot --chain kusama --pruning=1000 --in-peers 50 --out-peers 50 --sync=warp --detailed-log-output 2025-03-10 14:24:18.503 INFO main sub-libp2p: Running litep2p network backend ### Kusama with libp2p RUST_LOG=info ./target/release/polkadot --chain kusama --pruning=1000 --in-peers 50 --out... -
Sebastian Kunert authored
**Summary:** This PR enables authoring of multiple blocks in one AURA slot in the slot-based collator and stabilizes the slot-based collator. ## CLI Changes The flag `--experimental-use-slot-based` is now marked as deprecated. I opted to introduce `--authoring slot-based` instead of just removing the `experimental` prefix. By introducing the `authoring` variant, we get some future-proofing in case we want to introduce further options. ## Change Description With elastic-scaling, we are able to author multiple blocks with a single relay-chain parent. In the initial iteration, the interval between two blocks was determined by the `slot_duration` of the parachain. This PR introduces a more flexible model, where we try to author multiple blocks in a single slot if the runtime allows it. The block authoring loop is largely the same. The [`SlotTimer`](https://github.com/paritytech/polkadot-sdk/blob/f1935bd9/cumulus/cli...
-
- Mar 06, 2025
-
-
Andrei Sandu authored
Fixes https://github.com/paritytech/polkadot-sdk/issues/7664 The discussion in https://github.com/paritytech/polkadot-sdk/pull/7710 should provide the context for why this solution was picked. --------- Signed-off-by:
Andrei Sandu <andrei-mihail@parity.io> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
- Feb 27, 2025
-
-
Mrisho Lukamba authored
Closes #7573 @skunert @bkchr --------- Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by:
Sebastian Kunert <skunert49@gmail.com>
-
- Feb 24, 2025
-
-
CrabGopher authored
`sc-cli` brings rocksdb dependency into frame-benchmarking-cli when used with `default-features = false`. This PR makes rocksdb deps optional that sc-cli brings in some of the crates. I think I covered all the crates that depend on sc-cli but please let me know if I missed any. Fixes: https://github.com/paritytech/polkadot-sdk/issues/3793
-
- Feb 14, 2025
-
-
Florian Franzen authored
# Description This PR ensure that only valid syntax is uses inside the `Cargo.toml`. ## Integration Not sure if worth backporting. Came across this when trying to package `try-runtime-cli`. ## Review Notes It should be obvious that this is not valid syntax. I am not able to add labels and doubt this requires a prdoc.
-
- Feb 13, 2025
-
-
s0me0ne-unkn0wn authored
Closes #3270 --------- Co-authored-by: command-bot <>
-
- Feb 07, 2025
-
-
Przemek Rzad authored
- Closes https://github.com/paritytech/license-scanner/issues/44 - Silent because only comments are changed in the crates. ## What's inside First, we change the file traversal mechanism from shell globbing to walking through files which happens inside the `license-scanner` - so it has knowledge about directory structure and can correlate files with corresponding Cargo manifest. Next, added `MIT-0` and `Unlicense` to the allowed list of licenses. `Unlicense` appears only once across {Substrate,Cumulus,Polkadot} - in `penpal-runtime`. Finally, updated headers in files that do not match the corresponding manifest license. --------- Co-authored-by:
cornholio <0@mcornholio.ru>
-
- Feb 03, 2025
-
-
Alin Dima authored
Part of https://github.com/paritytech/polkadot-sdk/issues/5079. Removes all usage of the static async backing params, replacing them with dynamically computed equivalent values (based on the claim queue and scheduling lookahead). Adds a new runtime API for querying the scheduling lookahead value. If not present, falls back to 3 (the default value that is backwards compatible with values we have on production networks for allowed_ancestry_len) Also resolves most of https://github.com/paritytech/polkadot-sdk/issues/4447, removing code that handles async backing not yet being enabled. While doing this, I removed the support for collation protocol version 1 on collators, as it only worked for leaves not supporting async backing (which are none). I also unhooked the legacy v1 statement-distribution (for the same reason as above). That subsystem is basically dead code now, so I had to remove some of its tests as they would no longer pass (since the subsystem no longer sends messages to the legacy variant). I did not remove the entire legacy subsystem yet, as that would pollute this PR too much. We can remove the entire v1 and v2 validation protocols in a follow up PR. In another PR: remove test files with names `prospective_parachains` (it'd pollute this PR if we do now) TODO: - [x] add deprecation warnings - [x] prdoc --------- Co-authored-by:
cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
-
- Jan 28, 2025
-
-
Alin Dima authored
On top of https://github.com/paritytech/polkadot-sdk/pull/6757 Fixes https://github.com/paritytech/polkadot-sdk/issues/6858 by bumping the `PARENT_SEARCH_DEPTH` constant to a larger value (30) and adds a zombienet-sdk test that exercises the 12-core scenario. This is a node-side limit that restricts the number of allowed pending availability candidates when choosing the parent parablock during authoring. This limit is rather redundant, as the parachain runtime already restricts the unincluded segment length to the configured value in the [FixedVelocityConsensusHook](https://github.com/paritytech/polkadot-sdk/blob/88d900af /cumulus/pallets/aura-ext/src/consensus_hook.rs#L35) (which ideally should be equal to this `PARENT_SEARCH_DEPTH`). For 12 cores, a value of 24 should be enough, but I bumped it to 30 to have some extra buffer. There are two other potential ways of fixing this: - remove this constant altogether, as the parachain runtime already makes those guarantees. Chose not to do this, as it can't hurt to have an extra safeguard - set this value to be equal to the uninlcuded segment size. This value however is not exposed to the node-side and would require a new runtime API, which seems overkill for a redundant check. --------- Co-authored-by:
Javier Viola <javier@parity.io>
-
- Jan 26, 2025
-
-
Branislav Kontur authored
Part of: https://github.com/paritytech/polkadot-sdk/issues/6906
-
- Jan 23, 2025
-
-
Andrei Sandu authored
Currently the `para_backing_state` API is used only by the prospective parachains subsystems and returns 2 things: the constraints for parachain blocks and the candidates pending availability. This PR deprecates `para_backing_state` and introduces a new `backing_constraints` API that can be used together with `candidates_pending_availability` to get the same information provided by `para_backing_state`. TODO: - [x] PRDoc --------- Signed-off-by:
Andrei Sandu <andrei-mihail@parity.io> Co-authored-by: command-bot <>
-
- Jan 22, 2025
-
-
Mrisho Lukamba authored
Closes #7055 @skunert @bkchr --------- Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <> Co-authored-by:
Sebastian Kunert <skunert49@gmail.com>
-
- Jan 20, 2025
-
-
Sebastian Kunert authored
Follow-up to #6825, which introduced this bug. We use the `can_build_upon` method to ask the runtime if it is fine to build another block. The runtime checks this based on the [`ConsensusHook`](https://github.com/paritytech/polkadot-sdk/blob/c1b7c302/cumulus/pallets/aura-ext/src/consensus_hook.rs#L110-L110) implementation, the most popular one being the `FixedConsensusHook`. In #6825 I removed a check that would always allow us to build when we are building on an included block. Turns out this check is still required when: 1. The [`UnincludedSegment` ](https://github.com/paritytech/polkadot-sdk/blob/c1b7c302 /cumulus/pallets/parachain-system/src/lib.rs#L758-L758) storage item in pallet-parachain-system is equal or larger than the unincluded segment. 2. We are calling the `can_build_upon` runtime API where the included block has progressed offchain to the current parent block (so last entry in the `UnincludedSegment` storage item). In this scenario the last entry in `UnincludedSegment` does not have a hash assigned yet (because it was not available in `on_finalize` of the previous block). So the unincluded segment will be reported at its maximum length which will forbid building another block. Ideally we would have a more elegant solution than to rely on the node-side here. But for now the check is reintroduced and a test is added to not break it again by accident. --------- Co-authored-by: command-bot <> Co-authored-by:
Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
-
- Jan 14, 2025
-
-
Sebastian Kunert authored
closes #3967 ## Changes We now use relay chain slots to measure velocity on chain. Previously we were storing the current parachain slot. Then in `on_state_proof` of the `ConsensusHook` we were checking how many blocks were athored in the current parachain slot. This works well when the parachain slot time and relay chain slot time is the same. With elastic scaling, we can have parachain slot times lower than that of the relay chain. In these cases we want to measure velocity in relation to the relay chain. This PR adjusts that. ## Migration This PR includes a migration. Storage item `SlotInfo` of pallet `aura-ext` is renamed to `RelaySlotInfo` to better reflect its new content. A migration has been added that just kills the old storage item. `RelaySlotInfo` will be `None` initially but its value will be adjusted after one new relay chain slot arrives. --------- Co-authored-by: command-bot <> Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- Jan 06, 2025
-
-
Sebastian Kunert authored
## Problem In the parachain template we use the [fully verifying import queue ](https://github.com/paritytech/polkadot-sdk/blob/3d9eddbe/cumulus/client/consensus/aura/src/equivocation_import_queue.rs#L224-L224) which does extra equivocation checks. However, when we import a warp synced block with state, we don't set a fork choice, leading to an incomplete block import pipeline and error here: https://github.com/paritytech/polkadot-sdk/blob/3d9eddbe/substrate/client/service/src/client/client.rs#L488-L488 This renders warp sync useless for chains using this import queue. ## Fix The fix is to always import a block with state as best block, as we already do in the normal Aura Verifier. In a follow up we should also take another look into unifying the usage of the different import queues. fixes https://github.com/paritytech/project-mythical/issues/256 --------- Co-authored-by: command-bot <>
-
- Dec 20, 2024
-
-
Xavier Lau authored
It doesn't make sense to only reorder the features array. For example: This makes it hard for me to compare the dependencies and features, especially some crates have a really really long dependencies list. ```toml [dependencies] c = "*" a = "*" b = "*" [features] std = [ "a", "b", "c", ] ``` This makes my life easier. ```toml [dependencies] a = "*" b = "*" c = "*" [features] std = [ "a", "b", "c", ] ``` --------- Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <>
-
- Dec 18, 2024
-
-
Bastian Köcher authored
Move `RelayChainDataFetcher` to its own module and rename it to `RelayChainDataCache`. Also move the `core_selector` function to the `slot_based` module. Related issue: https://github.com/paritytech/polkadot-sdk/issues/6495
-
- Dec 16, 2024
-
-
Sebastian Kunert authored
We check if there is a pending validation code in storage. If there is, add the go-ahead signal in the relay chain storage proof. Not super elegant, but should get the job done for development. --------- Co-authored-by: command-bot <>
-
- Dec 13, 2024
-
-
Bastian Köcher authored
The `SlotBasedBlockImport` job is to collect the storage proofs of all blocks getting imported. These storage proofs alongside the block are being forwarded to the collation task. Right now they are just being thrown away. More logic will follow later. Basically this will be required to include multiple blocks into one `PoV` which will then be done by the collation task. --------- Co-authored-by:
Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Co-authored-by:
GitHub Action <action@github.com>
-
- Dec 03, 2024
-
-
Lulu authored
-
- Nov 24, 2024
-
-
Bastian Köcher authored
Before this was done for every imported transaction. When a lot of transactions got imported, the import notification channel was filled. The underlying problem was that the `status` call is read locking the `validated_pool` which will be write locked by the internal submitting logic. Thus, the submitting and status reading was interferring which each other. --------- Co-authored-by:
GitHub Action <action@github.com>
-
- Nov 21, 2024
-
-
Bastian Köcher authored
Move spawning of the slot-based collator into the `run` function. Also the tasks are being spawned as blocking task and not just as normal tasks. --------- Co-authored-by:
GitHub Action <action@github.com>
-
- Nov 11, 2024
-
-
Nazar Mokrynskyi authored
# Description This seems to be an old artifact of the long closed https://github.com/paritytech/substrate/issues/6827 that I noticed when working on related code earlier. ## Integration `NetworkStarter` was removed, simply remove its usage: ```diff -let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) = +let (network, system_rpc_tx, tx_handler_controller, sync_service) = build_network(BuildNetworkParams { ... -start_network.start_network(); ``` ## Review Notes Changes are trivial, the only reason for this to not be accepted is if it is desired to not start network automatically for whatever reason, in which case the description of network starter needs to change. # Checklist * [x] My PR includes a detailed description as outlined in the "Description" and its two subsections above. * [ ] My PR follows the [labeling requirements]( https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process ) of this project (at minimum one label for `T` required) * External contributors: ask maintainers to put the right label on your PR. --------- Co-authored-by:
GitHub Action <action@github.com> Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- Nov 07, 2024
-
-
Nazar Mokrynskyi authored
# Description This is a continuation of https://github.com/paritytech/polkadot-sdk/pull/5666 that finally fixes https://github.com/paritytech/polkadot-sdk/issues/5333. This should allow developers to create custom syncing strategies or even the whole syncing engine if they so desire. It also moved syncing engine creation and addition of corresponding protocol outside `build_network_advanced` method, which is something Bastian expressed as desired in https://github.com/paritytech/polkadot-sdk/issues/5#issuecomment-1700816458 Here I replaced strategy-specific types and methods in `SyncingStrategy` trait with generic ones. Specifically `SyncingAction` is now used by all strategies instead of strategy-specific types with conversions. `StrategyKey` was an enum with a fixed set of options and now replaced with an opaque type that strategies create privately and send to upper layers as an opaque type. Requests and responses are now handled in a generic way regardl...
-
- Nov 05, 2024
-
-
Nazar Mokrynskyi authored
Remove `sp_runtime::RuntimeString` and replace with `Cow<'static, str>` or `String` depending on use case (#5693) # Description As described in https://github.com/paritytech/polkadot-sdk/issues/4001 `RuntimeVersion` was not encoded consistently using serde. Turned out it was a remnant of old times and no longer actually needed. As such I removed it completely in this PR and replaced with `Cow<'static, str>` for spec/impl names and `String` for error cases. Fixes https://github.com/paritytech/polkadot-sdk/issues/4001. ## Integration For downstream projects the upgrade will primarily consist of following two changes: ```diff #[sp_version::runtime_version] pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("statemine"), - impl_name: create_runtime_str!("statemine"), + spec_name: alloc::borrow::Cow::Borrowed("statemine"), + impl_name: alloc::borrow::Cow::Borrowed("statemine"), ``` ```diff fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig - ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> { + ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> { ``` SCALE encoding/decoding remains the same as before, but serde encoding in runtime has changed from bytes to string (it was like this in `std` environment already), which most projects shouldn't have issues with. I consider the impact of serde encoding here low due to the type only being used in runtime version struct and mostly limited to runtime internals, where serde encoding/decoding of this data structure is quite unlikely (though we did hit exactly this edge-case ourselves
). ## Review Notes Most of the changes are trivial and mechanical, the only non-trivial change is in `substrate/primitives/version/proc-macro/src/decl_runtime_version.rs` where macro call expectation in `sp_version::runtime_version` implementation was replaced with function call expectation. # Checklist * [x] My PR includes a detailed description as outlined in the "Description" and its two subsections above. * [ ] My PR follows the [labeling requirements]( https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process ) of this project (at minimum one label for `T` required) * External contributors: ask maintainers to put the right label on your PR. * [ ] I have made corresponding changes to the documentation (if applicable) --------- Co-authored-by:GitHub Action <action@github.com> Co-authored-by:
Guillaume Thiolliere <guillaume.thiolliere@parity.io> Co-authored-by:
Bastian Köcher <info@kchr.de>
-
Alin Dima authored
Resolves https://github.com/paritytech/polkadot-sdk/issues/6179
-
- Oct 30, 2024
-
-
Sebastian Kunert authored
# Benchmark Overhead Command for Parachains This implements the `benchmark overhead` command for parachains. Full context is available at: https://github.com/paritytech/polkadot-sdk/issues/5303. Previous attempt was this https://github.com/paritytech/polkadot-sdk/pull/5283, but here we have integration into frame-omni-bencher and improved tooling. ## Changes Overview Users are now able to use `frame-omni-bencher` to generate `extrinsic_weight.rs` and `block_weight.rs` files for their runtime. The core logic for generating these remains untouched; this PR provides mostly machinery to make it work for parachains at all. Similar to the pallet benchmarks, we gain the option to benchmark based on just a runtime: ``` frame-omni-bencher v1 benchmark overhead --runtime {{runtime}} ``` or with a spec: ``` frame-omni-bencher v1 benchmark overhead --chain {{spec}} --genesis-builder spec ``` In this case, the genesis state is generated from the runtime presets. However, it is also possible to use `--chain` and genesis builder `spec` to generate the genesis state from the chain spec. Additionally, we use metadata to perform some checks based on the pallets the runtime exposes: - If we see the `ParaInherent` pallet, we assume that we are dealing with a relay chain. This means that we don't need proof recording during import (since there is no storage weight). - If we detect the `ParachainSystem` pallet, we assume that we are dealing with a parachain and take corresponding actions like patching a para id into the genesis state. On the inherent side, I am currently supplying the standard inherents every parachain needs. In the current state, `frame-omni-bencher` supports all system chains. In follow-up PRs, we could add additional inherents to increase compatibility. Since we are building a block during the benchmark, we also need to build an extrinsic. By default, I am leveraging subxt to build the xt dynamically. If a chain is not compatible with the `SubstrateConfig` that comes with `subxt`, it can provide a custom extrinsic builder to benchmarking-cli. This requires either a custom bencher implementation or an integration into the parachains node. Also cumulus-test-runtime has been migrated to provide genesis configs. ## Chain Compatibility The current version here is compatible with the system chains and common substrate chains. The way to go for others would be to customize the frame-omni-bencher by providing a custom extrinsicbuilder. I did an example implementation that works for mythical: https://github.com/skunert/mythical-bencher ## Follow-Ups - After #6040 is finished, we should integrate this here to make the tooling truly useful. In the current form, the state is fairly small and not representative. ## How to Review I recommend starting from [here](https://github.com/paritytech/polkadot-sdk/pull/5891/files#diff-50830ff756b3ac3403b7739d66c9e3a5185dbea550669ca71b28d19c7a2a54ecR264), this method is the main entry point for omni-bencher and `polkadot` binary. TBD: - [x] PRDoc --------- Co-authored-by:
Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
-
- Oct 25, 2024
-
-
Andrei Sandu authored
on top of https://github.com/paritytech/polkadot-sdk/pull/5423 This PR implements the plumbing work required for https://github.com/paritytech/polkadot-sdk/issues/5047 . I also added additional helper methods gated by feature "test" in primitives. TODO: - [x] PRDoc --------- Signed-off-by:
Andrei Sandu <andrei-mihail@parity.io> Co-authored-by:
GitHub Action <action@github.com>
-
- Oct 15, 2024
-
-
Michal Kucharczyk authored
### Fork-Aware Transaction Pool Implementation This PR introduces a fork-aware transaction pool (fatxpool) enhancing transaction management by maintaining the valid state of txpool for different forks. ### High-level overview The high level overview was added to [`sc_transaction_pool::fork_aware_txpool`](https://github.com/paritytech/polkadot-sdk/blob/3ad0a1b7/substrate/client/transaction-pool/src/fork_aware_txpool/mod.rs#L21) module. Use: ``` cargo doc --document-private-items -p sc-transaction-pool --open ``` to build the doc. It should give a good overview and nice entry point into the new pool's mechanics. <details> <summary>Quick overview (documentation excerpt)</summary> #### View For every fork, a view is created. The view is a persisted state of the transaction pool computed and updated at the tip of the fork. The view is built around the existing `ValidatedPool` structure. A view is created on every new best block notification. To create a view, one of the existing views is chosen and cloned. When the chain progresses, the view is kept in the cache (`retracted_views`) to allow building blocks upon intermediary blocks in the fork. The views are deleted on finalization: views lower than the finalized block are removed. The views are updated with the transactions from the mempool—all transactions are sent to the newly created views. A maintain process is also executed for the newly created views—basically resubmitting and pruning transactions from the appropriate tree route. ##### View store View store is the helper structure that acts as a container for all the views. It provides some convenient methods. ##### Submitting transactions Every transaction is submitted to every view at the tips of the forks. Retracted views are not updated. Every transaction also goes into the mempool. ##### Internal mempool Shortly, the main purpose of an internal mempool is to prevent a transaction from being lost. That could happen when a transaction is invalid on one fork and could be valid on another. It also allows the txpool to accept transactions when no blocks have been reported yet. The mempool removes its transactions when they get finalized. Transactions are also periodically verified on every finalized event and removed from the mempool if no longer valid. #### Events Transaction events from multiple views are merged and filtered to avoid duplicated events. `Ready` / `Future` / `Inblock` events are originated in the Views and are de-duplicated and forwarded to external listeners. `Finalized` events are originated in fork-aware-txpool logic. `Invalid` events requires special care and can be originated in both view and fork-aware-txpool logic. #### Light maintain Sometime transaction pool does not have enough time to prepare fully maintained view with all retracted transactions being revalidated. To avoid providing empty ready transaction set to block builder (what would result in empty block) the light maintain was implemented. It simply removes the imported transactions from ready iterator. #### Revalidation Revalidation is performed for every view. The revalidation process is started after a trigger is executed. The revalidation work is terminated just after a new best block / finalized event is notified to the transaction pool. The revalidation result is applied to the newly created view which is built upon the revalidated view. Additionally, parts of the mempool are also revalidated to make sure that no transactions are stuck in the mempool. #### Logs The most important log allowing to understand the state of the txpool is: ``` maintain: txs:(0, 92) views:[2;[(327, 76, 0), (326, 68, 0)]] event:Finalized { hash: 0x8...f, tree_route: [] } took:3.463522ms ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ unwatched txs in mempool ────┘ │ │ │ │ │ │ │ │ │ │ watched txs in mempool ───────┘ │ │ │ │ │ │ │ │ │ views ───────────────┘ │ │ │ │ │ │ │ │ 1st view block # ──────────┘ │ │ │ │ │ │ │ number of ready tx ───────┘ │ │ │ │ │ │ numer of future tx ─────┘ │ │ │ │ │ 2nd view block # ──────┘ │ │ │ │ number of ready tx ──────────┘ │ │ │ number of future tx ───────┘ │ │ event ────────┘ │ duration ──────────────────────────────────────────────────┘ ``` It is logged after the maintenance is done. The `debug` level enables per-transaction logging, allowing to keep track of all transaction-related actions that happened in txpool. </details> ### Integration notes For teams having a custom node, the new txpool needs to be instantiated, typically in `service.rs` file, here is an example: https://github.com/paritytech/polkadot-sdk/blob/9c547ff3 /cumulus/polkadot-omni-node/lib/src/common/spec.rs#L152-L161 To enable new transaction pool the following cli arg shall be specified: `--pool-type=fork-aware`. If it works, there shall be information printed in the log: ``` 2024-09-20 21:28:17.528 INFO main txpool: [Parachain] creating ForkAware txpool. ```` For debugging the following debugs shall be enabled: ``` "-lbasic-authorship=debug", "-ltxpool=debug", ``` *note:* trace for txpool enables per-transaction logging. ### Future work The current implementation seems to be stable, however further improvements are required. Here is the umbrella issue for future work: - https://github.com/paritytech/polkadot-sdk/issues/5472 Partially fixes: #1202 --------- Co-authored-by:
Bastian Köcher <git@kchr.de> Co-authored-by:
Sebastian Kunert <skunert49@gmail.com> Co-authored-by:
Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
-
- Oct 07, 2024
-
-
Alin Dima authored
Runtime side of https://github.com/paritytech/polkadot-sdk/issues/5048 Send the core selector ump signal in cumulus. Guarded by a compile time feature until nodes are upgraded to a version that includes https://github.com/paritytech/polkadot-sdk/pull/5423 for gracefully handling ump signals. --------- Co-authored-by:
GitHub Action <action@github.com>
-
- Oct 04, 2024
-
-
Alexandru Gheorghe authored
Jaeger tracing went mostly unused and it created bigger problems like wasting CPU or memory leaks, so remove it entirely. Fixes: https://github.com/paritytech/polkadot-sdk/issues/4995 --------- Signed-off-by:
Alexandru Gheorghe <alexandru.gheorghe@parity.io>
-
- Sep 26, 2024
-
-
Alexandru Gheorghe authored
This is the implementation of the approach described here: https://github.com/paritytech/polkadot-sdk/issues/1617#issuecomment-2150321612 & https://github.com/paritytech/polkadot-sdk/issues/1617#issuecomment-2154357547 & https://github.com/paritytech/polkadot-sdk/issues/1617#issuecomment-2154721395. ## Description of changes The end goal is to have an architecture where we have single subsystem(`approval-voting-parallel`) and multiple worker types that would full-fill the work that currently is fulfilled by the `approval-distribution` and `approval-voting` subsystems. The main loop of the new subsystem would do just the distribution of work to the workers. The new subsystem will have: - N approval-distribution workers: This would do the work that is currently being done by the approval-distribution subsystem and in addition to that will also perform the crypto-checks that an assignment is valid and that a vote is correctly signed. Work is assigned via the following formula: `worker_index = msg.validator % WORKER_COUNT`, this guarantees that all assignments and approvals from the same validator reach the same worker. - 1 approval-voting worker: This would receive an already valid message and do everything the approval-voting currently does, except the crypto-checking that has been moved already to the approval-distribution worker. On the hot path of processing messages **no** synchronisation and waiting is needed between approval-distribution and approval-voting workers. <img width="1431" alt="Screenshot 2024-06-07 at 11 28 08" src="https://github.com/paritytech/polkadot-sdk/assets/49718502/a196199b-b705-4140-87d4-c6900ba8595e"> ## Guidelines for reading The full implementation is broken in 5 PRs and all of them are self-contained and improve things incrementally even without the parallelisation being implemented/enabled, the reason this approach was taken instead of a big-bang PR, is to make things easier to review and reduced the risk of breaking this critical subsystems. After reading the full description of this PR, the changes should be read in the following order: 1. https://github.com/paritytech/polkadot-sdk/pull/4848, some other micro-optimizations for networks with a high number of validators. This change gives us a speed up by itself without any other changes. 2. https://github.com/paritytech/polkadot-sdk/pull/4845 , this contains only interface changes to decouple the subsystem from the `Context` and be able to run multiple instances of the subsystem on different threads. **No functional changes** 3. https://github.com/paritytech/polkadot-sdk/pull/4928, moving of the crypto checks from approval-voting in approval-distribution, so that the approval-distribution has no reason to wait after approval-voting anymore. This change gives us a speed up by itself without any other changes. 4. https://github.com/paritytech/polkadot-sdk/pull/4846, interface changes to make approval-voting runnable on a separate thread. **No functional changes** 5. This PR, where we instantiate an `approval-voting-parallel` subsystem that runs on different workers the logic currently in `approval-distribution` and `approval-voting`. 6. The next step after this changes get merged and deploy would be to bring all the files from approval-distribution, approval-voting, approval-voting-parallel into a single rust crate, to make it easier to maintain and understand the structure. ## Results Running subsystem-benchmarks with 1000 validators 100 fully ocuppied cores and triggering all assignments and approvals for all tranches #### Approval does not lags behind. Master ``` Chain selection approved after 72500 ms hash=0x0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a ``` With this PoC ``` Chain selection approved after 3500 ms hash=0x0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a ``` #### Gathering enough assignments Enough assignments are gathered in less than 500ms, so that gives un a guarantee that un-necessary work does not get triggered, on master on the same benchmark because the subsystems fall behind on work, that number goes above 32 seconds on master. <img width="2240" alt="Screenshot 2024-06-20 at 15 48 22" src="https://github.com/paritytech/polkadot-sdk/assets/49718502/d2f2b29c-5ff6-44b4-a245-5b37ab8e58bc"> #### Cpu usage: Master ``` CPU usage, seconds total per block approval-distribution 96.9436 9.6944 approval-voting 117.4676 11.7468 test-environment 44.0092 4.4009 ``` With this PoC ``` CPU usage, seconds total per block approval-distribution 0.0014 0.0001 --- unused approval-voting 0.0437 0.0044. --- unused approval-voting-parallel 5.9560 0.5956 approval-voting-parallel-0 22.9073 2.2907 approval-voting-parallel-1 23.0417 2.3042 approval-voting-parallel-2 22.0445 2.2045 approval-voting-parallel-3 22.7234 2.2723 approval-voting-parallel-4 21.9788 2.1979 approval-voting-parallel-5 23.0601 2.3060 approval-voting-parallel-6 22.4805 2.2481 approval-voting-parallel-7 21.8330 2.1833 approval-voting-parallel-db 37.1954 3.7195. --- the approval-voting thread. ``` # Enablement strategy Because just some trivial plumbing is needed in approval-distribution and approval-voting to be able to run things in parallel and because this subsystems plays a critical part in the system this PR proposes that we keep both ways of running the approval work, as separated subsystems and just a single subsystem(`approval-voting-parallel`) which has multiple workers for the distribution work and one worker for the approval-voting work and switch between them with a comandline flag. The benefits for this is twofold. 1. With the same polkadot binary we can easily switch just a few validators to use the parallel approach and gradually make this the default way of running, if now issues arise. 2. In the worst case scenario were it becomes the default way of running things, but we discover there are critical issues with it we have the path to quickly disable it by asking validators to adjust their command line flags. # Next steps - [x] Make sure through various testing we are not missing anything - [x] Polish the implementations to make them production ready - [x] Add Unittest Tests for approval-voting-parallel. - [x] Define and implement the strategy for rolling this change, so that the blast radius is minimal(single validator) in case there are problems with the implementation. - [x] Versi long running tests. - [x] Add relevant metrics. @ordian @eskimor @sandreim @AndreiEres , let me know what you think. --------- Signed-off-by:
Alexandru Gheorghe <alexandru.gheorghe@parity.io>
-
- Sep 23, 2024
-
-
Alin Dima authored
Partially implements https://github.com/paritytech/polkadot-sdk/issues/5048 - adds a core selection runtime API to cumulus and a generic way of configuring it for a parachain - modifies the slot based collator to utilise the claim queue and the generic core selection What's left to be implemented (in a follow-up PR): - add the UMP signal for core selection into the parachain-system pallet View the RFC for more context: https://github.com/polkadot-fellows/RFCs/pull/103 --------- Co-authored-by: command-bot <>
-
- Sep 22, 2024
-
-
Bastian Köcher authored
Use `sp_core::Bytes` as `payload` to encode the values correctly as `hex` string.
-
- Sep 20, 2024
-
-
tmpolaczyk authored
When using the relay chain though a `Arc<dyn RelayChainInterface>` there is no way to call arbitrary runtime apis. Both implementations of that trait allow this, so it feels natural to expose this functionality in the trait. This PR adds a `call_runtime_api` method to RelayChainInterface trait, and a separate function also named `call_runtime_api` which allows the caller to specify the input and output types, as opposed to having to encode them. This generic function cannot be part of the trait because a `dyn Trait` object cannot have generic methods. --------- Co-authored-by:
Bastian Köcher <git@kchr.de>
-
- Sep 19, 2024
-
-
Iulian Barbu authored
# Description When we start a node with connections to external RPC servers (as a minimal node), we lack metrics around how many individual calls we're doing to the remote RPC servers and their duration. This PR adds metrics that measure durations of each RPC call made by the minimal nodes, and implicitly how many calls there are. Closes #5409 Closes #5689 ## Integration Node operators should be able to track minimal node metrics and decide appropriate actions according to how the metrics are interpreted/felt. The added metrics can be observed by curl'ing the prometheus metrics endpoint for the ~relaychain~ parachain (it was changed based on the review). The metrics are represented by ~`polkadot_parachain_relay_chain_rpc_interface`~ `relay_chain_rpc_interface` namespace (I realized lining up `parachain_relay_chain` in the same metric might be confusing :). Excerpt from the curl: ``` relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="0.001"} 15 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="0.004"} 23 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="0.016"} 23 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="0.064"} 23 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="0.256"} 24 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="1.024"} 24 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="4.096"} 24 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="16.384"} 24 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="65.536"} 24 relay_chain_rpc_interface_bucket{method="chain_getBlockHash",chain="rococo_local_testnet",le="+Inf"} 24 relay_chain_rpc_interface_sum{method="chain_getBlockHash",chain="rococo_local_testnet"} 0.11719075 relay_chain_rpc_interface_count{method="chain_getBlockHash",chain="rococo_local_testnet"} 24 ``` ## Review Notes The way we measure durations/hits is based on `HistogramVec` struct which allows us to collect timings for each RPC client method called from the minimal node., It can be extended to measure the RPCs against other dimensions too (status codes, response sizes, etc). The timing measuring is done at the level of the `relay-chain-rpc-interface`, in the `RelayChainRpcClient` struct's method 'request_tracing'. A single entry point for all RPC requests done through the relay-chain-rpc-interface. The requests durations will fall under exponential buckets described by start `0.001`, factor `4` and count `9`. --------- Signed-off-by:
Iulian Barbu <iulian.barbu@parity.io>
-
- Sep 17, 2024
-
-
Nazar Mokrynskyi authored
# Description Follow-up to https://github.com/paritytech/polkadot-sdk/pull/5469 and mostly covering https://github.com/paritytech/polkadot-sdk/issues/5333. The primary change here is that syncing strategy is no longer created inside of syncing engine, instead syncing strategy is an argument of syncing engine, more specifically it is an argument to `build_network` that most downstream users will use. This also extracts addition of request-response protocols outside of network construction, making sure they are physically not present when they don't need to be (imagine syncing strategy that uses none of Substrate's protocols in its implementation for example). This technically allows to completely replace syncing strategy with whatever strategy chain might need. There will be at least one follow-up PR that will simplify `SyncingStrategy` trait and other public interfaces to remove mentions of block/state/warp sync requests, replacing them with generic APIs, such that strategies where warp sync is not applicable don't have to provide dummy method implementations, etc. ## Integration Downstream projects will have to write a bit of boilerplate calling `build_polkadot_syncing_strategy` function to create previously default syncing strategy. ## Review Notes Please review PR through individual commits rather than the final diff, it will be easier that way. The changes are mostly just moving code around one step at a time. # Checklist * [x] My PR includes a detailed description as outlined in the "Description" and its two subsections above. * [x] My PR follows the [labeling requirements]( https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process ) of this project (at minimum one label for `T` required) * External contributors: ask maintainers to put the right label on your PR. * [x] I have made corresponding changes to the documentation (if applicable)
-
- Sep 16, 2024
-
-
Przemek Rzad authored
- This will ensure that a correct product name (Polkadot/Cumulus/Substrate) is referenced in license headers. - Closes https://github.com/paritytech/license-scanner/issues/49
-