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

Incompatibility with different vyper versions #28

Closed
PatrickAlphaC opened this issue Nov 15, 2024 · 0 comments · Fixed by #29
Closed

Incompatibility with different vyper versions #28

PatrickAlphaC opened this issue Nov 15, 2024 · 0 comments · Fixed by #29
Assignees

Comments

@PatrickAlphaC
Copy link

Environment information

  • vvm Version: 0.3.1
  • vyper Version: 0.4.1b1
  • Python Version: 3.13.x
  • OS: MacOS

What was wrong?

Loading a contract with vyper==0.4.0 when the installed vyper is 0.4.1b1, for example, like this:

boa.load("my_contract.vy")

You get this error:

Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    boa.load("my_contract.vy")
    ~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/path/scrap/.venv/lib/python3.13/site-packages/boa/interpret.py", line 177, in load
    return loads(f.read(), *args, name=name, **kwargs, filename=filename)
  File "/path/scrap/.venv/lib/python3.13/site-packages/boa/interpret.py", line 189, in loads
    d = loads_partial(source_code, name, filename=filename, compiler_args=compiler_args)
  File "/path/scrap/.venv/lib/python3.13/site-packages/boa/interpret.py", line 252, in loads_partial
    return _loads_partial_vvm(source_code, version, filename)
  File "/path/scrap/.venv/lib/python3.13/site-packages/boa/interpret.py", line 286, in _loads_partial_vvm
    return _disk_cache.caching_lookup(cache_key, _compile)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/path/scrap/.venv/lib/python3.13/site-packages/boa/util/disk_cache.py", line 70, in caching_lookup
    res = func()
  File "/path/scrap/.venv/lib/python3.13/site-packages/boa/interpret.py", line 277, in _compile
    return VVMDeployer.from_compiler_output(compiler_output, filename=filename)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/scrap/.venv/lib/python3.13/site-packages/boa/contracts/vvm/vvm_contract.py", line 41, in from_compiler_output
    abi = compiler_output["abi"]
          ~~~~~~~~~~~~~~~^^^^^^^
TypeError: string indices must be integers, not 'str'

Full Reproduction steps

mkdir scrap
cd scrap
uv venv # This is essentially `python -m venv .venv`
source .venv/bin/activate
uv add 'vyper==0.4.1b1' # this is essentially `pip install 'vyper==0.4.1b1'`
uv add titanoboa # this is essentially `pip install titanoboa`
uv init # this essentially makes a pyproject.toml
echo "#pragma version 0.4.0\nmy_value: uint256" > my_contract.vy
python

In your python shell, run:

>>>import boa
>>>boa.load("my_contract.vy")

You'll get the error.

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.

2 participants