diff --git a/brownie/project/compiler/vyper.py b/brownie/project/compiler/vyper.py index 4554940cd..5216a6880 100644 --- a/brownie/project/compiler/vyper.py +++ b/brownie/project/compiler/vyper.py @@ -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} diff --git a/tests/network/transaction/test_revert_msg.py b/tests/network/transaction/test_revert_msg.py index 02f2688bf..6395b8fc2 100644 --- a/tests/network/transaction/test_revert_msg.py +++ b/tests/network/transaction/test_revert_msg.py @@ -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"