This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 371
Aura consensus for parachains #371
Merged
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
21bd35d
Update polkadot
pepyakin 1606eab
Migrate all uses of MQC heads to merkle proofs
pepyakin ca992ed
Mass rename `relay_parent_storage_root`
pepyakin 9e0724a
Restore parachain-system tests
pepyakin 4a179c2
Update polkadot and libp2p swarm for testing
pepyakin 94fad6c
Collapse match into an if let
pepyakin a4c1e72
Merge remote-tracking branch 'origin/ser-clean-pvd' into bkchr-aura-t…
bkchr d6c5060
Start with something
bkchr d1d06f0
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr cf17fbd
Update Substrate & Polkadot
bkchr 17916d8
Merge branch 'bkchr-update-substrate-and-poladkot2132434we' into bkch…
bkchr 677dc54
Start to make it compile
bkchr 007dfce
Make it compile
bkchr a8b4652
Begin with something
bkchr 0fc1f08
Yep
bkchr c4d80d6
I'm a hacker
bkchr d56c303
Bring back the builder
bkchr 4733bb2
Make it work in some way
bkchr e27ea7f
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr 26ab50d
Compile
bkchr 440a513
Parachains use their own "slot"
bkchr f6d891f
Adds cumulus-pallet-aura
bkchr f734351
Wrap AuRa import queue to disable equivocation checking by default
bkchr 8c1f788
Pass slot duration
bkchr e670750
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr c876cf9
Check the seal when validating a block
bkchr ad8e06e
Adds missing file
bkchr a5b385c
Try to make the seal working
bkchr b3452b9
Fix it
bkchr edd65c4
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr e3d3607
Some fixes
bkchr 2a3f53c
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr b65c69b
Bring in the latest features to cleanup the code
bkchr c3fce33
Update and make it compile
bkchr 7a1dc09
Improve the import
bkchr 0438a9c
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr 9064c08
Start fixing
bkchr a651bd3
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr 2d64c7c
More work
bkchr c8bbc6f
Fix fix fix
bkchr de10387
Make everything compile
bkchr 9619b67
Merge remote-tracking branch 'origin/master' into bkchr-aura-the-long…
bkchr d14e281
Small cleanups
bkchr d78e910
Rename and more docs
bkchr 033b657
Docs
bkchr b4a4790
Fixes fixes fixes
bkchr 1b94f39
Update rococo-parachains/src/chain_spec.rs
bkchr fe62ccc
Update client/consensus/aura/src/lib.rs
bkchr 2c0072b
Update client/consensus/aura/src/lib.rs
bkchr fe48de7
Update primitives/parachain-inherent/Cargo.toml
bkchr 548d69a
Update primitives/parachain-inherent/Cargo.toml
bkchr 911dc06
Update primitives/parachain-inherent/Cargo.toml
bkchr 35ec124
Update primitives/parachain-inherent/Cargo.toml
bkchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| [package] | ||
| name = "cumulus-client-consensus-aura" | ||
| description = "AURA consensus algorithm for parachains" | ||
| version = "0.1.0" | ||
| authors = ["Parity Technologies <[email protected]>"] | ||
| edition = "2018" | ||
|
|
||
| [dependencies] | ||
| # Substrate dependencies | ||
| sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
|
|
||
| # Polkadot dependencies | ||
| polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } | ||
|
|
||
| # Cumulus dependencies | ||
| cumulus-client-consensus-common = { path = "../common" } | ||
| cumulus-primitives-core = { path = "../../../primitives/core" } | ||
|
|
||
| # Other deps | ||
| futures = { version = "0.3.8", features = ["compat"] } | ||
| codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ] } | ||
| tracing = "0.1.22" | ||
| async-trait = "0.1.42" | ||
| parking_lot = "0.9" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| // Copyright 2021 Parity Technologies (UK) Ltd. | ||
| // This file is part of Cumulus. | ||
|
|
||
| // Cumulus is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Cumulus is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Cumulus. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| //! Parachain specific wrapper for the AuRa import queue. | ||
|
|
||
| use codec::Codec; | ||
| use sc_client_api::{backend::AuxStore, BlockOf}; | ||
| use sc_consensus_slots::InherentDataProviderExt; | ||
| use sp_api::{ApiExt, ProvideRuntimeApi}; | ||
| use sp_block_builder::BlockBuilder as BlockBuilderApi; | ||
| use sp_blockchain::{HeaderBackend, ProvideCache}; | ||
| use sp_consensus::{ | ||
| import_queue::DefaultImportQueue, BlockImport, CanAuthorWith, Error as ConsensusError, | ||
| }; | ||
| use sp_consensus_aura::{digests::CompatibleDigestItem, AuraApi}; | ||
| use sp_core::crypto::Pair; | ||
| use sp_inherents::CreateInherentDataProviders; | ||
| use sp_runtime::traits::{Block as BlockT, DigestItemFor}; | ||
| use std::{fmt::Debug, hash::Hash, sync::Arc}; | ||
| use substrate_prometheus_endpoint::Registry; | ||
| use sc_telemetry::TelemetryHandle; | ||
|
|
||
| /// Parameters of [`import_queue`]. | ||
| pub struct ImportQueueParams<'a, I, C, IDP, S, CAW> { | ||
| /// The block import to use. | ||
| pub block_import: I, | ||
| /// The client to interact with the chain. | ||
| pub client: Arc<C>, | ||
| /// The inherent data providers, to create the inherent data. | ||
| pub create_inherent_data_providers: IDP, | ||
| /// The spawner to spawn background tasks. | ||
| pub spawner: &'a S, | ||
| /// The prometheus registry. | ||
| pub registry: Option<&'a Registry>, | ||
| /// Can we author with the current node? | ||
| pub can_author_with: CAW, | ||
| /// The telemetry handle. | ||
| pub telemetry: Option<TelemetryHandle>, | ||
| } | ||
|
|
||
| /// Start an import queue for the Aura consensus algorithm. | ||
| pub fn import_queue<'a, P, Block, I, C, S, CAW, IDP>( | ||
| ImportQueueParams { | ||
| block_import, | ||
| client, | ||
| create_inherent_data_providers, | ||
| spawner, | ||
| registry, | ||
| can_author_with, | ||
| telemetry, | ||
| }: ImportQueueParams<'a, I, C, IDP, S, CAW>, | ||
| ) -> Result<DefaultImportQueue<Block, C>, sp_consensus::Error> | ||
| where | ||
| Block: BlockT, | ||
| C::Api: BlockBuilderApi<Block> + AuraApi<Block, P::Public> + ApiExt<Block>, | ||
| C: 'static | ||
| + ProvideRuntimeApi<Block> | ||
| + BlockOf | ||
| + ProvideCache<Block> | ||
| + Send | ||
| + Sync | ||
| + AuxStore | ||
| + HeaderBackend<Block>, | ||
| I: BlockImport<Block, Error = ConsensusError, Transaction = sp_api::TransactionFor<C, Block>> | ||
| + Send | ||
| + Sync | ||
| + 'static, | ||
| DigestItemFor<Block>: CompatibleDigestItem<P::Signature>, | ||
| P: Pair + Send + Sync + 'static, | ||
| P::Public: Clone + Eq + Send + Sync + Hash + Debug + Codec, | ||
| P::Signature: Codec, | ||
| S: sp_core::traits::SpawnEssentialNamed, | ||
| CAW: CanAuthorWith<Block> + Send + Sync + 'static, | ||
| IDP: CreateInherentDataProviders<Block, ()> + Sync + Send + 'static, | ||
| IDP::InherentDataProviders: InherentDataProviderExt + Send + Sync, | ||
| { | ||
| sc_consensus_aura::import_queue::<P, _, _, _, _, _, _>(sc_consensus_aura::ImportQueueParams { | ||
| block_import: crate::ParachainBlockImport(block_import), | ||
| justification_import: None, | ||
| client, | ||
| create_inherent_data_providers, | ||
| spawner, | ||
| registry, | ||
| can_author_with, | ||
| check_for_equivocation: sc_consensus_aura::CheckForEquivocation::No, | ||
| telemetry, | ||
| }) | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only difference from regular aura import queue right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah