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: nonpayable heuristic for vyper 0.2.5 #784

Merged
merged 1 commit into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions brownie/project/compiler/vyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ def _generate_coverage_data(

pc_list[0]["path"] = "0"
pc_list[0]["offset"] = [0, _convert_src(ast_json[-1]["src"])[1]]

if len(pc_list) > 7 and pc_list[0]["op"] == "CALLVALUE" and pc_list[6]["op"] == "REVERT":
# special case - initial nonpayable check on vyper >=0.2.5
pc_list[6]["dev"] = "Cannot send ether to nonpayable function"

pc_map = dict((i.pop("pc"), i) for i in pc_list)

return pc_map, {"0": statement_map}, {"0": branch_map}
Expand Down
2 changes: 1 addition & 1 deletion tests/network/transaction/test_revert_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ def test_deployment_size_limit(accounts, console_mode):
def baz():
assert msg.sender != ZERO_ADDRESS, '{'blah'*10000}'
"""
tx = compile_source(code, vyper_version="").Vyper.deploy({"from": accounts[0]})
tx = compile_source(code, vyper_version="0.2.4").Vyper.deploy({"from": accounts[0]})
assert tx.revert_msg == "exceeds EIP-170 size limit"