Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 73837c3

Browse files
davxybkchr
andauthored
Limit number of blocks per level (2nd attempt) (#1559)
Prevents the StateDbError::TooManySiblingBlocks error from being triggered by eagerly removing stale blocks from the backend on block import and before the error condition is met. Introduces a just in time block recovery mechanism for blocks that were wrongly removed via an explicit pov-recovery method Co-authored-by: Bastian Köcher <[email protected]>
1 parent f621351 commit 73837c3

File tree

17 files changed

+1091
-179
lines changed

17 files changed

+1091
-179
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/consensus/aura/src/import_queue.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Parachain specific wrapper for the AuRa import queue.
1818
1919
use codec::Codec;
20-
use cumulus_client_consensus_common::ParachainBlockImport;
20+
use cumulus_client_consensus_common::ParachainBlockImportMarker;
2121
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
2222
use sc_consensus::{import_queue::DefaultImportQueue, BlockImport};
2323
use sc_consensus_aura::{AuraVerifier, CompatibilityMode};
@@ -37,7 +37,7 @@ use substrate_prometheus_endpoint::Registry;
3737
/// Parameters for [`import_queue`].
3838
pub struct ImportQueueParams<'a, I, C, CIDP, S> {
3939
/// The block import to use.
40-
pub block_import: ParachainBlockImport<I>,
40+
pub block_import: I,
4141
/// The client to interact with the chain.
4242
pub client: Arc<C>,
4343
/// The inherent data providers, to create the inherent data.
@@ -73,6 +73,7 @@ where
7373
+ UsageProvider<Block>
7474
+ HeaderBackend<Block>,
7575
I: BlockImport<Block, Error = ConsensusError, Transaction = sp_api::TransactionFor<C, Block>>
76+
+ ParachainBlockImportMarker
7677
+ Send
7778
+ Sync
7879
+ 'static,

client/consensus/aura/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
use codec::{Decode, Encode};
2626
use cumulus_client_consensus_common::{
27-
ParachainBlockImport, ParachainCandidate, ParachainConsensus,
27+
ParachainBlockImportMarker, ParachainCandidate, ParachainConsensus,
2828
};
2929
use cumulus_primitives_core::{relay_chain::v2::Hash as PHash, PersistedValidationData};
3030

@@ -75,7 +75,7 @@ impl<B, CIDP, W> Clone for AuraConsensus<B, CIDP, W> {
7575
pub struct BuildAuraConsensusParams<PF, BI, CIDP, Client, BS, SO> {
7676
pub proposer_factory: PF,
7777
pub create_inherent_data_providers: CIDP,
78-
pub block_import: ParachainBlockImport<BI>,
78+
pub block_import: BI,
7979
pub para_client: Arc<Client>,
8080
pub backoff_authoring_blocks: Option<BS>,
8181
pub sync_oracle: SO,
@@ -114,7 +114,11 @@ where
114114
Client:
115115
ProvideRuntimeApi<B> + BlockOf + AuxStore + HeaderBackend<B> + Send + Sync + 'static,
116116
Client::Api: AuraApi<B, P::Public>,
117-
BI: BlockImport<B, Transaction = sp_api::TransactionFor<Client, B>> + Send + Sync + 'static,
117+
BI: BlockImport<B, Transaction = sp_api::TransactionFor<Client, B>>
118+
+ ParachainBlockImportMarker
119+
+ Send
120+
+ Sync
121+
+ 'static,
118122
SO: SyncOracle + Send + Sync + Clone + 'static,
119123
BS: BackoffAuthoringBlocksStrategy<NumberFor<B>> + Send + Sync + 'static,
120124
PF: Environment<B, Error = Error> + Send + Sync + 'static,

client/consensus/common/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ async-trait = "0.1.59"
1010
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
1111
dyn-clone = "1.0.10"
1212
futures = "0.3.25"
13+
log = "0.4.17"
1314
tracing = "0.1.37"
1415

1516
# Substrate
@@ -24,7 +25,9 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
2425
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
2526

2627
# Cumulus
28+
cumulus-primitives-core = { path = "../../../primitives/core" }
2729
cumulus-relay-chain-interface = { path = "../../relay-chain-interface" }
30+
cumulus-client-pov-recovery = { path = "../../pov-recovery" }
2831

2932
[dev-dependencies]
3033
futures-timer = "3.0.2"

0 commit comments

Comments
 (0)