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

bug: can't handle top-level "abi" key in .json interfaces #4231

Open
fubuloubu opened this issue Sep 10, 2024 · 9 comments
Open

bug: can't handle top-level "abi" key in .json interfaces #4231

fubuloubu opened this issue Sep 10, 2024 · 9 comments
Milestone

Comments

@fubuloubu
Copy link
Member

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?

@fubuloubu
Copy link
Member Author

actually I think that Validator is a json file

@charles-cooper
Copy link
Member

need a repro -- can you post the contents of Validator.json?

@charles-cooper
Copy link
Member

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

@fubuloubu
Copy link
Member Author

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

not sure I get it lol

@charles-cooper
Copy link
Member

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

@fubuloubu
Copy link
Member Author

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

@charles-cooper
Copy link
Member

yea, not sure where this regression happened

@charles-cooper charles-cooper added this to the v0.4.1 milestone Sep 10, 2024
@charles-cooper charles-cooper changed the title Relative import compiler panic bug: can't handle top-level "abi" key in .json interfaces Sep 10, 2024
@charles-cooper
Copy link
Member

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

seems like it's not a regression - #4279 (comment)

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

2 participants