Skip to content

Commit

Permalink
Fix KeyError when error happens in library
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Jul 19, 2024
1 parent e7efc7f commit 24a5c05
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
6 changes: 5 additions & 1 deletion boa/contracts/vyper/vyper_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,11 @@ def debug_frame(self, computation=None):
# TODO: figure out why fn is None.
return None

frame_info = self.compiler_data.function_signatures[fn.name]._ir_info.frame_info
signatures = self.compiler_data.function_signatures
if fn.name not in signatures:
return None # todo: recurse into imported libraries

frame_info = signatures[fn.name]._ir_info.frame_info

mem = computation._memory
frame_detail = FrameDetail(fn.name)
Expand Down
1 change: 1 addition & 0 deletions examples/ERC20.vy
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pragma version ^0.4.0
# @dev Implementation of ERC-20 token standard.
# @author Takayuki Jimba (@yudetamago)
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
Expand Down
7 changes: 7 additions & 0 deletions tests/unitary/fixtures/module_contract.vy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pragma version ^0.4.0
import module_lib

@external
@view
def fail():
module_lib.throw()
6 changes: 6 additions & 0 deletions tests/unitary/fixtures/module_lib.vy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# pragma version ~=0.4.0

@internal
@view
def throw():
raise "Error with message"
11 changes: 11 additions & 0 deletions tests/unitary/test_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from pathlib import Path

import boa

FIXTURES = Path(__file__).parent / "fixtures"


def test_throw():
c = boa.load(FIXTURES / "module_contract.vy")
with boa.reverts("Error with message"):
c.fail()

0 comments on commit 24a5c05

Please sign in to comment.