Skip to content

Commit

Permalink
Aura: Ensure we are building on each relay chain fork (#5352)
Browse files Browse the repository at this point in the history
We only want to build one block per slot for Aura on parachains.
However, we still need to build on each relay chain fork, which is using
the same slot.

Closes: #5349

---------

Co-authored-by: Davide Galassi <[email protected]>
Co-authored-by: Sebastian Kunert <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2024
1 parent 048f4b8 commit 63bf73d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cumulus/client/consensus/aura/src/collators/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ where
};

let mut last_processed_slot = 0;
let mut last_relay_chain_block = Default::default();

while let Some(request) = collation_requests.next().await {
macro_rules! reject_with_error {
Expand Down Expand Up @@ -215,11 +216,13 @@ where
//
// Most parachains currently run with 12 seconds slots and thus, they would try to
// produce multiple blocks per slot which very likely would fail on chain. Thus, we have
// this "hack" to only produce on block per slot.
// this "hack" to only produce one block per slot per relay chain fork.
//
// With https://github.com/paritytech/polkadot-sdk/issues/3168 this implementation will be
// obsolete and also the underlying issue will be fixed.
if last_processed_slot >= *claim.slot() {
if last_processed_slot >= *claim.slot() &&
last_relay_chain_block < *relay_parent_header.number()
{
continue
}

Expand Down Expand Up @@ -261,6 +264,7 @@ where
}

last_processed_slot = *claim.slot();
last_relay_chain_block = *relay_parent_header.number();
}
}
}
10 changes: 10 additions & 0 deletions prdoc/pr_5352.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: "Aura: Ensure parachains are building on all relay chain forks"

doc:
- audience: Node Dev
description: |
Ensure that parachains using the `basic` collator are building on all relay chain forks.

crates:
- name: cumulus-client-consensus-aura
bump: patch

0 comments on commit 63bf73d

Please sign in to comment.