-
Notifications
You must be signed in to change notification settings - Fork 248
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
No RuntimeApis available on a parachain #1873
Comments
In order to see Runtime APIs, the parachain needs to be using uptodate enough Substrate libraries such that it exposes V15 metadata or above. To check this, you can look for the runtime API |
Is the code for your parachain public anywhere? With some steps to reproduce, we could look more into it! That'd be the best way we can help you. If not, the next step I'd take is checking what metadata you're getting back from a node, which I think you could do by outputting it as One thought here is to make sure you're using the very latest version of the subxt CLI tool ( If the metadata is V15, then it would be a case of looking into your parachain runtime code to see what the |
@jsdw Thanks a lot for the pointers, your help is really appreciated.
galeheim ➜ subxt git:(master) ✗ ./target/release/subxt version
subxt-cli 0.38.0-0dbcdbdd9c6
galeheim ➜ runtime git:(feat/449/verify-post) ✗ cargo expand > expanded.rs
Compiling polka-storage-runtime v0.0.0 (/Users/konrad.stepniak/workspace/polka-storage/runtime)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 33.54s [...]
#[doc(hidden)]
trait InternalImplRuntimeApis {
#[inline(always)]
fn runtime_metadata(&self)
->
sp_api::__private::vec::Vec<sp_api::__private::metadata_ir::RuntimeApiMetadataIR> {
<[_]>::into_vec(#[rustc_box] ::alloc::boxed::Box::new([primitives_proofs::runtime_decl_for_storage_provider_api::runtime_metadata::<Block,
AccountId>(),
sp_consensus_aura::runtime_decl_for_aura_api::runtime_metadata::<Block,
AuraId>(),
cumulus_primitives_aura::runtime_decl_for_aura_unincluded_segment_api::runtime_metadata::<Block>(),
sp_api::runtime_decl_for_core::runtime_metadata::<Block>(),
sp_api::runtime_decl_for_metadata::runtime_metadata::<Block>(),
sp_block_builder::runtime_decl_for_block_builder::runtime_metadata::<Block>(),
[...] aaaand it looks like they should be there, in the metadata. ./target/release/subxt metadata -a --url http://127.0.0.1:42069 --format json > metadata.json |
Ok, I found the issue. It was a wild ride though. Root causeparitytech/polkadot-sdk#3817 -> introduced a refactoring of the parachain template. When So in the end, the 'default, backward compatible' implementation is used. Solution
I'm going to make a PR for our chain with the 1st solution, as it solves the issue and allows to progress further, however, not sure what will be the best for the overall ecosystem ( https://github.com/paritytech/polkadot-sdk-parachain-template ). Do you have any thoughts on that? // EDIT:
|
Hello. Sorry, I came across this issue because we had the same idea of refactoring the runtime code into multiple smaller modules. @th7nder your write-up was very informative to help me find a workaround. I did find that "aliasing" the private trait with a public one, and providing a blanket implementation for the new trait seems to work. Here's a commit that does that, perhaps it's helpful to someone that will stumble upon the same issue: KILTprotocol/kilt-node@7132eeb. |
@th7nder great job digging into this; your explanation is really helpful! From what I understand, A perhaps related issue in polkadot-sdk is paritytech/polkadot-sdk#3067 re multiple |
Thanks for all of the support guys! TL;DR for anyone looking at it some time later: |
Fixes KILTprotocol/ticket#3688. Due to how the `impl_runtime_apis` macro works, it is expected to be included in a runtime's `lib.rs` file. Since we split up the runtimes, the runtime APIs were not included anymore. I found a related issue in the subxt repo: paritytech/subxt#1873. Because the trait definition generated by the macro is local, we can't import it in the `lib.rs` module for the `construct_runtime` macro to pick up the right implementation, so we need a workaround that basically introduces a new marker trait, and we import _that_ in the `lib.rs` file so that the right implementation of `Runtime::runtime_metadata()` is picked up. More details about the issue are presented in the subxt ticket. ## How to test Spin up a chopsticks deployment after building peregrine and spiritnet runtime, and verify that the runtime APIs are there now.
Hey,
The runtime APIs are not available in the exported metadata.scale via
subxt
tool nor viaexplore
command.It doesn't work on our parachain, but on the template as well.
There should be at least the default ones, like AccountNonceApi etc.
Are there any additional steps that need to be performed to export Runtime API in the metadata?
The text was updated successfully, but these errors were encountered: