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: multiple evaluations of DST lead to non-unique symbol error when copying byte arrays or dynamic arrays #3514

Open
tserg opened this issue Jul 19, 2023 · 1 comment

Comments

@tserg
Copy link
Collaborator

tserg commented Jul 19, 2023

Version Information

  • vyper Version (output of vyper --version): 9e3b9a2
  • OS: linux
  • Python Version (output of python --version): 3.10.4

What's your issue about?

The destination of byte arrays and dynamic arrays copying is evaluated multiple times as cache_when_complex is not used. This includes make_byte_array_copier and _dynarray_make_setter (both cases: src.value == "multi" and src.value != "multi").

This contract fails to compile with the following error: AssertionError: non-unique symbols {'self.bar()2'}.

a: DynArray[DynArray[uint256, 2],2]

@external
def foo():
    self.a[self.bar()] = [1, 2]

@internal
def bar() -> uint256:
    return 0

reported by @trocher

How can it be fixed?

Fill this in if you know how to fix it.

@trocher
Copy link
Contributor

trocher commented Sep 18, 2023

Another example to add to tests when the issue will be patched:

d:String[4]

@internal
def bar()->uint256:
    return 0
@external
def bar():
    f:DynArray[String[5], 1] = ["aaaaa"]
    f[self.bar()] = self.d

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