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

Optimize nonpayable assertion #2307

Merged

Conversation

iamdefinitelyahuman
Copy link
Contributor

What I did

Optimize how the nonpayable check is applied within the bytecode

How I did it

Where possible, external functions are now organized by [payable], [nonpayable] and a single assertion that msg.value == 0 is placed in between the two sections.

When a contract contains a payable default function, and nonpayable functions, this optimization is not possible and the check is still applied per-function.

How to verify it

Run the tests. I expanded the testing around the @payable decorator to handle all the different possible permutations based on this optimization.

Cute Animal Picture

image

@fubuloubu fubuloubu self-requested a review February 16, 2021 18:57
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Feb 16, 2021

This pull request introduces 1 alert when merging 980dd35 into b378bfd - view on LGTM.com

new alerts:

  • 1 for Unused local variable

vyper/parser/parser.py Show resolved Hide resolved
vyper/parser/parser.py Show resolved Hide resolved
@iamdefinitelyahuman iamdefinitelyahuman merged commit fb9381e into vyperlang:master Feb 16, 2021
@iamdefinitelyahuman iamdefinitelyahuman deleted the feat-payable-check branch February 16, 2021 22:19
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.

2 participants