polkascan / py-substrate-interface

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

Crust pallet not found #251

Closed PaTara43 closed 1 year ago

PaTara43 commented 1 year ago

Hi! There is an issue opened https://github.com/crustio/crust/issues/894 and I don't understand whether it's a type registry issue (think not, since we are talking about inability to use the pallet) or a pallet discovery issue. Any ideas if something should be updated in py-substrate-interface?

arjanz commented 1 year ago

Ok I did some tests and the culprit is actually manually setting the type registry to type_registry_preset="crust".

This was necessary before in order to interpret the types used in the runtime, but I noticed Crust Shadow on Kusama upgraded to MetadataV14, which embeds its own type registry (PortableRegistry), so that drops the need to set manual types.

After analyzing what PolkadotJS generate for extrinsic bytes I found out the real culprit is actually the change in Address from AccountId to MultiAddress, which adds one extra bytes in front of the AccountId and because that was missing, it messed up the decoded by the runtime and caused the panic.

TL;DR: you can omit the type_registry_preset="crust" from now on and even after runtime upgrades the types will be loaded automatically because the runtime upgraded to MetadataV14.

PaTara43 commented 1 year ago

It worked! Thanks, I would never figured it out without your help.