paritytech / paritytech/subxt

Codegen error when using stripped metadata

Open
#1,642 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
489
Forks
293
Avg merge
18h 35m
Merged PRs (30d)
3

Description

It seems as if stripping pallets leads to a type not being found. This when generating metadata for Acala

The specific error comes from https://github.com/paritytech/scale-typegen/blob/c8c6f95f421d56c67be7a2bfd34ad8c615be5ace/typegen/src/utils.rs#L134, but is prob the result of some type no longer existing in the type registry that should be there.

~/github/acala-subxt main*
❯ subxt metadata --pallets EVM --url ws://localhost:9944 -o metadata.scale

~/github/acala-subxt main*
❯ cargo build
   Compiling acala-subxt v0.1.0 (/Users/pg/github/acala-subxt)
error: custom attribute panicked
 --> src/main.rs:6:1
  |
6 | #[subxt::subxt(runtime_metadata_path = "metadata.scale")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: type a should exist in registry

error: could not compile `acala-subxt` (bin "acala-subxt") due to 1 previous error

This goes away if the --pallets flag is removed.

@pgherveou I don't suppose you have a link to the repo/code that we could run that hits this error?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with subxt metadata --pallets EVM and the generated metadata.scale, then inspect typegen/src/utils.rs around the reported line. Compare code generation with and without --pallets to identify why a required registry type is missing. Done means stripped-metadata generation and the resulting cargo build succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.