-
Notifications
You must be signed in to change notification settings - Fork 776
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
New #[runtime]
should be real rust Rust for assigning a type
#4723
Comments
Yeah, I had considered it but realised that this would mean an addition of |
I think these extra characters are near zero overhead, but in fact having a user use the type And, in the interest of having all substrate macros be as close to real rust as possible, it is also better that we just have it make sense that a struct is being assigned to a type. Anyway, glad to know this will be a simple change. |
Supporting both is a good compromise to make sure it is not a breaking change for existing users. |
Fixes #4723. Also, closes #4622 As stated in the linked issue, this PR adds the ability to use a real rust type for pallet alias in the new `runtime` macro: ```rust #[runtime::pallet_index(0)] pub type System = frame_system::Pallet<Runtime>; ``` Please note that the current syntax still continues to be supported. CC: @shawntabrizi @kianenigma --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <[email protected]>
Fixes paritytech#4723. Also, closes paritytech#4622 As stated in the linked issue, this PR adds the ability to use a real rust type for pallet alias in the new `runtime` macro: ```rust #[runtime::pallet_index(0)] pub type System = frame_system::Pallet<Runtime>; ``` Please note that the current syntax still continues to be supported. CC: @shawntabrizi @kianenigma --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <[email protected]>
Fixes paritytech#4723. Also, closes paritytech#4622 As stated in the linked issue, this PR adds the ability to use a real rust type for pallet alias in the new `runtime` macro: ```rust #[runtime::pallet_index(0)] pub type System = frame_system::Pallet<Runtime>; ``` Please note that the current syntax still continues to be supported. CC: @shawntabrizi @kianenigma --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <[email protected]>
The new
#[runtime]
macro is great, but the assignment of pallet types is awkward since the type is assigned to a crate name:This is just not what would be valid in Rust.
Instead, we should simply update this to point to the
Pallet<T>
object, which is actually what is happening:This makes this line of code more accurate for what
System
or any pallet type represents, and also more in alignment with real Rust.cc @gupnik @kianenigma
The text was updated successfully, but these errors were encountered: