mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-16 22:31:03 +00:00
Parachains-Aura: Only produce once per slot (#3308)
Given how the block production is driven for Parachains right now, with the enabling of async backing we would produce two blocks per slot. Until we have a proper collator implementation, the "hack" is to prevent the production of multiple blocks per slot. Closes: https://github.com/paritytech/polkadot-sdk/issues/3282
This commit is contained in:
@@ -141,6 +141,8 @@ where
|
||||
collator_util::Collator::<Block, P, _, _, _, _, _>::new(params)
|
||||
};
|
||||
|
||||
let mut last_processed_slot = 0;
|
||||
|
||||
while let Some(request) = collation_requests.next().await {
|
||||
macro_rules! reject_with_error {
|
||||
($err:expr) => {{
|
||||
@@ -192,6 +194,18 @@ where
|
||||
Err(e) => reject_with_error!(e),
|
||||
};
|
||||
|
||||
// With async backing this function will be called every relay chain block.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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() {
|
||||
continue
|
||||
}
|
||||
|
||||
let (parachain_inherent_data, other_inherent_data) = try_request!(
|
||||
collator
|
||||
.create_inherent_data(
|
||||
@@ -228,6 +242,8 @@ where
|
||||
request.complete(None);
|
||||
tracing::debug!(target: crate::LOG_TARGET, "No block proposal");
|
||||
}
|
||||
|
||||
last_processed_slot = *claim.slot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user