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

Commit

Permalink
Make Polkadot use the Substrate traity libraries (#105)
Browse files Browse the repository at this point in the history
* Initial stuff.

* Various fixes.

* Fix tests.

* Fix another test

* Fix another test.

* Docs in polkadot runtime.

* Fix up ser/de tests.

* Update god keys

* Syntax

* Fix

* Merge remote-tracking branch 'origin/master' into gav-merge-runtime

* Permissions on init.sh

* Port-over the whitespace from @rphmeier

* Rename

* Merge branch 'master' into gav-merge-runtime

* Fix typo.

* Fix grumbles.

* Make more idiomatic.

* Move `Ed25519Signature` out of traits.
  • Loading branch information
gavofyork authored and rphmeier committed Apr 5, 2018
1 parent 9d0c4fb commit ef9a426
Show file tree
Hide file tree
Showing 60 changed files with 1,328 additions and 3,629 deletions.
28 changes: 26 additions & 2 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 demo/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub fn run<I, T>(args: I) -> error::Result<()> where

let genesis_config = GenesisConfig {
consensus: Some(ConsensusConfig {
code: vec![], // TODO
authorities: vec![god_key.clone()],
}),
system: None,
Expand Down
4 changes: 2 additions & 2 deletions demo/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ mod tests {
construct_block(
1,
[69u8; 32].into(),
hex!("4d58afeca0dec7604a0bcfb29573e6ad202efe65c8535b013c0c79b5a8c9114d").into(),
hex!("57ba67304318efaee95c4f9ab95ed5704eafe030bc8db2df00acb08c2f4979c8").into(),
vec![Extrinsic {
signed: Alice.into(),
index: 0,
Expand All @@ -210,7 +210,7 @@ mod tests {
construct_block(
2,
block1().1,
hex!("218ce7bdf2350713aa52dbf0a12d1e8b0a3a9f1623e7c95aa4800886e96397d1").into(),
hex!("ead4c60c0cad06b7ee73e64efeec2d4eb82c651469fb2ec748cfe5026bea5c49").into(),
vec![
Extrinsic {
signed: Bob.into(),
Expand Down
2 changes: 1 addition & 1 deletion demo/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ pub type Index = u64;
pub type Hash = primitives::H256;

/// Alias to 512-bit hash when used in the context of a signature on the relay chain.
pub type Signature = runtime_primitives::traits::Ed25519Signature;
pub type Signature = runtime_primitives::Ed25519Signature;
31 changes: 16 additions & 15 deletions demo/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,6 @@ impl HasPublicAux for Concrete {
type PublicAux = AccountId;
}

impl timestamp::Trait for Concrete {
type Value = u64;
}

/// Timestamp module for this concrete runtime.
pub type Timestamp = timestamp::Module<Concrete>;

impl consensus::Trait for Concrete {
type SessionKey = SessionKey;
}

/// Consensus module for this concrete runtime.
pub type Consensus = consensus::Module<Concrete>;

impl system::Trait for Concrete {
type Index = Index;
type BlockNumber = BlockNumber;
Expand All @@ -81,8 +67,22 @@ impl system::Trait for Concrete {
/// System module for this concrete runtime.
pub type System = system::Module<Concrete>;

impl session::Trait for Concrete {
impl consensus::Trait for Concrete {
type PublicAux = <Self as HasPublicAux>::PublicAux;
type SessionKey = SessionKey;
}

/// Consensus module for this concrete runtime.
pub type Consensus = consensus::Module<Concrete>;

impl timestamp::Trait for Concrete {
type Value = u64;
}

/// Timestamp module for this concrete runtime.
pub type Timestamp = timestamp::Module<Concrete>;

impl session::Trait for Concrete {
type ConvertAccountIdToSessionKey = Identity;
}

Expand Down Expand Up @@ -113,6 +113,7 @@ pub type CouncilVoting = council::voting::Module<Concrete>;

impl_outer_dispatch! {
pub enum Call where aux: <Concrete as HasPublicAux>::PublicAux {
Consensus = 0,
Session = 1,
Staking = 2,
Timestamp = 3,
Expand Down
5 changes: 5 additions & 0 deletions demo/runtime/wasm/Cargo.lock

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

Binary file not shown.
Binary file modified demo/runtime/wasm/target/wasm32-unknown-unknown/release/demo_runtime.wasm
100644 → 100755
Binary file not shown.
3 changes: 3 additions & 0 deletions polkadot/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ error-chain = "0.11"
polkadot-executor = { path = "../executor" }
polkadot-runtime = { path = "../runtime" }
polkadot-primitives = { path = "../primitives" }
substrate-codec = { path = "../../substrate/codec" }
substrate-runtime-io = { path = "../../substrate/runtime-io" }
substrate-client = { path = "../../substrate/client" }
substrate-primitives = { path = "../../substrate/primitives" }
substrate-executor = { path = "../../substrate/executor" }
substrate-state-machine = { path = "../../substrate/state-machine" }

Expand Down
Loading

0 comments on commit ef9a426

Please sign in to comment.