Skip to content

Commit 3368f5e

Browse files
author
Ayush
committed
Fix compilation issue and made changes in node directory
1 parent 98cc33d commit 3368f5e

File tree

6 files changed

+475
-264
lines changed

6 files changed

+475
-264
lines changed

node/Cargo.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ git = 'https://github.com/paritytech/substrate.git'
2828
branch = "polkadot-v0.9.8"
2929
version = '3.0.0'
3030

31+
[dependencies.substrate-prometheus-endpoint]
32+
git = 'https://github.com/paritytech/substrate.git'
33+
branch = "polkadot-v0.9.8"
34+
version = '0.9.0'
35+
3136
[dependencies.sc-basic-authorship]
3237
git = 'https://github.com/paritytech/substrate.git'
3338
branch = "polkadot-v0.9.8"
@@ -60,6 +65,10 @@ git = 'https://github.com/paritytech/substrate.git'
6065
branch = "polkadot-v0.9.8"
6166
version = '0.9.0'
6267

68+
[dependencies.sc-network]
69+
git = 'https://github.com/paritytech/substrate.git'
70+
branch = "polkadot-v0.9.8"
71+
6372
[dependencies.sc-keystore]
6473
git = 'https://github.com/paritytech/substrate.git'
6574
branch = "polkadot-v0.9.8"
@@ -111,6 +120,11 @@ git = 'https://github.com/paritytech/substrate.git'
111120
branch = "polkadot-v0.9.8"
112121
version = '0.9.0'
113122

123+
[dependencies.sp-consensus-aura]
124+
git = 'https://github.com/paritytech/substrate.git'
125+
branch = "polkadot-v0.9.8"
126+
version = '0.9.0'
127+
114128
[dependencies.sp-core]
115129
git = 'https://github.com/paritytech/substrate.git'
116130
branch = "polkadot-v0.9.8"
@@ -121,11 +135,27 @@ git = 'https://github.com/paritytech/substrate.git'
121135
branch = "polkadot-v0.9.8"
122136
version = '3.0.0'
123137

138+
[dependencies.sp-keystore]
139+
git = 'https://github.com/paritytech/substrate.git'
140+
branch = "polkadot-v0.9.8"
141+
version = '0.9.0'
142+
143+
144+
[dependencies.sp-offchain]
145+
git = 'https://github.com/paritytech/substrate.git'
146+
branch = "polkadot-v0.9.8"
147+
version = '3.0.0'
148+
124149
[dependencies.sp-runtime]
125150
git = 'https://github.com/paritytech/substrate.git'
126151
branch = "polkadot-v0.9.8"
127152
version = '3.0.0'
128153

154+
[dependencies.sp-session]
155+
git = 'https://github.com/paritytech/substrate.git'
156+
branch = "polkadot-v0.9.8"
157+
version = '3.0.0'
158+
129159
[dependencies.sp-timestamp]
130160
git = 'https://github.com/paritytech/substrate.git'
131161
branch = "polkadot-v0.9.8"
@@ -152,6 +182,15 @@ branch = "polkadot-v0.9.8"
152182
version = '3.0.0'
153183

154184
# Cumulus dependencies
185+
[dependencies.cumulus-client-consensus-aura]
186+
git = 'https://github.com/paritytech/cumulus.git'
187+
branch = "polkadot-v0.9.8"
188+
189+
[dependencies.cumulus-client-consensus-common]
190+
git = 'https://github.com/paritytech/cumulus.git'
191+
branch = "polkadot-v0.9.8"
192+
193+
155194
[dependencies.cumulus-client-consensus-relay-chain]
156195
git = 'https://github.com/paritytech/cumulus.git'
157196
branch = "polkadot-v0.9.8"
@@ -160,6 +199,10 @@ branch = "polkadot-v0.9.8"
160199
git = 'https://github.com/paritytech/cumulus.git'
161200
branch = "polkadot-v0.9.8"
162201

202+
[dependencies.cumulus-client-cli]
203+
git = 'https://github.com/paritytech/cumulus.git'
204+
branch = "polkadot-v0.9.8"
205+
163206
[dependencies.cumulus-client-network]
164207
git = 'https://github.com/paritytech/cumulus.git'
165208
branch = "polkadot-v0.9.8"
@@ -172,6 +215,10 @@ branch = "polkadot-v0.9.8"
172215
git = 'https://github.com/paritytech/cumulus.git'
173216
branch = "polkadot-v0.9.8"
174217

