-
Notifications
You must be signed in to change notification settings - Fork 646
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
Metadata V16 (unstable): Enrich metadata with associated types of config traits #5274
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
types Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/metadata-v16-updates/9557/1 |
@@ -320,12 +345,30 @@ pub fn replace_self_by_t(input: proc_macro2::TokenStream) -> proc_macro2::TokenS | |||
.collect() | |||
} | |||
|
|||
/// Check that the trait item requires the `TypeInfo` bound (or similar). | |||
fn contains_type_info_bound(ty: &TraitItemType) -> bool { | |||
const KNOWN_TYPE_INFO_BOUNDS: &[&str] = &[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Why not a Set?
@@ -437,6 +510,20 @@ impl ConfigDef { | |||
} | |||
} | |||
|
|||
// Metadata of associated types is collected by default, iff the associated type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iff
to if
impl ConfigDef { | ||
pub fn try_from( | ||
frame_system: &syn::Path, | ||
index: usize, | ||
item: &mut syn::Item, | ||
enable_default: bool, | ||
enable_associated_metadata: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe disable_associated_metadata
as by default it should be enabled(?)
…associated-types Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This feature is part of the upcoming metadata V16. The associated types of the
Config
trait that require theTypeInfo
orParameter
bounds are included in the metadata of the pallet. The metadata is not yet exposed to the end-user, however the metadata intermediate representation (IR) contains these types.Developers can opt out of metadata collection of the associated types by specifying
without_metadata
optional attribute to the#[pallet::config]
.Furthermore, the
without_metadata
argument can be used in combination with the newly added#[pallet::include_metadata]
attribute to selectively include only certain associated types in the metadata collection.API Design
Builds on top of the PoC: #4358
Closes: #4519
cc @paritytech/subxt-team