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

Improve exception for invalid use of dynamically sized struct #2189

Merged

Conversation

iamdefinitelyahuman
Copy link
Contributor

What I did

Raise ArgumentException when using a dynamically-sized struct as a function input.

How I did it

  • Added is_dynamic_size attribute to all type objects within vyper.context
  • When generating the function signature, raise if an input is a struct with dynamic size.

How to verify it

Run the tests. I added some new cases.

Cute Animal Picture

image

@codecov-io
Copy link

codecov-io commented Oct 10, 2020

Codecov Report

Merging #2189 into master will increase coverage by 0.00%.
The diff coverage is 85.71%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2189   +/-   ##
=======================================
  Coverage   85.49%   85.49%           
=======================================
  Files          83       83           
  Lines        8503     8517   +14     
  Branches     2056     2059    +3     
=======================================
+ Hits         7270     7282   +12     
- Misses        729      731    +2     
  Partials      504      504           
Impacted Files Coverage Δ
vyper/context/types/indexable/sequence.py 82.75% <66.66%> (-1.86%) ⬇️
vyper/context/types/bases.py 89.06% <100.00%> (+0.08%) ⬆️
vyper/context/types/function.py 83.95% <100.00%> (+0.30%) ⬆️
vyper/context/types/meta/struct.py 80.32% <100.00%> (+1.01%) ⬆️
vyper/context/types/value/array_value.py 92.10% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1fbdcd...c4e5ffe. Read the comment docs.

vyper/context/types/meta/struct.py Outdated Show resolved Hide resolved
vyper/context/types/indexable/sequence.py Outdated Show resolved Hide resolved
vyper/context/types/function.py Show resolved Hide resolved
@fubuloubu fubuloubu merged commit dcd0080 into vyperlang:master Oct 10, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-dynamic-struct-calldata branch December 4, 2020 10:33
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 this pull request may close these issues.

3 participants