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

RuntimeApis not exposed in the parachain template #6659

Closed
2 tasks done
th7nder opened this issue Nov 26, 2024 · 0 comments · Fixed by #6665
Closed
2 tasks done

RuntimeApis not exposed in the parachain template #6659

th7nder opened this issue Nov 26, 2024 · 0 comments · Fixed by #6665
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@th7nder
Copy link

th7nder commented Nov 26, 2024

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

Hey all,

The parachain template is by configured by default in a way, that does not expose the Runtime API calls information.
That's because impl_runtime_apis! macro is used in a separate module (apis) and it breaks the trait visibility.

I found the issue originally when integrating with subxt, more details on the investigation are here: paritytech/subxt#1873.

Steps to reproduce

#3817 -> introduced a refactoring of the parachain template.
It moves the impl_runtime_apis decl into another module called apis.
Effectivly, trait InternalImplRuntimeApis ends up being under crate::apis::InternalImplRuntimeApis, not in the crate::InternalImplRuntimeApis.

When construct_runtime macro is expanded and uses (&rt).runtime_metadata, it's expanded under crate::* and has no visibility into crate::apis::InternalImplRuntimeApis, because:
a) trait is private
b) construct macro is not importing api::*

So in the end, the 'default, backward compatible' implementation is used.

@th7nder th7nder added I10-unconfirmed Issue might be valid, but it's not yet known. I2-bug The node fails to follow expected behavior. labels Nov 26, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 29, 2024
Construct runtime uses autoref-based specialization to fetch the
metadata about the implemented runtime apis. This is done to not fail to
compile when there are no runtime apis implemented. However, there was
an issue with detecting runtime apis when they were implemented in a
different file. The problem is solved by moving the trait implemented by
`impl_runtime_apis!` to the metadata ir crate.


Closes: #6659

---------

Co-authored-by: GitHub Action <action@github.com>
Krayt78 pushed a commit to Krayt78/polkadot-sdk that referenced this issue Dec 18, 2024
Construct runtime uses autoref-based specialization to fetch the
metadata about the implemented runtime apis. This is done to not fail to
compile when there are no runtime apis implemented. However, there was
an issue with detecting runtime apis when they were implemented in a
different file. The problem is solved by moving the trait implemented by
`impl_runtime_apis!` to the metadata ir crate.


Closes: paritytech#6659

---------

Co-authored-by: GitHub Action <action@github.com>
dudo50 pushed a commit to paraspell-research/polkadot-sdk that referenced this issue Jan 4, 2025
Construct runtime uses autoref-based specialization to fetch the
metadata about the implemented runtime apis. This is done to not fail to
compile when there are no runtime apis implemented. However, there was
an issue with detecting runtime apis when they were implemented in a
different file. The problem is solved by moving the trait implemented by
`impl_runtime_apis!` to the metadata ir crate.


Closes: paritytech#6659

---------

Co-authored-by: GitHub Action <action@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I2-bug The node fails to follow expected behavior. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant