Skip to content

Improve exception for invalid use of dynamically sized struct#2189

Merged
fubuloubu merged 3 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-dynamic-struct-calldata
Oct 10, 2020
Merged

Improve exception for invalid use of dynamically sized struct#2189
fubuloubu merged 3 commits into
vyperlang:masterfrom
iamdefinitelyahuman:fix-dynamic-struct-calldata

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
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

codecov-io commented Oct 10, 2020

Copy link
Copy Markdown

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.

Comment thread vyper/context/types/meta/struct.py Outdated
Comment thread vyper/context/types/indexable/sequence.py Outdated
@iamdefinitelyahuman iamdefinitelyahuman force-pushed the fix-dynamic-struct-calldata branch from 63b5b00 to 2937303 Compare October 10, 2020 12:30
Comment thread vyper/context/types/function.py
@iamdefinitelyahuman iamdefinitelyahuman force-pushed the fix-dynamic-struct-calldata branch from 2937303 to c4e5ffe Compare October 10, 2020 12:37
@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