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 not parse event with tuple arguments #1629

Closed
recmo opened this issue Apr 24, 2020 · 13 comments
Closed

Can not parse event with tuple arguments #1629

recmo opened this issue Apr 24, 2020 · 13 comments

Comments

@recmo
Copy link

recmo commented Apr 24, 2020

  • Version: 5.7.0
  • Python: 3.7.6
  • OS: osx
  • pip freeze output
  • Node: Geth/v1.9.13-stable/darwin-amd64/go1.14.2 (IPCProvider)
pip freeze output
absl-py==0.9.0
appnope==0.1.0
asn1crypto==0.24.0
astor==0.8.1
astroid==2.0.4
atomicwrites==1.2.1
attrdict==2.0.1
attrs==18.2.0
autopep8==1.4.4
backcall==0.1.0
base58==2.0.0
beautifulsoup4==4.6.3
bigfloat==0.4.0
bleach==2.1.3
bs4==0.0.1
cachetools==4.0.0
certifi==2018.10.15
cffi==1.11.5
chardet==3.0.4
coincurve==9.0.0
coloredlogs==10.0
cryptography==2.3.1
cryptohash==1.0.4
crytic-compile==0.1.2
cycler==0.10.0
cytoolz==0.10.1
decorator==4.3.0
Deprecated==1.2.6
ecdsa==0.13
entrypoints==0.2.3
eth-abi==2.1.1
eth-account==0.4.0
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.2.4
eth-rlp==0.1.2
eth-typing==2.2.1
eth-utils==1.8.4
ethereum==2.3.2
future==0.16.0
gast==0.2.2
get==2018.11.19
gevent==1.4.0
git-filter-repo==2.26.0
google-auth==1.11.3
google-auth-oauthlib==0.4.1
google-pasta==0.2.0
greenlet==0.4.15
grpcio==1.27.2
h5py==2.10.0
hexbytes==0.2.0
html5lib==1.0.1
humanfriendly==4.17
idna==2.7
importlib-metadata==1.5.0
imutils==0.5.3
interval3==2.0.0
ipfshttpclient==0.4.13.2
ipykernel==4.8.2
ipysankeywidget==0.2.5
ipython==6.5.0
ipython-genutils==0.2.0
ipywidgets==7.4.0
isort==4.3.4
jedi==0.12.1
Jinja2==2.10
json5==0.9.2
jsonschema==3.2.0
jupyter-client==5.2.3
jupyter-console==5.2.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.5.1
jupyter-core==4.4.0
jupyter-highlight-selected-word==0.2.0
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.1
jupyterlab==2.0.1
jupyterlab-server==1.0.7
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
kiwisolver==1.0.1
lazy-object-proxy==1.3.1
lru-dict==1.1.6
lxml==4.3.4
Markdown==3.2.1
MarkupSafe==1.0
matplotlib==2.2.2
mccabe==0.6.1
mercurial==5.2.2
mistune==0.8.3
more-itertools==4.3.0
mpmath==1.1.0
multiaddr==0.0.9
nbconvert==5.3.1
nbformat==4.4.0
netaddr==0.7.19
networkx==2.2
notebook==5.6.0
numpy==1.18.2
oauthlib==3.1.0
opt-einsum==3.2.0
pandas==0.24.2
pandas-datareader==0.7.0
pandocfilters==1.4.2
parsimonious==0.8.1
parso==0.3.1
patsy==0.5.1
pbkdf2==1.3
pexpect==4.6.0
pickleshare==0.7.4
Pillow==7.0.0
pluggy==0.8.0
post==2018.11.20
prettytable==0.7.2
prometheus-client==0.3.1
prompt-toolkit==1.0.15
protobuf==3.11.2
ptyprocess==0.6.0
public==2018.11.20
py==1.7.0
py-ecc==1.1.1
py-solc==3.2.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle==2.5.0
pycparser==2.18
pycrypto==2.6.1
pycryptodome==3.6.6
pydot==1.4.1
pyethash==0.1.27
pyevmasm==0.1.1
PyGithub==1.43.8
Pygments==2.2.0
PyJWT==1.7.1
pykalman==0.9.5
pykeccak==0.2.1
pylint==2.1.1
pyOpenSSL==18.0.0
pypandoc==1.4
pyparsing==2.2.0
pyrsistent==0.15.7
pysha3==1.0.2
pytesseract==0.3.1
pytest==4.0.0
python-dateutil==2.7.3
python-engineio==3.4.2
python-socketio==3.1.2
pytz==2018.5
PyYAML==3.13
pyzmq==17.1.2
qtconsole==4.4.0
query-string==2018.11.20
repoze.lru==0.7
request==2018.11.20
requests==2.23.0
requests-oauthlib==1.3.0
rlp==1.0.3
rsa==4.0
scipy==1.4.1
scrypt==0.8.6
semantic-version==2.6.0
Send2Trash==1.5.0
simplegeneric==0.8.1
six==1.14.0
slither-analyzer==0.6.4
statsmodels==0.10.0
sympy==1.3
TBB==0.1
tensorboard==2.1.1
tensorflow==2.1.0
tensorflow-estimator==2.1.0
termcolor==1.1.0
terminado==0.8.1
testpath==0.3.1
toolz==0.9.0
tornado==5.1
traitlets==4.3.2
typing-extensions==3.7.4.2
urllib3==1.24.1
varint==1.0.2
virtualenv==16.0.0
wcwidth==0.1.7
web3==5.7.0
webencodings==0.5.1
websockets==8.1
Werkzeug==1.0.0
widgetsnbextension==3.4.0
wrapt==1.12.1
yahoo-finance-pandas==1.0.3
z3-solver==4.5.1.0.post2
zipp==3.1.0

