Skip to content

Commit bc21dad

Browse files
brunopgalvaoCopilotnhussein11dawnkelly09
authored
Add asynchronous backing guide (#788)
* Add async backing guide * python3 scripts/generate_llms.py * formatting * Update develop/parachains/maintenance/asynchronous-backing.md Co-authored-by: Copilot <[email protected]> * Update develop/parachains/maintenance/asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * Update develop/parachains/maintenance/asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * Update develop/parachains/maintenance/asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * Update develop/parachains/maintenance/asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * formatting text * formatting line breaks * reference Polkadot Rust Docs and Polkadot SDK * scheduling_lookahead is now lookahead and is set to 3 not 2 on Polkadot * add content; rename page; formatting * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * formatting * formatting * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Nicolás Hussein <[email protected]> * update formatting * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Dawn Kelly <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Dawn Kelly <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Dawn Kelly <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Dawn Kelly <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Dawn Kelly <[email protected]> * Update develop/parachains/maintenance/configure-asynchronous-backing.md Co-authored-by: Dawn Kelly <[email protected]> * formatting updates * use double digits for code snippets * additional changes, updates llms * grammarly tweaks, llms --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Nicolás Hussein <[email protected]> Co-authored-by: Dawn Kelly <[email protected]> Co-authored-by: DAWN KELLY <[email protected]>
1 parent c0a95e8 commit bc21dad

File tree

26 files changed

+673
-0
lines changed

26 files changed

+673
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
...
2+
cumulus-primitives-aura = { path = "../../../../primitives/aura", default-features = false }
3+
...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn impl_slot_duration() -> sp_consensus_aura::SlotDuration {
2+
sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
3+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
2+
fn can_build_upon(
3+
included_hash: <Block as BlockT>::Hash,
4+
slot: cumulus_primitives_aura::Slot,
5+
) -> bool {
6+
Runtime::impl_can_build_upon(included_hash, slot)
7+
}
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
...
2+
"async_backing_params": {
3+
"max_candidate_depth": 3,
4+
"allowed_ancestry_len": 2
5+
},
6+
...
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Maximum number of blocks simultaneously accepted by the runtime, not yet included into the
2+
// relay chain.
3+
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
4+
// How many parachain blocks are processed by the relay chain per parent. Limits the number of
5+
// blocks authored per slot.
6+
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
7+
// Relay chain slot duration, in milliseconds.
8+
pub const RELAY_chain_SLOT_DURATION_MILLIS: u32 = 6000;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked
2+
// up by `pallet_aura` to implement `fn slot_duration()`.
3+
//
4+
// Change this to adjust the block time.
5+
pub const MILLISECS_PER_BLOCK: u64 = 12000;
6+
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
2+
Runtime,
3+
RELAY_CHAIN_SLOT_DURATION_MILLIS,
4+
BLOCK_PROCESSING_VELOCITY,
5+
UNINCLUDED_SEGMENT_CAPACITY,
6+
>;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
impl cumulus_pallet_parachain_system::Config for Runtime {
2+
...
3+
type ConsensusHook = ConsensusHook;
4+
...
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
impl cumulus_pallet_parachain_system::Config for Runtime {
2+
...
3+
type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
4+
...
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
impl pallet_aura::Config for Runtime {
2+
...
3+
type AllowMultipleBlocksPerSlot = ConstBool<false>;
4+
#[cfg(feature = "experimental")]
5+
type SlotDuration = ConstU64<SLOT_DURATION>;
6+
...
7+
}

0 commit comments

Comments
 (0)