Skip to content

Commit 3c5fb81

Browse files
committed
formatting line breaks
1 parent cd30154 commit 3c5fb81

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed

develop/parachains/maintenance/asynchronous-backing.md

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ This guide is relevant for Cumulus-based parachain projects started in 2023 or b
1717

1818
## Prerequisite
1919

20-
The relay chain needs to have async backing enabled so double-check that the relay chain
21-
configuration contains the following three parameters (especially when testing locally e.g. with
22-
zombienet):
20+
The relay chain needs to have async backing enabled so double-check that the relay chain configuration contains the following three parameters (especially when testing locally e.g. with zombienet):
2321

2422
```json
2523
"async_backing_params": {
@@ -30,17 +28,14 @@ zombienet):
3028
```
3129

3230
!!! warning
33-
`scheduling_lookahead` must be set to 2, otherwise parachain
34-
block times will degrade to worse than with sync backing!
31+
`scheduling_lookahead` must be set to 2, otherwise parachain block times will degrade to worse than with sync backing!
3532

3633
## Phase 1 - Update Parachain Runtime
3734

38-
This phase involves configuring your parachain's runtime `/runtime/src/lib.rs` to make use of
39-
async backing system.
35+
This phase involves configuring your parachain's runtime `/runtime/src/lib.rs` to make use of async backing system.
4036

4137
1. Establish and ensure that constants for capacity (`UNINCLUDED_SEGMENT_CAPACITY`) and velocity (`BLOCK_PROCESSING_VELOCITY`) are both set to `1` in the runtime.
42-
2. Establish and ensure the constant relay chain slot duration measured in milliseconds equal to
43-
`6000` in the runtime.
38+
2. Establish and ensure the constant relay chain slot duration measured in milliseconds equal to `6000` in the runtime.
4439

4540
```rust title="lib.rs"
4641
// Maximum number of blocks simultaneously accepted by the runtime, not yet included into the
@@ -147,11 +142,7 @@ async backing system.
147142
```
148143

149144
!!!note
150-
With a capacity of 1 we have an effective velocity of ½ even when velocity is
151-
configured to some larger value. This is because capacity will be filled after a single block is
152-
produced and will only be freed up after that block is included on the relay chain, which takes
153-
2 relay blocks to accomplish. Thus with capacity 1 and velocity 1 we get the customary 12 second
154-
parachain block time.
145+
With a capacity of 1 we have an effective velocity of ½ even when velocity is configured to some larger value. This is because capacity will be filled after a single block is produced and will only be freed up after that block is included on the relay chain, which takes 2 relay blocks to accomplish. Thus with capacity 1 and velocity 1 we get the customary 12 second parachain block time.
155146

156147
8. If your `runtime/src/lib.rs` provides a `CheckInherents` type to `register_validate_block`, remove it. `FixedVelocityConsensusHook` makes it unnecessary. The following example shows how `register_validate_block` should look after removing `CheckInherents`.
157148

@@ -175,8 +166,7 @@ This phase consists of plugging in the new lookahead collator node.
175166
};
176167
```
177168

178-
2. In `node/src/service.rs`, modify `sc_service::spawn_tasks` to use a clone of `Backend` rather
179-
than the original
169+
2. In `node/src/service.rs`, modify `sc_service::spawn_tasks` to use a clone of `Backend` rather than the original
180170

181171
```rust
182172
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
@@ -235,9 +225,7 @@ This phase consists of plugging in the new lookahead collator node.
235225
```
236226

237227
!!!note
238-
Set `authoring_duration` to whatever you want, taking your own hardware into account.
239-
But if the backer, who should be slower than you due to reading from disk, times out at two
240-
seconds your candidates will be rejected.
228+
Set `authoring_duration` to whatever you want, taking your own hardware into account. But if the backer, who should be slower than you due to reading from disk, times out at two seconds your candidates will be rejected.
241229

242230
6. In `start_consensus()` replace `basic_aura::run` with `aura::run`
243231

@@ -284,9 +272,7 @@ This phase consists of changes to your parachain's runtime that activate async b
284272
3. Decrease `MILLISECS_PER_BLOCK` to 6000.
285273

286274
!!!note
287-
For a parachain which measures time in terms of its own block number rather than by relay block
288-
number it may be preferable to increase velocity. Changing block time may cause complications,
289-
requiring additional changes. See the section "Timing by Block Number".
275+
For a parachain which measures time in terms of its own block number rather than by relay block number it may be preferable to increase velocity. Changing block time may cause complications, requiring additional changes. See the section "Timing by Block Number".
290276

291277
```rust
292278
mod block_times {
@@ -328,12 +314,7 @@ This phase consists of changes to your parachain's runtime that activate async b
328314

329315
## Timing by Block Number
330316

331-
With asynchronous backing it will be possible for parachains to opt for a block time of 6
332-
seconds rather than 12 seconds. But modifying block duration isn't so simple for a parachain
333-
which was measuring time in terms of its own block number. It could result in expected and
334-
actual time not matching up, stalling the parachain.
317+
With asynchronous backing it will be possible for parachains to opt for a block time of 6 seconds rather than 12 seconds. But modifying block duration isn't so simple for a parachain which was measuring time in terms of its own block number. It could result in expected and actual time not matching up, stalling the parachain.
335318

336-
One strategy to deal with this issue is to instead rely on relay chain block numbers for timing.
337-
Relay block number is kept track of by each parachain in `pallet-parachain-system` with the
338-
storage value `LastRelaychainBlockNumber`. This value can be obtained and used wherever timing
339-
based on block number is needed.
319+
One strategy to deal with this issue is to instead rely on relay chain block numbers for timing. Relay block number is kept track of by each parachain in `pallet-parachain-system` with the
320+
storage value `LastRelaychainBlockNumber`. This value can be obtained and used wherever timing based on block number is needed.

0 commit comments

Comments
 (0)