What was wrong?

I'm unable to parse this event from this contract. Getting the following error:

order = w3.eth.contract(address='0xCd81398895bEa7AD9EFF273aeFFc41A9d83B4dAD', abi=getAbi('0xCd81398895bEa7AD9EFF273aeFFc41A9d83B4dAD'))
event_filter = order.events.LogCanonicalOrderFilled.createFilter(fromBlock=9936332)
event_filter.get_all_entries()
/usr/local/lib/python3.7/site-packages/eth_abi/registry.py in find(self, type_str)
     89             raise NoEntriesFound("No matching entries for '{}' in {}".format(
     90                 type_str,
---> 91                 self._name,
     92             ))
     93 

NoEntriesFound: No matching entries for 'tuple' in decoder registry

How can it be fixed?

Could be related to #829.

@recmo recmo changed the title Can not parse events with complex types Can not parse event Apr 24, 2020
@pipermerriam
Copy link
Member

Can you provide the output from pip freeze so we can see versions of your dependencies.

@recmo
Copy link
Author

recmo commented Apr 24, 2020

pip freeze (Sorry for the mess, this is my Jupyter Notebook which doesn't run in a virtualenv)

Output
absl-py==0.9.0
appnope==0.1.0
asn1crypto==0.24.0
astor==0.8.1
astroid==2.0.4
atomicwrites==1.2.1
attrdict==2.0.1
attrs==18.2.0
autopep8==1.4.4
backcall==0.1.0
base58==2.0.0
beautifulsoup4==4.6.3
bigfloat==0.4.0
bleach==2.1.3
bs4==0.0.1
cachetools==4.0.0
certifi==2018.10.15
cffi==1.11.5
chardet==3.0.4
coincurve==9.0.0
coloredlogs==10.0
cryptography==2.3.1
cryptohash==1.0.4
crytic-compile==0.1.2
cycler==0.10.0
cytoolz==0.10.1
decorator==4.3.0
Deprecated==1.2.6
ecdsa==0.13
entrypoints==0.2.3
eth-abi==2.1.1
eth-account==0.4.0
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.2.4
eth-rlp==0.1.2
eth-typing==2.2.1
eth-utils==1.8.4
ethereum==2.3.2
future==0.16.0
gast==0.2.2
get==2018.11.19
gevent==1.4.0
git-filter-repo==2.26.0
google-auth==1.11.3
google-auth-oauthlib==0.4.1
google-pasta==0.2.0
greenlet==0.4.15
grpcio==1.27.2
h5py==2.10.0
hexbytes==0.2.0
html5lib==1.0.1
humanfriendly==4.17
idna==2.7
importlib-metadata==1.5.0
imutils==0.5.3
interval3==2.0.0
ipfshttpclient==0.4.13.2
ipykernel==4.8.2
ipysankeywidget==0.2.5
ipython==6.5.0
ipython-genutils==0.2.0
ipywidgets==7.4.0
isort==4.3.4
jedi==0.12.1
Jinja2==2.10
json5==0.9.2
jsonschema==3.2.0
jupyter-client==5.2.3
jupyter-console==5.2.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.5.1
jupyter-core==4.4.0
jupyter-highlight-selected-word==0.2.0
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.1
jupyterlab==2.0.1
jupyterlab-server==1.0.7
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
kiwisolver==1.0.1
lazy-object-proxy==1.3.1
lru-dict==1.1.6
lxml==4.3.4
Markdown==3.2.1
MarkupSafe==1.0
matplotlib==2.2.2
mccabe==0.6.1
mercurial==5.2.2
mistune==0.8.3
more-itertools==4.3.0
mpmath==1.1.0
multiaddr==0.0.9
nbconvert==5.3.1
nbformat==4.4.0
netaddr==0.7.19
networkx==2.2
notebook==5.6.0
numpy==1.18.2
oauthlib==3.1.0
opt-einsum==3.2.0
pandas==0.24.2
pandas-datareader==0.7.0
pandocfilters==1.4.2
parsimonious==0.8.1
parso==0.3.1
patsy==0.5.1
pbkdf2==1.3
pexpect==4.6.0
pickleshare==0.7.4
Pillow==7.0.0
pluggy==0.8.0
post==2018.11.20
prettytable==0.7.2
prometheus-client==0.3.1
prompt-toolkit==1.0.15
protobuf==3.11.2
ptyprocess==0.6.0
public==2018.11.20
py==1.7.0
py-ecc==1.1.1
py-solc==3.2.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle==2.5.0
pycparser==2.18
pycrypto==2.6.1
pycryptodome==3.6.6
pydot==1.4.1
pyethash==0.1.27
pyevmasm==0.1.1
PyGithub==1.43.8
Pygments==2.2.0
PyJWT==1.7.1
pykalman==0.9.5
pykeccak==0.2.1
pylint==2.1.1
pyOpenSSL==18.0.0
pypandoc==1.4
pyparsing==2.2.0
pyrsistent==0.15.7
pysha3==1.0.2
pytesseract==0.3.1
pytest==4.0.0
python-dateutil==2.7.3
python-engineio==3.4.2
python-socketio==3.1.2
pytz==2018.5
PyYAML==3.13
pyzmq==17.1.2
qtconsole==4.4.0
query-string==2018.11.20
repoze.lru==0.7
request==2018.11.20
requests==2.23.0
requests-oauthlib==1.3.0
rlp==1.0.3
rsa==4.0
scipy==1.4.1
scrypt==0.8.6
semantic-version==2.6.0
Send2Trash==1.5.0
simplegeneric==0.8.1
six==1.14.0
slither-analyzer==0.6.4
statsmodels==0.10.0
sympy==1.3
TBB==0.1
tensorboard==2.1.1
tensorflow==2.1.0
tensorflow-estimator==2.1.0
termcolor==1.1.0
terminado==0.8.1
testpath==0.3.1
toolz==0.9.0
tornado==5.1
traitlets==4.3.2
typing-extensions==3.7.4.2
urllib3==1.24.1
varint==1.0.2
virtualenv==16.0.0
wcwidth==0.1.7
web3==5.7.0
webencodings==0.5.1
websockets==8.1
Werkzeug==1.0.0
widgetsnbextension==3.4.0
wrapt==1.12.1
yahoo-finance-pandas==1.0.3
z3-solver==4.5.1.0.post2
zipp==3.1.0

@carver
Copy link
Collaborator

carver commented Apr 24, 2020

IIRC, someone brought this up in chat recently, too. My first guess was an old version, but like @recmo, they had recent-enough libraries.

#1235 is what added tuple support generally, so really #829 should have closed. (Though clearly there's a new, specific problem here)

I do notice that this PR only adds tests for tuples at method arguments and return values. I don't see any tests for tuple-typed events. So the first step seems like adding a test of parsing an event with a tuple-typed log value.

Presumably that will fail and then we can get this fixed up.

@carver carver changed the title Can not parse event Can not parse event with tuple arguments Apr 24, 2020
@KaiRo-at
Copy link

Maybe related to #1569 as well (arrays there, not tuples, but otherwise I guess similar)?

@kclowes
Copy link
Collaborator

kclowes commented Apr 24, 2020

I'm pretty sure this is also the same problem as the one in #1621. I am going to close #1621, but want to leave #1569 open because I'm not sure that's exactly the same problem, even though it does look similar.

@dfinzer
Copy link

dfinzer commented Jul 3, 2020

Running into this as well. Any good workarounds?

@rexeee
Copy link

rexeee commented Jul 14, 2020

So can not support ABIEncoderV2 to enable structure-type parameter in event?

@alexisVandewalle
Copy link

I have the same issue when i try to parse an event wich takes a struct as parameters

@miracle2k
Copy link

For anyone struggling here, applying the patch from #1484 works for me.

@carver
Copy link
Collaborator

carver commented Aug 25, 2021

For anyone struggling here, applying the patch from #1484 works for me.

Glad that got your case working! A test I would definitely want to see before marking this as resolved is tuples-in-tuples. It's not obvious that #1484 handles that case.

@charles-cooper
Copy link
Contributor

For anyone struggling here, applying the patch from #1484 works for me.

Glad that got your case working! A test I would definitely want to see before marking this as resolved is tuples-in-tuples. It's not obvious that #1484 handles that case.

collapse_if_tuple handles nested tuples.

$ pip freeze|grep eth-util
eth-utils==1.10.0
...
$ python
Python 3.8.10 (default, Sep 28 2021, 16:10:42) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import eth_utils
>>> [eth_utils.abi.collapse_if_tuple(x) for x in [ {"name": "arg1", "type": "address", "indexed": True}, { "name": "arg2", "type": "tuple", "components": [ {"name": "x", "type": "uint256"}, {"name": "y", "type": "bytes"}, { "name": "z", "type": "tuple", "components": [ {"name": "t", "type": "string"}, {"name": "w", "type": "fixed168x10"}, ], }, ], "indexed": False, }, ]]
['address', '(uint256,bytes,(string,fixed168x10))']

@Th0rgal
Copy link

Th0rgal commented Jan 10, 2022

Hello there! I just got a similar issue today. Is there a workaround? Should I use a fork of web3.py?

@fselmo
Copy link
Collaborator

fselmo commented Jan 14, 2022

Going to close this since #2211 should fix this particular example

@fselmo fselmo closed this as completed Jan 14, 2022
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