Skip to content

Auto-generate the GetWeight impl for the XCM Instruction enum#12298

Draft
bolajahmad wants to merge 6 commits into
paritytech:masterfrom
bolajahmad:ba/generate-weightinfo
Draft

Auto-generate the GetWeight impl for the XCM Instruction enum#12298
bolajahmad wants to merge 6 commits into
paritytech:masterfrom
bolajahmad:ba/generate-weightinfo

Conversation

@bolajahmad

Copy link
Copy Markdown
Contributor

Description

Closes #12279.

Define a custom macro to autogenerate WeightInfo implementations for Instruction.

Integration

No special integration is needed. While the XcmWeightInfo is used by runtimes of rococo/westend/cumulus, this PR is unexpected to break these implementations as this is an optimization and refactoring issue.

Review Notes

This PR deleted a manual code block and uses the same xcm_procedural::XcmWeightInfoTrait that generates the WeightInfo trait to also generate the implementations also. In future updates, nothing else needs to be done as every new Instruction will be autogenerated.

This implementation includes a unit test to prevent regression logic when using the XcmWeightInfo.

Include your leftover TODOs, if any, here.

  • Ensure regression can be detected immediately

Checklist

  • My PR includes a detailed description as outlined in the "Description" and its two subsections above.
  • My PR follows the labeling requirements of this project (at minimum one label for T required)
    • External contributors: Use /cmd label <label-name> to add labels
    • Maintainers can also add labels manually
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

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.

Auto-generate the GetWeight impl for the XCM Instruction enum

1 participant