Skip to content

Commit

Permalink
Merge pull request #52 from r0gue-io/chungquantin/chore-stable2409
Browse files Browse the repository at this point in the history
chore: upgrade to stable2409
  • Loading branch information
chungquantin authored Jan 8, 2025
2 parents a136357 + 6ef127a commit 368d6d9
Show file tree
Hide file tree
Showing 11 changed files with 1,021 additions and 1,034 deletions.
1,358 changes: 662 additions & 696 deletions Cargo.lock

Large diffs are not rendered by default.

138 changes: 69 additions & 69 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,66 @@ members = ["node", "runtime"]
resolver = "2"

[workspace.dependencies]
clap = { version = "4.5.3", features = ["derive"] }
clap = { version = "4.5.10", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = [
"derive",
"derive",
] }
color-print = "0.3.4"
docify = "0.2.8"
futures = "0.3.30"
hex-literal = "0.4.1"
jsonrpsee = { version = "0.23.2", features = ["server"] }
jsonrpsee = { version = "0.24.3", features = ["server"] }
log = { version = "0.4.21", default-features = false }
scale-info = { version = "2.11.1", default-features = false, features = [
"derive",
"derive",
] }
serde = "1.0.197"
serde_json = "1.0.114"
serde = { version = "1.0.209", default-features = false }
serde_json = { version = "1.0.127", default-features = false }
smallvec = "1.11.2"

# Build
substrate-build-script-utils = "11.0.0"
substrate-wasm-builder = "24.0.0"
substrate-wasm-builder = "24.0.1"

# Local
parachain-template-runtime = { path = "./runtime" }

