My smartContract code event section:
event LogJob(address indexed clusterAddress,
string jobKey,
uint index,
uint8 storageID,
string desc
);
Web3.py source code:
blockReadFrom = 1899690;
myFilter = eBlocBroker.events.LogJob.createFilter(
fromBlock=blockReadFrom,
argument_filters={'clusterAddress': '0x75a4c787c5c18c587b284a904165ff06a269b48c2'}
)
print(myFilter.get_all_entries())
=> First I have created an event with:
clusterAddress: '0x4e4a0750350796164D8DefC442a712B7557BF282'.
This works if 0x4e4a0750350796164D8DefC442a712B7557BF282 exists on emitted event but when I give a non-existed clusterAddress such as (0x4e4a0750350796164D8DefC442a712B7557BF281) ending with 81 instead of 82; I have face with the following error: eth_abi.exceptions.EncodingTypeError: Value of type <class 'str'> cannot be encoded by AddressEncoder instead of returning an empty array [].
[Q] How could I fix this error? What might be the reason for this? Is there any check mechanism for this exceptions error?
eth-abi expects addresses to be checksummed addresses. See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
Your first address is a valid address, while the second is not:
>> from eth_utils import is_checksum_address
>>> is_checksum_address("0x4e4a0750350796164D8DefC442a712B7557BF282")
True
>>> is_checksum_address("0x4e4a0750350796164D8DefC442a712B7557BF281")
False
>>>
Most helpful comment
eth-abi expects addresses to be checksummed addresses. See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md
Your first address is a valid address, while the second is not: