Skip to content

Commit

Permalink
Merge pull request #85 from hammeWang/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sekisamu authored Nov 1, 2019
2 parents 432b4a3 + b48b129 commit 7da6c5f
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 3 deletions.
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;

}
}

0 comments on commit 7da6c5f

Please sign in to comment.