Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Manta Runtime #946

Merged
merged 9 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
57 changes: 7 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions node/src/chain_specs/calamari.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use calamari_runtime::{
currency::KMA, opaque::SessionKeys, CouncilConfig, DemocracyConfig, GenesisConfig,
ParachainStakingConfig, TechnicalCommitteeConfig,
};
use session_key_primitives::util::{unchecked_account_id, unchecked_collator_keys};
use session_key_primitives::util::unchecked_account_id;
/// Calamari Protocol Identifier
pub const CALAMARI_PROTOCOL_ID: &str = "calamari";

Expand Down Expand Up @@ -61,7 +61,7 @@ pub fn calamari_development_config() -> CalamariChainSpec {
calamari_dev_genesis(
vec![(
unchecked_account_id::<sr25519::Public>("Alice"),
SessionKeys::new(unchecked_collator_keys("Alice")),
SessionKeys::from_seed_unchecked("Alice"),
)],
// Delegations
vec![],
Expand Down Expand Up @@ -96,23 +96,23 @@ pub fn calamari_local_config() -> CalamariChainSpec {
vec![
(
unchecked_account_id::<sr25519::Public>("Alice"),
SessionKeys::new(unchecked_collator_keys("Alice")),
SessionKeys::from_seed_unchecked("Alice"),
),
(
unchecked_account_id::<sr25519::Public>("Bob"),
SessionKeys::new(unchecked_collator_keys("Bob")),
SessionKeys::from_seed_unchecked("Bob"),
),
(
unchecked_account_id::<sr25519::Public>("Charlie"),
SessionKeys::new(unchecked_collator_keys("Charlie")),
SessionKeys::from_seed_unchecked("Charlie"),
),
(
unchecked_account_id::<sr25519::Public>("Dave"),
SessionKeys::new(unchecked_collator_keys("Dave")),
SessionKeys::from_seed_unchecked("Dave"),
),
(
unchecked_account_id::<sr25519::Public>("Eve"),
SessionKeys::new(unchecked_collator_keys("Eve")),
SessionKeys::from_seed_unchecked("Eve"),
),
],
// Delegations
Expand Down
14 changes: 7 additions & 7 deletions node/src/chain_specs/dolphin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::command::{DOLPHIN_ON_BAIKAL_PARACHAIN_ID, DOLPHIN_PARACHAIN_ID};
use dolphin_runtime::{
opaque::SessionKeys, CouncilConfig, DemocracyConfig, GenesisConfig, TechnicalCommitteeConfig,
};
use session_key_primitives::util::{unchecked_account_id, unchecked_collator_keys};
use session_key_primitives::util::unchecked_account_id;

/// Dolphin Protocol Identifier
pub const DOLPHIN_PROTOCOL_ID: &str = "dolphin";
Expand Down Expand Up @@ -56,7 +56,7 @@ pub fn dolphin_development_config() -> DolphinChainSpec {
dolphin_dev_genesis(
vec![(
unchecked_account_id::<sr25519::Public>("Alice"),
SessionKeys::new(unchecked_collator_keys("Alice")),
SessionKeys::from_seed_unchecked("Alice"),
)],
unchecked_account_id::<sr25519::Public>("Alice"),
vec![
Expand Down Expand Up @@ -90,23 +90,23 @@ pub fn dolphin_local_config() -> DolphinChainSpec {
vec![
(
unchecked_account_id::<sr25519::Public>("Alice"),
SessionKeys::new(unchecked_collator_keys("Alice")),
SessionKeys::from_seed_unchecked("Alice"),
),
(
unchecked_account_id::<sr25519::Public>("Bob"),
SessionKeys::new(unchecked_collator_keys("Bob")),
SessionKeys::from_seed_unchecked("Bob"),
),
(
unchecked_account_id::<sr25519::Public>("Charlie"),
SessionKeys::new(unchecked_collator_keys("Charlie")),
SessionKeys::from_seed_unchecked("Charlie"),
),
(
unchecked_account_id::<sr25519::Public>("Dave"),
SessionKeys::new(unchecked_collator_keys("Dave")),
SessionKeys::from_seed_unchecked("Dave"),
),
(
unchecked_account_id::<sr25519::Public>("Eve"),
SessionKeys::new(unchecked_collator_keys("Eve")),
SessionKeys::from_seed_unchecked("Eve"),
),
],
unchecked_account_id::<sr25519::Public>("Alice"),
Expand Down
68 changes: 44 additions & 24 deletions node/src/chain_specs/manta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

use super::*;
use crate::command::MANTA_PARACHAIN_ID;
use manta_runtime::opaque::SessionKeys;
use session_key_primitives::util::{unchecked_account_id, unchecked_collator_keys};
use manta_runtime::{opaque::SessionKeys, GenesisConfig, ParachainStakingConfig};
use session_key_primitives::util::unchecked_account_id;
/// Manta Protocol Identifier
pub const MANTA_PROTOCOL_ID: &str = "manta";

Expand All @@ -35,13 +35,6 @@ pub const SAFE_XCM_VERSION: u32 = 2;
/// Manta Chain Specification
pub type MantaChainSpec = sc_service::GenericChainSpec<manta_runtime::GenesisConfig, Extensions>;

/// Generate the manta session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn manta_session_keys(keys: AuraId) -> SessionKeys {
SessionKeys { aura: keys }
}

/// Returns the [`Properties`] for the Manta parachain.
pub fn manta_properties() -> Properties {
let mut p = Properties::new();
Expand All @@ -61,9 +54,11 @@ pub fn manta_development_config() -> MantaChainSpec {
manta_dev_genesis(
vec![(
unchecked_account_id::<sr25519::Public>("Alice"),
unchecked_collator_keys("Alice").0,
SessionKeys::from_seed_unchecked("Alice"),
)],
unchecked_account_id::<sr25519::Public>("Alice"),
// Delegations
vec![],
vec![
unchecked_account_id::<sr25519::Public>("Alice"),
unchecked_account_id::<sr25519::Public>("Bob"),
Expand Down Expand Up @@ -95,14 +90,28 @@ pub fn manta_local_config() -> MantaChainSpec {
vec![
(
unchecked_account_id::<sr25519::Public>("Alice"),
unchecked_collator_keys("Alice").0,
SessionKeys::from_seed_unchecked("Alice"),
),
(
unchecked_account_id::<sr25519::Public>("Bob"),
unchecked_collator_keys("Bob").0,
SessionKeys::from_seed_unchecked("Bob"),
),
(
unchecked_account_id::<sr25519::Public>("Charlie"),
SessionKeys::from_seed_unchecked("Charlie"),
),
(
unchecked_account_id::<sr25519::Public>("Dave"),
SessionKeys::from_seed_unchecked("Dave"),
),
(
unchecked_account_id::<sr25519::Public>("Eve"),
SessionKeys::from_seed_unchecked("Eve"),
),
],
unchecked_account_id::<sr25519::Public>("Alice"),
// Delegations
vec![],
vec![
unchecked_account_id::<sr25519::Public>("Alice"),
unchecked_account_id::<sr25519::Public>("Bob"),
Expand Down Expand Up @@ -130,11 +139,12 @@ pub fn manta_local_config() -> MantaChainSpec {
}

fn manta_dev_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
invulnerables: Vec<(AccountId, SessionKeys)>,
root_key: AccountId,
delegations: Vec<(AccountId, AccountId, Balance)>,
endowed_accounts: Vec<AccountId>,
) -> manta_runtime::GenesisConfig {
manta_runtime::GenesisConfig {
) -> GenesisConfig {
GenesisConfig {
system: manta_runtime::SystemConfig {
code: manta_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
Expand All @@ -157,32 +167,42 @@ fn manta_dev_genesis(
sudo: manta_runtime::SudoConfig {
key: Some(root_key),
},
parachain_staking: ParachainStakingConfig {
candidates: invulnerables
.iter()
.cloned()
.map(|(account, _)| {
(
account,
manta_runtime::staking::NORMAL_COLLATOR_MINIMUM_STAKE,
)
})
.collect(),
delegations,
inflation_config: manta_runtime::staking::inflation_config::<manta_runtime::Runtime>(),
},
parachain_info: manta_runtime::ParachainInfoConfig {
parachain_id: MANTA_PARACHAIN_ID.into(),
Garandor marked this conversation as resolved.
Show resolved Hide resolved
},
collator_selection: manta_runtime::CollatorSelectionConfig {
Dengjianping marked this conversation as resolved.
Show resolved Hide resolved
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: MANTA * 10000, // How many tokens will be reserved as collator
candidacy_bond: 10_000 * MANTA, // How many tokens will be reserved as collator
..Default::default()
},
session: manta_runtime::SessionConfig {
keys: invulnerables
.iter()
.cloned()
.map(|(acc, aura)| {
.map(|(acc, session_keys)| {
(
acc.clone(), // account id
acc, // validator id
manta_session_keys(aura), // session keys
acc.clone(), // account id
acc, // validator id
session_keys, // collator session keys
)
})
.collect(),
},
aura_ext: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: manta_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
}
}

Expand Down
1 change: 0 additions & 1 deletion node/src/chain_specs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use manta_primitives::{
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::{ChainType, Properties};
use serde::{Deserialize, Serialize};
use session_key_primitives::AuraId;
use sp_core::sr25519;

pub mod calamari;
Expand Down
Loading