mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
Aura consensus for parachains (#371)
* Update polkadot * Migrate all uses of MQC heads to merkle proofs * Mass rename `relay_parent_storage_root` * Restore parachain-system tests * Update polkadot and libp2p swarm for testing * Collapse match into an if let Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Start with something * Update Substrate & Polkadot * Start to make it compile * Make it compile * Begin with something * Yep * I'm a hacker * Bring back the builder * Make it work in some way * Compile * Parachains use their own "slot" * Adds cumulus-pallet-aura * Wrap AuRa import queue to disable equivocation checking by default * Pass slot duration * Check the seal when validating a block * Adds missing file * Try to make the seal working * Fix it * Some fixes * Bring in the latest features to cleanup the code * Update and make it compile * Improve the import * Start fixing * More work * Fix fix fix * Make everything compile * Small cleanups * Rename and more docs * Docs * Fixes fixes fixes * Update rococo-parachains/src/chain_spec.rs * Update client/consensus/aura/src/lib.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Update client/consensus/aura/src/lib.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Update primitives/parachain-inherent/Cargo.toml Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Update primitives/parachain-inherent/Cargo.toml * Update primitives/parachain-inherent/Cargo.toml * Update primitives/parachain-inherent/Cargo.toml Co-authored-by: Sergei Shulepov <sergei@parity.io> Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,6 @@ polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "m
|
||||
# Cumulus dependencies
|
||||
cumulus-client-consensus-common = { path = "../common" }
|
||||
cumulus-primitives-core = { path = "../../../primitives/core" }
|
||||
cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent" }
|
||||
|
||||
# Other deps
|
||||
futures = { version = "0.3.8", features = ["compat"] }
|
||||
|
||||
@@ -64,7 +64,7 @@ where
|
||||
.create_inherent_data_providers
|
||||
.create_inherent_data_providers(*header.parent_hash(), ())
|
||||
.await
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let inherent_data = inherent_data_providers
|
||||
.create_inherent_data()
|
||||
|
||||
@@ -38,7 +38,6 @@ use cumulus_primitives_core::{
|
||||
relay_chain::v1::{Block as PBlock, Hash as PHash, ParachainHost},
|
||||
ParaId, PersistedValidationData,
|
||||
};
|
||||
use cumulus_primitives_parachain_inherent::ParachainInherentData;
|
||||
use parking_lot::Mutex;
|
||||
use polkadot_service::ClientHandle;
|
||||
use sc_client_api::Backend;
|
||||
@@ -89,7 +88,7 @@ where
|
||||
RClient: ProvideRuntimeApi<PBlock>,
|
||||
RClient::Api: ParachainHost<PBlock>,
|
||||
RBackend: Backend<PBlock>,
|
||||
CIDP: CreateInherentDataProviders<B, ()>,
|
||||
CIDP: CreateInherentDataProviders<B, (PHash, PersistedValidationData)>,
|
||||
{
|
||||
/// Create a new instance of relay-chain provided consensus.
|
||||
pub fn new(
|
||||
@@ -120,18 +119,18 @@ where
|
||||
) -> Option<InherentData> {
|
||||
let inherent_data_providers = self
|
||||
.create_inherent_data_providers
|
||||
.create_inherent_data_providers(parent, ())
|
||||
.create_inherent_data_providers(parent, (relay_parent, validation_data.clone()))
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tracing::error!(
|
||||
target: LOG_TARGET,
|
||||
error = ?e,
|
||||
"Failed to create inherent data providers",
|
||||
"Failed to create inherent data providers.",
|
||||
)
|
||||
})
|
||||
.ok()?;
|
||||
|
||||
let mut inherent_data = inherent_data_providers
|
||||
inherent_data_providers
|
||||
.create_inherent_data()
|
||||
.map_err(|e| {
|
||||
tracing::error!(
|
||||
@@ -140,31 +139,7 @@ where
|
||||
"Failed to create inherent data.",
|
||||
)
|
||||
})
|
||||
.ok()?;
|
||||
|
||||
let parachain_inherent_data = ParachainInherentData::create_at(
|
||||
relay_parent,
|
||||
&*self.relay_chain_client,
|
||||
&*self.relay_chain_backend,
|
||||
validation_data,
|
||||
self.para_id,
|
||||
)?;
|
||||
|
||||
inherent_data
|
||||
.put_data(
|
||||
cumulus_primitives_parachain_inherent::INHERENT_IDENTIFIER,
|
||||
¶chain_inherent_data,
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::error!(
|
||||
target: LOG_TARGET,
|
||||
error = ?e,
|
||||
"Failed to put the system inherent into inherent data.",
|
||||
)
|
||||
})
|
||||
.ok()?;
|
||||
|
||||
Some(inherent_data)
|
||||
.ok()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +159,7 @@ where
|
||||
ProofRecording = EnableProofRecording,
|
||||
Proof = <EnableProofRecording as ProofRecording>::Proof,
|
||||
>,
|
||||
CIDP: CreateInherentDataProviders<B, ()>,
|
||||
CIDP: CreateInherentDataProviders<B, (PHash, PersistedValidationData)>,
|
||||
{
|
||||
async fn produce_candidate(
|
||||
&mut self,
|
||||
@@ -201,7 +176,9 @@ where
|
||||
)
|
||||
.ok()?;
|
||||
|
||||
let inherent_data = self.inherent_data(parent.hash(), &validation_data, relay_parent).await?;
|
||||
let inherent_data = self
|
||||
.inherent_data(parent.hash(), &validation_data, relay_parent)
|
||||
.await?;
|
||||
|
||||
let Proposal {
|
||||
block,
|
||||
@@ -288,7 +265,7 @@ where
|
||||
RBackend: Backend<PBlock> + 'static,
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||
sc_client_api::StateBackendFor<RBackend, PBlock>: sc_client_api::StateBackend<HashFor<PBlock>>,
|
||||
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
|
||||
CIDP: CreateInherentDataProviders<Block, (PHash, PersistedValidationData)> + 'static,
|
||||
{
|
||||
RelayChainConsensusBuilder::new(
|
||||
para_id,
|
||||
@@ -331,7 +308,7 @@ where
|
||||
>,
|
||||
BI: BlockImport<Block> + Send + Sync + 'static,
|
||||
RBackend: Backend<PBlock> + 'static,
|
||||
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
|
||||
CIDP: CreateInherentDataProviders<Block, (PHash, PersistedValidationData)> + 'static,
|
||||
{
|
||||
/// Create a new instance of the builder.
|
||||
fn new(
|
||||
@@ -374,7 +351,7 @@ where
|
||||
>,
|
||||
BI: BlockImport<Block> + Send + Sync + 'static,
|
||||
RBackend: Backend<PBlock> + 'static,
|
||||
CIDP: CreateInherentDataProviders<Block, ()> + 'static,
|
||||
CIDP: CreateInherentDataProviders<Block, (PHash, PersistedValidationData)> + 'static,
|
||||
{
|
||||
type Output = Box<dyn ParachainConsensus<Block>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user