polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
241 stars 115 forks source link

Error parsing (some) blocks on Acala #256

Closed KarimJedda closed 1 year ago

KarimJedda commented 1 year ago

There are errors on some of the Acala blocks (happens every now and then):

from substrateinterface import SubstrateInterface

substrate = SubstrateInterface(
    url="wss://acala-rpc-2.aca-api.network/ws"
)

BLOCK_ID = 2112493
block = substrate.get_block(block_number=BLOCK_ID)

Returns: ValueError: Index '3' not present in Enum type mapping

Any hint what it could be? It looks like it's something in py-scale-codec that is erroring out.

Versions: substrate-interface==1.3.2 scalecodec==1.0.43

Thank you very much :)

arjanz commented 1 year ago

It seems Acala uses a new type of signature unknown to the library, current known curves are Ed25519 (0), Sr25519 (1) and Ecdsa (2)

arjanz commented 1 year ago

Ok Acala has an extended set of signatures, as defined here: https://github.com/AcalaNetwork/bodhi.js/blob/0f75a1c6aedd2fa5bcc36a2c18636ed4bbbb1fad/eth-providers/src/chain-api.ts#L29

I'll add definition this in scalecodec

KarimJedda commented 1 year ago

Oh wow, thank you very much for the quick addition! I'll update the services on our end right away. 👍