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

Fix Missing runtime APIs for Metadata v15 #2204

Merged
merged 11 commits into from
Oct 30, 2024
Merged

Conversation

wilwade
Copy link
Collaborator

@wilwade wilwade commented Oct 29, 2024

Goal

The goal of this PR is to make sure that Metadata v15 has the correct Runtime API call data

Closes #2202

Discussion

Why? I cannot be 100% sure. See the linked issues in #2202 for more details.

From what I can tell, the way rust macros work with context means that this macro is stuck being in the same file as the const that uses it is pub const VERSION

Specifics

  • Updated Polkadot js API
  • Fixed issue with the runtime APIs and the call in e2e/capacity/capacity_rpc.test.ts. Issue noted in code comment
  • Moved the runtime apis back into the runtime lib.rs
  • Removed the manual definitions of runtimeApis 🎉

Testing

  • make start && subxt metadata --version 15 -f json | jq .[1].V15.apis (Before this result would have been empty, now you have the runtime data!)

Comment on lines 1 to 2
// Unknown is causing these to be left out of the generated types.
// Adding them here for now.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this is a type generation issue. I see a few other places that have to do this. As these are all simple, for now, I think it is best to add them here and move on.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, they implemented TypeInfo macro . This is weird!

@@ -1294,6 +1309,348 @@ cumulus_pallet_parachain_system::register_validate_block! {
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
}

// The implementation has to be here due to the linking in the macro.
// It CANNOT be extracted into a separate file
sp_api::impl_runtime_apis! {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are just copied back from the runtime/frequency/src/apis.rs file. No additional changes.

@wilwade wilwade requested review from a team, shannonwells, mattheworris, enddynayn, aramikm, claireolmstead and JoeCap08055 and removed request for a team October 29, 2024 18:32
@wilwade wilwade marked this pull request as ready for review October 29, 2024 18:34
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Oct 29, 2024
@github-actions github-actions bot removed the metadata-changed Metadata has changed since the latest full release label Oct 29, 2024

#[test]
fn runtime_apis_are_populated() {
assert!(RUNTIME_API_VERSIONS.len() > 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@enddynayn enddynayn left a comment

Choose a reason for hiding this comment

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

👍 fabuloso!

Copy link
Collaborator

@aramikm aramikm left a comment

Choose a reason for hiding this comment

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

I read the code and it looked good afaik.

Comment on lines 1 to 2
// Unknown is causing these to be left out of the generated types.
// Adding them here for now.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, they implemented TypeInfo macro . This is weird!

@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Oct 29, 2024
@github-actions github-actions bot removed the metadata-changed Metadata has changed since the latest full release label Oct 30, 2024
@@ -28,19 +28,8 @@ export default {
event: 'u8',
data: 'Vec<u8>',
},
},
runtime: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Runtime types are part of the generation now

@wilwade wilwade requested a review from demisx as a code owner October 30, 2024 14:59
@github-actions github-actions bot added the metadata-changed Metadata has changed since the latest full release label Oct 30, 2024
@github-actions github-actions bot added metadata-changed Metadata has changed since the latest full release and removed metadata-changed Metadata has changed since the latest full release labels Oct 30, 2024
@github-actions github-actions bot added metadata-changed Metadata has changed since the latest full release metadata-version-not-incremented Metadata has changed since the latest full release, but the version has not been incremented and removed metadata-changed Metadata has changed since the latest full release labels Oct 30, 2024
@github-actions github-actions bot added metadata-changed Metadata has changed since the latest full release and removed metadata-changed Metadata has changed since the latest full release metadata-version-not-incremented Metadata has changed since the latest full release, but the version has not been incremented labels Oct 30, 2024
@wilwade wilwade merged commit 9dffba0 into main Oct 30, 2024
29 checks passed
@wilwade wilwade deleted the fix/missing-runtime-apis-v15 branch October 30, 2024 18:55
Copy link
Collaborator

@shannonwells shannonwells left a comment

Choose a reason for hiding this comment

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

I reviewed the code changes. All looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metadata-changed Metadata has changed since the latest full release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metadata v15 Issues
5 participants