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

Connecting to a node with incompatible version #1145

Open
mixmix opened this issue Nov 5, 2024 · 1 comment
Open

Connecting to a node with incompatible version #1145

mixmix opened this issue Nov 5, 2024 · 1 comment

Comments

@mixmix
Copy link
Contributor

mixmix commented Nov 5, 2024

The problem

I noticed a really unhelpful test when trialing the CLI. I told it to make a register an account and got this:

Attempting to register the address: 5CBCdVRZDw8zTvnVkcrwSriAuJKLTnajLpZkz2BU4aNWgGNs
file:///home/projects/ENTROPY/cli/node_modules/@polkadot/types/metadata/decorate/extrinsics/createUnchecked.js:11
            throw new Error(`Extrinsic ${section}.${funcName} expects ${expectedArgs.length} arguments, got ${args.length}.`);
                  ^

Error: Extrinsic registry.register expects 3 arguments, got 2.
    at extrinsicFn (file:///home/projects/ENTROPY/cli/node_modules/@polkadot/types/metadata/decorate/extrinsics/createUnchecked.js:11:19)
    at Object.decorated [as register] (file:///home/projects/ENTROPY/cli/node_modules/@polkadot/api/base/Decorate.js:539:50)
    at RegistrationManager.register (file:///home/projects/ENTROPY/cli/node_modules/@entropyxyz/sdk/dist/index.js:99:51)
    at Entropy.register (file:///home/projects/ENTROPY/cli/node_modules/@entropyxyz/sdk/dist/index.js:831:57)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Very unhelpful response as a CLI user.

The actual problem is that the default endpoint it was connecting to is on an old version of Entropy core compared to CLI.

Questions

I'm wondering

  • is this going to happen when there are changes to the network in the future?
  • is there a way to ask an endpoint what version it is?

Obviously we would make less breaking changes, but as the CLI developer I'm wanting to make it clear/ safe for my users.

@ameba23
Copy link
Contributor

ameba23 commented Nov 5, 2024

I think you can get the current version number of the runtime from a subxt client by doing api.runtime_version().spec_version. I imagine polkadot js has something similar. But i don't know whether this is telling you the runtime version the client is expecting (from the entropy-metadata.scale file) or the runtime version of the connected chain endpoint (by actually doing a query).

Ideally you want to know both and be able to compare them.

Usually though with subxt i get a pretty clear error MetadataError::IncompatibleCodegen which can be shown to the user as 'you need to update your client'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants