-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
createFilter event syntax does not work while eventFilter works #826
Comments
I am curious why this issue came up. My understanding of the address parameter is that it can be a list where logs from ANY of the addresses matching the filter parameters will be caught. Having two of the same address shouldnt prevent seeing logs. It doesnt make sense to have 2 identical contract addresses passed in a list and is a needed clean up (Thank you for catching that!), but it does seem weird that this would have caused no logs to show. I would be interested to see what would happen when comparing ganache to another node when passing identical addresses in the address parameter. |
I started doing a little bit of testing to see if I could find out if there is a deeper issue made apparent by the double address issue. The behavior seems specific to ganache. Im going to do some digging into ganache with multiple emanating contract addresses next. Here is a comparison between ganache and eth_tester:
|
I realize that the above test is useless, as Im not forcing the contract address to be lowercase. Here is a repeat of the full test with the checksum address validation monkey patch, and forced lowercased addresses:
It appears ganache does not properly handle mutliple address filters. |
Someone has already created an issue: trufflesuite/ganache#38 |
Good find dylanjw. Closing as this isn't really a web3.py bug (if you squint and don't look too closely), but it's still good that we uncovered #827 with it. |
What was wrong?
Filtering for an event with Syntax 2 does not work, while the deprecated Syntax 1 works:
Syntax 1:
Syntax 2
How can it be fixed?
By inspecting
event_filt.filter_params
, when using Syntax 2, theaddress
field is populated with a list which includes the contract address twice. This happens because in the following snippet, the call is made toconstruct_event_filter_params
with bothaddress
andcontract_address
which have the same value.web3.py/web3/contract.py
Lines 1211 to 1219 in ee8e217
Commenting out contract.py:1217 solves the issue for me.
If you are using ganache as a node you need to monkey-patch web3 to bypass trufflesuite/ganache#494, and create the contract object with a lowercase address #674, jordanjambazov@a61b382
The text was updated successfully, but these errors were encountered: