Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Make generics for pallet parts omissible in construct_runtime#9658

Closed
KiChjang wants to merge 6 commits intomasterfrom
kckyeung/omissible-pallet-part-generics
Closed

Make generics for pallet parts omissible in construct_runtime#9658
KiChjang wants to merge 6 commits intomasterfrom
kckyeung/omissible-pallet-part-generics

Conversation

@KiChjang
Copy link
Contributor

@KiChjang KiChjang commented Aug 31, 2021

Fixes #8743.

This PR makes it possible to omit the generics while declaring the Event, Config and Origin parts in the construct_runtime! macro.

Things left to do:

  • Figure out how to make the pallet declarative macros support this
  • Implement the feature on the Origin pallet part
  • Implement the feature on the Config pallet part
  • Issue deprecation notice on the generics for the 3 pallet parts when they are used in construct_runtime!

@KiChjang KiChjang changed the title Obviate the need to use event generics for proc macro expansion Make generics for pallet parts omissible in construct_runtime Aug 31, 2021
@KiChjang
Copy link
Contributor Author

KiChjang commented Sep 9, 2021

Getting this to work with the pallet declarative macros is really tough, I've been trying different methods for a while now and it is looking like that there's no possible solution for this.

The primary problem that I'm facing now is that decl_event! contains no information about the Pallet/Module struct, so it can't implement SubstratePalletEvent on it since it lacks the trait bounds and generics on the Pallet/Module, which will be used in the impl syntax. I am also unable to move the impl into decl_module! either, since it doesn't contain any information about the Event type.

I have half a mind to simply restrict this feature to pallet proc macros, but then I'll have to figure out a way to feature gate this so that it only works with proc macros, which should be doable but not ideal...

@shawntabrizi
Copy link
Member

I have half a mind to simply restrict this feature to pallet proc macros, but then I'll have to figure out a way to feature gate this so that it only works with proc macros, which should be doable but not ideal...

I think this is sensible... also we must be very close to having no decl macros anymore. Maybe working to get that past the finish line is the way to go.

@stale
Copy link

stale bot commented Oct 9, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Oct 9, 2021
@stale stale bot removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Oct 10, 2021
@KiChjang KiChjang force-pushed the kckyeung/omissible-pallet-part-generics branch from d7a5b1f to 97c06e5 Compare October 15, 2021 22:45
@gui1117
Copy link
Contributor

gui1117 commented Oct 18, 2021

I don't understand why do we need this after #9681 ?

@stale
Copy link

stale bot commented Nov 17, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Nov 17, 2021
@stale stale bot closed this Dec 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the need to specify <T> for parts in construct_runtime! (like Event<T>)

3 participants