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

Asynchronous-backing compatible Aura, not plugged in #2573

Merged
merged 42 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0057a11
rough draft of potential parent search
rphmeier May 13, 2023
5766a6a
get things compiling
rphmeier May 13, 2023
03a880a
fmt
rphmeier May 13, 2023
bbce10e
add new function to all RelayChainInterface implementations
rphmeier May 13, 2023
db7f9a5
fix compilation
rphmeier May 15, 2023
832a1c0
set slot and timestamp based on relay parent, prepare for find-parent
rphmeier May 17, 2023
b17694a
skeleton of new aura logic
rphmeier May 22, 2023
f70fcf1
fmt
rphmeier May 22, 2023
4109e0c
introduce a collator module in the Aura crate
rphmeier May 22, 2023
9628e44
extract different implementations into own modules
rphmeier May 22, 2023
8dca02a
make interface more convenient
rphmeier May 30, 2023
27f3f92
docs and todos for lookahead
rphmeier May 30, 2023
11b8062
refactor basic collator to use new collator utility
rphmeier May 30, 2023
95a6ff5
some more refactoring
rphmeier May 31, 2023
6408906
finish most of the control flow for new aura
rphmeier Jun 6, 2023
14d50cf
introduce backend as parameter
rphmeier Jun 7, 2023
706aaf5
fix compilation
rphmeier Jun 7, 2023
28cdd3a
fix a couple more TODOs
rphmeier Jun 7, 2023
1a43f18
add an `announce_block` function to collator service
rphmeier Jun 7, 2023
ae07088
announce with barrier
rphmeier Jun 7, 2023
3397395
rename block announcement validator to be more specific
rphmeier Jun 7, 2023
c6f272d
fmt
rphmeier Jun 7, 2023
84b69e9
clean up unused import errors
rphmeier Jun 7, 2023
a3984a7
update references to BlockAnnounceValidator
rphmeier Jun 7, 2023
7489c94
rename unstable_reimpl
rphmeier Jun 7, 2023
67ef6c7
add AuraUnincludedSegmentApi
rphmeier Jun 7, 2023
00fa318
finish rename
rphmeier Jun 7, 2023
be1e3a7
integrate AuraUnincludedSegmentApi
rphmeier Jun 7, 2023
a6a0f80
add a new block announcement validator for backwards compatibility
rphmeier Jun 7, 2023
3afbfe7
add some naive equivocation defenses
rphmeier Jun 7, 2023
89af9a6
rustfmt
rphmeier Jun 7, 2023
b7d8a9c
clean up remaining TODO [now]s
rphmeier Jun 7, 2023
f56b392
fmt
rphmeier Jun 19, 2023
a6bc18a
Merge branch 'master' into rh-find-potential-parents
rphmeier Jun 19, 2023
0101f91
try to fix inprocess-interface
rphmeier Jun 20, 2023
e00621f
actually fix compilation
rphmeier Jun 20, 2023
70caa20
ignored -> rejected rephrase
rphmeier Jul 3, 2023
8a27e2d
Merge branch 'master' into rh-find-potential-parents
rphmeier Jul 5, 2023
086eff0
fix test compilation
rphmeier Jul 5, 2023
e2319c2
fmt
rphmeier Jul 5, 2023
ce4c7b0
Merge branch 'master' into rh-find-potential-parents
rphmeier Jul 10, 2023
d0ab00c
clippy
rphmeier Jul 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ members = [
"pallets/xcmp-queue",
"parachain-template/node",
"parachain-template/runtime",
"primitives/aura",
"primitives/core",
"primitives/parachain-inherent",
"primitives/timestamp",
Expand Down
21 changes: 17 additions & 4 deletions client/collator/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ pub trait ServiceInterface<Block: BlockT> {
candidate: ParachainCandidate<Block>,
) -> Option<(Collation, ParachainBlockData<Block>)>;

/// Inform networking systems that the block should be announced after an appropriate
/// signal has been received. This returns the sending half of the signal.
/// Inform networking systems that the block should be announced after a signal has
/// been received to indicate the block has been seconded by a relay-chain validator.
///
/// This sets up the barrier and returns the sending side of a channel, for the signal
/// to be passed through.
fn announce_with_barrier(
&self,
block_hash: Block::Hash,
) -> oneshot::Sender<CollationSecondedSignal>;

/// Directly announce a block on the network.
fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>);
}

/// The [`CollatorService`] provides common utilities for parachain consensus and authoring.
Expand All @@ -74,6 +80,7 @@ pub trait ServiceInterface<Block: BlockT> {
pub struct CollatorService<Block: BlockT, BS, RA> {
block_status: Arc<BS>,
wait_to_announce: Arc<Mutex<WaitToAnnounce<Block>>>,
announce_block: Arc<dyn Fn(Block::Hash, Option<Vec<u8>>) + Send + Sync>,
runtime_api: Arc<RA>,
}

Expand All @@ -82,6 +89,7 @@ impl<Block: BlockT, BS, RA> Clone for CollatorService<Block, BS, RA> {
Self {
block_status: self.block_status.clone(),
wait_to_announce: self.wait_to_announce.clone(),
announce_block: self.announce_block.clone(),
runtime_api: self.runtime_api.clone(),
}
}
Expand All @@ -101,9 +109,10 @@ where
announce_block: Arc<dyn Fn(Block::Hash, Option<Vec<u8>>) + Send + Sync>,
runtime_api: Arc<RA>,
) -> Self {
let wait_to_announce = Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block)));
let wait_to_announce =
Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block.clone())));

Self { block_status, wait_to_announce, runtime_api }
Self { block_status, wait_to_announce, announce_block, runtime_api }
}

/// Checks the status of the given block hash in the Parachain.
Expand Down Expand Up @@ -315,4 +324,8 @@ where
) -> oneshot::Sender<CollationSecondedSignal> {
CollatorService::announce_with_barrier(self, block_hash)
}

fn announce_block(&self, block_hash: Block::Hash, data: Option<Vec<u8>>) {
(self.announce_block)(block_hash, data)
}
}
3 changes: 3 additions & 0 deletions client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ async-trait = "0.1.70"
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] }
futures = "0.3.28"
tracing = "0.1.37"
lru = "0.10.0"

# Substrate
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe = { 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" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand All @@ -35,6 +37,7 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate
cumulus-client-consensus-common = { path = "../common" }
cumulus-relay-chain-interface = { path = "../../relay-chain-interface" }
cumulus-client-consensus-proposer = { path = "../proposer" }
cumulus-primitives-aura = { path = "../../../primitives/aura" }
cumulus-primitives-core = { path = "../../../primitives/core" }
cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent" }
cumulus-client-collator = { path = "../../collator" }
Expand Down
Loading