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

fix: mutability check for interface implements #3805

Merged
merged 7 commits into from
Feb 25, 2024

Conversation

tserg
Copy link
Collaborator

@tserg tserg commented Feb 23, 2024

What I did

Fix #3774

How I did it

Add a check for payable.

How to verify it

Commit message

check mutability is exactly the same when implementing interfaces

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

Comment on lines 483 to 488
if self.mutability > other.mutability:
return False

if other.is_payable and not self.is_payable:
return False

Copy link
Contributor

@trocher trocher Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.mutability > other.mutability:
return False
if other.is_payable and not self.is_payable:
return False
if self.mutability != other.mutability:
return False

I think we should go all the way and enforce an exact matching of mutabilities: #3774 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this point, just return self.mutability == other.mutability

@codecov-commenter
Copy link

codecov-commenter commented Feb 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.05%. Comparing base (f97f4eb) to head (f6458c2).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3805      +/-   ##
==========================================
- Coverage   85.06%   85.05%   -0.01%     
==========================================
  Files          92       92              
  Lines       13769    13767       -2     
  Branches     3083     3082       -1     
==========================================
- Hits        11712    11710       -2     
  Misses       1568     1568              
  Partials      489      489              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@charles-cooper charles-cooper changed the title fix: validate implementation of payable decorator for interface fix: mutability check for interface implements Feb 25, 2024
@charles-cooper charles-cooper merged commit 9bab114 into vyperlang:master Feb 25, 2024
84 checks passed
@tserg tserg deleted the fix/implements branch February 26, 2024 03:13
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.

payable decorator in interface functions not enforced by implements
4 participants