Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1ea9296
companion PR for paritytech/substrate#4945
seunlanlege May 8, 2020
106e9ad
bump spec_version
seunlanlege May 8, 2020
15fe5ed
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege May 11, 2020
82f3eb5
newer commit
seunlanlege May 11, 2020
0ac22ba
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege May 12, 2020
176b3a6
bump Cargo.lock
seunlanlege May 19, 2020
3f5e582
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege May 19, 2020
f8fffa1
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege May 21, 2020
4f398e4
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege May 25, 2020
a85ec5d
switch branch to master
seunlanlege May 29, 2020
b3e564b
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege May 29, 2020
3a6d215
switch branch from master
seunlanlege May 29, 2020
882a54f
bump runtime spec_versions
seunlanlege May 29, 2020
c1b5582
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege May 29, 2020
afed728
manually construct signed extras
seunlanlege Jun 2, 2020
51b5942
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege Jun 2, 2020
e8387cb
rename some vars
seunlanlege Jun 2, 2020
85d9e34
merged with master
seunlanlege Jun 8, 2020
478c48f
???
seunlanlege Jun 8, 2020
ca133dc
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege Jun 8, 2020
a2a6b46
nah doesn't work for my branch
seunlanlege Jun 8, 2020
70a288a
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege Jun 8, 2020
5c7df4d
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege Jun 18, 2020
e07494a
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege Jun 19, 2020
532fe19
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege Jun 22, 2020
5ee5bd8
revert to master
seunlanlege Aug 20, 2020
ae5b7a3
Merge branch 'master' of github.com:paritytech/polkadot into seun-sc-…
seunlanlege Aug 20, 2020
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
Prev Previous commit
Next Next commit
merged with master
  • Loading branch information
seunlanlege committed Jun 8, 2020
commit 85d9e3430f78633badd03cfd9391bf940241e24e
661 changes: 371 additions & 290 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ path = "src/main.rs"

[package]
name = "polkadot"
version = "0.8.2"
version = "0.8.3"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"

