mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-11-08 11:51:07 +00:00
Make everything compile and fix tests
This commit is contained in:
1 parent
f9a7199b65
commit
1bcb147669
26 files changed
+5214
-3536
No files matched your search
@@ -7,8 +7,8 @@ edition = "2018"
|
||||
[dependencies]
|
||||
test-client = { package = "substrate-test-client", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
runtime = { package = "cumulus-test-runtime", path = "../runtime" }
|
||||
runtime_primitives = { package = "sr-primitives", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
keyring = { package = "substrate-keyring", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = [ "derive" ] }
|
||||
|
||||
+27
-22
@@ -16,15 +16,18 @@
|
||||
|
||||
//! A Cumulus test client.
|
||||
|
||||
pub use test_client::*;
|
||||
pub use runtime;
|
||||
use runtime::{Block, genesismap::{GenesisConfig, additional_storage_with_genesis}};
|
||||
use runtime_primitives::traits::{Hash as HashT, Header as HeaderT, Block as BlockT};
|
||||
use primitives::{storage::well_known_keys, sr25519};
|
||||
use keyring::{Sr25519Keyring, AccountKeyring};
|
||||
use runtime::{
|
||||
genesismap::{additional_storage_with_genesis, GenesisConfig},
|
||||
Block,
|
||||
};
|
||||
use sp_core::{sr25519, storage::Storage};
|
||||
use sp_keyring::{AccountKeyring, Sr25519Keyring};
|
||||
use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT};
|
||||
pub use test_client::*;
|
||||
|
||||
mod local_executor {
|
||||
use test_client::executor::native_executor_instance;
|
||||
use test_client::sc_executor::native_executor_instance;
|
||||
native_executor_instance!(
|
||||
pub LocalExecutor,
|
||||
runtime::api::dispatch,
|
||||
@@ -39,16 +42,17 @@ pub use local_executor::LocalExecutor;
|
||||
pub type Backend = test_client::Backend<Block>;
|
||||
|
||||
/// Test client executor.
|
||||
pub type Executor = client::LocalCallExecutor<Backend, executor::NativeExecutor<LocalExecutor>>;
|
||||
pub type Executor =
|
||||
sc_client::LocalCallExecutor<Backend, sc_executor::NativeExecutor<LocalExecutor>>;
|
||||
|
||||
/// Test client builder for Cumulus
|
||||
pub type TestClientBuilder = test_client::TestClientBuilder<Executor, Backend, GenesisParameters>;
|
||||
|
||||
/// LongestChain type for the test runtime/client.
|
||||
pub type LongestChain = test_client::client::LongestChain<Backend, Block>;
|
||||
pub type LongestChain = test_client::sc_client::LongestChain<Backend, Block>;
|
||||
|
||||
/// Test client type with `LocalExecutor` and generic Backend.
|
||||
pub type Client = client::Client<Backend, Executor, Block, runtime::RuntimeApi>;
|
||||
pub type Client = sc_client::Client<Backend, Executor, Block, runtime::RuntimeApi>;
|
||||
|
||||
/// Parameters of test-client builder with test-runtime.
|
||||
#[derive(Default)]
|
||||
@@ -57,22 +61,24 @@ pub struct GenesisParameters {
|
||||
}
|
||||
|
||||
impl test_client::GenesisInit for GenesisParameters {
|
||||
fn genesis_storage(&self) -> (StorageOverlay, ChildrenStorageOverlay) {
|
||||
fn genesis_storage(&self) -> Storage {
|
||||
use codec::Encode;
|
||||
let mut storage = genesis_config(self.support_changes_trie).genesis_map();
|
||||
storage.0.insert(well_known_keys::CODE.to_vec(), runtime::WASM_BINARY.to_vec());
|
||||
|
||||
let child_roots = storage.1.iter().map(|(sk, child_map)| {
|
||||
let state_root = <<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
child_map.clone().into_iter().collect()
|
||||
);
|
||||
let mut storage = genesis_config(self.support_changes_trie).genesis_map();
|
||||
|
||||
let child_roots = storage.children.iter().map(|(sk, child_content)| {
|
||||
let state_root =
|
||||
<<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
child_content.data.clone().into_iter().collect(),
|
||||
);
|
||||
(sk.clone(), state_root.encode())
|
||||
});
|
||||
let state_root = <<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
storage.0.clone().into_iter().chain(child_roots).collect()
|
||||
);
|
||||
let block: runtime::Block = client::genesis::construct_genesis_block(state_root);
|
||||
storage.0.extend(additional_storage_with_genesis(&block));
|
||||
let state_root =
|
||||
<<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
storage.top.clone().into_iter().chain(child_roots).collect(),
|
||||
);
|
||||
let block: runtime::Block = sc_client::genesis::construct_genesis_block(state_root);
|
||||
storage.top.extend(additional_storage_with_genesis(&block));
|
||||
|
||||
storage
|
||||
}
|
||||
@@ -129,7 +135,6 @@ fn genesis_config(support_changes_trie: bool) -> GenesisConfig {
|
||||
AccountKeyring::Charlie.into(),
|
||||
],
|
||||
1000,
|
||||
None,
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
)
|
||||
|
||||
+19
-16
@@ -12,31 +12,33 @@ path = 'src/main.rs'
|
||||
[dependencies]
|
||||
derive_more = '0.15.0'
|
||||
exit-future = '0.1.4'
|
||||
futures = '0.1.29'
|
||||
futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] }
|
||||
futures = { version = "0.3.1", features = ["compat"] }
|
||||
log = '0.4.8'
|
||||
parking_lot = '0.9.0'
|
||||
tokio = '0.1.22'
|
||||
trie-root = '0.15.2'
|
||||
codec = { package = 'parity-scale-codec', version = '1.0.0' }
|
||||
parachain-runtime = { package = "cumulus-test-parachain-runtime", path = "runtime" }
|
||||
structopt = "0.3.3"
|
||||
ctrlc = { version = "3.1.3", features = ["termination"] }
|
||||
|
||||
# Parachain dependencies
|
||||
parachain-runtime = { package = "cumulus-test-parachain-runtime", path = "runtime" }
|
||||
|
||||
# Substrate dependencies
|
||||
sr-primitives = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sr-io = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
substrate-cli = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
substrate-primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
substrate-executor = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
substrate-service = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
inherents = { package = "substrate-inherents", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
transaction-pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
network = { package = "substrate-network", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
srml-timestamp = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
basic-authorship = { package = "substrate-basic-authorship", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
consensus-common = { package = "substrate-consensus-common", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sc-service = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sc-network = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sc-client = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sc-basic-authority = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-consensus = { path = "../../consensus" }
|
||||
@@ -45,6 +47,7 @@ cumulus-collator = { path = "../../collator" }
|
||||
# Polkadot dependencies
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" }
|
||||
polkadot-collator = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" }
|
||||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" }
|
||||
|
||||
[build-dependencies]
|
||||
vergen = '3.0.4'
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
use vergen::{ConstantsFlags, generate_cargo_keys};
|
||||
use vergen::{generate_cargo_keys, ConstantsFlags};
|
||||
|
||||
const ERROR_MSG: &str = "Failed to generate metadata files";
|
||||
|
||||
@@ -24,13 +24,16 @@ fn main() {
|
||||
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
|
||||
|
||||
let mut manifest_dir = PathBuf::from(
|
||||
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo.")
|
||||
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is always set by cargo."),
|
||||
);
|
||||
|
||||
while manifest_dir.parent().is_some() {
|
||||
if manifest_dir.join(".git/HEAD").exists() {
|
||||
println!("cargo:rerun-if-changed={}", manifest_dir.join(".git/HEAD").display());
|
||||
return
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}",
|
||||
manifest_dir.join(".git/HEAD").display()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
manifest_dir.pop();
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"name": "Local Testnet",
|
||||
"id": "local_testnet",
|
||||
"bootNodes": [],
|
||||
"telemetryEndpoints": null,
|
||||
"protocolId": "dot",
|
||||
"properties": null,
|
||||
"forkBlocks": null,
|
||||
"badBlocks": null,
|
||||
"consensusEngine": null,
|
||||
"genesis": {
|
||||
"raw": {
|
||||
"top": {
|
||||
"0x3a65787472696e7369635f696e646578": "0x00000000",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac": "0x01000000",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef7a44704b568d21667356a5a050c11874611da6d1f761ddf9bdb4c9d6e5303ebd41f61858d0a5647a1a7bfe089bf921be9": "0x4545454545454545454545454545454545454545454545454545454545454545",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca88dcde934c658227ee1dfafcd6e169039a9304efeee429067b2e8dfbcfd8a22d96f9d996a5d6daa02899b96bd7a667b1": "0x000001be5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca28dccb559b95c40168a1b2696581b5a7": "0x00000000000000000000000000000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca422adb579f1dbf4f3886c5cfa3bb8cc42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba": "0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f0b00407a10f35a0b00407a10f35a00",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca88dcde934c658227ee1dfafcd6e169034724e5390fcf0d08afc9608ff4c45df257266ae599ac7a32baba26155dcf4402": "0x0001fe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e00",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca9220e172bed316605f73f1ff7b4ade984724e5390fcf0d08afc9608ff4c45df257266ae599ac7a32baba26155dcf4402": "0x00",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b4c4a80eb5e32005323fb878ca749473d7e5f40d60ed5e74e887bc125a3659f258": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba04c014e6bf8b8c2c011e7290b85696bb39fe6329cc0b39e09343a73657373696f6e3a6b6579734724e5390fcf0d08afc9608ff4c45df257266ae599ac7a32baba26155dcf4402": "0x88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0eed43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b657973cd9a09d6a67c0c3940e99786404c36c6d220e3bb8003f1ac1dda3a49b72ebc90": "0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0x5f3e4907f716ac89b6347d15ececedcaf7dad0317324aecae8744b87fc95f2f3": "0x00",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba04c014e6bf8b8c2c011e7290b85696bb39fe6329cc0b39e09343a73657373696f6e3a6b6579739a9304efeee429067b2e8dfbcfd8a22d96f9d996a5d6daa02899b96bd7a667b1": "0xd17c2d7823ebf260fd138f2d7e27d114c0145d968b5ff5006125f2414fadae698eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a488eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a488eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a488eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b6579733b07ae43d4d18b2f6a5ce4eabef01ad3860523243fb4bb3a6a4922750c1d7e4b": "0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b4a315ee9e56d2f3bb24992a1cff6617b0f7510628a15722b680c42c2be8bb7452": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b49a9304efeee429067b2e8dfbcfd8a22d96f9d996a5d6daa02899b96bd7a667b1": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca308ce9615de0775a82f8a94dc3d285a1": "0x01000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca9cbd2f0b29a008a36009ac44cca0c969": "0x00407a10f35a00000000000000000000",
|
||||
"0x1a736d37504c2e3fb73dad160c55b2917ac6a308d645671864cda07d358e751211da6d1f761ddf9bdb4c9d6e5303ebd41f61858d0a5647a1a7bfe089bf921be9": "0x30d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a4890b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22306721211d5404bd9da88e0204360a1a9ab8b87c66c1bc2fcdd37f3c2222cc20e659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e1cbd2d43530a44705ad088af313e18f80b53ef16b36177cd4b77b846f2a5f07cbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25ffe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e1e07379407fecc4b89eb7dbd287c2c781cfb1907a96947a3eb18e4f8e7198625e860f1b1c7227f7c22602f53f15af80747814dffd839719731ee3bba6edc126c8ac59e11963af19174d0b94d5d78041c233f55d2e19324665bafdfb62925af2d101191192fc877c24d725b337120fa3edc63d227bbc92705db1e2cb65f56981a",
|
||||
"0x3fba98689ebed1138735e0e7a5a790ab0b76934f4cc08dee01012d059e1b83ee": "0x00",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f218f26c73add634897550b4003b26bc64724e5390fcf0d08afc9608ff4c45df257266ae599ac7a32baba26155dcf4402": "0x047374616b696e672000407a10f35a00000000000000000000ffffffff1f",
|
||||
"0x5f3e4907f716ac89b6347d15ececedcac29a0310e1bb45d20cace77ccb62c97d": "0x00e1f505",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca0b6a45321efae92aea15e0740ec7afe7": "0x00000000",
|
||||
"0x0b76934f4cc08dee01012d059e1b83ee5e0621c4869aa60c02be9adcc98a0d1d": "0x088eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
|
||||
"0x2099d7f109d6e535fb000bba623fd4409f99a2ce711f3a31b2fc05604c93f179": "0x088eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef78a42f33323cb5ced3b44dd825fda9fcc": "0x4545454545454545454545454545454545454545454545454545454545454545",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b465d0de2c1f75d898c078307a00486016783280c8f3407db41dc9547d3e3d651e": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b49ea52149af6b15f4d523ad4342f63089646e29232a1777737159c7bc84173597": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0x5c0d1176a568c1f92944340dbfed9e9c530ebca703c85910e7164cb7d1c9e47b": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca0ea0ecac76457d0f9b39b981dd107012": "0x08fe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860ebe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0xf2794c22e353e9a839f12faab03a911be2f6cb0456905c189bcb0458f9440f13": "0x00000000",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b65797379b1148d2eef14114c422e7d0647dde06e73c1ab283dce7d8a383ae6f948faf1": "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",
|
||||
"0x1a736d37504c2e3fb73dad160c55b291b35b5a09b938edfd10fcbacc615abb0c": "0x00000000",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b4927407fbcfe5afa14bcfb44714a843c532f291a9c33612677cb9e0ae5e2bd5de": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe709a9304efeee429067b2e8dfbcfd8a22d96f9d996a5d6daa02899b96bd7a667b1": "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f218f26c73add634897550b4003b26bc69a9304efeee429067b2e8dfbcfd8a22d96f9d996a5d6daa02899b96bd7a667b1": "0x047374616b696e672000407a10f35a00000000000000000000ffffffff1f",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b6579739b94324fd570688c7f3c5e3d0b90af7ae011ebcfe3e4d92e027ffbdf0db62684": "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca422adb579f1dbf4f3886c5cfa3bb8cc494772f97f5f6b539aac74e798bc395119f39603402d0c85bc9eda5dfc5ae2160": "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e0b00407a10f35a0b00407a10f35a00",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca83e585bbc5fdcec57219c0dc81ef5ff49a9304efeee429067b2e8dfbcfd8a22d96f9d996a5d6daa02899b96bd7a667b1": "0x0b00407a10f35a0b00407a10f35a00",
|
||||
"0x2b06af9719ac64d755623cda8ddd9b949f99a2ce711f3a31b2fc05604c93f179": "0x088eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
|
||||
"0x3a636f6465": "0x0061736d0100000001a4022b60037f7f7f017f60027f7f017f60027f7f0060017f0060017f017e60037f7e7e0060017e017f60027e7e0060037f7e7f017f60017e0060017e017e6000017f60027f7e017e60047f7e7e7e017f60027f7e017f6000017e60037f7f7e017e60027f7f017e60017f017f60037e7e7f017e60000060037f7f7f0060057f7f7f7f7f0060027e7f017f60057f7f7f7f7f017f60047f7f7f7f017f60047f7f7f7f0060067f7f7f7f7f7f0060047f7f7e7e0060067f7f7e7e7f7f0060057f7f7f7e7e0060027f7e0060067f7f7f7e7e7f0060077f7f7f7f7f7e7e0060027e7f0060077f7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017f60067f7e7e7f7f7f0060047f7e7e7e0060057f7e7e7f7f0060047f7e7e7f0060057f7e7e7e7e0060067f7e7e7e7e7f0002ca0a2103656e76196578745f6c6f6767696e675f6c6f675f76657273696f6e5f31000503656e76206578745f68617368696e675f626c616b65325f3235365f76657273696f6e5f31000603656e76196578745f73746f726167655f7365745f76657273696f6e5f31000703656e761e6578745f68617368696e675f74776f785f3132385f76657273696f6e5f31000603656e76236578745f63727970746f5f737232353531395f7665726966795f76657273696f6e5f31000803656e761b6578745f73746f726167655f636c6561725f76657273696f6e5f31000903656e76196578745f73746f726167655f6765745f76657273696f6e5f31000a03656e761d6578745f6d6973635f7072696e745f757466385f76657273696f6e5f31000903656e76226578745f73746f726167655f636c6561725f7072656669785f76657273696f6e5f31000903656e76206578745f68617368696e675f6b656363616b5f3235365f76657273696f6e5f31000603656e76236578745f63727970746f5f656432353531395f7665726966795f76657273696f6e5f31000803656e761d6578745f68617368696e675f74776f785f36345f76657273696f6e5f31000603656e761c6578745f6d6973635f7072696e745f6865785f76657273696f6e5f31000903656e76236578745f6f6666636861696e5f69735f76616c696461746f725f76657273696f6e5f31000b03656e76286578745f6f6666636861696e5f6c6f63616c5f73746f726167655f6765745f76657273696f6e5f31000c03656e76346578745f6f6666636861696e5f6c6f63616c5f73746f726167655f636f6d706172655f616e645f7365745f76657273696f6e5f31000d03656e76286578745f6f6666636861696e5f6c6f63616c5f73746f726167655f7365745f76657273696f6e5f31000503656e76256578745f63727970746f5f656432353531395f67656e65726174655f76657273696f6e5f31000e03656e761a6578745f73746f726167655f726f6f745f76657273696f6e5f31000f03656e76226578745f73746f726167655f6368616e6765735f726f6f745f76657273696f6e5f31000a03656e76206578745f68617368696e675f626c616b65325f3132385f76657273696f6e5f31000603656e76256578745f63727970746f5f737232353531395f67656e65726174655f76657273696f6e5f31000e03656e76296578745f6f6666636861696e5f7375626d69745f7472616e73616374696f6e5f76657273696f6e5f31000a03656e76246578745f6f6666636861696e5f6e6574776f726b5f73746174655f76657273696f6e5f31000f03656e76286578745f63727970746f5f737232353531395f7075626c69635f6b6579735f76657273696f6e5f31000403656e76216578745f63727970746f5f737232353531395f7369676e5f76657273696f6e5f31001003656e762c6578745f63727970746f5f736563703235366b315f65636473615f7265636f7665725f76657273696f6e5f31001103656e76376578745f63727970746f5f736563703235366b315f65636473615f7265636f7665725f636f6d707265737365645f76657273696f6e5f31001103656e761e6578745f616c6c6f6361746f725f6d616c6c6f635f76657273696f6e5f31001203656e761c6578745f616c6c6f6361746f725f667265655f76657273696f6e5f31000303656e761a6578745f73746f726167655f726561645f76657273696f6e5f31001303656e762a6578745f747269655f626c616b65325f3235365f6f7264657265645f726f6f745f76657273696f6e5f31000603656e761c6578745f6d6973635f7072696e745f6e756d5f76657273696f6e5f31000903bd04bb0412120303000012121114141415021500141603000101020117030418190202001a0101011201010101150101001a03010100010100010003010101020202150102010001010203021a02020202020202021203021501020203030202020202020202120112020215020302150115021b02010303051c15030305030705031d1e1f0102020202021c151d1c1e1c050303020302020303030202151515150302020303200303030303030303030303030303030303030302030102020202020202020202020202120215020215021515021a02020212020202020202021a020702021a021a2102020216151412121502020303150303020202020215030203020f0215150202030302021622151602020202021502151a020203150303020b120202151a020315021515021501150202150315030303020202020216030215030303020303020202151a0202011a020201020215140202020216020202232401161a05020315030203021203020303030202020219030303020303030202020202030303012526020202021202020202020202020202020203030203030201150203020302020303030203111103021a02031111110211111111111511020316001111111111111111111111151111030202120202030303030203030303020203010215150302030202031c020202270202031403021502020202030202151e0202030101140b03030203031a020212030302020203020202021603020302030303020202030303151512010102050101160000000028282929292a0407017001b801b80105030100120619037f01418080c0000b7f004188d1c6000b7f004188d1c6000b07b0061d066d656d6f72790200195f5f696e6469726563745f66756e6374696f6e5f7461626c6501000a5f5f646174615f656e6403010b5f5f686561705f62617365030209686173685f7465737400290c436f72655f76657273696f6e00cb0312436f72655f657865637574655f626c6f636b00cc0315436f72655f696e697469616c697a655f626c6f636b00d203114d657461646174615f6d6574616461746100d3031c426c6f636b4275696c6465725f6170706c795f65787472696e73696300d4031b426c6f636b4275696c646572Line truncated
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b657973538a5b67f2b6e2a4e04e3a0121d75f4d0efb5bd14689ab4a07cbff45b88e7f7d": "0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0xf2794c22e353e9a839f12faab03a911b7f17cdfbfa73331856cca0acddd7842e": "0x00000000",
|
||||
"0x9c5d795d0297be56027a4b2464e33397f43d6436dec51f09c3b71287a8fc9d48": "0x00000000000000000000000000000000",
|
||||
"0x3a6772616e6470615f617574686f726974696573": "0x0108d17c2d7823ebf260fd138f2d7e27d114c0145d968b5ff5006125f2414fadae69010000000000000088dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee0100000000000000",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b454b75224d766c852ac60eb44e1329aec5058574ae8daf703d43bc2fbd9f33d6c": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b65797308219184be6a65e5100ee2c171c4c477d68940c58d3253a46259bf1014f484d9": "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba088dcde934c658227ee1dfafcd6e16903": "0x08fe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860ebe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca5579297f4dfb9609e7e4c2ebab9ce40a": "0x08be5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25ffe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b65797342a1d578558b434ecac1371dde376dca0109923708bad2f9b39a39fe726cba7e": "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",
|
||||
"0x2371e21684d2fae99bcb4d579242f74a8a2d09463effcc78a22d75b9cb87dffc": "0x0000000000000000",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b6579734d2dcad73929f2afb5515ffc71c2142294a1e3f04d440e4a8de86030a47b0093": "0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0e0cdd062e6eaf24295ad4ccfc41d4609": "0x08fe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860ed17c2d7823ebf260fd138f2d7e27d114c0145d968b5ff5006125f2414fadae698eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a488eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a488eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a488eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48be5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0eed43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27dd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
|
||||
"0x1cb6f36e027abb2091cfb5110ab5087f5e0621c4869aa60c02be9adcc98a0d1d": "0x088eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a480100000000000000d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0100000000000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedcab49a2738eeb30896aacb8b3fb46471bd": "0x01000000",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b477d14a2289dda9bbb32dd9313db096ef628101ac5bbb3b19301ede2c61915b89": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0x1cb6f36e027abb2091cfb5110ab5087f66e8f035c8adbe7f1547b43c51e6f8a4": "0x00000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca138e71612491192d68deab7e6f563fe1": "0x02000000",
|
||||
"0x492a52699edf49c972c21db794cfcf57ba7fb8745735dc3be2a2c61a72c39e78": "0x00",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b42e3fb4c297a84c5cebc0e78257d213d0927ccc7596044c6ba013dd05522aacba": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca6a93112633bb3354e67952fcdd740cd5": "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b494772f97f5f6b539aac74e798bc395119f39603402d0c85bc9eda5dfc5ae2160": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b657973bac7529970f762c176f48cd3fbb3ba96612765c95390df59eaf282193664c85e": "0xbe5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca83e585bbc5fdcec57219c0dc81ef5ff44724e5390fcf0d08afc9608ff4c45df257266ae599ac7a32baba26155dcf4402": "0x0b00407a10f35a0b00407a10f35a00",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80": "0x0000b0d86b9088a60000000000000000",
|
||||
"0xcec5070d609dd3497f72bde07fc96ba0726380404683fc89e8233450c8aa19509fe6329cc0b39e09343a73657373696f6e3a6b65797303ab9ef4e6c4b0eea2939ffa571bac1fde2ed0137bd64339758ce9a753a4af0c": "0xfe65717dad0447d715f660a0a58411de509b42e6efb8375f562f58a554d5860e",
|
||||
"0xf2794c22e353e9a839f12faab03a911bbdcb0c5143a8617ed38ae3810dd45bc6": "0x00000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca9220e172bed316605f73f1ff7b4ade989a9304efeee429067b2e8dfbcfd8a22d96f9d996a5d6daa02899b96bd7a667b1": "0x00",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b44724e5390fcf0d08afc9608ff4c45df257266ae599ac7a32baba26155dcf4402": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0xc2261276cc9d1f8598ea4b6a74b15c2f6482b9ade7bc6657aaca787ba1add3b4024cd62ab7726e039438193d4bbd915427f2d7de85afbcf00bd16fadbcad6aed": "0x000064a7b3b6e00d0000000000000000",
|
||||
"0x5f3e4907f716ac89b6347d15ececedca3ed14b45ed20d054f05e37e2542cfe704724e5390fcf0d08afc9608ff4c45df257266ae599ac7a32baba26155dcf4402": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
|
||||
},
|
||||
"children": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,27 +6,30 @@ edition = '2018'
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
safe-mix = { version = "1.0.0", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] }
|
||||
|
||||
# Substrate dependencies
|
||||
rstd = { package = "sr-std", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
runtime-io = { package = "sr-io", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
version = { package = "sr-version", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
support = { package = "srml-support", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
substrate-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
balances = { package = "srml-balances", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
executive = { package = "srml-executive", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
indices = { package = "srml-indices", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
randomness-collective-flip = { package = "srml-randomness-collective-flip", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
system = { package = "srml-system", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
timestamp = { package = "srml-timestamp", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sudo = { package = "srml-sudo", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sr-primitives = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
offchain-primitives = { package = "substrate-offchain-primitives", git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
transaction-payment = { package = "srml-transaction-payment", git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
pallet-indices = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
pallet-sudo = { git = "https://github.com/paritytech/substrate", default_features = false, branch = "bkchr-cumulus-branch" }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" }
|
||||
|
||||
# Cumulus dependencies
|
||||
cumulus-runtime = { path = "../../../runtime", default-features = false }
|
||||
@@ -38,24 +41,26 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.
|
||||
default = ['std']
|
||||
std = [
|
||||
'codec/std',
|
||||
'client/std',
|
||||
'rstd/std',
|
||||
'runtime-io/std',
|
||||
'support/std',
|
||||
'balances/std',
|
||||
'executive/std',
|
||||
'indices/std',
|
||||
'primitives/std',
|
||||
'sr-primitives/std',
|
||||
'randomness-collective-flip/std',
|
||||
'system/std',
|
||||
'timestamp/std',
|
||||
'sudo/std',
|
||||
'version/std',
|
||||
'serde',
|
||||
'safe-mix/std',
|
||||
'offchain-primitives/std',
|
||||
'substrate-session/std',
|
||||
'sp-api/std',
|
||||
'sp-std/std',
|
||||
'sp-io/std',
|
||||
'sp-core/std',
|
||||
'sp-runtime/std',
|
||||
'sp-version/std',
|
||||
'sp-offchain/std',
|
||||
'sp-session/std',
|
||||
'sp-block-builder/std',
|
||||
'sp-transaction-pool/std',
|
||||
'sp-inherents/std',
|
||||
'frame-support/std',
|
||||
'frame-executive/std',
|
||||
'frame-system/std',
|
||||
'pallet-balances/std',
|
||||
'pallet-indices/std',
|
||||
'pallet-randomness-collective-flip/std',
|
||||
'pallet-timestamp/std',
|
||||
'pallet-sudo/std',
|
||||
'pallet-transaction-payment/std',
|
||||
'cumulus-runtime/std',
|
||||
'transaction-payment/std',
|
||||
]
|
||||
@@ -16,35 +16,35 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
|
||||
#![recursion_limit="256"]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
// Make the WASM binary available.
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
use rstd::prelude::*;
|
||||
use primitives::OpaqueMetadata;
|
||||
use sr_primitives::{
|
||||
ApplyResult, transaction_validity::TransactionValidity, generic, create_runtime_str,
|
||||
impl_opaque_keys, AnySignature
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::OpaqueMetadata;
|
||||
use sp_runtime::traits::{
|
||||
BlakeTwo256, Block as BlockT, ConvertInto, NumberFor, StaticLookup, Verify,
|
||||
};
|
||||
use sr_primitives::traits::{NumberFor, BlakeTwo256, Block as BlockT, StaticLookup, Verify, ConvertInto};
|
||||
use sr_primitives::weights::Weight;
|
||||
use client::{
|
||||
block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api},
|
||||
runtime_api as client_api, impl_runtime_apis
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys, transaction_validity::TransactionValidity,
|
||||
AnySignature, ApplyExtrinsicResult,
|
||||
};
|
||||
use version::RuntimeVersion;
|
||||
use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
use version::NativeVersion;
|
||||
use sp_version::NativeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
// A few exports that help ease life for downstream crates.
|
||||
pub use frame_support::{
|
||||
construct_runtime, parameter_types, traits::Randomness, weights::Weight, StorageValue,
|
||||
};
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sr_primitives::BuildStorage;
|
||||
pub use timestamp::Call as TimestampCall;
|
||||
pub use balances::Call as BalancesCall;
|
||||
pub use sr_primitives::{Permill, Perbill};
|
||||
pub use support::{StorageValue, construct_runtime, parameter_types, traits::Randomness};
|
||||
pub use sp_runtime::BuildStorage;
|
||||
pub use sp_runtime::{Perbill, Permill};
|
||||
|
||||
/// An index to a block.
|
||||
pub type BlockNumber = u32;
|
||||
@@ -67,7 +67,7 @@ pub type Balance = u128;
|
||||
pub type Index = u32;
|
||||
|
||||
/// A hash of some data used by the chain.
|
||||
pub type Hash = primitives::H256;
|
||||
pub type Hash = sp_core::H256;
|
||||
|
||||
/// Digest item type.
|
||||
pub type DigestItem = generic::DigestItem<Hash>;
|
||||
@@ -79,7 +79,7 @@ pub type DigestItem = generic::DigestItem<Hash>;
|
||||
pub mod opaque {
|
||||
use super::*;
|
||||
|
||||
pub use sr_primitives::OpaqueExtrinsic as UncheckedExtrinsic;
|
||||
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
|
||||
|
||||
/// Opaque block header type.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
@@ -136,7 +136,7 @@ parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
}
|
||||
|
||||
impl system::Trait for Runtime {
|
||||
impl frame_system::Trait for Runtime {
|
||||
/// The identifier used to distinguish between accounts.
|
||||
type AccountId = AccountId;
|
||||
/// The aggregated dispatch type that is available for extrinsics.
|
||||
@@ -165,15 +165,18 @@ impl system::Trait for Runtime {
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
/// Portion of the block weight that is available to all normal transactions.
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
/// Runtime version.
|
||||
type Version = Version;
|
||||
/// Converts a module to an index of this module in the runtime.
|
||||
type ModuleToIndex = ModuleToIndex;
|
||||
}
|
||||
|
||||
impl indices::Trait for Runtime {
|
||||
impl pallet_indices::Trait for Runtime {
|
||||
/// The type for recording indexing into the account enumeration. If this ever overflows, there
|
||||
/// will be problems!
|
||||
type AccountIndex = u32;
|
||||
/// Use the standard means of resolving an index hint from an id.
|
||||
type ResolveHint = indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
|
||||
type ResolveHint = pallet_indices::SimpleResolveHint<Self::AccountId, Self::AccountIndex>;
|
||||
/// Determine whether an account is dead.
|
||||
type IsDeadAccount = Balances;
|
||||
/// The ubiquitous event type.
|
||||
@@ -184,7 +187,7 @@ parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl timestamp::Trait for Runtime {
|
||||
impl pallet_timestamp::Trait for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
@@ -199,7 +202,7 @@ parameter_types! {
|
||||
pub const TransactionByteFee: u128 = 1;
|
||||
}
|
||||
|
||||
impl balances::Trait for Runtime {
|
||||
impl pallet_balances::Trait for Runtime {
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
/// What to do if an account's free balance gets zeroed.
|
||||
@@ -215,7 +218,7 @@ impl balances::Trait for Runtime {
|
||||
type CreationFee = CreationFee;
|
||||
}
|
||||
|
||||
impl transaction_payment::Trait for Runtime {
|
||||
impl pallet_transaction_payment::Trait for Runtime {
|
||||
type Currency = Balances;
|
||||
type OnTransactionPayment = ();
|
||||
type TransactionBaseFee = TransactionBaseFee;
|
||||
@@ -224,7 +227,7 @@ impl transaction_payment::Trait for Runtime {
|
||||
type FeeMultiplierUpdate = ();
|
||||
}
|
||||
|
||||
impl sudo::Trait for Runtime {
|
||||
impl pallet_sudo::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type Proposal = Call;
|
||||
}
|
||||
@@ -235,12 +238,12 @@ construct_runtime! {
|
||||
NodeBlock = opaque::Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module, Call, Storage, Config, Event},
|
||||
Timestamp: timestamp::{Module, Call, Storage, Inherent},
|
||||
Indices: indices::{default, Config<T>},
|
||||
Balances: balances::{default, Error},
|
||||
Sudo: sudo,
|
||||
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
|
||||
System: frame_system::{Module, Call, Storage, Config, Event},
|
||||
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
||||
Indices: pallet_indices,
|
||||
Balances: pallet_balances,
|
||||
Sudo: pallet_sudo,
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,22 +259,28 @@ pub type SignedBlock = generic::SignedBlock<Block>;
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// The SignedExtension to the basic transaction logic.
|
||||
pub type SignedExtra = (
|
||||
system::CheckVersion<Runtime>,
|
||||
system::CheckGenesis<Runtime>,
|
||||
system::CheckEra<Runtime>,
|
||||
system::CheckNonce<Runtime>,
|
||||
system::CheckWeight<Runtime>,
|
||||
transaction_payment::ChargeTransactionPayment<Runtime>,
|
||||
frame_system::CheckVersion<Runtime>,
|
||||
frame_system::CheckGenesis<Runtime>,
|
||||
frame_system::CheckEra<Runtime>,
|
||||
frame_system::CheckNonce<Runtime>,
|
||||
frame_system::CheckWeight<Runtime>,
|
||||
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
|
||||
);
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
|
||||
pub type Executive = frame_executive::Executive<
|
||||
Runtime,
|
||||
Block,
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllModules,
|
||||
>;
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl client_api::Core<Block> for Runtime {
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
VERSION
|
||||
}
|
||||
@@ -285,14 +294,16 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl client_api::Metadata<Block> for Runtime {
|
||||
impl sp_api::Metadata<Block> for Runtime {
|
||||
fn metadata() -> OpaqueMetadata {
|
||||
Runtime::metadata().into()
|
||||
}
|
||||
}
|
||||
|
||||
impl block_builder_api::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyResult {
|
||||
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(
|
||||
extrinsic: <Block as BlockT>::Extrinsic,
|
||||
) -> ApplyExtrinsicResult {
|
||||
Executive::apply_extrinsic(extrinsic)
|
||||
}
|
||||
|
||||
@@ -300,11 +311,11 @@ impl_runtime_apis! {
|
||||
Executive::finalize_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
|
||||
fn check_inherents(block: Block, data: sp_inherents::InherentData) -> sp_inherents::CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
|
||||
@@ -313,21 +324,20 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl client_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
||||
Executive::validate_transaction(tx)
|
||||
}
|
||||
}
|
||||
|
||||
impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
|
||||
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
||||
fn offchain_worker(number: NumberFor<Block>) {
|
||||
Executive::offchain_worker(number)
|
||||
}
|
||||
}
|
||||
|
||||
impl substrate_session::SessionKeys<Block> for Runtime {
|
||||
impl sp_session::SessionKeys<Block> for Runtime {
|
||||
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
||||
let seed = seed.as_ref().map(|s| rstd::str::from_utf8(&s).expect("Seed is an utf8 string"));
|
||||
opaque::SessionKeys::generate(seed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use substrate_primitives::{Pair, Public};
|
||||
use parachain_runtime::{
|
||||
AccountId, BalancesConfig, GenesisConfig, SudoConfig, IndicesConfig, SystemConfig, WASM_BINARY,
|
||||
AccountId, BalancesConfig, GenesisConfig, IndicesConfig, SudoConfig, SystemConfig, WASM_BINARY,
|
||||
};
|
||||
use substrate_service;
|
||||
use sc_service;
|
||||
use sp_core::{Pair, Public};
|
||||
|
||||
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
||||
pub type ChainSpec = substrate_service::ChainSpec<GenesisConfig>;
|
||||
pub type ChainSpec = sc_service::ChainSpec<GenesisConfig>;
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
@@ -32,7 +32,10 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Pu
|
||||
|
||||
/// Helper function to generate stash, controller and session key from seed
|
||||
pub fn get_authority_keys_from_seed(seed: &str) -> (AccountId, AccountId) {
|
||||
(get_from_seed::<AccountId>(&format!("{}//stash", seed)), get_from_seed::<AccountId>(seed))
|
||||
(
|
||||
get_from_seed::<AccountId>(&format!("{}//stash", seed)),
|
||||
get_from_seed::<AccountId>(seed),
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns the chain spec.
|
||||
@@ -40,28 +43,30 @@ pub fn get_chain_spec() -> ChainSpec {
|
||||
ChainSpec::from_genesis(
|
||||
"Local Testnet",
|
||||
"parachain_local_testnet",
|
||||
|| testnet_genesis(
|
||||
vec![
|
||||
get_authority_keys_from_seed("Alice"),
|
||||
get_authority_keys_from_seed("Bob"),
|
||||
],
|
||||
get_from_seed::<AccountId>("Alice"),
|
||||
vec![
|
||||
|| {
|
||||
testnet_genesis(
|
||||
vec![
|
||||
get_authority_keys_from_seed("Alice"),
|
||||
get_authority_keys_from_seed("Bob"),
|
||||
],
|
||||
get_from_seed::<AccountId>("Alice"),
|
||||
get_from_seed::<AccountId>("Bob"),
|
||||
get_from_seed::<AccountId>("Charlie"),
|
||||
get_from_seed::<AccountId>("Dave"),
|
||||
get_from_seed::<AccountId>("Eve"),
|
||||
get_from_seed::<AccountId>("Ferdie"),
|
||||
get_from_seed::<AccountId>("Alice//stash"),
|
||||
get_from_seed::<AccountId>("Bob//stash"),
|
||||
get_from_seed::<AccountId>("Charlie//stash"),
|
||||
get_from_seed::<AccountId>("Dave//stash"),
|
||||
get_from_seed::<AccountId>("Eve//stash"),
|
||||
get_from_seed::<AccountId>("Ferdie//stash"),
|
||||
],
|
||||
true,
|
||||
),
|
||||
vec![
|
||||
get_from_seed::<AccountId>("Alice"),
|
||||
get_from_seed::<AccountId>("Bob"),
|
||||
get_from_seed::<AccountId>("Charlie"),
|
||||
get_from_seed::<AccountId>("Dave"),
|
||||
get_from_seed::<AccountId>("Eve"),
|
||||
get_from_seed::<AccountId>("Ferdie"),
|
||||
get_from_seed::<AccountId>("Alice//stash"),
|
||||
get_from_seed::<AccountId>("Bob//stash"),
|
||||
get_from_seed::<AccountId>("Charlie//stash"),
|
||||
get_from_seed::<AccountId>("Dave//stash"),
|
||||
get_from_seed::<AccountId>("Eve//stash"),
|
||||
get_from_seed::<AccountId>("Ferdie//stash"),
|
||||
],
|
||||
true,
|
||||
)
|
||||
},
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
@@ -77,19 +82,21 @@ fn testnet_genesis(
|
||||
_enable_println: bool,
|
||||
) -> GenesisConfig {
|
||||
GenesisConfig {
|
||||
system: Some(SystemConfig {
|
||||
frame_system: Some(SystemConfig {
|
||||
code: WASM_BINARY.to_vec(),
|
||||
changes_trie_config: Default::default(),
|
||||
}),
|
||||
indices: Some(IndicesConfig {
|
||||
pallet_indices: Some(IndicesConfig {
|
||||
ids: endowed_accounts.clone(),
|
||||
}),
|
||||
balances: Some(BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(),
|
||||
pallet_balances: Some(BalancesConfig {
|
||||
balances: endowed_accounts
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|k| (k, 1 << 60))
|
||||
.collect(),
|
||||
vesting: vec![],
|
||||
}),
|
||||
sudo: Some(SudoConfig {
|
||||
key: root_key,
|
||||
}),
|
||||
pallet_sudo: Some(SudoConfig { key: root_key }),
|
||||
}
|
||||
}
|
||||
+93
-50
@@ -18,23 +18,29 @@ use crate::chain_spec;
|
||||
|
||||
use parachain_runtime::Block;
|
||||
|
||||
pub use substrate_cli::{VersionInfo, IntoExit, error::{self, Result}};
|
||||
use substrate_cli::{parse_and_prepare, ParseAndPrepare, NoCustom};
|
||||
use substrate_service::{Roles as ServiceRoles, Configuration};
|
||||
use sr_primitives::{traits::{Block as BlockT, Header as HeaderT, Hash as HashT}, BuildStorage};
|
||||
use substrate_client::genesis;
|
||||
use substrate_primitives::hexdisplay::HexDisplay;
|
||||
pub use sc_cli::{
|
||||
error::{self, Result},
|
||||
IntoExit, VersionInfo,
|
||||
};
|
||||
use sc_cli::{parse_and_prepare, NoCustom, ParseAndPrepare};
|
||||
use sc_client::genesis;
|
||||
use sc_service::{Configuration, Roles as ServiceRoles};
|
||||
use sp_core::hexdisplay::HexDisplay;
|
||||
use sp_runtime::{
|
||||
traits::{Block as BlockT, Hash as HashT, Header as HeaderT},
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use futures::{channel::oneshot, future::Map, FutureExt};
|
||||
|
||||
use codec::Encode;
|
||||
|
||||
use log::info;
|
||||
|
||||
use std::{path::PathBuf, cell::RefCell, sync::Arc};
|
||||
use std::{cell::RefCell, path::PathBuf, sync::Arc};
|
||||
|
||||
use structopt::StructOpt;
|
||||
|
||||
use futures::{sync::oneshot, future, Future};
|
||||
|
||||
/// Sub-commands supported by the collator.
|
||||
#[derive(Debug, StructOpt, Clone)]
|
||||
enum SubCommands {
|
||||
@@ -43,8 +49,10 @@ enum SubCommands {
|
||||
ExportGenesisState(ExportGenesisStateCommand),
|
||||
}
|
||||
|
||||
impl substrate_cli::GetLogFilter for SubCommands {
|
||||
fn get_log_filter(&self) -> Option<String> { None }
|
||||
impl sc_cli::GetSharedParams for SubCommands {
|
||||
fn shared_params(&self) -> Option<&sc_cli::SharedParams> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Command for exporting the genesis state of the parachain
|
||||
@@ -57,10 +65,10 @@ struct ExportGenesisStateCommand {
|
||||
|
||||
/// Parse command line arguments into service configuration.
|
||||
pub fn run<I, T, E>(args: I, exit: E, version: VersionInfo) -> error::Result<()>
|
||||
where
|
||||
I: IntoIterator<Item = T>,
|
||||
T: Into<std::ffi::OsString> + Clone,
|
||||
E: IntoExit + Send + 'static,
|
||||
where
|
||||
I: IntoIterator<Item = T>,
|
||||
T: Into<std::ffi::OsString> + Clone,
|
||||
E: IntoExit + Send + 'static,
|
||||
{
|
||||
type Config<T> = Configuration<(), T>;
|
||||
match parse_and_prepare::<SubCommands, NoCustom, _>(
|
||||
@@ -68,37 +76,68 @@ pub fn run<I, T, E>(args: I, exit: E, version: VersionInfo) -> error::Result<()>
|
||||
"cumulus-test-parachain-collator",
|
||||
args,
|
||||
) {
|
||||
ParseAndPrepare::Run(cmd) => cmd.run(load_spec, exit,
|
||||
|exit, _cli_args, _custom_args, mut config: Config<_>| {
|
||||
info!("{}", version.name);
|
||||
info!(" version {}", config.full_version());
|
||||
info!(" by {}, 2019", version.author);
|
||||
info!("Chain specification: {}", config.chain_spec.name());
|
||||
info!("Node name: {}", config.name);
|
||||
info!("Roles: {:?}", config.roles);
|
||||
info!("Parachain id: {:?}", crate::PARA_ID);
|
||||
ParseAndPrepare::Run(cmd) => cmd.run(
|
||||
load_spec,
|
||||
exit,
|
||||
|exit, _cli_args, _custom_args, mut config: Config<_>| {
|
||||
info!("{}", version.name);
|
||||
info!(" version {}", config.full_version());
|
||||
info!(" by {}, 2019", version.author);
|
||||
info!("Chain specification: {}", config.chain_spec.name());
|
||||
info!("Node name: {}", config.name);
|
||||
info!("Roles: {:?}", config.roles);
|
||||
info!("Parachain id: {:?}", crate::PARA_ID);
|
||||
|
||||
// TODO
|
||||
let key = Arc::new(substrate_primitives::Pair::from_seed(&[10; 32]));
|
||||
// TODO
|
||||
let key = Arc::new(sp_core::Pair::from_seed(&[10; 32]));
|
||||
|
||||
// TODO
|
||||
config.network.listen_addresses = Vec::new();
|
||||
config.network.boot_nodes = vec![];
|
||||
config.chain_spec = chain_spec::get_chain_spec();
|
||||
// TODO
|
||||
config.network.listen_addresses = Vec::new();
|
||||
|
||||
match config.roles {
|
||||
ServiceRoles::LIGHT => unimplemented!("Light client not supported!"),
|
||||
_ => crate::service::run_collator(config, exit, key, version.clone()),
|
||||
}.map_err(|e| format!("{:?}", e))
|
||||
}),
|
||||
ParseAndPrepare::BuildSpec(cmd) => cmd.run(load_spec),
|
||||
ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder(|config: Config<_>|
|
||||
Ok(new_full_start!(config).0), load_spec, exit),
|
||||
ParseAndPrepare::ImportBlocks(cmd) => cmd.run_with_builder(|config: Config<_>|
|
||||
Ok(new_full_start!(config).0), load_spec, exit),
|
||||
// TODO
|
||||
let mut polkadot_config =
|
||||
polkadot_collator::Configuration::default_with_spec_and_base_path(
|
||||
polkadot_service::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../res/polkadot_chainspec.json")[..],
|
||||
)?,
|
||||
config.in_chain_config_dir("polkadot"),
|
||||
);
|
||||
polkadot_config.network.boot_nodes = config.network.boot_nodes.clone();
|
||||
|
||||
if let Some(ref config_dir) = polkadot_config.config_dir {
|
||||
polkadot_config.database = sc_service::config::DatabaseConfig::Path {
|
||||
cache_size: Default::default(),
|
||||
path: config_dir.join("db"),
|
||||
};
|
||||
}
|
||||
|
||||
match config.roles {
|
||||
ServiceRoles::LIGHT => unimplemented!("Light client not supported!"),
|
||||
_ => crate::service::run_collator(config, exit, key, polkadot_config),
|
||||
}
|
||||
.map_err(|e| format!("{:?}", e))
|
||||
},
|
||||
),
|
||||
ParseAndPrepare::BuildSpec(cmd) => cmd.run::<NoCustom, _, _, _>(load_spec),
|
||||
ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder(
|
||||
|config: Config<_>| Ok(new_full_start!(config).0),
|
||||
load_spec,
|
||||
exit,
|
||||
),
|
||||
ParseAndPrepare::ImportBlocks(cmd) => cmd.run_with_builder(
|
||||
|config: Config<_>| Ok(new_full_start!(config).0),
|
||||
load_spec,
|
||||
exit,
|
||||
),
|
||||
ParseAndPrepare::CheckBlock(cmd) => cmd.run_with_builder(
|
||||
|config: Config<_>| Ok(new_full_start!(config).0),
|
||||
load_spec,
|
||||
exit,
|
||||
),
|
||||
ParseAndPrepare::PurgeChain(cmd) => cmd.run(load_spec),
|
||||
ParseAndPrepare::RevertChain(cmd) => cmd.run_with_builder(|config: Config<_>|
|
||||
Ok(new_full_start!(config).0), load_spec),
|
||||
ParseAndPrepare::RevertChain(cmd) => {
|
||||
cmd.run_with_builder(|config: Config<_>| Ok(new_full_start!(config).0), load_spec)
|
||||
}
|
||||
ParseAndPrepare::CustomCommand(SubCommands::ExportGenesisState(cmd)) => {
|
||||
export_genesis_state(cmd.output)
|
||||
}
|
||||
@@ -113,16 +152,16 @@ fn load_spec(_: &str) -> std::result::Result<Option<chain_spec::ChainSpec>, Stri
|
||||
|
||||
/// Export the genesis state of the parachain.
|
||||
fn export_genesis_state(output: Option<PathBuf>) -> error::Result<()> {
|
||||
let storage = chain_spec::get_chain_spec().build_storage()?;
|
||||
let storage = (&chain_spec::get_chain_spec()).build_storage()?;
|
||||
|
||||
let child_roots = storage.1.iter().map(|(sk, child_map)| {
|
||||
let child_roots = storage.children.iter().map(|(sk, child_content)| {
|
||||
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
child_map.clone().into_iter().collect()
|
||||
child_content.data.clone().into_iter().collect(),
|
||||
);
|
||||
(sk.clone(), state_root.encode())
|
||||
});
|
||||
let state_root = <<<Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(
|
||||
storage.0.clone().into_iter().chain(child_roots).collect()
|
||||
storage.top.clone().into_iter().chain(child_roots).collect(),
|
||||
);
|
||||
let block: Block = genesis::construct_genesis_block(state_root);
|
||||
|
||||
@@ -140,19 +179,23 @@ fn export_genesis_state(output: Option<PathBuf>) -> error::Result<()> {
|
||||
// handles ctrl-c
|
||||
pub struct Exit;
|
||||
impl IntoExit for Exit {
|
||||
type Exit = future::MapErr<oneshot::Receiver<()>, fn(oneshot::Canceled) -> ()>;
|
||||
type Exit = Map<oneshot::Receiver<()>, fn(std::result::Result<(), oneshot::Canceled>) -> ()>;
|
||||
fn into_exit(self) -> Self::Exit {
|
||||
// can't use signal directly here because CtrlC takes only `Fn`.
|
||||
let (exit_send, exit) = oneshot::channel();
|
||||
|
||||
let exit_send_cell = RefCell::new(Some(exit_send));
|
||||
ctrlc::set_handler(move || {
|
||||
let exit_send = exit_send_cell.try_borrow_mut().expect("signal handler not reentrant; qed").take();
|
||||
let exit_send = exit_send_cell
|
||||
.try_borrow_mut()
|
||||
.expect("signal handler not reentrant; qed")
|
||||
.take();
|
||||
if let Some(exit_send) = exit_send {
|
||||
exit_send.send(()).expect("Error sending exit notification");
|
||||
}
|
||||
}).expect("Error setting Ctrl-C handler");
|
||||
})
|
||||
.expect("Error setting Ctrl-C handler");
|
||||
|
||||
exit.map_err(drop)
|
||||
exit.map(drop)
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ mod chain_spec;
|
||||
mod service;
|
||||
mod cli;
|
||||
|
||||
pub use substrate_cli::{VersionInfo, IntoExit, error};
|
||||
pub use sc_cli::{error, IntoExit, VersionInfo};
|
||||
|
||||
/// The parachain id of this parachain.
|
||||
pub const PARA_ID: ParaId = ParaId::new(100);
|
||||
|
||||
@@ -16,20 +16,19 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use parachain_runtime::{self, GenesisConfig, opaque::Block};
|
||||
use parachain_runtime::{self, opaque::Block, GenesisConfig};
|
||||
|
||||
use inherents::InherentDataProviders;
|
||||
use substrate_service::{AbstractService, Configuration};
|
||||
use network::construct_simple_protocol;
|
||||
use substrate_executor::native_executor_instance;
|
||||
use sc_executor::native_executor_instance;
|
||||
use sc_network::construct_simple_protocol;
|
||||
use sc_service::{AbstractService, Configuration};
|
||||
use sp_consensus::{BlockImport, Environment, Proposer};
|
||||
use sp_inherents::InherentDataProviders;
|
||||
|
||||
use futures::prelude::*;
|
||||
|
||||
use futures03::FutureExt;
|
||||
use futures::{compat::Future01CompatExt, future, task::Spawn, FutureExt, TryFutureExt};
|
||||
|
||||
use log::error;
|
||||
|
||||
pub use substrate_executor::NativeExecutor;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
|
||||
// Our native executor instance.
|
||||
native_executor_instance!(
|
||||
@@ -49,29 +48,35 @@ construct_simple_protocol! {
|
||||
/// be able to perform chain operations.
|
||||
macro_rules! new_full_start {
|
||||
($config:expr) => {{
|
||||
let inherent_data_providers = inherents::InherentDataProviders::new();
|
||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||
|
||||
let builder = substrate_service::ServiceBuilder::new_full::<
|
||||
parachain_runtime::opaque::Block, parachain_runtime::RuntimeApi, crate::service::Executor,
|
||||
let builder = sc_service::ServiceBuilder::new_full::<
|
||||
parachain_runtime::opaque::Block,
|
||||
parachain_runtime::RuntimeApi,
|
||||
crate::service::Executor,
|
||||
>($config)?
|
||||
.with_select_chain(|_config, backend| {
|
||||
Ok(substrate_client::LongestChain::new(backend.clone()))
|
||||
})?
|
||||
.with_transaction_pool(|config, client|
|
||||
Ok(transaction_pool::txpool::Pool::new(config, transaction_pool::FullChainApi::new(client)))
|
||||
)?
|
||||
.with_import_queue(|_config, client, _, _| {
|
||||
let import_queue = cumulus_consensus::import_queue::import_queue(
|
||||
client.clone(),
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
)?;
|
||||
.with_select_chain(|_config, backend| Ok(sc_client::LongestChain::new(backend.clone())))?
|
||||
.with_transaction_pool(|config, client, _| {
|
||||
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
|
||||
let pool = sc_transaction_pool::BasicPool::new(config, pool_api);
|
||||
let maintainer =
|
||||
sc_transaction_pool::FullBasicPoolMaintainer::new(pool.pool().clone(), client);
|
||||
let maintainable_pool =
|
||||
sp_transaction_pool::MaintainableTransactionPool::new(pool, maintainer);
|
||||
Ok(maintainable_pool)
|
||||
})?
|
||||
.with_import_queue(|_config, client, _, _| {
|
||||
let import_queue = cumulus_consensus::import_queue::import_queue(
|
||||
client.clone(),
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
)?;
|
||||
|
||||
Ok(import_queue)
|
||||
})?;
|
||||
Ok(import_queue)
|
||||
})?;
|
||||
|
||||
(builder, inherent_data_providers)
|
||||
}}
|
||||
}};
|
||||
}
|
||||
|
||||
/// Run the collator with the given `config`.
|
||||
@@ -79,13 +84,17 @@ pub fn run_collator<C: Send + Default + 'static, E: crate::cli::IntoExit + Send
|
||||
config: Configuration<C, GenesisConfig>,
|
||||
exit: E,
|
||||
key: Arc<polkadot_primitives::parachain::CollatorPair>,
|
||||
version: crate::cli::VersionInfo,
|
||||
polkadot_config: polkadot_collator::Configuration,
|
||||
) -> crate::cli::Result<()> {
|
||||
let (builder, inherent_data_providers) = new_full_start!(config);
|
||||
inherent_data_providers.register_provider(srml_timestamp::InherentDataProvider).unwrap();
|
||||
inherent_data_providers
|
||||
.register_provider(sp_timestamp::InherentDataProvider)
|
||||
.unwrap();
|
||||
|
||||
let service = builder.with_network_protocol(|_| Ok(NodeProtocol::new()))?.build()?;
|
||||
let proposer_factory = basic_authorship::ProposerFactory {
|
||||
let service = builder
|
||||
.with_network_protocol(|_| Ok(NodeProtocol::new()))?
|
||||
.build()?;
|
||||
let proposer_factory = sc_basic_authority::ProposerFactory {
|
||||
client: service.client(),
|
||||
transaction_pool: service.transaction_pool(),
|
||||
};
|
||||
@@ -101,7 +110,13 @@ pub fn run_collator<C: Send + Default + 'static, E: crate::cli::IntoExit + Send
|
||||
block_import,
|
||||
};
|
||||
|
||||
cumulus_collator::run_collator(setup_parachain, crate::PARA_ID, on_exit, key, version)
|
||||
cumulus_collator::run_collator(
|
||||
setup_parachain,
|
||||
crate::PARA_ID,
|
||||
on_exit,
|
||||
key,
|
||||
polkadot_config,
|
||||
)
|
||||
}
|
||||
|
||||
struct SetupParachain<S, PF, E, BI> {
|
||||
@@ -112,43 +127,66 @@ struct SetupParachain<S, PF, E, BI> {
|
||||
block_import: BI,
|
||||
}
|
||||
|
||||
type TransactionFor<E, Block> =
|
||||
<<E as Environment<Block>>::Proposer as Proposer<Block>>::Transaction;
|
||||
|
||||
impl<S, PF, E, BI> cumulus_collator::SetupParachain<Block> for SetupParachain<S, PF, E, BI>
|
||||
where
|
||||
S: AbstractService,
|
||||
E: Send + crate::cli::IntoExit,
|
||||
PF: consensus_common::Environment<Block> + Send + 'static,
|
||||
BI: consensus_common::BlockImport<Block, Error=consensus_common::Error> + Send + Sync + 'static,
|
||||
where
|
||||
S: AbstractService,
|
||||
E: Send + crate::cli::IntoExit,
|
||||
PF: Environment<Block> + Send + 'static,
|
||||
BI: BlockImport<Block, Error = sp_consensus::Error, Transaction = TransactionFor<PF, Block>>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
{
|
||||
type ProposerFactory = PF;
|
||||
type BlockImport = BI;
|
||||
|
||||
fn setup_parachain<P: cumulus_consensus::PolkadotClient>(
|
||||
fn setup_parachain<P: cumulus_consensus::PolkadotClient, Spawner>(
|
||||
self,
|
||||
polkadot_client: P,
|
||||
task_executor: polkadot_collator::TaskExecutor,
|
||||
) -> Result<(Self::ProposerFactory, Self::BlockImport, InherentDataProviders), String> {
|
||||
spawner: Spawner,
|
||||
) -> Result<
|
||||
(
|
||||
Self::ProposerFactory,
|
||||
Self::BlockImport,
|
||||
InherentDataProviders,
|
||||
),
|
||||
String,
|
||||
>
|
||||
where
|
||||
Spawner: Spawn + Clone + Send + Sync + 'static,
|
||||
{
|
||||
let client = self.service.client();
|
||||
|
||||
let follow = match cumulus_consensus::follow_polkadot(crate::PARA_ID, client, polkadot_client) {
|
||||
Ok(follow) => follow,
|
||||
Err(e) => {
|
||||
return Err(format!("Could not start following polkadot: {:?}", e));
|
||||
}
|
||||
};
|
||||
let follow =
|
||||
match cumulus_consensus::follow_polkadot(crate::PARA_ID, client, polkadot_client) {
|
||||
Ok(follow) => follow,
|
||||
Err(e) => {
|
||||
return Err(format!("Could not start following polkadot: {:?}", e));
|
||||
}
|
||||
};
|
||||
|
||||
task_executor.execute(
|
||||
Box::new(
|
||||
self.service
|
||||
.map_err(|e| error!("Parachain service error: {:?}", e))
|
||||
.select(futures03::compat::Compat::new(follow.map(|_| Ok::<(), ()>(()))))
|
||||
.map(|_| ())
|
||||
.map_err(|_| ())
|
||||
.select(self.exit.into_exit())
|
||||
.map(|_| ())
|
||||
.map_err(|_| ())
|
||||
),
|
||||
).map_err(|_| "Could not spawn parachain server!")?;
|
||||
spawner
|
||||
.spawn_obj(
|
||||
Box::new(
|
||||
future::select(
|
||||
self.service
|
||||
.compat()
|
||||
.map_err(|e| error!("Parachain service error: {:?}", e)),
|
||||
future::select(follow, self.exit.into_exit()),
|
||||
)
|
||||
.map(|_| ()),
|
||||
)
|
||||
.into(),
|
||||
)
|
||||
.map_err(|_| "Could not spawn parachain server!")?;
|
||||
|
||||
Ok((self.proposer_factory, self.block_import, self.inherent_data_providers))
|
||||
Ok((
|
||||
self.proposer_factory,
|
||||
self.block_import,
|
||||
self.inherent_data_providers,
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -24,4 +24,4 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
pub use substrate_test_runtime::*;
|
||||
|
||||
runtime::register_validate_block!(Block, system::BlockExecutor);
|
||||
runtime::register_validate_block!(Block, system::BlockExecutor);
|
||||
Reference in new issue
Block a user