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

NotImplementedError: Decoder class for "Compact<u32>" not found #246

Open
sergpsu opened this issue Sep 21, 2022 · 1 comment
Open

NotImplementedError: Decoder class for "Compact<u32>" not found #246

sergpsu opened this issue Sep 21, 2022 · 1 comment

Comments

@sergpsu
Copy link

sergpsu commented Sep 21, 2022

Hi
The exception occurs from time to time in different scenarios but always for Compact<u32> type.
Have to mention that few instances of py-substrate-interface is used in parallel in different async tasks. Also it seems that the exception occurs only at the start, so if it does not happen at once then it should not happen ever.
We are using py-substrate-interface 1.3.0, scalecodec 1.0.42 and python 3.8
Here are two logs

  1. Block subscription
2022-09-21 18:52:01,654 [ERROR] Future exception was never retrieved
future: <Future finished exception=NotImplementedError('Decoder class for "Compact<u32>" not found')>
Traceback (most recent call last):
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/app/./ps.py", line 480, in wait_block_finalized
    substrate.isubstrate.subscribe_block_headers( subscription_handler_f, finalized_only=True )
  File "/usr/local/lib/python3.8/dist-packages/substrateinterface/base.py", line 2810, in subscribe_block_headers
    return self.__get_block_handler(
  File "/usr/local/lib/python3.8/dist-packages/substrateinterface/base.py", line 2563, in __get_block_handler
    self.init_runtime(block_hash=block_hash)
  File "/usr/local/lib/python3.8/dist-packages/substrateinterface/base.py", line 1136, in init_runtime
    self.metadata_decoder = self.get_block_metadata(block_hash=runtime_block_hash, decode=True)
  File "/usr/local/lib/python3.8/dist-packages/substrateinterface/base.py", line 940, in get_block_metadata
    metadata_decoder.decode()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 552, in process
    member_obj = self.process_type(member_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 1896, in process
    value = super().process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 1064, in process
    result_obj = self.process_type(enum_type_mapping[1], metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 830, in process
    element = self.process_type(self.sub_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 135, in process
    self.value_object = self.process_type(self.sub_type)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 830, in process
    element = self.process_type(self.sub_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 830, in process
    element = self.process_type(self.sub_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 159, in process
    length = self.process_type('Compact<u32>').value
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 759, in process_type
    obj = self.runtime_config.create_scale_object(type_string, self.data, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 168, in create_scale_object
    raise NotImplementedError('Decoder class for "{}" not found'.format(type_string))
NotImplementedError: Decoder class for "Compact<u32>" not found
  1. substrate_interface.query() call
future: <Task finished name='IPFS BOOTSTRAP' coro=<ParameterServer.ipfs_bootstrap() done, defined at /app/./ps.py:904> exception=NotImplementedError('Decoder class for "Compact<u32>" not found')>
Traceback (most recent call last):
  File "/app/./ps.py", line 915, in ipfs_bootstrap
    if not self.substrate.get_vendor(VENDOR_NAME):
  File "/app/./lib/py_substrate/substrate.py", line 857, in get_vendor
    res = self.isubstrate.query(
  File "/usr/local/lib/python3.8/dist-packages/substrateinterface/base.py", line 1361, in query
    self.init_runtime(block_hash=block_hash)
  File "/usr/local/lib/python3.8/dist-packages/substrateinterface/base.py", line 1136, in init_runtime
    self.metadata_decoder = self.get_block_metadata(block_hash=runtime_block_hash, decode=True)
  File "/usr/local/lib/python3.8/dist-packages/substrateinterface/base.py", line 940, in get_block_metadata
    metadata_decoder.decode()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 552, in process
    member_obj = self.process_type(member_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 1896, in process
    value = super().process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 1064, in process
    result_obj = self.process_type(enum_type_mapping[1], metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 830, in process
    element = self.process_type(self.sub_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 1064, in process
    result_obj = self.process_type(enum_type_mapping[1], metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 830, in process
    element = self.process_type(self.sub_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 830, in process
    element = self.process_type(self.sub_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 506, in process
    field_obj = self.process_type(data_type, metadata=self.metadata)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 135, in process
    self.value_object = self.process_type(self.sub_type)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 760, in process_type
    obj.decode(check_remaining=False)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 677, in decode
    self.value_serialized = self.process()
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/types.py", line 159, in process
    length = self.process_type('Compact<u32>').value
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 759, in process_type
    obj = self.runtime_config.create_scale_object(type_string, self.data, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/scalecodec/base.py", line 168, in create_scale_object
    raise NotImplementedError('Decoder class for "{}" not found'.format(type_string))
NotImplementedError: Decoder class for "Compact<u32>" not found
@zhoujs93
Copy link

Hi, has there been any issue around ? Currently running into the same problem

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

2 participants