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

Refactor v13 metadata types #11

Merged
merged 9 commits into from
May 10, 2021
Merged

Refactor v13 metadata types #11

merged 9 commits into from
May 10, 2021

Conversation

ascjones
Copy link
Contributor

@ascjones ascjones commented Apr 27, 2021

Replace custom definitions for errors and event metadata with scale-info type information for the pallet Event and Error types (depends on paritytech/scale-info#87 which adds documentation to the scale-info derive).

As @thiolliere pointed out, metadata for events and errors (which are expanded to simple enums) can be captured already by the scale_info derives.

Call definitions could also just use the scale-info derives on the Call enum also, but we will keep the custom types in case we need to add additional metadata, see the comment below.

Also:

  • Renames types/comments with module -> pallet
  • Adds wrapper types for calls and events metadata

@gui1117
Copy link

gui1117 commented Apr 27, 2021

about calls I think it might makes sense to still organize it as metadata V12.

In the future we might want to add additional information per call variant. Like the origin the call can accept. Or just some unstructured information about the call. paritytech/polkadot-sdk#349

In this context having the call declared as a vec of function would allow use to just add another field in this FunctionMetadata.
On the other end we can still have an extra field in ModuleMetadata: calls_extra: Vec<FunctionMetadata> which only contains the additional information.

@ascjones
Copy link
Contributor Author

Makes sense, so for events and errors just the TypeSpec is okay?

@gui1117
Copy link

gui1117 commented Apr 27, 2021

Makes sense, so for events and errors just the TypeSpec is okay?

yes for me it makes sense considering those types are only description. But maybe opinion from other people using the metadata can be helpful here.

@ascjones ascjones changed the title Replace call, event and error metadata types with TypeSpec Refactor v13 metadata types Apr 27, 2021
frame-metadata/src/v13.rs Outdated Show resolved Hide resolved
@ascjones ascjones marked this pull request as ready for review May 6, 2021 13:50
Copy link

@gui1117 gui1117 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@ascjones ascjones merged commit f4b1727 into main May 10, 2021
@ascjones ascjones deleted the aj-type-specs branch May 10, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants