You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop/parachains/maintenance/configure-asynchronous-backing.md
+28-28Lines changed: 28 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,7 @@ This can be found in the relay chain's runtime. You can see the Polkadot [`async
35
35
This phase involves configuring your parachain's runtime `/runtime/src/lib.rs` to make use of async backing system.
36
36
37
37
1. Establish and ensure that constants for capacity ([`UNINCLUDED_SEGMENT_CAPACITY`](https://github.com/polkadot-fellows/runtimes/blob/d49a9f33d0ea85ce51c26c84a70b61624ec06901/system-parachains/constants/src/polkadot.rs#L42-L44){target=\_blank}) and velocity ([`BLOCK_PROCESSING_VELOCITY`](https://github.com/polkadot-fellows/runtimes/blob/d49a9f33d0ea85ce51c26c84a70b61624ec06901/system-parachains/constants/src/polkadot.rs#L45-L47){target=\_blank}) are both set to `1` in the runtime.
38
+
38
39
2. Establish and ensure the constant relay chain slot duration measured in milliseconds equal to `6000` in the runtime.
39
40
40
41
```rust title="lib.rs"
@@ -59,7 +60,7 @@ This phase involves configuring your parachain's runtime `/runtime/src/lib.rs` t
4.Configure[`cumulus_pallet_parachain_system`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_parachain_system/index.html){target=\_blank} in the runtime.
63
64
64
65
-Definea [`FixedVelocityConsensusHook`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_aura_ext/consensus_hook/struct.FixedVelocityConsensusHook.html){target=\_blank} using our capacity, velocity, and relay slot duration constants.
65
66
```rusttitle="lib.rs"
@@ -74,36 +75,36 @@ This phase involves configuring your parachain's runtime `/runtime/src/lib.rs` t
-Settheparachainsystemproperty [`CheckAssociatedRelayNumber`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_parachain_system/pallet/trait.Config.html#associatedtype.CheckAssociatedRelayNumber){target=\_blank} to [`RelayNumberMonotonicallyIncreases`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_parachain_system/struct.RelayNumberMonotonicallyIncreases.html){target=\_blank}
5.Configure [`pallet_aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank} in the runtime.
93
94
94
-
[`pallet_aura`]((https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank}) implements Authority Round (Aura) - a deterministic [consensus](https://docs.polkadot.com/polkadot-protocol/glossary/#consensus){target=\_blank} protocol where block production is limited to a rotating list of authorities that take turns creating blocks. [`pallet_aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank} uses [`pallet_timestamp`](https://paritytech.github.io/polkadot-sdk/master/pallet_timestamp/index.html){target=\_blank} to track consensus rounds (via [`slots`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/pallet/trait.Config.html#associatedtype.SlotDuration){target=\_blank}).
95
+
[`pallet_aura`]((https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank}) implements Authority Round (Aura) - a deterministic [consensus](/polkadot-protocol/glossary/#consensus){target=\_blank} protocol where block production is limited to a rotating list of authorities that take turns creating blocks. [`pallet_aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank} uses [`pallet_timestamp`](https://paritytech.github.io/polkadot-sdk/master/pallet_timestamp/index.html){target=\_blank} to track consensus rounds (via [`slots`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/pallet/trait.Config.html#associatedtype.SlotDuration){target=\_blank}).
95
96
96
97
-Set [`AllowMultipleBlocksPerSlot`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/pallet/trait.Config.html#associatedtype.AllowMultipleBlocksPerSlot){target=\_blank} to `false`
-Define [`pallet_aura::SlotDuration`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/pallet/trait.Config.html#associatedtype.SlotDuration){target=\_blank} using our constant [`SLOT_DURATION`](https://github.com/polkadot-fellows/runtimes/blob/d49a9f33d0ea85ce51c26c84a70b61624ec06901/system-parachains/constants/src/lib.rs#L38-L40){target=\_blank}
100
101
```rusttitle="lib.rs"
101
102
implpallet_aura::ConfigforRuntime {
102
-
..
103
+
...
103
104
typeAllowMultipleBlocksPerSlot=ConstBool<false>;
104
105
#[cfg(feature ="experimental")]
105
106
typeSlotDuration=ConstU64<SLOT_DURATION>;
106
-
..
107
+
...
107
108
}
108
109
```
109
110
@@ -119,14 +120,14 @@ This phase involves configuring your parachain's runtime `/runtime/src/lib.rs` t
119
120
120
121
-Addthedependency [`cumulus-primitives-aura`](https://paritytech.github.io/polkadot-sdk/master/cumulus_primitives_aura/index.html){target=\_blank} to the `runtime/Cargo.toml` file for your runtime
-Insidethe [`impl_runtime_apis!`]((https://github.com/paritytech/polkadot-sdk/blob/6b17df5ae96f7970109ec3934c7d288f05baa23b/templates/parachain/runtime/src/apis.rs#L87-L91){target=\_blank}) block for your runtime, implement the [`cumulus_primitives_aura::AuraUnincludedSegmentApi`](https://paritytech.github.io/polkadot-sdk/master/cumulus_primitives_aura/trait.AuraUnincludedSegmentApi.html){target=\_blank} as shown below.
130
+
-Insidethe [`impl_runtime_apis!`](https://github.com/paritytech/polkadot-sdk/blob/6b17df5ae96f7970109ec3934c7d288f05baa23b/templates/parachain/runtime/src/apis.rs#L87-L91){target=\_blank} block for your runtime, implement the [`cumulus_primitives_aura::AuraUnincludedSegmentApi`](https://paritytech.github.io/polkadot-sdk/master/cumulus_primitives_aura/trait.AuraUnincludedSegmentApi.html){target=\_blank} as shown below.
@@ -138,7 +139,7 @@ This phase involves configuring your parachain's runtime `/runtime/src/lib.rs` t
138
139
```
139
140
140
141
!!!note
141
-
Withacapacityof1wehaveaneffectivevelocityof ½ evenwhenvelocityisconfiguredtosomelargervalue.Thisisbecausecapacitywillbefilledafterasingleblockisproducedandwillonlybefreedupafterthatblockisincludedontherelaychain, whichtakes2relayblockstoaccomplish.Thuswithcapacity1andvelocity1wegetthecustomary12secondparachainblocktime.
142
+
Withacapacityof1youhaveaneffectivevelocityof ½ evenwhenvelocityisconfiguredtosomelargervalue.Thisisbecausecapacitywillbefilledafterasingleblockisproducedandwillonlybefreedupafterthatblockisincludedontherelaychain, whichtakes2relayblockstoaccomplish.Thuswithcapacity1andvelocity1yougetthecustomary12secondparachainblocktime.
142
143
143
144
8.Ifyour `runtime/src/lib.rs` providesa [`CheckInherents`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_parachain_system/macro.register_validate_block.html){target=\_blank} type to [`register_validate_block`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_parachain_system/macro.register_validate_block.html), remove it. [`FixedVelocityConsensusHook`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_aura_ext/consensus_hook/struct.FixedVelocityConsensusHook.html){target=\_blank} makes it unnecessary. The following example shows how `register_validate_block` should look after removing `CheckInherents`.
144
145
@@ -166,27 +167,27 @@ This phase consists of plugging in the new lookahead collator node.
3.Add `backend` asaparameterto [`start_consensus()`](https://paritytech.github.io/polkadot-sdk/master/parachain_template_node/service/fn.start_consensus.html){target=\_blank} in `node/src/service.rs`
176
177
177
178
```rusttitle="node/src/service.rs"
178
179
fnstart_consensus(
179
-
..
180
+
...
180
181
backend:Arc<ParachainBackend>,
181
-
..
182
+
...
182
183
```
183
184
184
185
```rusttitle="node/src/service.rs"
185
186
ifvalidator {
186
187
start_consensus(
187
-
..
188
+
...
188
189
backend.clone(),
189
-
..
190
+
...
190
191
)?;
191
192
}
192
193
```
@@ -206,16 +207,16 @@ This phase consists of plugging in the new lookahead collator node.
206
207
-Increase [`authoring_duration`](https://github.com/paritytech/polkadot-sdk/blob/6b17df5ae96f7970109ec3934c7d288f05baa23b/templates/parachain/node/src/service.rs#L206-L225){target=\_blank} from 500 milliseconds to 2000
1.Configure [`pallet_aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank}, setting [`AllowMultipleBlocksPerSlot`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/pallet/trait.Config.html#associatedtype.AllowMultipleBlocksPerSlot){target=\_blank} to true in
239
-
`runtime/src/lib.rs`.
239
+
1.Configure [`pallet_aura`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/index.html){target=\_blank}, setting [`AllowMultipleBlocksPerSlot`](https://paritytech.github.io/polkadot-sdk/master/pallet_aura/pallet/trait.Config.html#associatedtype.AllowMultipleBlocksPerSlot){target=\_blank} to true in `runtime/src/lib.rs`.
240
240
241
241
```rusttitle="runtime/src/lib.rs"
242
242
implpallet_aura::ConfigforRuntime {
@@ -266,7 +266,7 @@ This phase consists of changes to your parachain's runtime that activate async b
266
266
3.Decrease [`MILLI_SECS_PER_BLOCK`](https://github.com/paritytech/polkadot-sdk/blob/6b17df5ae96f7970109ec3934c7d288f05baa23b/templates/parachain/runtime/src/lib.rs#L182-L194){target=\_blank} to 6000.
267
267
268
268
!!!note
269
-
Foraparachainwhichmeasurestimeintermsofitsownblocknumberratherthanbyrelayblocknumberitmaybepreferabletoincreasevelocity.Changingblocktimemaycausecomplications, requiringadditionalchanges.Seethesection"Timing by Block Number".
0 commit comments