Commit 77ea0412 authored by Gav Wood's avatar Gav Wood
Browse files

New chain spec

parent f69ef9ec
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
use primitives::{H256, AuthorityId, ed25519}; use primitives::{H256, AuthorityId, ed25519};
use polkadot_runtime::{ use polkadot_runtime::{
GenesisConfig, ConsensusConfig, CouncilSeatsConfig, DemocracyConfig, GenesisConfig, ConsensusConfig, CouncilSeatsConfig, DemocracyConfig, TreasuryConfig,
SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, Perbill, SessionConfig, StakingConfig, TimestampConfig, BalancesConfig, Perbill,
CouncilVotingConfig, GrandpaConfig, UpgradeKeyConfig, SudoConfig CouncilVotingConfig, GrandpaConfig, UpgradeKeyConfig, SudoConfig, Permill
}; };
const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
...@@ -35,14 +35,22 @@ pub fn poc_3_testnet_config() -> Result<ChainSpec, String> { ...@@ -35,14 +35,22 @@ pub fn poc_3_testnet_config() -> Result<ChainSpec, String> {
fn staging_testnet_config_genesis() -> GenesisConfig { fn staging_testnet_config_genesis() -> GenesisConfig {
let initial_authorities = vec![ let initial_authorities = vec![
hex!["82c39b31a2b79a90f8e66e7a77fdb85a4ed5517f2ae39f6a80565e8ecae85cf5"].into(), hex!["4bd3620064cda1f4cf405bf9ab565c9bad69446034c48884ffc5363a5286b145"].into(),
hex!["4de37a07567ebcbf8c64568428a835269a566723687058e017b6d69db00a77e7"].into(), hex!["3a92077b16fbb87972be7ebaf1b7e70f5b4fac9636c136936a28d0fb494d1ed4"].into(),
hex!["063d7787ebca768b7445dfebe7d62cbb1625ff4dba288ea34488da266dd6dca5"].into(), hex!["ca8feb6f870330cdaea24e49c2f850b66729340cab164aea86c0a782ddecf57a"].into(),
hex!["8101764f45778d4980dadaceee6e8af2517d3ab91ac9bec9cd1714fa5994081c"].into(), hex!["dcb83e46917c3c0ca35b9a18a32ba6d3912b6d50ab2bd382341d2e4fd2e6946f"].into(),
]; ];
let endowed_accounts = vec![ let endowed_accounts = vec![
hex!["f295940fa750df68a686fcf4abd4111c8a9c5a5a5a83c4c8639c451a94a7adfd"].into(), hex!["f295940fa750df68a686fcf4abd4111c8a9c5a5a5a83c4c8639c451a94a7adfd"].into(),
]; ];
const MILLICENTS: u128 = 1_000_000_000;
const CENTS: u128 = 1_000 * MILLICENTS; // assume this is worth about a cent.
const DOLLARS: u128 = 100 * CENTS;
const SECS_PER_BLOCK: u64 = 6;
const MINUTES: u64 = 60 / SECS_PER_BLOCK;
const HOURS: u64 = MINUTES * 60;
const DAYS: u64 = HOURS * 24;
GenesisConfig { GenesisConfig {
consensus: Some(ConsensusConfig { consensus: Some(ConsensusConfig {
code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm").to_vec(), // TODO change code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm").to_vec(), // TODO change
...@@ -50,69 +58,74 @@ fn staging_testnet_config_genesis() -> GenesisConfig { ...@@ -50,69 +58,74 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
}), }),
system: None, system: None,
balances: Some(BalancesConfig { balances: Some(BalancesConfig {
transaction_base_fee: 100, balances: endowed_accounts.iter().map(|&k| (k, 10_000_000 * DOLLARS)).collect(),
transaction_byte_fee: 1, transaction_base_fee: 1 * CENTS,
existential_deposit: 500, transaction_byte_fee: 10 * MILLICENTS,
transfer_fee: 0, existential_deposit: 1 * DOLLARS,
creation_fee: 0, transfer_fee: 1 * CENTS,
reclaim_rebate: 0, creation_fee: 1 * CENTS,
balances: endowed_accounts.iter().map(|&k|(k, 1u128 << 60)).collect(), reclaim_rebate: 1 * CENTS,
}), }),
session: Some(SessionConfig { session: Some(SessionConfig {
validators: initial_authorities.iter().cloned().map(Into::into).collect(), validators: initial_authorities.iter().cloned().map(Into::into).collect(),
session_length: 60, // that's 5 minutes per session. session_length: 5 * MINUTES,
}), }),
staking: Some(StakingConfig { staking: Some(StakingConfig {
current_era: 0, current_era: 0,
intentions: initial_authorities.iter().cloned().map(Into::into).collect(), intentions: initial_authorities.iter().cloned().map(Into::into).collect(),
offline_slash: Perbill::from_billionths(1_000_000), offline_slash: Perbill::from_billionths(1_000_000),
session_reward: Perbill::from_billionths(60), session_reward: Perbill::from_billionths(2_065),
current_offline_slash: 0, current_offline_slash: 0,
current_session_reward: 0, current_session_reward: 0,
validator_count: 12, validator_count: 7,
sessions_per_era: 12, // 1 hour per era sessions_per_era: 12,
bonding_duration: 24 * 60 * 12, // 1 day per bond. bonding_duration: 60 * MINUTES,
offline_slash_grace: 4, offline_slash_grace: 4,
minimum_validator_count: 4, minimum_validator_count: 4,
}), }),
democracy: Some(DemocracyConfig { democracy: Some(DemocracyConfig {
launch_period: 12 * 60 * 24, // 1 day per public referendum launch_period: 10 * MINUTES, // 1 day per public referendum
voting_period: 12 * 60 * 24 * 3, // 3 days to discuss & vote on an active referendum voting_period: 10 * MINUTES, // 3 days to discuss & vote on an active referendum
minimum_deposit: 5000, // 12000 as the minimum deposit for a referendum minimum_deposit: 50 * DOLLARS, // 12000 as the minimum deposit for a referendum
public_delay: 10 * 60, public_delay: 10 * MINUTES,
max_lock_periods: 6, max_lock_periods: 6,
}), }),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.clone().into_iter().map(|k| (k, 1)).collect(),
}),
council_seats: Some(CouncilSeatsConfig { council_seats: Some(CouncilSeatsConfig {
active_council: vec![], active_council: vec![],
candidacy_bond: 5000, // 5000 to become a council candidate candidacy_bond: 10 * DOLLARS,
voter_bond: 1000, // 1000 down to vote for a candidate voter_bond: 1 * DOLLARS,
present_slash_per_voter: 1, // slash by 1 per voter for an invalid presentation. present_slash_per_voter: 1 * CENTS,
carry_count: 6, // carry over the 6 runners-up to the next council election carry_count: 6,
presentation_duration: 12 * 60 * 24, // one day for presenting winners. presentation_duration: 1 * DAYS,
approval_voting_period: 12 * 60 * 24 * 2, // two days period between possible council elections. approval_voting_period: 2 * DAYS,
term_duration: 12 * 60 * 24 * 24, // 24 day term duration for the council. term_duration: 28 * DAYS,
desired_seats: 0, // start with no council: we'll raise this once the stake has been dispersed a bit. desired_seats: 0,
inactive_grace_period: 1, // one addition vote should go by before an inactive voter can be reaped. inactive_grace_period: 1, // one additional vote should go by before an inactive voter can be reaped.
}), }),
council_voting: Some(CouncilVotingConfig { council_voting: Some(CouncilVotingConfig {
cooloff_period: 75, cooloff_period: 4 * DAYS,
voting_period: 20, voting_period: 1 * DAYS,
enact_delay_period: 0, enact_delay_period: 0,
}), }),
parachains: Some(Default::default()),
timestamp: Some(TimestampConfig { timestamp: Some(TimestampConfig {
period: 2, // 2*2=4 second block time. period: SECS_PER_BLOCK / 2, // due to the nature of aura the slots are 2*period
}), }),
treasury: Some(Default::default()), treasury: Some(TreasuryConfig {
proposal_bond: Permill::from_percent(5),
proposal_bond_minimum: 1 * DOLLARS,
spend_period: 1 * DAYS,
burn: Permill::from_percent(50),
}),
parachains: Some(Default::default()),
upgrade_key: Some(UpgradeKeyConfig { upgrade_key: Some(UpgradeKeyConfig {
key: endowed_accounts[0], key: endowed_accounts[0],
}), }),
sudo: Some(SudoConfig { sudo: Some(SudoConfig {
key: endowed_accounts[0], key: endowed_accounts[0],
}), }),
grandpa: Some(GrandpaConfig {
authorities: initial_authorities.clone().into_iter().map(|k| (k, 1)).collect(),
}),
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment