3

I was executing a transaction using Alice account to make a sudo call in local Rococo Network

let alice = PairSigner::new(AccountKeyring::Alice.pair())

I am trying to change it to use my own account following this previous answers on StackExchange in: Is it possible to make a transaction with my own account?. To test it I got the Alice's keys from: What are the predefined accounts (ALICE, BOB, etc)?

let mnemonic_phrase = std::env::var("SEED").expect("Error: No mnemonic phrase");
let pair = sp_core::sr25519::Pair::from_string(&mnemonic_phrase, None).unwrap();
let alice = PairSigner::new(pair);

println!("pair: {:?}", pair.public());

It looks like is recovering Alice account fine, but when I try to execute the extrinsic I am getting an error: Error: Metadata(IncompatibleCodegen).

1 Answer 1

2

If you run into an Metadata(IncompatibleCodegen), it means that the metadata used to generate the static interface (either via the subxt macro or subxt codegen CLI tool) is out of date (or otherwise different) from the metadata of the node you're trying to talk to.

The error basically means "the interface has changed, and so your code needs to be updated". In this case, the thing to do is download new metadata from the node, and then fix any compilation errors that crop up as a result of the interface changes :)

2
  • To get the metadata of the local network, is without --uri? subxt metadata -f bytes > metadata/local_metadata.scale
    – Alex Bean
    Commented Jun 20, 2023 at 8:32
  • Yup, no --url means it'll default to the local node at the moment (or you can provide an explicit url eg --url ws://127.0.0.1:9944).
    – jsdw
    Commented Jun 20, 2023 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.