218+
[dependencies.cumulus-primitives-parachain-inherent]
219+
git = 'https://github.com/paritytech/cumulus.git'
220+
branch = "polkadot-v0.9.8"
221+
175222
# Polkadot dependencies
176223
[dependencies.polkadot-primitives]
177224
git = "https://github.com/paritytech/polkadot"

node/src/chain_spec.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ const INITIAL_DHX_DAO_TREASURY_UNLOCKED_RESERVES_BALANCE: u128 = 30_000_000_000_
285285

286286
fn mk_genesis(endowed_accounts: Vec<AccountId>, root_key: AccountId, parachain_id: ParaId) -> GenesisConfig {
287287
GenesisConfig {
288-
frame_system: datahighway_runtime::SystemConfig {
288+
system: datahighway_runtime::SystemConfig {
289289
code: datahighway_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!").to_vec(),
290290
changes_trie_config: Default::default(),
291291
},
292-
pallet_balances: BalancesConfig {
292+
balances: BalancesConfig {
293293
balances: endowed_accounts
294294
.iter()
295295
.cloned()
@@ -298,18 +298,20 @@ fn mk_genesis(endowed_accounts: Vec<AccountId>, root_key: AccountId, parachain_i
298298
.map(|k| (k.0, INITIAL_DHX_DAO_TREASURY_UNLOCKED_RESERVES_BALANCE))
299299
.collect(),
300300
},
301-
pallet_collective_Instance1: Default::default(),
302-
pallet_membership_Instance1: GeneralCouncilMembershipConfig {
301+
general_council: Default::default(),
302+
general_council_membership: GeneralCouncilMembershipConfig {
303303
members: vec![root_key.clone()],
304304
phantom: Default::default(),
305305
},
306306
pallet_treasury: Default::default(),
307-
pallet_sudo: SudoConfig {
307+
sudo: SudoConfig {
308308
key: root_key.clone(),
309309
},
310310
parachain_info: datahighway_runtime::ParachainInfoConfig {
311311
parachain_id,
312312
},
313+
aura: Default::default(),
314+
aura_ext: Default::default(),
313315
}
314316
}
315317

@@ -320,14 +322,14 @@ fn testnet_genesis(
320322
id: ParaId,
321323
) -> GenesisConfig {
322324
GenesisConfig {
323-
frame_system: datahighway_runtime::SystemConfig {
325+
system: datahighway_runtime::SystemConfig {
324326
code: datahighway_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!").to_vec(),
325327
changes_trie_config: Default::default(),
326328
},
327329
// pallet_indices: IndicesConfig {
328330
// indices: endowed_accounts.iter().enumerate().map(|(index, x)| (index as u32, (*x).clone())).collect(),
329331
// },
330-
pallet_balances: BalancesConfig {
332+
balances: BalancesConfig {
331333
balances: endowed_accounts
332334
.iter()
333335
.cloned()
@@ -353,7 +355,7 @@ fn testnet_genesis(
353355
// slash_reward_fraction: Perbill::from_percent(10),
354356
// ..Default::default()
355357
// },
356-
pallet_sudo: SudoConfig {
358+
sudo: SudoConfig {
357359
key: root_key.clone(),
358360
},
359361
// pallet_babe: BabeConfig {
@@ -362,15 +364,17 @@ fn testnet_genesis(
362364
// pallet_grandpa: GrandpaConfig {
363365
// authorities: vec![],
364366
// },
365-
pallet_collective_Instance1: Default::default(),
366-
pallet_membership_Instance1: GeneralCouncilMembershipConfig {
367+
general_council: Default::default(),
368+
general_council_membership: GeneralCouncilMembershipConfig {
367369
members: vec![root_key.clone()],
368370
phantom: Default::default(),
369371
},
370372
pallet_treasury: Default::default(),
371373
parachain_info: datahighway_runtime::ParachainInfoConfig {
372374
parachain_id: id,
373375
},
376+
aura: Default::default(),
377+
aura_ext: Default::default(),
374378
}
375379
}
376380

@@ -381,14 +385,14 @@ fn dev_genesis(
381385
id: ParaId,
382386
) -> datahighway_runtime::GenesisConfig {
383387
datahighway_runtime::GenesisConfig {
384-
frame_system: datahighway_runtime::SystemConfig {
388+
system: datahighway_runtime::SystemConfig {
385389
code: datahighway_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!").to_vec(),
386390
changes_trie_config: Default::default(),
387391
},
388392
// pallet_indices: IndicesConfig {
389393
// indices: endowed_accounts.iter().enumerate().map(|(index, x)| (index as u32, (*x).clone())).collect(),
390394
// },
391-
pallet_balances: datahighway_runtime::BalancesConfig {
395+
balances: datahighway_runtime::BalancesConfig {
392396
balances: endowed_accounts.iter().cloned().map(|x|
393397
// Insert Public key (hex) of the account without the 0x prefix below
394398
if x == UncheckedFrom::unchecked_from(hex!("a42b7518d62a942344fec55d414f1654bf3fd325dbfa32a3c30534d5976acb21").into()) {
@@ -416,7 +420,7 @@ fn dev_genesis(
416420
// slash_reward_fraction: Perbill::from_percent(10),
417421
// ..Default::default()
418422
// },
419-
pallet_sudo: datahighway_runtime::SudoConfig {
423+
sudo: datahighway_runtime::SudoConfig {
420424
key: root_key.clone(),
421425
},
422426
// pallet_babe: BabeConfig {
@@ -425,14 +429,16 @@ fn dev_genesis(
425429
// pallet_grandpa: GrandpaConfig {
426430
// authorities: vec![],
427431
// },
428-
pallet_collective_Instance1: Default::default(),
429-
pallet_membership_Instance1: GeneralCouncilMembershipConfig {
432+
general_council: Default::default(),
433+
general_council_membership: GeneralCouncilMembershipConfig {
430434
members: vec![root_key.clone()],
431435
phantom: Default::default(),
432436
},
433437
pallet_treasury: Default::default(),
434438
parachain_info: datahighway_runtime::ParachainInfoConfig {
435439
parachain_id: id,
436440
},
441+
aura: Default::default(),
442+
aura_ext: Default::default(),
437443
}
438444
}

node/src/cli.rs

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use std::path::PathBuf;
2-
1+
use crate::chain_spec;
2+
use cumulus_client_cli;
33
use sc_cli;
4+
use std::path::PathBuf;
45
use structopt::StructOpt;
56

67
/// Sub-commands supported by the collator.
@@ -30,7 +31,7 @@ pub enum Subcommand {
3031
ImportBlocks(sc_cli::ImportBlocksCmd),
3132

3233
/// Remove the whole chain.
33-
PurgeChain(sc_cli::PurgeChainCmd),
34+
PurgeChain(cumulus_client_cli::PurgeChainCmd),
3435

3536
/// Revert the chain to a previous state.
3637
Revert(sc_cli::RevertCmd),
@@ -72,24 +73,6 @@ pub struct ExportGenesisWasmCommand {
7273
pub chain: Option<String>,
7374
}
7475

75-
#[derive(Debug, StructOpt)]
76-
pub struct RunCmd {
77-
#[structopt(flatten)]
78-
pub base: sc_cli::RunCmd,
79-
80-
/// Id of the parachain this collator collates for.
81-
#[structopt(long)]
82-
pub parachain_id: Option<u32>,
83-
}
84-
85-
impl std::ops::Deref for RunCmd {
86-
type Target = sc_cli::RunCmd;
87-
88-
fn deref(&self) -> &Self::Target {
89-
&self.base
90-
}
91-
}
92-
9376
#[derive(Debug, StructOpt)]
9477
#[structopt(settings = &[
9578
structopt::clap::AppSettings::GlobalVersion,
@@ -101,13 +84,7 @@ pub struct Cli {
10184
pub subcommand: Option<Subcommand>,
10285

10386
#[structopt(flatten)]
104-
pub run: RunCmd,
105-
106-
/// Run node as collator.
107-
///
108-
/// Note that this is the same as running with `--validator`.
109-
#[structopt(long, conflicts_with = "validator")]
110-
pub collator: bool,
87+
pub run: cumulus_client_cli::RunCmd,
11188

11289
/// Relaychain arguments
11390
#[structopt(raw = true)]
@@ -127,12 +104,17 @@ pub struct RelayChainCli {
127104
}
128105

129106
impl RelayChainCli {
130-
/// Create a new instance of `Self`.
107+
/// Parse the relay chain CLI parameters using the para chain `Configuration`.
131108
pub fn new<'a>(
132-
base_path: Option<PathBuf>,
133-
chain_id: Option<String>,
109+
para_config: &sc_service::Configuration,
134110
relay_chain_args: impl Iterator<Item = &'a String>,
135111
) -> Self {
112+
let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec);
113+
let chain_id = extension.map(|e| e.relay_chain.clone());
114+
let base_path = para_config
115+
.base_path
116+
.as_ref()
117+
.map(|x| x.path().join("polkadot"));
136118
Self {
137119
base_path,
138120
chain_id,

0 commit comments

Comments
 (0)