Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom default configs using derive_impl #4827

Open
gupnik opened this issue Jun 19, 2024 · 1 comment · May be fixed by #4965
Open

Custom default configs using derive_impl #4827

gupnik opened this issue Jun 19, 2024 · 1 comment · May be fixed by #4965
Assignees
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@gupnik
Copy link
Contributor

gupnik commented Jun 19, 2024

As @kianenigma suggested in this comment, we should be able to provide custom default configs and use derive_impl to share those across runtimes.

The following could be possible way:

pub trait CustomDefaultConfigProvider {
	type RuntimeOrigin;
	type RuntimeCall;
	type RuntimeTask;
}

pub struct CustomDefaultConfig;

#[crate::register_default_impl(CustomDefaultConfig)]
impl CustomDefaultConfigProvider for CustomDefaultConfig {
	#[inject_runtime_type]
	type RuntimeOrigin = ();
	#[inject_runtime_type]
	type RuntimeCall = ();
	#[inject_runtime_type]
	type RuntimeTask = ();
}

struct Runtime;

#[derive_impl(CustomDefaultConfig, no_aggregated_types)
impl Config for Runtime {}

If this works, we should add some documentation (ideally using docify) on how to use it.

@gupnik gupnik added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Jun 19, 2024
@gupnik gupnik self-assigned this Jun 19, 2024
@kianenigma
Copy link
Contributor

kianenigma commented Jul 4, 2024

IMO What we foremost need is to be able to use these macros outside of the frame::pallet umbrella.

@gupnik gupnik linked a pull request Jul 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants