From 9745b3261b462a3dc78452e559556f520f7fdf8f Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Mon, 11 Jul 2022 12:17:39 +0800 Subject: [PATCH 1/3] feat: add vyper version bytecode check --- brownie/project/compiler/vyper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/brownie/project/compiler/vyper.py b/brownie/project/compiler/vyper.py index cc375be7b..1a6cc87e6 100644 --- a/brownie/project/compiler/vyper.py +++ b/brownie/project/compiler/vyper.py @@ -310,6 +310,10 @@ def _generate_coverage_data( revert_pc = len(opcodes) + sum(int(i[4:]) - 1 for i in opcodes if i.startswith("PUSH")) - 5 while opcodes: + # ignore vyper version bytecode for >= 0.3.4 + if len(source_map) == 0 and opcodes[0] == "PUSH6" and opcodes[1] == "0x767970657283": + break + # format of source is [start, stop, contract_id, jump code] source = source_map.popleft() pc_list.append({"op": opcodes.popleft(), "pc": pc}) From c4745113bd14ef188fcbe9c1db2b2c49012dfa78 Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Mon, 11 Jul 2022 12:26:23 +0800 Subject: [PATCH 2/3] fix lint --- brownie/project/compiler/vyper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brownie/project/compiler/vyper.py b/brownie/project/compiler/vyper.py index 1a6cc87e6..e612e38da 100644 --- a/brownie/project/compiler/vyper.py +++ b/brownie/project/compiler/vyper.py @@ -313,7 +313,7 @@ def _generate_coverage_data( # ignore vyper version bytecode for >= 0.3.4 if len(source_map) == 0 and opcodes[0] == "PUSH6" and opcodes[1] == "0x767970657283": break - + # format of source is [start, stop, contract_id, jump code] source = source_map.popleft() pc_list.append({"op": opcodes.popleft(), "pc": pc}) From a8a3a4843f5fb98f754f3aa08cb9a5279452a1a4 Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Mon, 11 Jul 2022 16:26:19 +0800 Subject: [PATCH 3/3] update changlog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b4462976..6b19f6552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This changelog format is based on [Keep a Changelog](https://keepachangelog.com/ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased](https://github.com/eth-brownie/brownie) +### Fixed +- Handle version bytecode for Vyper `>=0.3.4` ([#1578](https://github.com/eth-brownie/brownie/pull/1578)) ## [1.19.0](https://github.com/eth-brownie/brownie/tree/v1.19.0) - 2022-05-29 ### Added