Skip to content

Commit 2d3a693

Browse files
sc-chain-spec: deprecated code removed (#4410)
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
1 parent a709768 commit 2d3a693

File tree

21 files changed

+143
-365
lines changed

21 files changed

+143
-365
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cumulus/polkadot-parachain/src/chain_spec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Extensions {
5454
}
5555

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

5959
/// Helper function to generate a crypto pair from seed
6060
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {

cumulus/polkadot-parachain/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ mod tests {
10171017
cfg_file_path
10181018
}
10191019

1020-
pub type DummyChainSpec<E> = sc_service::GenericChainSpec<(), E>;
1020+
pub type DummyChainSpec<E> = sc_service::GenericChainSpec<E>;
10211021

10221022
pub fn create_default_with_extensions<E: Extension>(
10231023
id: &str,

cumulus/test/service/src/chain_spec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#![allow(missing_docs)]
1818

1919
use cumulus_primitives_core::ParaId;
20-
use cumulus_test_runtime::{AccountId, RuntimeGenesisConfig, Signature};
20+
use cumulus_test_runtime::{AccountId, Signature};
2121
use parachains_common::AuraId;
2222
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
2323
use sc_service::ChainType;
@@ -26,7 +26,7 @@ use sp_core::{sr25519, Pair, Public};
2626
use sp_runtime::traits::{IdentifyAccount, Verify};
2727

2828
/// Specialized `ChainSpec` for the normal parachain runtime.
29-
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig, Extensions>;
29+
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
3030

3131
/// Helper function to generate a crypto pair from seed
3232
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {

polkadot/node/service/src/chain_spec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ pub struct Extensions {
7070
}
7171

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

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

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

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

8888
/// The `ChainSpec` parameterized for the rococo runtime.
8989
// Dummy chain spec, but that is fine when we don't have the native runtime.

polkadot/node/service/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ pub use sc_executor::NativeExecutionDispatch;
100100
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
101101
pub use service::{
102102
config::{DatabaseSource, PrometheusConfig},
103-
ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, RuntimeGenesis,
104-
TFullBackend, TFullCallExecutor, TFullClient, TaskManager, TransactionPoolOptions,
103+
ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, TFullBackend,
104+
TFullCallExecutor, TFullClient, TaskManager, TransactionPoolOptions,
105105
};
106106
pub use sp_api::{ApiRef, ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi};
107107
pub use sp_runtime::{

polkadot/node/test/service/src/chain_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use test_runtime_constants::currency::DOTS;
3333
const DEFAULT_PROTOCOL_ID: &str = "dot";
3434

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

3838
/// Returns the properties for the [`PolkadotChainSpec`].
3939
pub fn polkadot_chain_spec_properties() -> serde_json::map::Map<String, serde_json::Value> {

prdoc/pr_4410.prdoc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
title: "[sc-chain-spec] Remove deprecated code"
2+
3+
doc:
4+
- audience: Node Dev
5+
description: |
6+
The RuntimeGenesisConfig generic type parameter was removed from GenericChainSpec struct.
7+
ChainSpec::from_genesis method was removed.
8+
Removed related deprecated code from `sc-chain-spec`.
9+
This change simplifies the codebase and ensures the use of up-to-date definitions.
10+
11+
crates:
12+
- name: sc-service
13+
bump: minor
14+
- name: minimal-template-node
15+
bump: minor
16+
- name: sc-cli
17+
bump: patch
18+
- name: polkadot-test-service
19+
bump: major
20+
- name: sc-service-test
21+
bump: major
22+
- name: staging-node-cli
23+
bump: major
24+
- name: parachain-template-node
25+
bump: minor
26+
- name: solochain-template-node
27+
bump: minor
28+
- name: polkadot-parachain-bin
29+
bump: major
30+
- name: polkadot-service
31+
bump: major
32+
- name: sc-consensus-grandpa
33+
bump: patch
34+
- name: cumulus-test-service
35+
bump: minor
36+
- name: sc-chain-spec
37+
bump: major

substrate/bin/node/cli/src/chain_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub struct Extensions {
6464
}
6565

6666
/// Specialized `ChainSpec`.
67-
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig, Extensions>;
67+
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
6868
/// Flaming Fir testnet generator
6969
pub fn flaming_fir_config() -> Result<ChainSpec, String> {
7070
ChainSpec::from_json_bytes(&include_bytes!("../res/flaming-fir.json")[..])

substrate/client/chain-spec/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ substrate-test-runtime = { path = "../../test-utils/runtime" }
4242
sp-keyring = { path = "../../primitives/keyring" }
4343
sp-application-crypto = { default-features = false, path = "../../primitives/application-crypto", features = ["serde"] }
4444
sp-consensus-babe = { default-features = false, path = "../../primitives/consensus/babe", features = ["serde"] }
45+
regex = "1.6.0"

0 commit comments

Comments
 (0)