Skip to content

Commit

Permalink
sc-chain-spec: deprecated code removed (paritytech#4410)
Browse files Browse the repository at this point in the history
This PR removes deprecated code:
- The `RuntimeGenesisConfig` generic type parameter in
`GenericChainSpec` struct.
- `ChainSpec::from_genesis` method allowing to create chain-spec using
closure providing runtime genesis struct
- `GenesisSource::Factory` variant together with no longer needed
`GenesisSource`'s generic parameter `G` (which was intended to be a
runtime genesis struct).


https://github.com/paritytech/polkadot-sdk/blob/17b56fae2d976a3df87f34076875de8c26da0355/substrate/client/chain-spec/src/chain_spec.rs#L559-L563
  • Loading branch information
michalkucharczyk authored and TarekkMA committed Aug 2, 2024
1 parent ed230fd commit 5799ebb
Show file tree
Hide file tree
Showing 21 changed files with 143 additions and 365 deletions.
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.

2 changes: 1 addition & 1 deletion cumulus/polkadot-parachain/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl Extensions {
}

/// Generic chain spec for all polkadot-parachain runtimes
pub type GenericChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub type GenericChainSpec = sc_service::GenericChainSpec<Extensions>;

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down
2 changes: 1 addition & 1 deletion cumulus/polkadot-parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ mod tests {
cfg_file_path
}

pub type DummyChainSpec<E> = sc_service::GenericChainSpec<(), E>;
pub type DummyChainSpec<E> = sc_service::GenericChainSpec<E>;

pub fn create_default_with_extensions<E: Extension>(
id: &str,
Expand Down
4 changes: 2 additions & 2 deletions cumulus/test/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![allow(missing_docs)]

use cumulus_primitives_core::ParaId;
use cumulus_test_runtime::{AccountId, RuntimeGenesisConfig, Signature};
use cumulus_test_runtime::{AccountId, Signature};
use parachains_common::AuraId;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
Expand All @@ -26,7 +26,7 @@ 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<RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down
6 changes: 3 additions & 3 deletions polkadot/node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ pub struct Extensions {
}

// Generic chain spec, in case when we don't have the native runtime.
pub type GenericChainSpec = service::GenericChainSpec<(), Extensions>;
pub type GenericChainSpec = service::GenericChainSpec<Extensions>;

/// The `ChainSpec` parameterized for the westend runtime.
#[cfg(feature = "westend-native")]
pub type WestendChainSpec = service::GenericChainSpec<(), Extensions>;
pub type WestendChainSpec = service::GenericChainSpec<Extensions>;

/// The `ChainSpec` parameterized for the westend runtime.
// Dummy chain spec, but that is fine when we don't have the native runtime.
Expand All @@ -83,7 +83,7 @@ pub type WestendChainSpec = GenericChainSpec;

/// The `ChainSpec` parameterized for the rococo runtime.
#[cfg(feature = "rococo-native")]
pub type RococoChainSpec = service::GenericChainSpec<(), Extensions>;
pub type RococoChainSpec = service::GenericChainSpec<Extensions>;

/// The `ChainSpec` parameterized for the rococo runtime.
// Dummy chain spec, but that is fine when we don't have the native runtime.
Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ pub use sc_executor::NativeExecutionDispatch;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
pub use service::{
config::{DatabaseSource, PrometheusConfig},
ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, RuntimeGenesis,
TFullBackend, TFullCallExecutor, TFullClient, TaskManager, TransactionPoolOptions,
ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, TFullBackend,
TFullCallExecutor, TFullClient, TaskManager, TransactionPoolOptions,
};
pub use sp_api::{ApiRef, ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi};
pub use sp_runtime::{
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/test/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use test_runtime_constants::currency::DOTS;
const DEFAULT_PROTOCOL_ID: &str = "dot";

/// The `ChainSpec` parameterized for polkadot test runtime.
pub type PolkadotChainSpec = sc_service::GenericChainSpec<(), Extensions>;
pub type PolkadotChainSpec = sc_service::GenericChainSpec<Extensions>;

/// Returns the properties for the [`PolkadotChainSpec`].
pub fn polkadot_chain_spec_properties() -> serde_json::map::Map<String, serde_json::Value> {
Expand Down
37 changes: 37 additions & 0 deletions prdoc/pr_4410.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
title: "[sc-chain-spec] Remove deprecated code"

doc:
- audience: Node Dev
description: |
The RuntimeGenesisConfig generic type parameter was removed from GenericChainSpec struct.
ChainSpec::from_genesis method was removed.
Removed related deprecated code from `sc-chain-spec`.
This change simplifies the codebase and ensures the use of up-to-date definitions.

crates:
- name: sc-service
bump: minor
- name: minimal-template-node
bump: minor
- name: sc-cli
bump: patch
- name: polkadot-test-service
bump: major
- name: sc-service-test
bump: major
- name: staging-node-cli
bump: major
- name: parachain-template-node
bump: minor
- name: solochain-template-node
bump: minor
- name: polkadot-parachain-bin
bump: major
- name: polkadot-service
bump: major
- name: sc-consensus-grandpa
bump: patch
- name: cumulus-test-service
bump: minor
- name: sc-chain-spec
bump: major
2 changes: 1 addition & 1 deletion substrate/bin/node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct Extensions {
}

/// Specialized `ChainSpec`.
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
/// Flaming Fir testnet generator
pub fn flaming_fir_config() -> Result<ChainSpec, String> {
ChainSpec::from_json_bytes(&include_bytes!("../res/flaming-fir.json")[..])
Expand Down
1 change: 1 addition & 0 deletions substrate/client/chain-spec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ substrate-test-runtime = { path = "../../test-utils/runtime" }
sp-keyring = { path = "../../primitives/keyring" }
sp-application-crypto = { default-features = false, path = "../../primitives/application-crypto", features = ["serde"] }
sp-consensus-babe = { default-features = false, path = "../../primitives/consensus/babe", features = ["serde"] }
regex = "1.6.0"

This file was deleted.

Loading

0 comments on commit 5799ebb

Please sign in to comment.