# Substrate
frame-benchmarking = { version = "37.0.0", default-features = false }
frame-benchmarking-cli = "42.0.0"
frame-executive = { version = "37.0.0", default-features = false }
frame-support = { version = "37.0.0", default-features = false }
frame-support-procedural = { version = "30.0.2", default-features = false }
frame-system = { version = "37.1.0", default-features = false }
frame-system-benchmarking = { version = "37.0.0", default-features = false }
frame-benchmarking = { version = "38.0.0", default-features = false }
frame-benchmarking-cli = "43.0.0"
frame-executive = { version = "38.0.0", default-features = false }
frame-support = { version = "38.2.0", default-features = false }
frame-support-procedural = { version = "30.0.3", default-features = false }
frame-system = { version = "38.0.0", default-features = false }
frame-system-benchmarking = { version = "38.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "34.0.0", default-features = false }
frame-try-runtime = { version = "0.43.0", default-features = false }
frame-metadata-hash-extension = { version = "0.5.0", default-features = false }
pallet-aura = { version = "36.0.0", default-features = false }
pallet-authorship = { version = "37.0.0", default-features = false }
pallet-balances = { version = "38.0.0", default-features = false }
pallet-message-queue = { version = "40.0.0", default-features = false }
pallet-session = { version = "37.0.0", default-features = false }
pallet-sudo = { version = "37.0.0", default-features = false }
pallet-timestamp = { version = "36.0.0", default-features = false }
pallet-transaction-payment = { version = "37.0.0", default-features = false }
pallet-transaction-payment-rpc = "40.0.0"
pallet-transaction-payment-rpc-runtime-api = { version = "37.0.0", default-features = false }
frame-try-runtime = { version = "0.44.0", default-features = false }
frame-metadata-hash-extension = { version = "0.6.0", default-features = false }
pallet-aura = { version = "37.0.0", default-features = false }
pallet-authorship = { version = "38.0.0", default-features = false }
pallet-balances = { version = "39.0.0", default-features = false }
pallet-message-queue = { version = "41.0.2", default-features = false }
pallet-session = { version = "38.0.0", default-features = false }
pallet-sudo = { version = "38.0.0", default-features = false }
pallet-timestamp = { version = "37.0.0", default-features = false }
pallet-transaction-payment = { version = "38.0.2", default-features = false }
pallet-transaction-payment-rpc = "41.0.0"
pallet-transaction-payment-rpc-runtime-api = { version = "38.0.0", default-features = false }
prometheus-endpoint = { version = "0.17.0", default-features = false, package = "substrate-prometheus-endpoint" }
sc-basic-authorship = "0.44.0"
sc-chain-spec = "37.0.0"
sc-cli = "0.46.0"
sc-basic-authorship = "0.45.0"
sc-chain-spec = "38.0.0"
sc-cli = "0.47.0"
sc-client-api = "37.0.0"
sc-offchain = "39.0.0"
sc-consensus = "0.43.0"
sc-executor = "0.40.0"
sc-network = "0.44.0"
sc-network-sync = "0.43.0"
sc-rpc = "39.0.0"
sc-service = "0.45.0"
sc-sysinfo = "37.0.0"
sc-telemetry = "24.0.0"
sc-tracing = "37.0.0"
sc-offchain = "40.0.0"
sc-consensus = "0.44.0"
sc-executor = "0.40.1"
sc-network = "0.45.3"
sc-network-sync = "0.44.1"
sc-rpc = "40.0.0"
sc-service = "0.46.0"
sc-sysinfo = "38.0.0"
sc-telemetry = "25.0.0"
sc-tracing = "37.0.1"
sc-transaction-pool = "37.0.0"
sc-transaction-pool-api = "37.0.0"
sp-api = { version = "34.0.0", default-features = false }
Expand All @@ -81,46 +81,46 @@ sp-blockchain = "37.0.1"
sp-consensus-aura = { version = "0.40.0", default-features = false }
sp-core = { version = "34.0.0", default-features = false }
sp-io = { version = "38.0.0", default-features = false }
sp-genesis-builder = { version = "0.15.0", default-features = false }
sp-genesis-builder = { version = "0.15.1", default-features = false }
sp-inherents = { version = "34.0.0", default-features = false }
sp-keystore = "0.40.0"
sp-offchain = { version = "34.0.0", default-features = false }
sp-runtime = { version = "39.0.0", default-features = false }
sp-session = { version = "35.0.0", default-features = false }
sp-runtime = { version = "39.0.5", default-features = false }
sp-session = { version = "36.0.0", default-features = false }
sp-std = { version = "14.0.0", default-features = false }
sp-timestamp = "34.0.0"
sp-transaction-pool = { version = "34.0.0", default-features = false }
sp-version = { version = "37.0.0", default-features = false }
substrate-frame-rpc-system = "38.0.0"
substrate-frame-rpc-system = "39.0.0"

# Polkadot
pallet-xcm = { version = "16.0.0", default-features = false }
polkadot-cli = "17.0.0"
pallet-xcm = { version = "17.0.1", default-features = false }
polkadot-cli = "19.0.0"
polkadot-parachain-primitives = { version = "14.0.0", default-features = false }
polkadot-primitives = "15.0.0"
polkadot-runtime-common = { version = "16.0.0", default-features = false }
xcm = { version = "14.1.0", package = "staging-xcm", default-features = false }
xcm-builder = { version = "16.0.0", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "16.0.0", package = "staging-xcm-executor", default-features = false }
polkadot-primitives = "16.0.0"
polkadot-runtime-common = { version = "17.0.0", default-features = false }
xcm = { version = "14.2.0", package = "staging-xcm", default-features = false }
xcm-builder = { version = "17.0.3", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "17.0.0", package = "staging-xcm-executor", default-features = false }

# Cumulus
cumulus-client-cli = "0.17.0"
cumulus-client-collator = "0.17.0"
cumulus-client-consensus-aura = "0.17.0"
cumulus-client-consensus-common = "0.17.0"
cumulus-client-consensus-proposer = "0.15.0"
cumulus-client-service = "0.17.0"
cumulus-pallet-aura-ext = { version = "0.16.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.16.0", default-features = false }
cumulus-pallet-session-benchmarking = { version = "18.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.16.0", default-features = false }
cumulus-pallet-xcmp-queue = { version = "0.16.0", default-features = false }
cumulus-client-cli = "0.18.0"
cumulus-client-collator = "0.18.0"
cumulus-client-consensus-aura = "0.18.0"
cumulus-client-consensus-common = "0.18.0"
cumulus-client-consensus-proposer = "0.16.0"
cumulus-client-service = "0.19.0"
cumulus-pallet-aura-ext = { version = "0.17.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.17.1", default-features = false }
cumulus-pallet-session-benchmarking = { version = "19.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.17.0", default-features = false }
cumulus-pallet-xcmp-queue = { version = "0.17.0", default-features = false }
cumulus-primitives-aura = { version = "0.15.0", default-features = false }
cumulus-primitives-core = { version = "0.15.0", default-features = false }
cumulus-primitives-parachain-inherent = "0.15.0"
cumulus-primitives-storage-weight-reclaim = { version = "7.0.1", default-features = false }
cumulus-primitives-utility = { version = "0.16.0", default-features = false }
cumulus-relay-chain-interface = "0.17.0"
pallet-collator-selection = { version = "18.0.0", default-features = false }
parachains-common = { version = "17.0.0", default-features = false }
parachain-info = { version = "0.16.0", package = "staging-parachain-info", default-features = false }
cumulus-primitives-core = { version = "0.16.0", default-features = false }
cumulus-primitives-parachain-inherent = "0.16.0"
cumulus-primitives-storage-weight-reclaim = { version = "8.0.0", default-features = false }
cumulus-primitives-utility = { version = "0.17.0", default-features = false }
cumulus-relay-chain-interface = "0.18.0"
pallet-collator-selection = { version = "19.0.0", default-features = false }
parachains-common = { version = "18.0.0", default-features = false }
parachain-info = { version = "0.17.0", package = "staging-parachain-info", default-features = false }
26 changes: 14 additions & 12 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ sp-block-builder.workspace = true
sp-blockchain.workspace = true
sp-consensus-aura.workspace = true
sp-core.workspace = true
sp-genesis-builder.workspace = true
sp-genesis-builder.default-features = true
sp-keystore.workspace = true
sp-io.workspace = true
sp-runtime.workspace = true
Expand All @@ -78,19 +80,19 @@ cumulus-relay-chain-interface.workspace = true

[features]
default = ["std"]
std = ["log/std", "xcm/std"]
std = ["xcm/std"]
runtime-benchmarks = [
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"parachain-template-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"parachain-template-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"parachain-template-runtime/try-runtime",
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
"parachain-template-runtime/try-runtime",
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
]
134 changes: 2 additions & 132 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
use cumulus_primitives_core::ParaId;
use parachain_template_runtime as runtime;
use runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
.expect("static values are valid; qed")
.public()
}

