Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ jobs:
fail-fast: false
matrix:
chain: [integritee]
config: [rococo, westend, kusama, polkadot]
config: [rococo, westend, kusama, polkadot, moonbase]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
74 changes: 74 additions & 0 deletions polkadot-parachains/res/integritee-moonbase.json

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions polkadot-parachains/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ pub enum GenesisKeys {
Integritee,
/// Use Keys from the keyring for a test setup
WellKnown,
/// Use integriTEE dev keys.
IntegriteeDev,
}

struct WellKnownKeys;
Expand Down Expand Up @@ -104,6 +106,29 @@ impl IntegriteeKeys {
}
}

struct IntegriteeDevKeys;

impl IntegriteeDevKeys {
fn root() -> AccountId {
public_from_ss58::<sr25519::Public>("5DMCERPw2yC6LBWNKzswHKLCtuYdtmgKssLJAsPGPVp6fuMY")
.into()
}
fn authorities() -> Vec<AuraId> {
vec![
public_from_ss58::<sr25519::Public>("5GZJjbPPD9u6NDgK1ApYmbyGs7EBX4HeEz2y2CD38YJxjvQH")
.into(),
public_from_ss58::<sr25519::Public>("5CcSd1GZus6Jw7rP47LLqMMmtr2KeXCH6W11ZKk1LbCQ9dPY")
.into(),
public_from_ss58::<sr25519::Public>("5FsECrDjBXrh5hXmN4PhQfNPbjYYwwW7edu2UQ8G5LR1JFuH")
.into(),
public_from_ss58::<sr25519::Public>("5HBdSEnswkqm6eoHzzX5PCeKoC15CCy88vARrT8XMaRRuyaE")
.into(),
public_from_ss58::<sr25519::Public>("5GGxVLYTXS7JZAwVzisdXbsugHSD6gtDb3AT3MVzih9jTLQT")
.into(),
]
}
}

