-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Make a test crate to make the runtime-test usable #1258
Changes from 14 commits
7a956fb
9dd9118
ffa95f1
b5ee29e
d2428b4
587870d
886d76f
6306561
6c95310
555715a
4a3b4b0
0d506a1
16f1c67
9e1bf51
186a764
528b2ed
88c57d3
b5b219e
9aba20a
83d9bf3
84fe08a
df43948
7a27276
29b8a34
4ca5082
f67af13
5ae1794
0061afe
2fd2d71
899505d
25eb924
780fbdf
302fa9a
a3ba37b
d36cdc2
960f1f1
de25f24
ee93ecd
cd96ffb
d42d727
95e1a87
30c0dd7
f48b071
9c04748
4730489
3a0eee3
f2444bc
fb62093
acb88cc
6e5e060
3de82c2
8f4245d
605da30
9467bd8
b723dea
be679dd
4816880
f35262e
74ab47c
be3889b
73ae473
b8ec09d
36fec81
178ab7b
de65c05
abf0f35
6bae984
261c552
4fc1a58
5796cd5
91bf6bb
a6a54b5
3092be3
6dce9b1
a8fe1dd
df63aa1
0cdda37
5b4fcfd
36c8c65
cf3fb7b
2bbe1b6
f97dd0c
523366e
6be349f
fb41215
5550cbb
c4cd5fb
a44b1c0
e8573ae
fd8a9d7
fc00d0c
5916b39
d620fc6
f108a3f
602814a
00316bd
42545d5
c94459c
1637455
90750a1
35e8ab1
5fb41d2
7fa0a85
6a65f87
c74756a
f94de16
e606833
4e65412
b44f302
f3b3142
d32f811
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| [package] | ||
| name = "polkadot-test-service" | ||
| version = "0.8.2" | ||
| authors = ["Parity Technologies <[email protected]>"] | ||
| edition = "2018" | ||
|
|
||
| [dependencies] | ||
| log = "0.4.8" | ||
| futures = "0.3.4" | ||
| av_store = { package = "polkadot-availability-store", path = "../availability-store" } | ||
| consensus = { package = "polkadot-validation", path = "../validation" } | ||
| polkadot-primitives = { path = "../primitives" } | ||
| polkadot-test-runtime = { path = "../runtime/test-runtime" } | ||
| polkadot-network = { path = "../network" } | ||
| polkadot-rpc = { path = "../rpc" } | ||
| polkadot-service = { path = "../service" } | ||
| sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| consensus_common = { package = "sp-consensus", git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| grandpa_primitives = { package = "sp-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } | ||
| sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| authority-discovery = { package = "sc-authority-discovery", git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| babe = { package = "sc-consensus-babe", git = "https://github.com/paritytech/substrate", branch = "master" } | ||
|
|
||
| [features] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // Copyright 2017-2020 Parity Technologies (UK) Ltd. | ||
cecton marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // This file is part of Polkadot. | ||
|
|
||
| // Polkadot is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Polkadot is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| //! Polkadot test service only. | ||
| use std::sync::Arc; | ||
| use std::time::Duration; | ||
| use polkadot_primitives::{parachain, Hash, BlockId}; | ||
| use polkadot_network::{legacy::gossip::Known, protocol as network_protocol}; | ||
| use service::{error::Error as ServiceError}; | ||
| use grandpa::{FinalityProofProvider as GrandpaFinalityProofProvider}; | ||
| use log::info; | ||
| use service::{AbstractService, Role, TFullBackend, Configuration}; | ||
| use consensus_common::{SelectChain, block_validation::Chain}; | ||
| use polkadot_primitives::parachain::{CollatorId}; | ||
| use polkadot_primitives::Block; | ||
| use polkadot_service::PolkadotClient; | ||
| use polkadot_service::{new_full, new_full_start, FullNodeHandles, PolkadotExecutor}; | ||
|
|
||
| /// Create a new Polkadot test service for a full node. | ||
| pub fn polkadot_test_new_full( | ||
| config: Configuration, | ||
| collating_for: Option<(CollatorId, parachain::Id)>, | ||
| max_block_data_size: Option<u64>, | ||
| authority_discovery_enabled: bool, | ||
| slot_duration: u64, | ||
| grandpa_pause: Option<(u32, u32)>, | ||
| informant_prefix: Option<String>, | ||
|
||
| ) | ||
| -> Result<( | ||
| impl AbstractService, | ||
| Arc<impl PolkadotClient< | ||
| Block, | ||
| TFullBackend<Block>, | ||
| polkadot_test_runtime::RuntimeApi | ||
| >>, | ||
| FullNodeHandles, | ||
| ), ServiceError> | ||
| { | ||
| let (service, client, handles) = new_full!(test | ||
| config, | ||
| collating_for, | ||
| max_block_data_size, | ||
| authority_discovery_enabled, | ||
| slot_duration, | ||
| grandpa_pause, | ||
| polkadot_test_runtime::RuntimeApi, | ||
| PolkadotExecutor, | ||
| informant_prefix, | ||
| ); | ||
|
|
||
| Ok((service, client, handles)) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,7 @@ impl GenesisConfig { | |
| parachains: None, | ||
| registrar: None, | ||
| vesting: None, | ||
| authority_discovery: None, | ||
|
||
| }; | ||
| config.assimilate_storage(&mut storage).expect("Adding `system::GensisConfig` to the genesis"); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems somewhat redundant to put this in a directory starting with
polkadot. What do you think about just calling the directorytest-service? Also, maybe put it innode/instead of at the root. That will keep things more organizedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely is... when I first named it I called it just "test" but it was super confusing with the tests directory.
I'm not familiar with the "node" directory. I think it's newish? I see it's been introduced in early June. What should we put there?
(Meanwhile I will follow your suggestion and move it already)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, the
nodedir is new and is meant to hold all things related to the node. At the end I think I'd like to have onlynode/runtime/primitivesat the root.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we have a
test-helpersdirectory. Wouldn't it be even better if I moved it to there in "service" (crate name would be: polkadot-service-test-helpers)