Expand All @@ -29,6 +29,7 @@ members = [
"network/test",
"primitives",
"runtime/common",
"runtime/parachains",
"runtime/polkadot",
"runtime/kusama",
"runtime/westend",
Expand All @@ -39,6 +40,9 @@ members = [
"service",
"validation",

"node/messages",
"node/overseer",

"parachain/test-parachains",
"parachain/test-parachains/adder",
"parachain/test-parachains/adder/collator",
Expand Down
2 changes: 1 addition & 1 deletion availability-store/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "polkadot-availability-store"
description = "Persistent database for parachain data"
version = "0.8.2"
version = "0.8.3"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-cli"
version = "0.8.2"
version = "0.8.3"
authors = ["Parity Technologies <[email protected]>"]
description = "Polkadot Relay-chain Client Node"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-collator"
version = "0.8.2"
version = "0.8.3"
authors = ["Parity Technologies <[email protected]>"]
description = "Collator node implementation"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion erasure-coding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-erasure-coding"
version = "0.8.2"
version = "0.8.3"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-network"
version = "0.8.2"
version = "0.8.3"
authors = ["Parity Technologies <[email protected]>"]
description = "Polkadot-specific networking protocol"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion network/test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-network-test"
version = "0.8.2"
version = "0.8.3"
license = "GPL-3.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"
Expand Down
1 change: 1 addition & 0 deletions node/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stub - This folder will hold core subsystem implementations, each with their own crate.
9 changes: 9 additions & 0 deletions node/messages/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "polkadot-node-messages"
version = "0.1.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"
description = "Message types used by Subsystems"

[dependencies]
polkadot-primitives = { path = "../../primitives" }
72 changes: 72 additions & 0 deletions node/messages/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2017-2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot 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.

// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Message types for the overseer and subsystems.
//!
//! These messages are intended to define the protocol by which different subsystems communicate with each
//! other and signals that they receive from an overseer to coordinate their work.
//! This is intended for use with the `polkadot-overseer` crate.
//!
//! Subsystems' APIs are defined separately from their implementation, leading to easier mocking.

use polkadot_primitives::Hash;

/// Signals sent by an overseer to a subsystem.
#[derive(PartialEq, Clone, Debug)]
pub enum OverseerSignal {
/// `Subsystem` should start working on block-based work, given by the relay-chain block hash.
StartWork(Hash),
/// `Subsystem` should stop working on block-based work specified by the relay-chain block hash.
StopWork(Hash),
/// Conclude the work of the `Overseer` and all `Subsystem`s.
Conclude,
}

/// A message type used by the Validation Subsystem.
#[derive(Debug)]
pub enum ValidationSubsystemMessage {
ValidityAttestation,
}

/// A message type used by the CandidateBacking Subsystem.
#[derive(Debug)]
pub enum CandidateBackingSubsystemMessage {
RegisterBackingWatcher,
Second,
}

/// A message type tying together all message types that are used across Subsystems.
#[derive(Debug)]
pub enum AllMessages {
Validation(ValidationSubsystemMessage),
CandidateBacking(CandidateBackingSubsystemMessage),
}

/// A message type that a subsystem receives from an overseer.
/// It wraps signals from an overseer and messages that are circulating
/// between subsystems.
///
/// It is generic over over the message type `M` that a particular `Subsystem` may use.
#[derive(Debug)]
pub enum FromOverseer<M: std::fmt::Debug> {
/// Signal from the `Overseer`.
Signal(OverseerSignal),

/// Some other `Subsystem`'s message.
Communication {
msg: M,
},
}
1 change: 1 addition & 0 deletions node/network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stub - This folder will hold networking subsystem implementations, each with their own crate.
21 changes: 21 additions & 0 deletions node/overseer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "polkadot-overseer"
version = "0.1.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"

[dependencies]
futures = "0.3.5"
log = "0.4.8"
futures-timer = "3.0.2"
streamunordered = "0.5.1"
polkadot-primitives = { path = "../../primitives" }
client = { package = "sc-client-api", git = "https://github.com/paritytech/substrate", branch = "seun-sc-cli-subkey" }
messages = { package = "polkadot-node-messages", path = "../messages" }

[dev-dependencies]
futures = { version = "0.3.5", features = ["thread-pool"] }
futures-timer = "3.0.2"
femme = "2.0.1"
log = "0.4.8"
kv-log-macro = "1.0.6"
136 changes: 136 additions & 0 deletions node/overseer/examples/minimal-example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot 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.

// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Shows a basic usage of the `Overseer`:
//! * Spawning subsystems and subsystem child jobs
//! * Establishing message passing

use std::time::Duration;
use futures::{
pending, pin_mut, executor, select, stream,
FutureExt, StreamExt,
};
use futures_timer::Delay;
use kv_log_macro as log;

use polkadot_overseer::{Overseer, Subsystem, SubsystemContext, SpawnedSubsystem};

use messages::{
AllMessages, CandidateBackingSubsystemMessage, FromOverseer, ValidationSubsystemMessage
};

struct Subsystem1;

impl Subsystem1 {
async fn run(mut ctx: SubsystemContext<CandidateBackingSubsystemMessage>) {
loop {
match ctx.try_recv().await {
Ok(Some(msg)) => {
if let FromOverseer::Communication { msg } = msg {
log::info!("msg {:?}", msg);
}
continue;
}
Ok(None) => (),
Err(_) => {
log::info!("exiting");
return;
}
}

Delay::new(Duration::from_secs(1)).await;
ctx.send_msg(AllMessages::Validation(
ValidationSubsystemMessage::ValidityAttestation
)).await.unwrap();
}
}
}

impl Subsystem<CandidateBackingSubsystemMessage> for Subsystem1 {
fn start(&mut self, ctx: SubsystemContext<CandidateBackingSubsystemMessage>) -> SpawnedSubsystem {
SpawnedSubsystem(Box::pin(async move {
Self::run(ctx).await;
}))
}
}

struct Subsystem2;

impl Subsystem2 {
async fn run(mut ctx: SubsystemContext<ValidationSubsystemMessage>) {
ctx.spawn(Box::pin(async {
loop {
log::info!("Job tick");
Delay::new(Duration::from_secs(1)).await;
}
})).await.unwrap();

loop {
match ctx.try_recv().await {
Ok(Some(msg)) => {
log::info!("Subsystem2 received message {:?}", msg);
continue;
}
Ok(None) => { pending!(); }
Err(_) => {
log::info!("exiting");
return;
},
}
}
}
}

impl Subsystem<ValidationSubsystemMessage> for Subsystem2 {
fn start(&mut self, ctx: SubsystemContext<ValidationSubsystemMessage>) -> SpawnedSubsystem {
SpawnedSubsystem(Box::pin(async move {
Self::run(ctx).await;
}))
}
}

fn main() {
femme::with_level(femme::LevelFilter::Trace);
let spawner = executor::ThreadPool::new().unwrap();

futures::executor::block_on(async {
let timer_stream = stream::repeat(()).then(|_| async {
Delay::new(Duration::from_secs(1)).await;
});

let (overseer, _handler) = Overseer::new(
vec![],
Box::new(Subsystem2),
Box::new(Subsystem1),
spawner,
).unwrap();
let overseer_fut = overseer.run().fuse();
let timer_stream = timer_stream;

pin_mut!(timer_stream);
pin_mut!(overseer_fut);

loop {
select! {
_ = overseer_fut => break,
_ = timer_stream.next() => {
log::info!("tick");
}
complete => break,
}
}
});
}
Loading