pub fn shell_chain_spec(
id: ParaId,
genesis_keys: GenesisKeys,
Expand All @@ -112,6 +137,11 @@ pub fn shell_chain_spec(
let (root, endowed, authorities) = match genesis_keys {
GenesisKeys::Integritee =>
(IntegriteeKeys::root(), vec![IntegriteeKeys::root()], IntegriteeKeys::authorities()),
GenesisKeys::IntegriteeDev => (
IntegriteeDevKeys::root(),
vec![IntegriteeDevKeys::root()],
IntegriteeDevKeys::authorities(),
),
GenesisKeys::WellKnown =>
(WellKnownKeys::root(), WellKnownKeys::endowed(), WellKnownKeys::authorities()),
};
Expand All @@ -136,6 +166,11 @@ pub fn integritee_chain_spec(
(IntegriteeKeys::root(), vec![IntegriteeKeys::root()], IntegriteeKeys::authorities()),
GenesisKeys::WellKnown =>
(WellKnownKeys::root(), WellKnownKeys::endowed(), WellKnownKeys::authorities()),
GenesisKeys::IntegriteeDev => (
IntegriteeDevKeys::root(),
vec![IntegriteeDevKeys::root()],
IntegriteeDevKeys::authorities(),
),
};

let chain_name = "Integritee Network".to_string();
Expand Down Expand Up @@ -244,6 +279,7 @@ pub enum RelayChain {
Westend,
Kusama,
Polkadot,
Moonbase,
}

pub fn shell_rococo_config() -> Result<ShellChainSpec, String> {
Expand All @@ -262,6 +298,10 @@ pub fn shell_polkadot_config() -> Result<ShellChainSpec, String> {
ShellChainSpec::from_json_bytes(&include_bytes!("../res/integritee-polkadot.json")[..])
}

pub fn shell_moonbase_config() -> Result<ShellChainSpec, String> {
ShellChainSpec::from_json_bytes(&include_bytes!("../res/integritee-moonbase.json")[..])
}

impl ToString for RelayChain {
fn to_string(&self) -> String {
match self {
Expand All @@ -273,6 +313,7 @@ impl ToString for RelayChain {
RelayChain::Westend => "westend".into(),
RelayChain::Kusama => "kusama".into(),
RelayChain::Polkadot => "polkadot".into(),
RelayChain::Moonbase => "westend_moonbase_relay_testnet".into(),
}
}
}
Expand All @@ -288,6 +329,7 @@ impl RelayChain {
RelayChain::Westend => ChainType::Live,
RelayChain::Kusama => ChainType::Live,
RelayChain::Polkadot => ChainType::Live,
RelayChain::Moonbase => ChainType::Live,
}
}
fn protocol_id(&self) -> &str {
Expand All @@ -300,6 +342,7 @@ impl RelayChain {
RelayChain::Westend => "teer-w",
RelayChain::Kusama => "teer-k",
RelayChain::Polkadot => "teer-p",
RelayChain::Moonbase => "teer-m",
}
}
}
8 changes: 6 additions & 2 deletions polkadot-parachains/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
use crate::{
chain_spec,
chain_spec::{
integritee_chain_spec, shell_chain_spec, shell_kusama_config, shell_polkadot_config,
shell_rococo_config, shell_westend_config, GenesisKeys, RelayChain, ShellChainSpec,
integritee_chain_spec, shell_chain_spec, shell_kusama_config, shell_moonbase_config,
shell_polkadot_config, shell_rococo_config, shell_westend_config, GenesisKeys, RelayChain,
ShellChainSpec,
},
cli::{Cli, RelayChainCli, Subcommand},
service::{
Expand Down Expand Up @@ -47,6 +48,7 @@ const ROCOCO_PARA_ID: u32 = 2015;
const WESTEND_PARA_ID: u32 = 2081;
const KUSAMA_PARA_ID: u32 = 2015;
const POLKADOT_PARA_ID: u32 = 2039;
const MOONBASE_PARA_ID: u32 = 2015;

trait IdentifyChain {
fn is_shell(&self) -> bool;
Expand Down Expand Up @@ -75,12 +77,14 @@ fn load_spec(
"integritee-westend" => Box::new(shell_westend_config()?),
"integritee-kusama" => Box::new(shell_kusama_config()?),
"integritee-polkadot" => Box::new(shell_polkadot_config()?),
"integritee-moonbase" => Box::new(shell_moonbase_config()?),

// live config initialize
"integritee-rococo-fresh" => Box::new(shell_chain_spec(ROCOCO_PARA_ID.into(), GenesisKeys::Integritee, RelayChain::Rococo)),
"integritee-westend-fresh" => Box::new(shell_chain_spec(WESTEND_PARA_ID.into(), GenesisKeys::Integritee, RelayChain::Westend)),
"integritee-kusama-fresh" => Box::new(shell_chain_spec(KUSAMA_PARA_ID.into(), GenesisKeys::Integritee, RelayChain::Kusama)),
"integritee-polkadot-fresh" => Box::new(shell_chain_spec(POLKADOT_PARA_ID.into(), GenesisKeys::Integritee, RelayChain::Polkadot)),
"integritee-moonbase-fresh" => Box::new(integritee_chain_spec(MOONBASE_PARA_ID.into(), GenesisKeys::IntegriteeDev, RelayChain::Moonbase)),

// on-the-spot specs
"integritee-rococo-local" => Box::new(integritee_chain_spec(LOCAL_PARA_ID.into(), GenesisKeys::Integritee, RelayChain::RococoLocal)),
Expand Down
1 change: 1 addition & 0 deletions scripts/dump_wasm_and_state_for_all_chains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ chainspecs=("integritee-rococo-local" \
"integritee-polkadot-local" \
"integritee-polkadot-local-dev" \
"integritee-polkadot" \
"integritee-moonbase" \
"shell-rococo-local" \
"shell-rococo-local-dev" \
"shell-westend-local" \
Expand Down
1 change: 1 addition & 0 deletions scripts/update_hardcoded_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"integritee-westend",
"integritee-kusama",
"integritee-polkadot",
"integritee-moonbase",
]
COLLATOR = "target/release/integritee-collator"
RES_DIR = "polkadot-parachains/res"
Expand Down