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

Decoder class for "Compact<u32>" not found #369

Open
zhoujs93 opened this issue Dec 22, 2023 · 4 comments
Open

Decoder class for "Compact<u32>" not found #369

zhoujs93 opened this issue Dec 22, 2023 · 4 comments

Comments

@zhoujs93
Copy link

zhoujs93 commented Dec 22, 2023

Hi,

I sometimes encounter the following error when executing the following code:
The error that I seem to get is related to: Decoder class for "Compact<u32>" not found

Do you know how I could work around this ? I tried to add a try except clause in there, but it still doesnt seem to work.

Thanks !

@PsicoThePato
Copy link

Im having the same problem. It seems to happen occasionally when im multithreading.

@arjanz
Copy link
Member

arjanz commented Dec 28, 2023

The library is currently not thread-safe, so it is highly recommended to have a dedicated instance of SubstrateInterface for each thread.

I am currently working on version 2 of the library, which will include asyncio support. However, this is likely to take a few more months to complete.

@scottyeager
Copy link

This can happen even when using an instance per thread, in which case it's really a duplicate of #336. What I can recommend as a workaround, rather than trying to catch the error, is just to replace any threads that exit due to the error with new threads. There's a skeleton of my workflow on the linked issue.

@vtexier
Copy link
Contributor

vtexier commented May 18, 2024

I am currently working on version 2 of the library, which will include asyncio support. However, this is likely to take a few more months to complete.

Glad to read that your plan is to support thread-safe capability !

I am using the library in a Qt5 project where the main loop event is handle by Qt5 and I use Qt5 threads. I hope the support for asyncio will not be "only usable with a asyncio project and main loop". If the library is going to be thread safe, ideally it should be for any concurrency solution used by the main project (threads, asyncio, etc).

For now, I am using a home made queue system to handle thread calls to the same Substrate() connection, as a workaround.

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

No branches or pull requests

5 participants