2
    let signer = PairSigner::<PolkadotConfig,Pair>::new(AccountKeyring::Alice.pair());

This code cannot compile due to AccountKeyring::Alice.pair() returns sp_core::sr25519::Pair while new method accepts types which implement subxt::ext::sp_core::Pair type.

Error message

1 Answer 1

2

ext::sp_core::Pair is just a re export of the sp_core one, so I suspect you're importing a version of sp_keyring yourself that pulls in a different version of sp_core and trying to use the AccountKeyring from that?

Your options at the moment are to make sure you're using sp_keyring 7.0.0, or to do something like manually convert the Pair you get back into the Pair that sp_core 7.0.0 exposes and then pass that in to PairSigner.

There are issues updating Subxt to the latest substrate versions at the moment as a change there broke WASM compat, but I am working on it. That said, now that substrate crates are updating weekly, you may more frequently bump into this sort of version mismatch issue if you keep up to date with the latest substrate crates every week and Subxt has fallen behind.

5
  • It's worth noting perhaps that WASM compat was restored and Subxt is a little more uptodate now with Substrate crates. But what I said still stands; if you keep uptodate with Substrate weekly releases, Subxt will fall behind at times (though it should be fairly trivial for us to update it now or for you to patch those dependencies in the worst case)
    – jsdw
    Commented Jan 17, 2023 at 14:30
  • The issue is which the re-exportation of crates (eg, sp_core). So AccountKeyring.pair() return type is being treated differently, but in essence they are just same. Commented Jan 22, 2023 at 14:57
  • The issue is that Subxt depended on (and re-exported; it doesn't now but that's not really the point) different versions than you were using, so the types appeare the same but were not :)
    – jsdw
    Commented Jan 25, 2023 at 16:15
  • Also the issue of crate compatibility is a big deal as it introduces breaking changes Commented Jan 25, 2023 at 19:39
  • 1
    Indeed; if you update your substrate dependencies and subxt has not, then you will run into incompatibility issues here since substrate crates don't follow semver. Substrate crate releases will start to align with polkadot releases soon, and at that point subxt can endeavour to keep up to date with those, and we can track which subxt version corresponds to which substrate/polkadot release.
    – jsdw
    Commented Feb 6, 2023 at 13:35

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.