Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Future Impl] Wiki Reorg: Sharding and Asynchronous Backing #4871

Merged
merged 70 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
7dc3dd8
added async backing
CrackTheCode016 Jun 2, 2023
4f02a8e
remove async backing, add mermaid js diagram
CrackTheCode016 Jun 8, 2023
0356901
depds
CrackTheCode016 Jun 10, 2023
c926439
remove diagram
CrackTheCode016 Jul 3, 2023
a238830
removed mermaid locally
CrackTheCode016 Jul 3, 2023
24f2b58
Merge branch 'master' into async-backing-future-impl
CrackTheCode016 Jul 3, 2023
044f912
lock delete
CrackTheCode016 Jul 3, 2023
4ddc428
actual diagram
CrackTheCode016 Jul 4, 2023
ff823b0
grammar
CrackTheCode016 Jul 4, 2023
569608e
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 4, 2023
f2365d1
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 4, 2023
de26c1e
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 4, 2023
c4e9442
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 4, 2023
1eadeed
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 4, 2023
1ed41de
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 4, 2023
569ac8b
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 4, 2023
1ece721
start refactor
CrackTheCode016 Jul 5, 2023
577f888
fix diagram + clarify
CrackTheCode016 Jul 5, 2023
cf2bae7
add more
CrackTheCode016 Jul 5, 2023
bf7d39e
slight change
CrackTheCode016 Jul 5, 2023
9571c25
Filippo edits
filippoweb3 Jul 6, 2023
fb1c578
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 6, 2023
74471fb
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 6, 2023
fe5a5c9
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 6, 2023
afe3fed
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 6, 2023
2ecf221
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 6, 2023
cf987cf
clarify diagram + remove dank compare
CrackTheCode016 Jul 6, 2023
5878d3f
block-labels
CrackTheCode016 Jul 6, 2023
403f891
link fix
CrackTheCode016 Jul 11, 2023
3be5fff
refactor / clarify
CrackTheCode016 Jul 11, 2023
494001c
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
8e9a7c3
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
9a0c984
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
5f74586
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
d8039a0
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
cc5cbc8
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
159643c
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
475a168
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
a2dde8e
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
2faab35
Update docs/learn/learn-async-backing.md
CrackTheCode016 Jul 31, 2023
621db85
initial round applied
CrackTheCode016 Aug 1, 2023
b1da52a
minor grammar / tweaks
CrackTheCode016 Aug 1, 2023
89624fb
slight polish
CrackTheCode016 Aug 3, 2023
50a2e26
merge master
CrackTheCode016 Aug 30, 2023
16b587f
sync with master
CrackTheCode016 Aug 30, 2023
dece9b1
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
740358c
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
8983d01
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
b72ce58
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
e3ff31e
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
4a23802
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
a2aa2dc
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
669ca60
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
166d35f
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
aa6db66
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
897b1ab
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
82b86c9
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
9136cbd
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
a1f139d
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
213c1c0
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
0a2cba3
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
76a3d42
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
b3eb54f
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
1984755
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
e70115b
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
5187eeb
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
98754a0
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 5, 2023
9e3e96f
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 8, 2023
4ca506b
Update docs/learn/learn-async-backing.md
CrackTheCode016 Sep 8, 2023
44523a1
clarified small nit
CrackTheCode016 Sep 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/build/build-integrate-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ Here are the available public instances:
and
- [Sidecar connected to Kusama Asset Hub](https://kusama-asset-hub-public-sidecar.parity-chains.parity.io)

The purpose of these instances is to allow anyone to check and get a quick
overview of the info that the asset-related endpoints provide.
The purpose of these instances is to allow anyone to check and get a quick overview of the info that
the asset-related endpoints provide.

:::caution

Expand Down
3 changes: 2 additions & 1 deletion docs/build/build-tools-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ Please see the [Wallets](./wallets) page.
- [Panic](https://github.com/SimplyVC/panic) - A node monitoring and alert server for validators.
- [OpenWeb3/Guardian](https://github.com/open-web3-stack/guardian) - A CLI tool and JS library to
monitor on chain states and events.
- [Ocelloids SDK](https://github.com/sodazone/ocelloids) - Typescript SDK for multi-chain monitoring that supports domain-specific logic for different pallets.
- [Ocelloids SDK](https://github.com/sodazone/ocelloids) - Typescript SDK for multi-chain monitoring
that supports domain-specific logic for different pallets.

## Clients

Expand Down
4 changes: 2 additions & 2 deletions docs/general/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ There are a few basic ground-rules for contributors:
8. Care should be taken to remain as objective and informative as possible. There should be no
editorializing, and external bias should not be present.
9. We use a plugin called Prettier to standardize the style across documents. You can run this on
your local copy with `npx lint-staged`, but for simplicity we also have a bot which
runs this for us in your PRs.
your local copy with `npx lint-staged`, but for simplicity we also have a bot which runs this for
us in your PRs.

## Heritage

Expand Down
2 changes: 1 addition & 1 deletion docs/general/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ use TPS as a measure for the network performance if all the transactions carry t
[Performance benchmark tests](https://twitter.com/gavofyork/status/1270025498580656134) show that
Substrate-based blockchains can achieve over 1000 TPS for balance transfer transactions. Assuming
Polkadot is running over 100 parachains; the projected TPS is well over 100,000. With
[asynchronous backing upgrade](../learn/learn-async-backing), the TPS is expected to increase
[asynchronous backing upgrade](../learn/learn-async-backing.md), the TPS is expected to increase
tenfold to 1,000,000.

It is essential to realize that TPS is inherently a subjective measurement with numerous factors
Expand Down
114 changes: 114 additions & 0 deletions docs/learn/learn-async-backing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
id: learn-async
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
title: Asynchronous Backing
sidebar_label: Asynchronous Backing
description: A brief overview of asynchronous backing, and how it affects Polkadot's scalability.
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
keywords: [parachains, slots, backing, parablock]
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
slug: ../learn-async
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
---

Asynchronous backing is a feature that introduces
[pipelining](https://www.techtarget.com/whatis/definition/pipelining) to the parachain block
generation and validation process. It is analogous to the logical pipelining of processor
instruction in "traditional" architectures, where some instructions may be executed before others
are complete. Instructions may also be executed in parallel, enabling multiple parts of the
processor to be working on potentially different instructions at the same time.

Bundles of state transitions represented as blocks may be processed similarly. In the context of
Polkadot, it aims to increase the throughput of the entire network.

:::info

In order to realize which exact processes this upgrade improves, it is recommended to be familiar
with the stages of parablock validation, which you may [read here](./learn-parachains-protocol.md).

:::

Asynchronous backing enables logical pipelining over the parablock
[**generation**](https://wiki.polkadot.network/docs/learn-parachains-protocol#collators),
[**backing**](https://wiki.polkadot.network/docs/learn-parachains-protocol#parachain-phase), and
[**inclusion**](https://wiki.polkadot.network/docs/learn-parachains-protocol#inclusion-pipeline)
processes. A parablock may be at different stages, but multiple blocks should be able to process them
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
simultaneously (in parallel) if needed. Most notably, parablock N + 1 can be generated and backed while its predecessor, parablock N, is undergoing inclusion on the relay chain.
Processes can occur while their ancestors are included on the relay chain.

This pipeline will allow [collators](./learn-parachains-protocol.md#collators) to include an
estimated ~3-5x more transactions/data while speeding up parachain block times from 12 to 6 seconds.
In short, Polkadot with asynchronous backing will deliver an estimated ~6-10x more blockspace to its parachains.

Asynchronous Backing has three overarching goals:

1. Decrease parachain block (parablock) validation time to **6 seconds** from **12 seconds**
2. Increase the amount of usable blockspace, allowing more state changes per
relay chain block.
3. Allow for parablocks to be re-proposed to the network if they are not included successfully on the
first attempt.

Asynchronous backing provides a form of **contextual execution**, which allows for more time for
parachain collators to fit more transactions and prepare block candidates for backing and inclusion.
**Contextual execution** refers to how a parablock can be built earlier using the context
provided by an _unincluded segment_ of recent block ancestors.

**Unincluded segments** are chains of candidate blocks that are not yet included in the relay chain.
Parablocks can be added to this unincluded segment without waiting for the latest
included parent block of the relay chain. The core functionality that asynchronous backing brings is
the ability to build on these unincluded segments of block ancestors rather than ancestors included in the relay
chain state.

Currently, parablocks rely on the most recent relay chain block (often referred to as the **parent**
block, as the parablock anchors itself to it). Each parablock must be generated and go through the
entire backing process in a single relay block. It then proceeds to the availability + inclusion
process during the next block.

:::info

It is important to note the following clarifications:

1. The parablock is not placed on the relay chain in its entirety, but rather the **paraheader**
2. The relay chain does not access the entire state of a parachain but only the values that changed during that block and the merkelized hashes of the unchanged values.

:::

For more information on the validity and availability process, be sure to visit the
[parachain protocol](../learn/learn-parachains-protocol.md) page.

## Synchronous Backing on Polkadot

With synchronous backing, there was only about a single relay chain block (6-second window), to
complete the parablock candidate generation and backing process. This was tightly coupled to the
relay chain's progress, where blocks had to be created within this window.

The main limitation of synchronous backing is that parablock validation is tightly coupled to the
relay chain's progression on a 1-1 basis, meaning every parablock must be generated and backed
within six seconds. This time limit reduces the amount of data a collator has time to add to each
block.

A particular parablock, `P1`, would **only** be valid for backing at relay chain parent `R1 + 1` and
subsequently, be included at `R1 + 2` should it be backed successfully. Essentially, a parablock is
rushing to be backed and included within this two-block window due to the inherent requirement for synchrony between
the parachain and relay chain.

## Asynchronous Backing on Polkadot

With asynchronous backing, the window of time is customizable and will most likely sit around the
6-18 second range. It also introduces a parameter to aid in defining the maximum amount of ancestor
blocks, which allows for a parablock to be backed later in the future, enabling more computational
and storage time per block. The context for the latest parablock is derived from the unincluded
segment of block ancestors upon which the newest parablock is built.

These blocks can be prepared in anticipation of being included later rather than keeping in sync
with the relay chain's progress 1-1. The block can be in a different stage from another block being
built, as long as it abides by the parameters set forth by the asynchronous backing configuration.

This combination of lower latency, higher storage per block, and a logical pipeline spanning
Polkadot's networking, runtime, and collation aspects will allow for higher, more robust throughput.

## Learn More

This topic is evolving and being implemented at the moment, keep up to date using the following
CrackTheCode016 marked this conversation as resolved.
Show resolved Hide resolved
resources:

- [Polkadot Roadmap Roundup](https://polkadot.network/blog/polkadot-roadmap-roundup) - Article by
Rob Habermeier, Polkadot founder, details the plans for Polkadot for 2023.
- [Asynchronous Backing Spec & Tracking Issue](https://github.com/paritytech/polkadot/issues/3779) -
The implementation tracking issue for asynchronous backing
3 changes: 2 additions & 1 deletion docs/learn/learn-parachains.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ maintain the stronger property of single block composability.

## Parachain Slot Acquisition

There are several ways to allocate parachain slots on {{ polkadot: Polkadot :polkadot }}{{ kusama: Kusama :kusama }}:
There are several ways to allocate parachain slots on
{{ polkadot: Polkadot :polkadot }}{{ kusama: Kusama :kusama }}:

- Governance granted parachains, or "system parachains"
- Auction granted parachains
Expand Down
20 changes: 11 additions & 9 deletions docs/maintain/maintain-guides-polkadot-opengov.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,24 @@ from the treasury at once.

### Submitting a Preimage

The act of creating a proposal is split from submitting the preimage for the proposal since the storage cost of submitting a large preimage could be expensive. Allowing the preimage submission to come as a separate transaction means that another account could submit the preimage for you and pay the fee. The example below demonstrates the creation of a preimage to propose and approve a spend of treasury funds.
The act of creating a proposal is split from submitting the preimage for the proposal since the
storage cost of submitting a large preimage could be expensive. Allowing the preimage submission to
come as a separate transaction means that another account could submit the preimage for you and pay
the fee. The example below demonstrates the creation of a preimage to propose and approve a spend of
treasury funds.

![submit preimage](../assets/governance/opengov-submit-preimage.png)

Follow the steps below to submit a preimage as shown in the screenshot above.

1. Navigate to Governance -> Referenda.
2. Click on the "Add preimage" button.
3. From the *propose* drop-down field, select `treasury`.
4. From the unlabeled drop-down field to the right of the *propose* drop-down field, select `spend(amount, beneficiary)`.
3. From the _propose_ drop-down field, select `treasury`.
4. From the unlabeled drop-down field to the right of the _propose_ drop-down field, select
`spend(amount, beneficiary)`.
5. In the `amount: Compact<u128> (BalanceOf)` text field, enter the spend amount.
6. The `beneficiary: MultiAddress (AccountIdLookupOf)` drop-down field will have `Id` selected by default. Select the beneficiary from the `Id: AccountId` drop-down field.

6. The `beneficiary: MultiAddress (AccountIdLookupOf)` drop-down field will have `Id` selected by
default. Select the beneficiary from the `Id: AccountId` drop-down field.

:::info

Expand All @@ -252,10 +257,7 @@ Copy the `preimage hash` value before clicking the "Submit preimage" button.
7. Click the "Submit preimage" button.

After the preimage is submitted successfully on-chain, Polkadot-JS UI lists it under the tab of
Governance -> Preimages.



Governance -> Preimages.

### Submitting a Proposal

Expand Down
1 change: 1 addition & 0 deletions polkadot-wiki/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ module.exports = {
items: [
'learn/learn-spree',
"learn/learn-parathreads",
"learn/learn-async",
],
},
{
Expand Down
Loading