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 KeyError when error happens in library #259

Merged
merged 2 commits into from
Jul 29, 2024
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
4 changes: 3 additions & 1 deletion boa/contracts/vyper/vyper_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,9 @@ 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
fn_t = fn._metadata["func_type"]

frame_info = fn_t._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()
Loading