vyper
vyper copied to clipboard
bug: can't handle top-level "abi" key in .json interfaces
Version Information
- vyper Version (output of
vyper --version): 0.4.0 - OS: linux
- Python Version (output of
python --version): 3.11.9
What's your issue about?
CompilerPanic:unhandled exception 'str' object has no attribute 'get'
contract "contracts/StreamManager.vy:23", line 23:0
22
---> 23 from . import Validator
--------^
24
How can it be fixed?
actually I think that Validator is a json file
need a repro -- can you post the contents of Validator.json?
https://github.com/ApeWorX/ApePay/blob/2b1326328c729b7a131b99321111f6d326754363/contracts/Validator.json
compiling with -v shows the problem --
File "/home/charles/vyper/vyper/semantics/types/module.py", line 212, in <listcomp>
for item in [i for i in abi if i.get("type") == "function"]:
^^^^^
vyper.exceptions.CompilerPanic: unhandled exception 'str' object has no attribute 'get'
contract "tmp/StreamManager.vy:1", line 1:0
---> 1 from . import Validator
-------^
2
compiling with
-vshows the problem --File "/home/charles/vyper/vyper/semantics/types/module.py", line 212, in <listcomp> for item in [i for i in abi if i.get("type") == "function"]: ^^^^^ vyper.exceptions.CompilerPanic: unhandled exception 'str' object has no attribute 'get' contract "tmp/StreamManager.vy:1", line 1:0 ---> 1 from . import Validator -------^ 2
not sure I get it lol
yea i mean it's not very well validated, but moving the contents of the "abi" key to top level (so the top level object is a list) fixes the compilation issue
gotcha
to note for transparency though, this works in <0.4, so there is a bit of a regression not to support optional abi top-level key
yea, not sure where this regression happened
gotcha
to note for transparency though, this works in <0.4, so there is a bit of a regression not to support optional
abitop-level key
seems like it's not a regression - https://github.com/vyperlang/vyper/pull/4279#issuecomment-2400633840
fixed in https://github.com/vyperlang/vyper/pull/4279