diff --git a/Cargo.lock b/Cargo.lock index bb2abfd75b..14203f1e1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1060,6 +1060,7 @@ dependencies = [ "sp-consensus-aura", "sp-core", "sp-externalities", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-offchain", diff --git a/Cargo.toml b/Cargo.toml index b4aec03280..a5f65fcbe6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -139,6 +139,7 @@ sp-application-crypto = { git = "https://github.com/galacticcouncil/polkadot-sdk sp-arithmetic = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch ="release-polkadot-v1.11.0-patch", default-features = false } sp-authority-discovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch ="release-polkadot-v1.11.0-patch", default-features = false} sp-block-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch ="release-polkadot-v1.11.0-patch", default-features = false } +sp-genesis-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch", default-features = false } sp-blockchain = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch ="release-polkadot-v1.11.0-patch", default-features = false } sp-consensus = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch ="release-polkadot-v1.11.0-patch", default-features = false } sp-consensus-aura = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch ="release-polkadot-v1.11.0-patch", default-features = false } @@ -270,6 +271,7 @@ sp-api = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "re sp-arithmetic = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch" } sp-authority-discovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch" } sp-block-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch" } +sp-genesis-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch" } sp-blockchain = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch" } sp-consensus = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch" } sp-consensus-aura = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "release-polkadot-v1.11.0-patch" } diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index e4c53792a9..a5a3de37a8 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -120,6 +120,7 @@ sp-arithmetic = { workspace = true } sp-block-builder = { workspace = true } sp-consensus-aura = { workspace = true } sp-core = { workspace = true } +sp-genesis-builder = { workspace = true } sp-inherents = { workspace = true } sp-externalities = { workspace = true } sp-offchain = { workspace = true } @@ -228,6 +229,7 @@ std = [ "sp-block-builder/std", "sp-consensus-aura/std", "sp-core/std", + "sp-genesis-builder/std", "sp-io/std", "sp-inherents/std", "sp-externalities/std", diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 244edef8f5..bd920713c7 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -51,11 +51,14 @@ pub use primitives::{ AccountId, Amount, AssetId, Balance, BlockNumber, CollectionId, Hash, Index, ItemId, Price, Signature, }; -use frame_support::sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdConversion, BlakeTwo256, Block as BlockT}, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, ExtrinsicInclusionMode, +use frame_support::{ + genesis_builder_helper::{build_state, get_preset}, + sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, + traits::{AccountIdConversion, BlakeTwo256, Block as BlockT}, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, ExtrinsicInclusionMode, + } }; use frame_system::pallet_prelude::BlockNumberFor; use sp_api::impl_runtime_apis; @@ -420,6 +423,20 @@ impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn build_state(config: Vec) -> sp_genesis_builder::Result { + build_state::(config) + } + + fn get_preset(id: &Option) -> Option> { + get_preset::(id, |_| None) + } + + fn preset_names() -> Vec { + Default::default() + } + } + #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { fn benchmark_metadata(extra: bool) -> (