mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 19:17:58 +00:00
GenesisBuild<T,I> deprecated. BuildGenesisConfig added. (#14306)
* frame::support: GenesisConfig types for Runtime enabled * frame::support: macro generating GenesisBuild::build for RuntimeGenesisConfig * frame: ambiguity BuildStorage vs GenesisBuild fixed * fix * RuntimeGenesisBuild added * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed" This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293. * Revert "fix" This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b. * Revert "RuntimeGenesisBuild added" This reverts commit 3c131b618138ced29c01ab8d15d8c6410c9e128b. * Revert "Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed"" This reverts commit 2b1ecd467231eddec69f8d328039ba48a380da3d. * Revert "Revert "fix"" This reverts commit fd7fa629adf579d83e30e6ae9fd162637fc45e30. * Code review suggestions * frame: BuildGenesisConfig added, BuildGenesis deprecated * frame: some pallets updated with BuildGenesisConfig * constuct_runtime: support for BuildGenesisConfig * frame::support: genesis_build macro supports BuildGenesisConfig * frame: BuildGenesisConfig added, BuildGenesis deprecated * Cargo.lock update * test-runtime: fixes * Revert "fix" This reverts commit a2f76dd24e9a16cf9230d45825ed28787211118b. * Revert "frame: ambiguity BuildStorage vs GenesisBuild fixed" This reverts commit 950f3d019d0e21c55a739c44cc19cdabd3ff0293. * self review * doc fixed * ui tests fixed * fmt * tests fixed * genesis_build macrto fixed for non-generic GenesisConfig * BuildGenesisConfig constraints added * warning fixed * some duplication removed * fmt * fix * doc tests fix * doc fix * cleanup: remove BuildModuleGenesisStorage * self review comments * fix * Update frame/treasury/src/tests.rs Co-authored-by: Sebastian Kunert <skunert49@gmail.com> * Update frame/support/src/traits/hooks.rs Co-authored-by: Sebastian Kunert <skunert49@gmail.com> * doc fix: GenesisBuild exposed * ".git/.scripts/commands/fmt/fmt.sh" * frame: more serde(skip) + cleanup * Update frame/support/src/traits/hooks.rs Co-authored-by: Davide Galassi <davxy@datawok.net> * frame: phantom fields moved to the end of structs * chain-spec: Default::default cleanup * test-runtime: phantom at the end * merge master fixes * fix * fix * fix * fix * fix (facepalm) * Update frame/support/procedural/src/pallet/expand/genesis_build.rs Co-authored-by: Bastian Köcher <git@kchr.de> * fmt * fix * fix --------- Co-authored-by: parity-processbot <> Co-authored-by: Sebastian Kunert <skunert49@gmail.com> Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
committed by
GitHub
parent
49150ee583
commit
87d41d0a89
@@ -52,7 +52,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ pub mod pallet2 {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ pub mod pallet3 {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,11 +165,14 @@ mod nested {
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {}
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
@@ -234,11 +237,14 @@ pub mod module3 {
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {}
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
@@ -262,8 +268,8 @@ frame_support::construct_runtime!(
|
||||
Module1_1: module1::<Instance1>::{Pallet, Call, Storage, Event<T>, Origin<T>},
|
||||
Module2: module2::{Pallet, Call, Storage, Event<T>, Origin},
|
||||
Module1_2: module1::<Instance2>::{Pallet, Call, Storage, Event<T>, Origin<T>},
|
||||
NestedModule3: nested::module3::{Pallet, Call, Config, Storage, Event<T>, Origin},
|
||||
Module3: self::module3::{Pallet, Call, Config, Storage, Event<T>, Origin<T>},
|
||||
NestedModule3: nested::module3::{Pallet, Call, Config<T>, Storage, Event<T>, Origin},
|
||||
Module3: self::module3::{Pallet, Call, Config<T>, Storage, Event<T>, Origin<T>},
|
||||
Module1_3: module1::<Instance3>::{Pallet, Storage, Event<T> } = 6,
|
||||
Module1_4: module1::<Instance4>::{Pallet, Call, Event<T> } = 3,
|
||||
Module1_5: module1::<Instance5>::{Pallet, Event<T>},
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ construct_runtime! {
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
#[cfg(test)]
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
error: `System` pallet declaration is feature gated, please remove any `#[cfg]` attributes
|
||||
--> tests/construct_runtime_ui/feature_gated_system_pallet.rs:10:3
|
||||
|
|
||||
10 | System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
10 | System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
| ^^^^^^
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet1: pallet::{Pallet},
|
||||
Pallet2: pallet::{Pallet},
|
||||
Pallet3: pallet::{Pallet},
|
||||
|
||||
@@ -77,7 +77,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet::{Pallet},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet::{Pallet, Call},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Event},
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Config},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Inherent},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system expanded::{}::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet expanded::{}::{Pallet, Origin},
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ error[E0599]: no variant or associated item named `Pallet` found for enum `Runti
|
||||
51 | || Block = Block,
|
||||
52 | || NodeBlock = Block,
|
||||
... ||
|
||||
55 | || System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
55 | || System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
56 | || Pallet: pallet::{Pallet, ValidateUnsigned},
|
||||
| || -^^^^^^ variant or associated item not found in `RuntimeCall`
|
||||
| ||________|
|
||||
|
||||
@@ -90,7 +90,7 @@ mod no_instance {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
<Value<T>>::put(self.value);
|
||||
<TestGenericValue<T>>::put(&self.test_generic_value);
|
||||
@@ -169,7 +169,7 @@ mod instance {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
<Value<T, I>>::put(self.value);
|
||||
<TestGenericValue<T, I>>::put(&self.test_generic_value);
|
||||
|
||||
@@ -53,7 +53,7 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
for (k1, k2, v) in &self.t {
|
||||
<AppendableDM<T>>::insert(k1, k2, v);
|
||||
|
||||
@@ -87,7 +87,7 @@ mod module1 {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I>
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I>
|
||||
where
|
||||
T::BlockNumber: std::fmt::Display,
|
||||
{
|
||||
@@ -196,7 +196,7 @@ mod module2 {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I>
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I>
|
||||
where
|
||||
T::BlockNumber: std::fmt::Display,
|
||||
{
|
||||
|
||||
@@ -134,14 +134,16 @@ mod module {
|
||||
pub type RequestLifeTime<T: Config> = StorageValue<_, u64, ValueQuery, ConstU64<0>>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub enable_storage_role: bool,
|
||||
pub request_life_time: u64,
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {
|
||||
if self.enable_storage_role {
|
||||
<Parameters<T>>::insert(Role::Storage, <RoleParameters<T>>::default());
|
||||
@@ -187,7 +189,11 @@ frame_support::construct_runtime!(
|
||||
#[test]
|
||||
fn create_genesis_config() {
|
||||
let config = RuntimeGenesisConfig {
|
||||
module: module::GenesisConfig { request_life_time: 0, enable_storage_role: true },
|
||||
module: module::GenesisConfig {
|
||||
request_life_time: 0,
|
||||
enable_storage_role: true,
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
assert_eq!(config.module.request_life_time, 0);
|
||||
assert!(config.module.enable_storage_role);
|
||||
|
||||
@@ -60,11 +60,14 @@ mod nested {
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {}
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
@@ -128,11 +131,14 @@ pub mod module {
|
||||
}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {}
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,13 +402,18 @@ pub mod pallet {
|
||||
pub type Unbounded<T> = StorageValue<Value = Vec<u8>>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config>
|
||||
where
|
||||
T::AccountId: From<SomeType1> + SomeAssociation1 + From<SomeType4>,
|
||||
{
|
||||
#[serde(skip)]
|
||||
_config: sp_std::marker::PhantomData<T>,
|
||||
_myfield: u32,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T>
|
||||
where
|
||||
T::AccountId: From<SomeType1> + SomeAssociation1 + From<SomeType4>,
|
||||
{
|
||||
@@ -586,7 +591,7 @@ pub mod pallet2 {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig<T>
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T>
|
||||
where
|
||||
T::AccountId: From<SomeType1> + SomeAssociation1,
|
||||
{
|
||||
|
||||
@@ -185,13 +185,15 @@ pub mod pallet {
|
||||
>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
#[serde(skip)]
|
||||
_config: sp_std::marker::PhantomData<(T, I)>,
|
||||
_myfield: u32,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
|
||||
@@ -281,7 +283,7 @@ pub mod pallet2 {
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ frame_support::construct_runtime!(
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
// Exclude part `Storage` in order not to check its metadata in tests.
|
||||
System: frame_system::{Pallet, Config, Call, Event<T> },
|
||||
System: frame_system::{Pallet, Config<T>, Call, Event<T> },
|
||||
|
||||
// This pallet exposes the Error type explicitly.
|
||||
Example: common::outer_enums::pallet::{Pallet, Config<T>, Event<T>, Error<T>},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#[frame_support::pallet]
|
||||
mod pallet {
|
||||
use frame_support::pallet_prelude::{Hooks, GenesisBuild};
|
||||
use frame_support::pallet_prelude::{BuildGenesisConfig, Hooks};
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
|
||||
#[pallet::config]
|
||||
@@ -19,7 +19,7 @@ mod pallet {
|
||||
pub struct GenesisConfig;
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {}
|
||||
impl BuildGenesisConfig for GenesisConfig {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
error[E0277]: the trait bound `pallet::GenesisConfig: std::default::Default` is not satisfied
|
||||
--> tests/pallet_ui/genesis_default_not_satisfied.rs:22:38
|
||||
--> tests/pallet_ui/genesis_default_not_satisfied.rs:22:30
|
||||
|
|
||||
22 | impl<T: Config> GenesisBuild<T> for GenesisConfig {}
|
||||
| ^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `pallet::GenesisConfig`
|
||||
22 | impl BuildGenesisConfig for GenesisConfig {}
|
||||
| ^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `pallet::GenesisConfig`
|
||||
|
|
||||
note: required by a bound in `GenesisBuild`
|
||||
note: required by a bound in `BuildGenesisConfig`
|
||||
--> $WORKSPACE/frame/support/src/traits/hooks.rs
|
||||
|
|
||||
| pub trait GenesisBuild<T, I = ()>: Default + sp_runtime::traits::MaybeSerializeDeserialize {
|
||||
| ^^^^^^^ required by this bound in `GenesisBuild`
|
||||
| pub trait BuildGenesisConfig: Default + sp_runtime::traits::MaybeSerializeDeserialize {
|
||||
| ^^^^^^^ required by this bound in `BuildGenesisConfig`
|
||||
help: consider annotating `pallet::GenesisConfig` with `#[derive(Default)]`
|
||||
|
|
||||
19 + #[derive(Default)]
|
||||
|
||||
@@ -43,8 +43,8 @@ construct_runtime! {
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
Pallet: test_pallet::{Pallet, Config},
|
||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Pallet: test_pallet::{Pallet, Config<T>},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ use frame_support::{
|
||||
weights::constants::RocksDbWeight,
|
||||
};
|
||||
use frame_system::Config;
|
||||
use sp_runtime::BuildStorage;
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
@@ -48,11 +49,14 @@ mod dummy_pallet {
|
||||
pub type SomeStorage<T: Config> = StorageValue<_, u32, ValueQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(Default)]
|
||||
pub struct GenesisConfig {}
|
||||
#[derive(frame_support::DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
#[serde(skip)]
|
||||
_config: sp_std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
fn build(&self) {}
|
||||
}
|
||||
}
|
||||
@@ -65,8 +69,8 @@ construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
|
||||
DummyPallet: dummy_pallet::{Pallet, Config, Storage} = 1,
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||
DummyPallet: dummy_pallet::{Pallet, Config<T>, Storage} = 1,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -81,7 +85,7 @@ impl frame_system::Config for Test {
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
|
||||
let mut ext: sp_io::TestExternalities = sp_io::TestExternalities::from(storage);
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
ext
|
||||
|
||||
Reference in New Issue
Block a user