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

Commit a70f4a0

Browse files
committed
Merge branch 'refactor/environmental-generic-traits' into refactor/substrate-state-machine-generic
* refactor/environmental-generic-traits: whitespace Teach environmental! about generics Validator side of the collation protocol. (#295) Improve Wasm extern errors and increase heap (#299) Issue 212 - refactor Checkable trait to be more generic (#287) Fix for nightly 2018-07-10 (#296) PoC-2 tweaks (#293)
2 parents c7503ad + 711da4f commit a70f4a0

File tree

39 files changed

+769
-246
lines changed

39 files changed

+769
-246
lines changed

Cargo.lock

Lines changed: 50 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

polkadot/cli/src/chain_spec.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ pub enum ChainSpec {
2929
LocalTestnet,
3030
/// The PoC-1 testnet.
3131
PoC1Testnet,
32-
/// The PoC-2 testnet.
33-
PoC2Testnet,
32+
/// Whatever the current runtime is with the "global testnet" defaults.
33+
StagingTestnet,
3434
/// Custom Genesis file.
3535
Custom(String),
3636
}
@@ -42,7 +42,7 @@ impl ChainSpec {
4242
ChainSpec::PoC1Testnet => service::ChainSpec::poc_1_testnet_config()?,
4343
ChainSpec::Development => service::ChainSpec::development_config(),
4444
ChainSpec::LocalTestnet => service::ChainSpec::local_testnet_config(),
45-
ChainSpec::PoC2Testnet => service::ChainSpec::poc_2_testnet_config(),
45+
ChainSpec::StagingTestnet => service::ChainSpec::staging_testnet_config(),
4646
ChainSpec::Custom(f) => service::ChainSpec::from_json_file(PathBuf::from(f))?,
4747
})
4848
}
@@ -54,7 +54,7 @@ impl<'a> From<&'a str> for ChainSpec {
5454
"dev" => ChainSpec::Development,
5555
"local" => ChainSpec::LocalTestnet,
5656
"poc-1" => ChainSpec::PoC1Testnet,
57-
"poc-2" => ChainSpec::PoC2Testnet,
57+
"staging" => ChainSpec::StagingTestnet,
5858
s => ChainSpec::Custom(s.into()),
5959
}
6060
}
@@ -66,7 +66,7 @@ impl From<ChainSpec> for String {
6666
ChainSpec::Development => "dev".into(),
6767
ChainSpec::LocalTestnet => "local".into(),
6868
ChainSpec::PoC1Testnet => "poc-1".into(),
69-
ChainSpec::PoC2Testnet => "poc-2".into(),
69+
ChainSpec::StagingTestnet => "staging".into(),
7070
ChainSpec::Custom(f) => format!("custom ({})", f),
7171
}
7272
}

polkadot/cli/src/cli.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ args:
6969
- chain:
7070
long: chain
7171
value_name: CHAIN_SPEC
72-
help: Specify the chain specification (one of dev, local or poc-2)
72+
help: Specify the chain specification (one of poc-1, dev, local or staging)
7373
takes_value: true
7474
- pruning:
7575
long: pruning
@@ -84,7 +84,11 @@ args:
8484
- telemetry:
8585
short: t
8686
long: telemetry
87-
help: Should connect to the Polkadot telemetry server (off by default)
87+
help: Should connect to the Polkadot telemetry server (telemetry is off by default on local chains)
88+
takes_value: false
89+
- no-telemetry:
90+
long: no-telemetry
91+
help: Should not connect to the Polkadot telemetry server (telemetry is on by default on global chains)
8892
takes_value: false
8993
- telemetry-url:
9094
long: telemetry-url
@@ -102,7 +106,7 @@ subcommands:
102106
- chain:
103107
long: chain
104108
value_name: CHAIN_SPEC
105-
help: Specify the chain specification (one of dev, local or poc-2)
109+
help: Specify the chain specification (one of poc-1, dev, local or staging)
106110
takes_value: true
107111
- export-blocks:
108112
about: Export blocks to a file

polkadot/cli/src/lib.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,17 @@ impl substrate_rpc::system::SystemApi for SystemConfiguration {
106106
}
107107
}
108108

