Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #85

Merged
merged 3 commits into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ members = [
"srml/kton",
"srml/support",
"srml/try",
"srml/chainrelay",
"srml/chainrelay/poa"
]

exclude = ["node/runtime/wasm"]
Expand Down
12 changes: 10 additions & 2 deletions node/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub enum ChainSpec {
FlamingFir,
/// Whatever the current runtime is with the "global testnet" defaults.
StagingTestnet,
CrayfishTestnet,
}

/// Custom subcommands.
Expand Down Expand Up @@ -129,15 +130,17 @@ impl ChainSpec {
ChainSpec::Development => chain_spec::development_config(),
ChainSpec::LocalTestnet => chain_spec::local_testnet_config(),
ChainSpec::StagingTestnet => chain_spec::staging_testnet_config(),
ChainSpec::CrayfishTestnet => chain_spec::crayfish_testnet_config(),
})
}

pub(crate) fn from(s: &str) -> Option<Self> {
match s {
"dev" => Some(ChainSpec::Development),
"local" => Some(ChainSpec::LocalTestnet),
"" | "fir" | "flaming-fir" => Some(ChainSpec::FlamingFir),
"fir" | "flaming-fir" => Some(ChainSpec::FlamingFir),
"staging" => Some(ChainSpec::StagingTestnet),
"" => Some(ChainSpec::CrayfishTestnet),
_ => None,
}
}
Expand Down Expand Up @@ -166,7 +169,12 @@ where
|exit, _cli_args, _custom_args, config: Config<_, _>| {
info!("{}", version.name);
info!(" version {}", config.full_version());
info!(" by Parity Technologies, 2017-2019");
info!(" _____ _ _ ");
info!(" | __ \\ (_) (_) ");
info!(" | | | | __ _ _ ____ ___ _ __ _ __ _ ");
info!(" | | | |/ _` | '__\\ \\ /\\ / / | '_ \\| |/ _` |");
info!(" | |__| | (_| | | \\ V V /| | | | | | (_| |");
info!(" |_____/ \\__,_|_| \\_/\\_/ |_|_| |_|_|\\__,_|");
info!("Chain specification: {}", config.chain_spec.name());
info!("Node name: {}", config.name);
info!("Roles: {:?}", config.roles);
Expand Down
2 changes: 1 addition & 1 deletion node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ parameter_types! {
impl session::Trait for Runtime {
type OnSessionEnding = Staking;
type SessionHandler = SessionHandlers;
type ShouldEndSession = session::PeriodicSessions<Period, Offset>;
type ShouldEndSession = Babe;
type Event = Event;
type Keys = SessionKeys;
type ValidatorId = <Self as system::Trait>::AccountId;
Expand Down
22 changes: 22 additions & 0 deletions srml/chainrelay/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "darwinia-chainrelay"
version = "0.1.0"
authors = ["hammeWang <dsw0602@foxmail.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rstd = { package = "sr-std", git = 'https://github.com/paritytech/substrate.git', default-features = false }
support = { package = "srml-support", git = 'https://github.com/paritytech/substrate.git', default-features = false }
system = { package = "srml-system", git = 'https://github.com/paritytech/substrate.git', default-features = false }
poa = { package = "darwinia-chainrelay-poa", path = "../chainrelay/poa", default-features = false }

[features]
default = ["std"]
std = [
"rstd/std",
"support/std",
"system/std",
"poa/std",
]
14 changes: 14 additions & 0 deletions srml/chainrelay/poa/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "darwinia-chainrelay-poa"
version = "0.1.0"
authors = ["hammeWang <dsw0602@foxmail.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]


[features]
default = ["std"]
std = []
4 changes: 4 additions & 0 deletions srml/chainrelay/poa/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub struct BestHeader<Hash> {
height: u64, // enough for ethereum poa network (kovan)
hash: Hash,
}
21 changes: 21 additions & 0 deletions srml/chainrelay/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! prototype module for bridging in ethereum poa blockcahin

#![recursion_limit = "128"]
#![cfg_attr(not(feature = "std"), no_std)]

use rstd::prelude::*;
use support::{decl_event, decl_module, decl_storage, ensure};

use poa::BestHeader;

pub trait Trait: system::Trait {}

decl_storage! {
trait Store for Module<T: Trait> as Bridge {
// we don't need to start from genesis block
pub InitialBlock get(initial_block) config(): T::BlockNumber;
// BestHeader
pub BestHeader get(best_header): BestHeader;

}
}