From c367ac2488db23a68e1cdf446cece58c66ea93d5 Mon Sep 17 00:00:00 2001
From: Rodrigo Quelhas <22591718+RomarQ@users.noreply.github.com>
Date: Tue, 5 Mar 2024 14:05:04 +0000
Subject: [PATCH] remove deprecated type 'GenesisConfig' (#3378)

# Description

Removed deprecated type `GenesisConfig` from the codebase.

Closes https://github.com/paritytech/polkadot-sdk/issues/175

# Checklist

- [x] My PR includes a detailed description as outlined in the
"Description" section above
- [x] My PR follows the [labeling requirements](CONTRIBUTING.md#Process)
of this project (at minimum one label for `T`
  required)
- [x] I have made corresponding changes to the documentation (if
applicable)

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
---
 prdoc/pr_3378.prdoc                           | 13 +++++++++
 .../chain-spec/src/genesis_config_builder.rs  | 24 ++++++++-------
 .../src/construct_runtime/expand/config.rs    |  4 ---
 .../deprecated_where_block.stderr             |  2 +-
 .../primitives/genesis-builder/Cargo.toml     |  2 +-
 .../primitives/genesis-builder/src/lib.rs     | 29 ++++++++++---------
 6 files changed, 43 insertions(+), 31 deletions(-)
 create mode 100644 prdoc/pr_3378.prdoc

diff --git a/prdoc/pr_3378.prdoc b/prdoc/pr_3378.prdoc
new file mode 100644
index 00000000000..2470fc15851
--- /dev/null
+++ b/prdoc/pr_3378.prdoc
@@ -0,0 +1,13 @@
+# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
+# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
+
+title: Remove deprecated GenesisConfig
+
+doc:
+  - audience: Runtime Dev
+    description: |
+      Removes deprecated type `GenesisConfig`, it was replaced by `RuntimeGenesisConfig` on May 24 of 2023.
+      The type `GenesisConfig` was deprecated on May 24 of 2023 [#14210](https://github.com/paritytech/substrate/pull/14210)
+
+crates:
+  - name: frame-support-procedural
\ No newline at end of file
diff --git a/substrate/client/chain-spec/src/genesis_config_builder.rs b/substrate/client/chain-spec/src/genesis_config_builder.rs
index 6b956316203..c8b54f66be6 100644
--- a/substrate/client/chain-spec/src/genesis_config_builder.rs
+++ b/substrate/client/chain-spec/src/genesis_config_builder.rs
@@ -81,7 +81,8 @@ where
 			.0
 	}
 
-	/// Returns the default `GenesisConfig` provided by the `runtime`.
+	/// Returns a json representation of the default `RuntimeGenesisConfig` provided by the
+	/// `runtime`.
 	///
 	/// Calls [`GenesisBuilder::create_default_config`](sp_genesis_builder::GenesisBuilder::create_default_config) in the `runtime`.
 	pub fn get_default_config(&self) -> core::result::Result<Value, String> {
@@ -94,7 +95,7 @@ where
 		Ok(from_slice(&default_config[..]).expect("returned value is json. qed."))
 	}
 
-	/// Build the given `GenesisConfig` and returns the genesis state.
+	/// Builds `RuntimeGenesisConfig` from given json blob and returns the genesis state.
 	///
 	/// Calls [`GenesisBuilder::build_config`](sp_genesis_builder::GenesisBuilder::build_config)
 	/// provided by the `runtime`.
@@ -111,25 +112,26 @@ where
 		Ok(ext.into_storages())
 	}
 
-	/// Creates the genesis state by patching the default `GenesisConfig` and applying it.
+	/// Creates the genesis state by patching the default `RuntimeGenesisConfig`.
 	///
-	/// This function generates the `GenesisConfig` for the runtime by applying a provided JSON
-	/// patch. The patch modifies the default `GenesisConfig` allowing customization of the specific
-	/// keys. The resulting `GenesisConfig` is then deserialized from the patched JSON
-	/// representation and stored in the storage.
+	/// This function generates the `RuntimeGenesisConfig` for the runtime by applying a provided
+	/// JSON patch. The patch modifies the default `RuntimeGenesisConfig` allowing customization of
+	/// the specific keys. The resulting `RuntimeGenesisConfig` is then deserialized from the
+	/// patched JSON representation and stored in the storage.
 	///
 	/// If the provided JSON patch is incorrect or the deserialization fails the error will be
 	/// returned.
 	///
-	/// The patching process modifies the default `GenesisConfig` according to the followingĂ‚ rules:
+	/// The patching process modifies the default `RuntimeGenesisConfig` according to the following
+	/// rules:
 	/// 1. Existing keys in the default configuration will be overridden by the corresponding values
 	///    in the patch.
 	/// 2. If a key exists in the patch but not in the default configuration, it will be added to
-	///    the resulting `GenesisConfig`.
+	///    the resulting `RuntimeGenesisConfig`.
 	/// 3. Keys in the default configuration that have null values in the patch will be removed from
-	///    the resulting  `GenesisConfig`. This is helpful for changing enum variant value.
+	///    the resulting `RuntimeGenesisConfig`. This is helpful for changing enum variant value.
 	///
-	/// Please note that the patch may contain full `GenesisConfig`.
+	/// Please note that the patch may contain full `RuntimeGenesisConfig`.
 	pub fn get_storage_for_patch(&self, patch: Value) -> core::result::Result<Storage, String> {
 		let mut config = self.get_default_config()?;
 		crate::json_patch::merge(&mut config, patch);
diff --git a/substrate/frame/support/procedural/src/construct_runtime/expand/config.rs b/substrate/frame/support/procedural/src/construct_runtime/expand/config.rs
index 5613047359a..dbbe6ba6e6c 100644
--- a/substrate/frame/support/procedural/src/construct_runtime/expand/config.rs
+++ b/substrate/frame/support/procedural/src/construct_runtime/expand/config.rs
@@ -76,10 +76,6 @@ pub fn expand_outer_config(
 			#fields
 		}
 
-		#[cfg(any(feature = "std", test))]
-		#[deprecated(note = "GenesisConfig is planned to be removed in December 2023. Use `RuntimeGenesisConfig` instead.")]
-		pub type GenesisConfig = RuntimeGenesisConfig;
-
 		#[cfg(any(feature = "std", test))]
 		impl #scrate::sp_runtime::BuildStorage for RuntimeGenesisConfig {
 			fn assimilate_storage(
diff --git a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr
index 9dd460da75a..c677ddcd672 100644
--- a/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr
+++ b/substrate/frame/support/test/tests/construct_runtime_ui/deprecated_where_block.stderr
@@ -347,7 +347,7 @@ error[E0277]: the trait bound `Runtime: Config` is not satisfied
 26 |         System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
    |         ^^^^^^ the trait `Config` is not implemented for `Runtime`
    |
-note: required by a bound in `frame_system::GenesisConfig`
+note: required by a bound in `GenesisConfig`
   --> $WORKSPACE/substrate/frame/system/src/lib.rs
    |
    |     pub struct GenesisConfig<T: Config> {
diff --git a/substrate/primitives/genesis-builder/Cargo.toml b/substrate/primitives/genesis-builder/Cargo.toml
index bf12433c5f4..15440b4811e 100644
--- a/substrate/primitives/genesis-builder/Cargo.toml
+++ b/substrate/primitives/genesis-builder/Cargo.toml
@@ -6,7 +6,7 @@ edition.workspace = true
 license = "Apache-2.0"
 homepage = "https://substrate.io"
 repository.workspace = true
-description = "Substrate GenesisConfig builder API"
+description = "Substrate RuntimeGenesisConfig builder API"
 readme = "README.md"
 
 [lints]
diff --git a/substrate/primitives/genesis-builder/src/lib.rs b/substrate/primitives/genesis-builder/src/lib.rs
index e002cd3aa6f..bb1a2a35248 100644
--- a/substrate/primitives/genesis-builder/src/lib.rs
+++ b/substrate/primitives/genesis-builder/src/lib.rs
@@ -19,36 +19,37 @@
 
 //! Substrate genesis config builder
 //!
-//! This Runtime API allows to construct `GenesisConfig`, in particular:
-//! - serialize the runtime default `GenesisConfig` struct into json format,
-//! - put the GenesisConfig struct into the storage. Internally this operation calls
+//! This Runtime API allows to construct `RuntimeGenesisConfig`, in particular:
+//! - serialize the runtime default `RuntimeGenesisConfig` struct into json format,
+//! - put the RuntimeGenesisConfig struct into the storage. Internally this operation calls
 //!   `GenesisBuild::build` function for all runtime pallets, which is typically provided by
 //!   pallet's author.
-//! - deserialize the `GenesisConfig` from given json blob and put `GenesisConfig` into the state
-//!   storage. Allows to build customized configuration.
+//! - deserialize the `RuntimeGenesisConfig` from given json blob and put `RuntimeGenesisConfig`
+//!   into the state storage. Allows to build customized configuration.
 //!
-//! Providing externalities with empty storage and putting `GenesisConfig` into storage allows to
-//! catch and build the raw storage of `GenesisConfig` which is the foundation for genesis block.
+//! Providing externalities with empty storage and putting `RuntimeGenesisConfig` into storage
+//! allows to catch and build the raw storage of `RuntimeGenesisConfig` which is the foundation for
+//! genesis block.
 
 /// The result type alias, used in build methods. `Err` contains formatted error message.
 pub type Result = core::result::Result<(), sp_runtime::RuntimeString>;
 
 sp_api::decl_runtime_apis! {
-	/// API to interact with GenesisConfig for the runtime
+	/// API to interact with RuntimeGenesisConfig for the runtime
 	pub trait GenesisBuilder {
-		/// Creates the default `GenesisConfig` and returns it as a JSON blob.
+		/// Creates the default `RuntimeGenesisConfig` and returns it as a JSON blob.
 		///
-		/// This function instantiates the default `GenesisConfig` struct for the runtime and serializes it into a JSON
-		/// blob. It returns a `Vec<u8>` containing the JSON representation of the default `GenesisConfig`.
+		/// This function instantiates the default `RuntimeGenesisConfig` struct for the runtime and serializes it into a JSON
+		/// blob. It returns a `Vec<u8>` containing the JSON representation of the default `RuntimeGenesisConfig`.
 		fn create_default_config() -> sp_std::vec::Vec<u8>;
 
-		/// Build `GenesisConfig` from a JSON blob not using any defaults and store it in the storage.
+		/// Build `RuntimeGenesisConfig` from a JSON blob not using any defaults and store it in the storage.
 		///
-		/// This function deserializes the full `GenesisConfig` from the given JSON blob and puts it into the storage.
+		/// This function deserializes the full `RuntimeGenesisConfig` from the given JSON blob and puts it into the storage.
 		/// If the provided JSON blob is incorrect or incomplete or the deserialization fails, an error is returned.
 		/// It is recommended to log any errors encountered during the process.
 		///
-		/// Please note that provided json blob must contain all `GenesisConfig` fields, no defaults will be used.
+		/// Please note that provided json blob must contain all `RuntimeGenesisConfig` fields, no defaults will be used.
 		fn build_config(json: sp_std::vec::Vec<u8>) -> Result;
 	}
 }
-- 
GitLab