1

What was wrong?

It seems I am not able to decode events from my contract.

Solidity event:

    event PlotChange(bytes32 indexed location, Plot newPlot);

My python code:

        print("CODEC:", codec)
        print("LOG:", log)
        evt = get_event_data(codec, abi, log)
        print(evt)

Error code (and output):

CODEC: <eth_abi.codec.ABICodec object at 0x102929070>
LOG: AttributeDict({'address': '0x40B24f2A0F58E050233A3C19eb42f297df069bB8', 'blockHash': HexBytes('0x1af88b407390f70365dfe6590fe97011549fb683cb4619e6b4674f02fffc838a'), 'blockNumber': 1295972, 'data': '0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000061dc05430000000000000000000000000000000000000000000000000000000000000001', 'logIndex': 0, 'removed': False, 'topics': [HexBytes('0xb0b3ea803f5e36351f6eb0eec7e662cac0949697e039219aea060eb29f64a0d0'), HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000')], 'transactionHash': HexBytes('0x4cb2c4dfe12d69ac27a3fb3379387dcbabd1afd87e13f0d7f587c07a2d27e342'), 'transactionIndex': 0})
Traceback (most recent call last):
  File "test.py", line 324, in _retry_web3_call
    return end_block, func(start_block, end_block)
  File "test.py", line 180, in _fetch_events
    return _fetch_events_for_all_contracts(self.web3,
  File "test.py", line 405, in _fetch_events_for_all_contracts
    evt = get_event_data(codec, abi, log)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "/nix/store/czlg5442w24w6mbam890wcgkjf6vqgxd-python3-3.8.12-env/lib/python3.8/site-packages/web3/_utils/events.py", line 241, in get_event_data
    decoded_log_data = abi_codec.decode_abi(log_data_types, log_data)
  File "/nix/store/czlg5442w24w6mbam890wcgkjf6vqgxd-python3-3.8.12-env/lib/python3.8/site-packages/eth_abi/codec.py", line 173, in decode_abi
    decoders = [
  File "/nix/store/czlg5442w24w6mbam890wcgkjf6vqgxd-python3-3.8.12-env/lib/python3.8/site-packages/eth_abi/codec.py", line 174, in <listcomp>
    self._registry.get_decoder(type_str)
  File "/nix/store/czlg5442w24w6mbam890wcgkjf6vqgxd-python3-3.8.12-env/lib/python3.8/site-packages/eth_abi/registry.py", line 469, in get_decoder
    return self._get_registration(self._decoders, type_str)
  File "/nix/store/czlg5442w24w6mbam890wcgkjf6vqgxd-python3-3.8.12-env/lib/python3.8/site-packages/eth_abi/registry.py", line 354, in _get_registration
    coder = super()._get_registration(mapping, type_str)
  File "/nix/store/czlg5442w24w6mbam890wcgkjf6vqgxd-python3-3.8.12-env/lib/python3.8/site-packages/eth_abi/registry.py", line 336, in _get_registration
    value = mapping.find(type_str)
  File "/nix/store/czlg5442w24w6mbam890wcgkjf6vqgxd-python3-3.8.12-env/lib/python3.8/site-packages/eth_abi/registry.py", line 89, in find
    raise NoEntriesFound("No matching entries for '{}' in {}".format(
eth_abi.exceptions.NoEntriesFound: No matching entries for 'tuple' in decoder registry
WARNING:__main__:Retrying events for block range 1295961 - 1295981 (20) failed with No matching entries for 'tuple' in decoder registry, retrying in 3.0 seconds

I was connected through websockets,

How can it be fixed?

I don't know. I tried this version but it didn't fix anything: https://github.com/ethereum/web3.py/pull/2211

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.