diff --git a/Cargo.lock b/Cargo.lock index 03ecc657d..eea698b36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -660,6 +660,20 @@ dependencies = [ "vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "darwinia-chainrelay" +version = "0.1.0" +dependencies = [ + "darwinia-chainrelay-poa 0.1.0", + "sr-std 2.0.0 (git+https://github.com/paritytech/substrate.git)", + "srml-support 2.0.0 (git+https://github.com/paritytech/substrate.git)", + "srml-system 2.0.0 (git+https://github.com/paritytech/substrate.git)", +] + +[[package]] +name = "darwinia-chainrelay-poa" +version = "0.1.0" + [[package]] name = "darwinia-staking" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index adc22a05b..340f4c43d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,8 @@ members = [ "srml/kton", "srml/support", "srml/try", + "srml/chainrelay", + "srml/chainrelay/poa" ] exclude = ["node/runtime/wasm"] diff --git a/node/cli/src/lib.rs b/node/cli/src/lib.rs index 468333a5f..217b880b2 100644 --- a/node/cli/src/lib.rs +++ b/node/cli/src/lib.rs @@ -47,6 +47,7 @@ pub enum ChainSpec { FlamingFir, /// Whatever the current runtime is with the "global testnet" defaults. StagingTestnet, + CrayfishTestnet, } /// Custom subcommands. @@ -129,6 +130,7 @@ 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(), }) } @@ -136,8 +138,9 @@ impl ChainSpec { 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, } } @@ -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); diff --git a/node/runtime/src/lib.rs b/node/runtime/src/lib.rs index f837c9a1a..27f8e1e81 100644 --- a/node/runtime/src/lib.rs +++ b/node/runtime/src/lib.rs @@ -264,7 +264,7 @@ parameter_types! { impl session::Trait for Runtime { type OnSessionEnding = Staking; type SessionHandler = SessionHandlers; - type ShouldEndSession = session::PeriodicSessions; + type ShouldEndSession = Babe; type Event = Event; type Keys = SessionKeys; type ValidatorId = ::AccountId; diff --git a/srml/chainrelay/Cargo.toml b/srml/chainrelay/Cargo.toml new file mode 100644 index 000000000..c42d9bb81 --- /dev/null +++ b/srml/chainrelay/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "darwinia-chainrelay" +version = "0.1.0" +authors = ["hammeWang "] +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", +] \ No newline at end of file diff --git a/srml/chainrelay/poa/Cargo.toml b/srml/chainrelay/poa/Cargo.toml new file mode 100644 index 000000000..252e715c9 --- /dev/null +++ b/srml/chainrelay/poa/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "darwinia-chainrelay-poa" +version = "0.1.0" +authors = ["hammeWang "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + + +[features] +default = ["std"] +std = [] \ No newline at end of file diff --git a/srml/chainrelay/poa/src/lib.rs b/srml/chainrelay/poa/src/lib.rs new file mode 100644 index 000000000..69529b312 --- /dev/null +++ b/srml/chainrelay/poa/src/lib.rs @@ -0,0 +1,4 @@ +pub struct BestHeader { + height: u64, // enough for ethereum poa network (kovan) + hash: Hash, +} diff --git a/srml/chainrelay/src/lib.rs b/srml/chainrelay/src/lib.rs new file mode 100644 index 000000000..acc6c9867 --- /dev/null +++ b/srml/chainrelay/src/lib.rs @@ -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 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; + + } +}