threefoldtech / js-sdk

extensions to js-ng for tfgrid
Apache License 2.0
14 stars 6 forks source link

Update to js-ng 11.0b16 #3374

Open abom opened 2 years ago

abom commented 2 years ago

The build fails on python3.10, while it's fixed on js-ng

abom commented 2 years ago

Make sure the build of older versions is passing in other workflows.

abom commented 2 years ago

Trying to update js-ng only by changing the version in pyproject.toml and then do poetry update js-ng didn't upgrade the dependency of greenlet (also doing something like poetry update js-ng greenlet gevent didn't work too).

Also, without modifying the pyproject.toml manually, I tried to do it using add command:

poetry add js-ng@latest

But, it didn't update greenlet again. Finally, I tried to pin the versions of greenlet and gevent too and it worked with

poetry add js-ng@latest greenlet@latest gevent@latest

All set? nope :laughing: Installation went without issues, but running js-ng and trying a simple (but important quick test) of stellar client, I got the following error:

....
....
  File "/home/abom/projects/jumpscale/js-next/js-sdk/.venv/lib/python3.10/site-packages/stellar_sdk/strkey.py", line 91, in decode_ed25519_secret_seed
   raise Ed25519SecretSeedInvalidError(f"Invalid Ed25519 Secret Seed: {data}")

stellar_sdk.exceptions.Ed25519SecretSeedInvalidError: Invalid Ed25519 Secret Seed: XXXXXX

Invalid Ed25519 Secret Seed: XXXXXX

Trying to dig a little bit into decode_ed25519_secret_seed and add raise from to know the exact cause, and it showed:

...
...
  File "/home/abom/projects/jumpscale/js-next/js-sdk/.venv/lib/python3.10/site-packages/stellar_sdk/strkey.py", line 239, in _calculate_checksum
    checksum = crc16xmodem(payload)
               │           └ b'\x90\xc9..........'
               └ <built-in function crc16xmodem>

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

And it turned out this error is just python 3.10 compatibility-related. Will test newer stellar-sdk in an isolated environment, but I don't know If we can upgrade stellar-sdk for js-sdk or not.

abom commented 2 years ago

After testing with stellar-sdk 8.1.0, I can load the key from secret as:

from stellar_sdk.keypair import Keypair
k = Keypair.from_secret("XXXXX")