/// The extensions for the [`ChainSpec`].
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
pub struct Extensions {
Expand All @@ -38,30 +24,6 @@ impl Extensions {
}
}

type AccountPublic = <Signature as Verify>::Signer;

/// Generate collator keys from seed.
///
/// This function's return type must always match the session keys of the chain in tuple format.
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
get_from_seed::<AuraId>(seed)
}

/// Helper function to generate an account ID from seed
pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
where
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
{
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
}

/// Generate the 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 template_session_keys(keys: AuraId) -> runtime::SessionKeys {
runtime::SessionKeys { aura: keys }
}

pub fn development_config() -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
Expand All @@ -80,35 +42,7 @@ pub fn development_config() -> ChainSpec {
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(testnet_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob"),
),
],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
2000.into(),
))
.with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
.build()
}

Expand All @@ -131,72 +65,8 @@ pub fn local_testnet_config() -> ChainSpec {
.with_name("Local Testnet")
.with_id("local_testnet")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(testnet_genesis(
// initial collators.
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_collator_keys_from_seed("Alice"),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_collator_keys_from_seed("Bob"),
),
],
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
2000.into(),
))
.with_genesis_config_preset_name(sc_chain_spec::LOCAL_TESTNET_RUNTIME_PRESET)
.with_protocol_id("template-local")
.with_properties(properties)
.build()
}

fn testnet_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
root: AccountId,
id: ParaId,
) -> 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
template_session_keys(aura), // session keys
)
})
.collect::<Vec<_>>(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
"sudo": { "key": Some(root) }
})
}
Loading

0 comments on commit 368d6d9

Please sign in to comment.