109-
fn load_spec(matches: &clap::ArgMatches) -> Result<service::ChainSpec, String> {
109+
fn load_spec(matches: &clap::ArgMatches) -> Result<(service::ChainSpec, bool), String> {
110110
let chain_spec = matches.value_of("chain")
111111
.map(ChainSpec::from)
112-
.unwrap_or_else(|| if matches.is_present("dev") { ChainSpec::Development } else { ChainSpec::PoC2Testnet });
112+
.unwrap_or_else(|| if matches.is_present("dev") { ChainSpec::Development } else { ChainSpec::StagingTestnet });
113+
let is_global = match chain_spec {
114+
ChainSpec::PoC1Testnet | ChainSpec::StagingTestnet => true,
115+
_ => false,
116+
};
113117
let spec = chain_spec.load()?;
114118
info!("Chain specification: {}", spec.name());
115-
Ok(spec)
119+
Ok((spec, is_global))
116120
}
117121

118122
fn base_path(matches: &clap::ArgMatches) -> PathBuf {
@@ -186,7 +190,7 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
186190
return import_blocks(matches, worker.exit_only());
187191
}
188192

189-
let spec = load_spec(&matches)?;
193+
let (spec, is_global) = load_spec(&matches)?;
190194
let mut config = service::Configuration::default_with_spec(spec);
191195

192196
if let Some(name) = matches.value_of("name") {
@@ -260,7 +264,11 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
260264
let mut runtime = Runtime::new()?;
261265
let executor = runtime.executor();
262266

263-
let _guard = if matches.is_present("telemetry") || matches.value_of("telemetry-url").is_some() {
267+
let telemetry_enabled =
268+
matches.is_present("telemetry")
269+
|| matches.value_of("telemetry-url").is_some()
270+
|| (is_global && !matches.is_present("no-telemetry"));
271+
let _guard = if telemetry_enabled {
264272
let name = config.name.clone();
265273
let chain_name = config.chain_spec.name().to_owned();
266274
Some(init_telemetry(TelemetryConfig {
@@ -290,7 +298,7 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
290298
}
291299

292300
fn build_spec(matches: &clap::ArgMatches) -> error::Result<()> {
293-
let spec = load_spec(&matches)?;
301+
let (spec, _) = load_spec(&matches)?;
294302
info!("Building chain spec");
295303
let json = spec.to_json(matches.is_present("raw"))?;
296304
print!("{}", json);
@@ -301,7 +309,7 @@ fn export_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
301309
where E: Future<Item=(),Error=()> + Send + 'static
302310
{
303311
let base_path = base_path(matches);
304-
let spec = load_spec(&matches)?;
312+
let (spec, _) = load_spec(&matches)?;
305313
let mut config = service::Configuration::default_with_spec(spec);
306314
config.database_path = db_path(&base_path).to_string_lossy().into();
307315
info!("DB path: {}", config.database_path);
@@ -365,7 +373,7 @@ fn export_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
365373
fn import_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
366374
where E: Future<Item=(),Error=()> + Send + 'static
367375
{
368-
let spec = load_spec(&matches)?;
376+
let (spec, _) = load_spec(&matches)?;
369377
let base_path = base_path(matches);
370378
let mut config = service::Configuration::default_with_spec(spec);
371379
config.database_path = db_path(&base_path).to_string_lossy().into();

polkadot/collator/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ pub fn collate<'a, R, P>(
157157
ingress.0.iter().flat_map(|&(id, ref msgs)| msgs.iter().cloned().map(move |msg| (id, msg)))
158158
);
159159

160-
let signature = key.sign(&block_data.0[..]).into();
160+
let block_data_hash = block_data.hash();
161+
let signature = key.sign(&block_data_hash.0[..]).into();
161162
let pubkey_bytes: [u8; 32] = key.public().into();
162163

163164
let receipt = parachain::CandidateReceipt {
@@ -168,7 +169,7 @@ pub fn collate<'a, R, P>(
168169
balance_uploads: Vec::new(),
169170
egress_queue_roots: Vec::new(),
170171
fees: 0,
171-
block_data_hash: block_data.hash(),
172+
block_data_hash,
172173
};
173174

174175
parachain::Collation {

polkadot/consensus/src/collation.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ pub trait Collators: Clone {
3737
type Collation: IntoFuture<Item=Collation,Error=Self::Error>;
3838

3939
/// Collate on a specific parachain, building on a given relay chain parent hash.
40+
///
41+
/// The returned collation should be checked for basic validity in the signature
42+
/// and will be checked for state-transition validity by the consumer of this trait.
43+
///
44+
/// This does not have to guarantee local availability, as a valid collation
45+
/// will be passed to the `TableRouter` instance.
4046
fn collate(&self, parachain: ParaId, relay_parent: Hash) -> Self::Collation;
4147

4248
/// Note a bad collator. TODO: take proof

0 commit comments

Comments
 (0)