Serialisable genesis config (#229)

* Genesis serialization

* Custom type for AuthorityId

* Merge w master

* Fixed a few minor issues

* Fixed unmerged file

* Renamed tag

* Deferred genesis loading

* Upated wasm runtime

* Minor issues
This commit is contained in:
Arkadiy Paronyan
2018-07-03 15:56:01 +02:00
committed by Gav Wood
parent 276c464b50
commit 9b885ba092
51 changed files with 557 additions and 368 deletions
+5 -5
View File
@@ -49,7 +49,7 @@ pub mod error;
use std::sync::Arc;
use demo_primitives::Hash;
use demo_runtime::{Block, BlockId, UncheckedExtrinsic, BuildStorage, GenesisConfig,
use demo_runtime::{Block, BlockId, UncheckedExtrinsic, GenesisConfig,
ConsensusConfig, CouncilConfig, DemocracyConfig, SessionConfig, StakingConfig,
TimestampConfig};
use futures::{Future, Sink, Stream};
@@ -101,10 +101,10 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
let executor = demo_executor::Executor::new();
let god_key = hex!["3d866ec8a9190c8343c2fc593d21d8a6d0c5c4763aaab2349de3a6111d64d124"];
let genesis_storage = GenesisConfig {
let genesis_config = GenesisConfig {
consensus: Some(ConsensusConfig {
code: vec![], // TODO
authorities: vec![god_key.clone()],
authorities: vec![god_key.clone().into()],
}),
system: None,
session: Some(SessionConfig {
@@ -152,9 +152,9 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
timestamp: Some(TimestampConfig {
period: 5, // 5 second block time.
}),
}.build_storage();
};
let client = Arc::new(client::new_in_mem::<_, Block, _>(executor, genesis_storage)?);
let client = Arc::new(client::new_in_mem::<_, Block, _>(executor, genesis_config)?);
let mut core = ::tokio_core::reactor::Core::new().expect("Unable to spawn event loop.");
let _rpc_servers = {
+1 -1
View File
@@ -207,7 +207,7 @@ mod tests {
democracy: Some(Default::default()),
council: Some(Default::default()),
timestamp: Some(Default::default()),
}.build_storage()
}.build_storage().unwrap()
}
fn construct_block(number: BlockNumber, parent_hash: Hash, state_root: Hash, extrinsics: Vec<BareExtrinsic>) -> (Vec<u8>, Hash) {
+1 -1
View File
@@ -97,7 +97,7 @@ pub type Timestamp = timestamp::Module<Concrete>;
pub struct SessionKeyConversion;
impl Convert<AccountId, SessionKey> for SessionKeyConversion {
fn convert(a: AccountId) -> SessionKey {
a.0
a.0.into()
}
}
-18
View File
@@ -172,11 +172,6 @@ dependencies = [
name = "environmental"
version = "0.1.0"
[[package]]
name = "error-chain"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ethbloom"
version = "0.5.0"
@@ -329,16 +324,6 @@ dependencies = [
"tiny-keccak 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "kvdb"
version = "0.1.0"
source = "git+https://github.com/paritytech/parity.git#dec390a89fe038337399315daf15e628ffbb4d8e"
dependencies = [
"elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bytes 0.1.0 (git+https://github.com/paritytech/parity.git)",
]
[[package]]
name = "lazy_static"
version = "0.2.11"
@@ -995,7 +980,6 @@ dependencies = [
"ethereum-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hashdb 0.1.1 (git+https://github.com/paritytech/parity.git)",
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kvdb 0.1.0 (git+https://github.com/paritytech/parity.git)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"memorydb 0.1.1 (git+https://github.com/paritytech/parity.git)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1182,7 +1166,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a2f4a431c5c9f662e1200b7c7f02c34e91361150e382089a8f2dec3ba680cbda"
"checksum elastic-array 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88d4851b005ef16de812ea9acdb7bece2f0a40dd86c07b85631d7dafa54537bb"
"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b"
"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
"checksum ethbloom 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a93a43ce2e9f09071449da36bfa7a1b20b950ee344b6904ff23de493b03b386"
"checksum ethcore-bytes 0.1.0 (git+https://github.com/paritytech/parity.git)" = "<none>"
"checksum ethcore-logger 1.12.0 (git+https://github.com/paritytech/parity.git)" = "<none>"
@@ -1200,7 +1183,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum integer-sqrt 0.1.0 (git+https://github.com/paritytech/integer-sqrt-rs.git)" = "<none>"
"checksum keccak-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b7f51f30d7986536accaec4a6a288008dfb3dbffe8a2863a65292bc395a3ae7"
"checksum keccak-hash 0.1.2 (git+https://github.com/paritytech/parity.git)" = "<none>"
"checksum kvdb 0.1.0 (git+https://github.com/paritytech/parity.git)" = "<none>"
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
"checksum lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e6412c5e2ad9584b0b8e979393122026cdd6d2a80b933f890dcd694ddbe73739"
"checksum libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)" = "ac8ebf8343a981e2fa97042b14768f02ed3e1d602eac06cae6166df3c8ced206"