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: no sanity check on storage layout files #3516

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

bug: no sanity check on storage layout files #3516

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?

When compiling a contract with the flag storage_layout_file, some basic sanity checks could be performed on the given JSON file as currently:

  • The JSON can have duplicated entries. In this case, the last one will be the one used by the compiler.
  • The JSON can have entries not matching any storage slot of the contract
  • The entries of the JSON do not necessarily have to match with the type of the corresponding variables in the contract.

For example, a contract only defining the storage variable a: uint256 can be compiled given the following storage layout:

{
    "a": {"type": "uint16", "slot": 10},
    "a": {"type": "uint8", "slot": 1},
    "b": {"type": "uint256", "slot": 1}
}

h/t @trocher

How can it be fixed?

Fill this in if you know how to fix it.

@cyberthirst
Copy link
Collaborator

roundtrip requirement was added in #3789

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