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

Codegen error when using stripped metadata #1642

Open
jsdw opened this issue Jun 14, 2024 · 2 comments
Open

Codegen error when using stripped metadata #1642

jsdw opened this issue Jun 14, 2024 · 2 comments

Comments

@jsdw
Copy link
Collaborator

jsdw commented Jun 14, 2024

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?

@pgherveou
Copy link
Contributor

Hey @jsdw, I don't but this code should be enough

❯ subxt metadata --pallets EVM --url wss://acala-rpc-0.aca-api.network -o metadata.scale

#[subxt::subxt(runtime_metadata_path = "metadata.scale")]
mod acala {}

fn main() {}

@jsdw
Copy link
Collaborator Author

jsdw commented Jun 25, 2024

Just to check; how old is the version of the subxt binary that you're using?

Definitely worth trying the very latest version if possible. #1648 is perhaps related, and the issue there is essentially that older versions of the subxt binary relied on a version of scale-info that would not properly handle type IDs when stripping pallets (something we will flag up better in future versions via paritytech/scale-typegen#34)

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

No branches or pull requests

2 participants