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

Can't create filter #1807

Closed
zinootje opened this issue Dec 12, 2020 · 3 comments · Fixed by #1846
Closed

Can't create filter #1807

zinootje opened this issue Dec 12, 2020 · 3 comments · Fixed by #1846

Comments

@zinootje
Copy link

zinootje commented Dec 12, 2020

  • Version:5.12.2
  • Python: 3.7
  • OS: win
  • pip freeze output
attrdict==2.0.1
attrs==20.2.0
autobahn==20.7.1
Automat==20.2.0
base58==2.0.0
bitarray==1.2.2
cachetools==4.1.0
certifi==2019.11.28
cffi==1.14.3
chardet==3.0.4
click==7.1.2
colorama==0.4.3
commando==1.0.0
constantly==15.1.0
coverage==5.3
cryptography==3.2.1
Cython==0.29.21
cytoolz==0.10.1
deap==1.3.1
eth-abi==2.1.1
eth-account==0.5.4
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.2.4
eth-rlp==0.2.1
eth-typing==2.2.1
eth-utils==1.9.5
fswrap==1.0.0
gast==0.4.0
gevent==1.4.0
google-auth==1.14.3
google-auth-oauthlib==0.4.1
google-pasta==0.2.0
greenlet==0.4.15
grpcio==1.28.1
guppy3==3.1.0
gviz-api==1.9.0
h5py==2.10.0
hexbytes==0.2.1
hkdf==0.0.3
humanize==3.1.0
hyde==0.8.9
hyperlink==20.0.1
idna==2.8
importlib-metadata==1.5.0
incremental==17.5.0
ipfshttpclient==0.7.0a1
Jinja2==2.11.2
joblib==0.17.0
jsonpickle==1.4.1
jsonschema==3.2.0
Keras-Preprocessing==1.1.2
lru-dict==1.1.6
magic-wormhole==0.12.0
Markdown==2.6.11
MarkupSafe==0.23
minify-html==0.3.8
mock==3.0.5
multiaddr==0.0.9
mypy-extensions==0.4.3
netaddr==0.8.0
nose==1.3.7
numpy==1.18.4
oauthlib==3.1.0
opt-einsum==3.3.0
parsimonious==0.8.1
profilehooks==1.11.2
protobuf==3.11.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.19
pycryptodome==3.9.4
Pygments==2.7.1
PyHamcrest==2.0.2
PyNaCl==1.4.0
pyOpenSSL==19.1.0
pypiwin32==223
pyrsistent==0.15.7
python-dateutil==2.8.1
pytz==2020.1
pywin32==227
PyYAML==3.13
rednose==1.3.0
requests==2.22.0
requests-oauthlib==1.3.0
rlp==1.2.0
rsa==4.0
scikit-learn==0.23.0
scipy==1.4.1
service-identity==18.1.0
six==1.13.0
sklearn==0.0
smartypants==1.8.6
spake2==0.8
stopit==1.1.2
termcolor==1.1.0
termstyle==0.1.11
threadpoolctl==2.0.0
toolz==0.10.0
TPOT==0.11.2
tqdm==4.46.0
Twisted==20.3.0
txaio==20.4.1
txtorcon==20.0.0
typing-extensions==3.7.4.1
typogrify==2.0.7
ujson==4.0.1
uniswap-python==0.3.4
update-checker==0.17
urllib3==1.25.7
varint==1.0.2
web3==5.12.2
websocket==0.2.1
websocket-client==0.57.0
websockets==8.1
Werkzeug==1.0.1
wrapt==1.12.1
xgboost==1.0.2
yappi==1.2.3
yattag==1.14.0
zipp==2.1.0
zope.interface==5.1.2

What was wrong?

import web3
w3 = web3.Web3(web3.WebsocketProvider("wss://mainnet.infura.io/ws/*******"))
Governanceaddres = "0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F"
govabi:str = """[{"inputs":[{"internalType":"address","name":"timelock_","type":"address"},{"internalType":"address","name":"uni_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProposalCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"address[]","name":"targets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"},{"indexed":false,"internalType":"string[]","name":"signatures","type":"string[]"},{"indexed":false,"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"ProposalCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProposalExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eta","type":"uint256"}],"name":"ProposalQueued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"support","type":"bool"},{"indexed":false,"internalType":"uint256","name":"votes","type":"uint256"}],"name":"VoteCast","type":"event"},{"constant":true,"inputs":[],"name":"BALLOT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"cancel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"}],"name":"castVote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"castVoteBySig","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"execute","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"getActions","outputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"voter","type":"address"}],"name":"getReceipt","outputs":[{"components":[{"internalType":"bool","name":"hasVoted","type":"bool"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint96","name":"votes","type":"uint96"}],"internalType":"struct GovernorAlpha.Receipt","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"latestProposalIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposalCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"proposalMaxOperations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"proposalThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposals","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"canceled","type":"bool"},{"internalType":"bool","name":"executed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"internalType":"string","name":"description","type":"string"}],"name":"propose","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"queue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"quorumVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"state","outputs":[{"internalType":"enum GovernorAlpha.ProposalState","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"timelock","outputs":[{"internalType":"contract TimelockInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"uni","outputs":[{"internalType":"contract UniInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"votingDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"votingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"}]"""

govContract = w3.eth.contract(Governanceaddres, abi=govabi)
block_filter = govContract.events.ProposalCreated.createFilter(fromBlock=1)

running this gives the error

Traceback (most recent call last):
  File chain.py", line 4, in <module>
    block_filter = govContract.events.ProposalCreated.createFilter(fromBlock=1)
  File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\eth_utils\decorators.py", line 20, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\web3\contract.py", line 1227, in createFilter
    log_filter = filter_builder.deploy(self.web3)
  File "C:\Users\****\AppData\Local\Programs\Python\Python37\lib\site-packages\web3\_utils\events.py", line 404, in deploy
    for arg in self.args.values():
TypeError: 'DataArgumentFilter' object is not callable

I do not understand why i can't create a filter this way for other events it works as expected and also when creating manually.
The contract is the uniswap governance contract

@wolovim
Copy link
Member

wolovim commented Jan 5, 2021

Thanks for the report. I've reproduced the issue and indeed see other events working. Investigating.

@wolovim
Copy link
Member

wolovim commented Jan 21, 2021

ah ha - the ProposalCreated event abi contains a values key. Our filter building logic blows up when it tries to read the values() of the dict. Will have to account for that case. Fix coming soon™.

@ngovindrajan
Copy link

Hi @marcgarreau , I am seeing the same issue for ProposalCreated event. I see this issue was fixed long back .
Could you please suggest which version has this fix ? Because , I am using Version: 5.9.0 of Web3.py.
Any thoughts would be helpful.Thanks !

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

Successfully merging a pull request may close this issue.

3 participants