mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
Adds ability to provide defaults for types provided by construct_runtime (#14682)
* Adds ability to use defaults for verbatim types * Adds RuntimeOrigin and PalletInfo in DefaultConfig * Adds RuntimeEvent in DefaultConfig * Adds RuntimeEvent in DefaultConfig * Minor fix * Minor fix * Everything in frame_system can now have a default * Adds docs * Adds UI Test for no_bounds * Updates docs * Adds UI tests for verbatim * Minor update * Minor updates * Minor updates * Addresses review comments * Fixes test * Update frame/support/procedural/src/derive_impl.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * Minor fix * Minor * Fixes build * Uses runtime_type * Fixes comment * Fixes comment * Fixes test * Uses no_aggregated_types as an option in derive_impl * Uses specific imports * Fmt * Updates doc * Update frame/support/procedural/src/derive_impl.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/support/procedural/src/derive_impl.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Addresses review comment * Addresses review comment * fmt * Renames test files * Adds docs using docify * Fixes test * Fixes UI tests --------- Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -87,7 +87,7 @@ pub mod pallet {
|
||||
/// A type providing default configurations for this pallet in testing environment.
|
||||
pub struct TestDefaultConfig;
|
||||
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig, no_aggregated_types)]
|
||||
impl frame_system::DefaultConfig for TestDefaultConfig {}
|
||||
|
||||
#[frame_support::register_default_impl(TestDefaultConfig)]
|
||||
@@ -109,7 +109,7 @@ pub mod pallet {
|
||||
/// example, we simple derive `frame_system::config_preludes::TestDefaultConfig` again.
|
||||
pub struct OtherDefaultConfig;
|
||||
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig, no_aggregated_types)]
|
||||
impl frame_system::DefaultConfig for OtherDefaultConfig {}
|
||||
|
||||
#[frame_support::register_default_impl(OtherDefaultConfig)]
|
||||
@@ -147,16 +147,7 @@ pub mod tests {
|
||||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
// these items are defined by frame-system as `no_default`, so we must specify them here.
|
||||
// Note that these are types that actually rely on the outer runtime, and can't sensibly
|
||||
// have an _independent_ default.
|
||||
type Block = Block;
|
||||
type BlockHashCount = frame_support::traits::ConstU64<10>;
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type PalletInfo = PalletInfo;
|
||||
type OnSetCode = ();
|
||||
|
||||
// all of this is coming from `frame_system::config_preludes::TestDefaultConfig`.
|
||||
|
||||
@@ -177,6 +168,17 @@ pub mod tests {
|
||||
// type BlockWeights = ();
|
||||
// type BlockLength = ();
|
||||
// type DbWeight = ();
|
||||
// type BaseCallFilter = frame_support::traits::Everything;
|
||||
// type BlockHashCount = frame_support::traits::ConstU64<10>;
|
||||
// type OnSetCode = ();
|
||||
|
||||
// These are marked as `#[inject_runtime_type]`. Hence, they are being injected as
|
||||
// types generated by `construct_runtime`.
|
||||
|
||||
// type RuntimeOrigin = RuntimeOrigin;
|
||||
// type RuntimeCall = RuntimeCall;
|
||||
// type RuntimeEvent = RuntimeEvent;
|
||||
// type PalletInfo = PalletInfo;
|
||||
|
||||
// you could still overwrite any of them if desired.
|
||||
type SS58Prefix = frame_support::traits::ConstU16<456>;
|
||||
|
||||
Reference in New Issue
Block a user