Description
This is maybe an issue for the SDK rather that the CLI, but putting it here since steps to recreate involve the CLI, and i came across it when trying out the new release of the CLI.
It feels like i am using the wrong version of this CLI - but since there is no --version
option and the ascii logo still displays core v0.1.0, cant be totally sure.
I have npm version 9.5.0 and node version 18.15.0
I did:
$npm i -g @entropyxyz/[email protected]
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN EBADENGINE required: { node: '>=18.19' },
npm WARN EBADENGINE current: { node: 'v18.15.0', npm: '9.5.0' }
npm WARN EBADENGINE }
npm WARN deprecated @substrate/[email protected]: versions below 1.x are no longer maintained
changed 162 packages in 21s
23 packages are looking for funding
run `npm fund` for details
$ whereis entropy
entropy: /home/turnip/.nvm/versions/node/v18.15.0/bin/entropy
$ ls -l /home/turnip/.nvm/versions/node/v18.15.0/bin/entropy
lrwxrwxrwx 1 turnip turnip 47 Oct 24 08:58 /home/turnip/.nvm/versions/node/v18.15.0/bin/entropy -> ../lib/node_modules/@entropyxyz/cli/dist/cli.js
$ head ~/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/package.json
{
"name": "@entropyxyz/cli",
"version": "0.0.4-1",
"description": "cli and tui for interacting with the entropy protocol",
"type": "module",
"scripts": {
"start": "yarn build:global && entropy",
"start:debug": "DEBUG=@entropyxyz/cli yarn start",
"build": "tsup",
"build:global": "tsup && npm install -g",
So it looks like i have the right version installed
I am running a local test network with the docker compose script from entropy-core - NOT the docker script from the SDK. So i dont know if that makes a difference but ideally it shouldn't.
I am running the 0.3.0 release candidate - lets check that:
$ curl 127.0.0.1:3001/version | less
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35 100 35 0 0 22026 0 --:--:-- --:--:-- --:--:-- 35000
0.3.0-rc.1-VERGEN_IDEMPOTENT_OUTPUT
I have also checked i am able to register using the entropy-test-cli and the //Alice
account.
Lets try to register using the TUI:
$ export ENTROPY_ENDPOINT=ws://localhost:9944
$ entropy
Then with the TUI i create an account and attempt to register it. The account isn't funded so i don't expect this to work, but i hope for a nice error message:
? Select Action Register
Attempting to register the address: 5Dcfax2yfAtbxsS2xpL6qQArHFp7NDUSqP5oWJrAddNL1sAq
file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/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/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@polkadot/types/metadata/decorate/extrinsics/createUnchecked.js:11:19)
at Object.decorated [as register] (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@polkadot/api/base/Decorate.js:539:50)
at RegistrationManager.register (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@entropyxyz/sdk/dist/index.js:99:51)
at Entropy.register (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@entropyxyz/sdk/dist/index.js:831:57)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.15.0
This is strange, it seems like is is expecting version v0.2.0 which had 3 arguments to the register extrinsic (before key visibility was removed).
But i can see that in v0.3.0 of the SDK, only 2 arguments are used: https://github.com/entropyxyz/sdk/blob/faa9ddca18618e8d7d59134ee6c9e9fef40047a9/src/registration/index.ts#L90
Which makes me wonder if i am actually running the right version of the entropy CLI.
Lets try registering with the command line:
$ entropy account create foo | less
{"name":"foo","address":"5ENWQkRZcpzYZqKe8yxPJv3aDQUMpRU3t288YL9hEiDTMBkM","verifyingKeys":[]}
$ entropy account register foo
2024-10-24 09:13:37 API-WS: disconnected from ws://localhost:9944: 1006:: Abnormal Closure
connect ECONNREFUSED ::1:9944
file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/dist/cli.js:3566
throw new Error("Signer keypair is undefined or not properly initialized.");
^
Error: Signer keypair is undefined or not properly initialized.
at loadEntropy (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/dist/cli.js:3566:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Command.<anonymous> (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/dist/cli.js:11877:21)
at async Command.parseAsync (/home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/commander/lib/command.js:1092:5)
Node.js v18.15.0
This is also strange, now it seems it cannot connect to the chain endpoint.
Lets double check that the chain endpoint is accessible with the other CLI:
$ export ENTROPY_DEVNET=ws://localhost:9944
turnip ~ $ entropy-test-cli status
There are 1 registered Entropy accounts.
Verifying key: Visibility: Programs:
02784b3cf0fb8341c49f44a393030d335e0281b6532d6a065e0da287cba0384ef8 ["0x3289…d9b3"]
There are 2 stored programs
Hash Stored by: Times used: Size in bytes: Configurable? Has auxiliary?
3289435006003c3c83da5582d779d810c343f177fb1fecddbaca5d326ef9d9b3 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY 1 20971 false false
0000000000000000000000000000000000000000000000000000000000000000 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY 10 300498 true true
Success: Got status
That took 73.35926ms
I have the feeling that either i am somehow running the wrong version, or there are issues specific to the entropy-core docker compose setup as opposed to the SDK docker compose script which i assume is what yous are testing against.
Now lets try with zach's testnet, which is the only staging network on v0.3.0-rc.1 i currently know of:
$ export ENTROPY_ENDPOINT=wss://api.dev.testnet.zach.sandbox.entropy.xyz
turnip ~ $ entropy account register foo
broken config:
undefined:1
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at deserialize (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/dist/cli.js:3308:17)
at async EventEmitter.<anonymous> (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/dist/cli.js:3444:23)
Node.js v18.15.0
not sure what went on there, but i'll try with the TUI:
? Select Action Register
Attempting to register the address: 5ENWQkRZcpzYZqKe8yxPJv3aDQUMpRU3t288YL9hEiDTMBkM
file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/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/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@polkadot/types/metadata/decorate/extrinsics/createUnchecked.js:11:19)
at Object.decorated [as register] (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@polkadot/api/base/Decorate.js:539:50)
at RegistrationManager.register (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@entropyxyz/sdk/dist/index.js:99:51)
at Entropy.register (file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@entropyxyz/sdk/dist/index.js:831:57)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
hmm same as before.
Finally i try with the CLI again:
$ entropy account register foo
2024-10-24 09:34:25 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
2024-10-24 09:34:25 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@entropyxyz/sdk/dist/index.js:60
reject(Error(e.message));
^
Error: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
at file:///home/turnip/.nvm/versions/node/v18.15.0/lib/node_modules/@entropyxyz/cli/node_modules/@entropyxyz/sdk/dist/index.js:60:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.15.0
Yes! This is the desired behavior since that account isn't funded.
So it seems this is an issue related to the entropy-core docker-compose setup. However there is still the issue that there is different behavior with the TUI vs CLI.
I haven't managed to fund an account on Zach's staging network as for some reason the root account seems to be different than the one i have saved.