Skip to content

Commit c53f4b4

Browse files
committed
enable governance related modules.
1 parent 6f078e2 commit c53f4b4

File tree

6 files changed

+575
-91
lines changed

6 files changed

+575
-91
lines changed

Cargo.lock

+93
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/src/chain_spec.rs

+46-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use sp_core::{Pair, Public, crypto::UncheckedInto, sr25519};
22
use node_template_runtime::{
33
AccountId, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig,
4-
SudoConfig, SystemConfig, SessionConfig, StakingConfig, opaque::SessionKeys,
4+
SudoConfig, SystemConfig, SessionConfig, StakingConfig, DemocracyConfig,
5+
ElectionsConfig, CouncilConfig, TechnicalCommitteeConfig, opaque::SessionKeys,
56
StakerStatus, Balance, currency::DOLLARS, WASM_BINARY, Signature, ImOnlineConfig,
67
};
78
use sp_consensus_babe::{AuthorityId as BabeId};
@@ -121,6 +122,7 @@ fn testnet_genesis(initial_authorities: Vec<(AccountId, AccountId, BabeId, Grand
121122
_enable_println: bool) -> GenesisConfig {
122123

123124
const STASH: Balance = 100 * DOLLARS;
125+
let num_endowed_accounts = endowed_accounts.len();
124126

125127
GenesisConfig {
126128
system: Some(SystemConfig {
@@ -161,6 +163,24 @@ fn testnet_genesis(initial_authorities: Vec<(AccountId, AccountId, BabeId, Grand
161163
im_online: Some(ImOnlineConfig {
162164
keys: vec![],
163165
}),
166+
democracy: Some(DemocracyConfig::default()),
167+
elections_phragmen: Some(ElectionsConfig {
168+
members: endowed_accounts.iter()
169+
.take((num_endowed_accounts + 1) / 2)
170+
.cloned()
171+
.map(|member| (member, STASH))
172+
.collect(),
173+
}),
174+
collective_Instance1: Some(CouncilConfig::default()),
175+
collective_Instance2: Some(TechnicalCommitteeConfig {
176+
members: endowed_accounts.iter()
177+
.take((num_endowed_accounts + 1) / 2)
178+
.cloned()
179+
.collect(),
180+
phantom: Default::default(),
181+
}),
182+
membership_Instance1: Some(Default::default()),
183+
treasury: Some(Default::default()),
164184
}
165185
}
166186

@@ -189,6 +209,12 @@ fn tao_staging_testnet_genesis() -> GenesisConfig {
189209
let endowed_accounts = vec![
190210
// 5FemZuvaJ7wVy4S49X7Y9mj7FyTR4caQD5mZo2rL7MXQoXMi
191211
hex!["9eaf896d76b55e04616ff1e1dce7fc5e4a417967c17264728b3fd8fee3b12f3c"].into(),
212+
// 5FNrxGpnd3z5NTBEFDarNeCCYYx2Fw7DFbsXv1VuwmNXQsNW
213+
hex!["928dbd595055b13e3606618516e69d60ea4d8861f0f1c632cf9f503c45f24717"].into(),
214+
// 5DknRrEh2khKAiEV9rFFGJLiQQahSJZ7hTYPQNfYmxFsLHQr
215+
hex!["4acd70cdbe4a0ab21e96615e1d3f7f809d44ceb169d19232327dc71819451c6e"].into(),
216+
// 5E4gXxnM9oC16VCfiL2rGbYhie9B1W8unKpQ2HPzj2EqoGJL
217+
hex!["587403d0dbdc7d12ce2a4da526b18df0a3b5c7c2074464c4879ef47b42769b2d"].into(),
192218
];
193219

194220
// for i in 1 2 3 4; do for j in stash controller; do subkey inspect "$SECRET//$i//$j"; done; done
@@ -249,6 +275,7 @@ fn tao_staging_testnet_genesis() -> GenesisConfig {
249275

250276
const ENDOWMENT: u128 = 1_000_000 * DOLLARS;
251277
const STASH: u128 = 100 * DOLLARS;
278+
let num_endowed_accounts = endowed_accounts.len();
252279

253280
GenesisConfig {
254281
system: Some(SystemConfig {
@@ -294,6 +321,24 @@ fn tao_staging_testnet_genesis() -> GenesisConfig {
294321
im_online: Some(ImOnlineConfig {
295322
keys: vec![],
296323
}),
324+
democracy: Some(DemocracyConfig::default()),
325+
elections_phragmen: Some(ElectionsConfig {
326+
members: endowed_accounts.iter()
327+
.take((num_endowed_accounts + 1) / 2)
328+
.cloned()
329+
.map(|member| (member, STASH))
330+
.collect(),
331+
}),
332+
collective_Instance1: Some(CouncilConfig::default()),
333+
collective_Instance2: Some(TechnicalCommitteeConfig {
334+
members: endowed_accounts.iter()
335+
.take((num_endowed_accounts + 1) / 2)
336+
.cloned()
337+
.collect(),
338+
phantom: Default::default(),
339+
}),
340+
membership_Instance1: Some(Default::default()),
341+
treasury: Some(Default::default()),
297342
}
298343
}
299344

runtime/Cargo.toml

+52
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[dependencies]
2+
static_assertions = "1.1.0"
3+
14
[dependencies.babe]
25
default-features = false
36
git = 'https://github.com/paritytech/substrate.git'
@@ -197,6 +200,49 @@ package = 'pallet-utility'
197200
tag = 'v2.0.0-rc4'
198201
version = '2.0.0-rc4'
199202

203+
204+
[dependencies.treasury]
205+
default-features = false
206+
git = 'https://github.com/paritytech/substrate.git'
207+
package = 'pallet-treasury'
208+
tag = 'v2.0.0-rc4'
209+
version = '2.0.0-rc4'
210+
211+
[dependencies.collective]
212+
default-features = false
213+
git = 'https://github.com/paritytech/substrate.git'
214+
package = 'pallet-collective'
215+
tag = 'v2.0.0-rc4'
216+
version = '2.0.0-rc4'
217+
218+
[dependencies.elections-phragmen]
219+
default-features = false
220+
git = 'https://github.com/paritytech/substrate.git'
221+
package = 'pallet-elections-phragmen'
222+
tag = 'v2.0.0-rc4'
223+
version = '2.0.0-rc4'
224+
225+
[dependencies.membership]
226+
default-features = false
227+
git = 'https://github.com/paritytech/substrate.git'
228+
package = 'pallet-membership'
229+
tag = 'v2.0.0-rc4'
230+
version = '2.0.0-rc4'
231+
232+
[dependencies.democracy]
233+
default-features = false
234+
git = 'https://github.com/paritytech/substrate.git'
235+
package = 'pallet-democracy'
236+
tag = 'v2.0.0-rc4'
237+
version = '2.0.0-rc4'
238+
239+
[dependencies.scheduler]
240+
default-features = false
241+
git = 'https://github.com/paritytech/substrate.git'
242+
package = 'pallet-scheduler'
243+
tag = 'v2.0.0-rc4'
244+
version = '2.0.0-rc4'
245+
200246
[dependencies.template]
201247
default-features = false
202248
package = 'pallet-template'
@@ -272,6 +318,12 @@ std = [
272318
'offences/std',
273319
'im-online/std',
274320
'transaction-payment/std',
321+
'utility/std',
322+
'treasury/std',
323+
'collective/std',
324+
'elections-phragmen/std',
325+
'membership/std',
326+
'democracy/std',
275327
'template/std',
276328
'organization/std',
277329
]

0 commit comments

Comments
 (0)