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

Kreivo de Paseo #417

Merged
merged 8 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ substrate-build-script-utils = {workspace = true}

[features]
default = []
paseo = [
"kreivo-runtime/paseo"
]
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
Expand Down
210 changes: 0 additions & 210 deletions node/src/chain_spec/kreivo.rs

This file was deleted.

89 changes: 89 additions & 0 deletions node/src/chain_spec/kreivo/live.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
use super::*;

#[cfg(not(feature = "paseo"))]
pub fn chain_spec() -> ChainSpec {
ChainSpec::from_json_bytes(include_bytes!("./kreivo_kusama_chainspec.json").as_slice()).unwrap()
}

#[cfg(feature = "paseo")]
use sp_core::crypto::Ss58Codec;

#[cfg(feature = "paseo")]
pub fn chain_spec() -> ChainSpec {
pandres95 marked this conversation as resolved.
Show resolved Hide resolved
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "PAS".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 42.into());

#[allow(deprecated)]
ChainSpec::builder(
kreivo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
Extensions {
relay_chain: "paseo".into(),
// You MUST set this to the correct network!
para_id: KREIVO_PARA_ID,
},
)
.with_name("Kreivo de Paseo")
.with_id("kreivo")
.with_chain_type(ChainType::Live)
.with_genesis_config_patch(local_genesis(
KREIVO_PARA_ID.into(),
// initial collators.
vec![(
sr25519::Public::from_string("Ets3sAp4f2odq8FLEV17CYHwec5KgMvNHfV4MVuiLoadjVp")
.expect("valid ss58 given; qed")
.into(),
sr25519::Public::from_string("Ets3sAp4f2odq8FLEV17CYHwec5KgMvNHfV4MVuiLoadjVp")
.expect("valid ss58 given; qed")
.into(),
)],
vec![], // No endowment. Send actual assets from Relay
sr25519::Public::from_string("EvoLanodoqDsgHb98Ymbu41uXXKfCPDKxeM6dXHyJ2JoVus")
.expect("valid ss58 given; qed")
.into(),
))
.with_protocol_id(DEFAULT_PROTOCOL_ID)
.with_properties(properties)
.build()
}

#[cfg(feature = "paseo")]
fn local_genesis(
id: ParaId,
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
sudo: AccountId,
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
},
"parachainInfo": {
"parachainId": id,
},
"collatorSelection": {
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
"candidacyBond": EXISTENTIAL_DEPOSIT * 16,
},
"session": {
"keys": invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
session_keys(aura), // session keys
)
})
.collect::<Vec<_>>(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
"sudo": {
"key": sudo
}
})
}
Loading