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

Revert in an internal function leads to a crash #340

Open
Leminkay opened this issue Oct 30, 2024 · 0 comments
Open

Revert in an internal function leads to a crash #340

Leminkay opened this issue Oct 30, 2024 · 0 comments

Comments

@Leminkay
Copy link

Boa commit: f58c33cde50f6deaaeefff1136b18f92ef747c6b

import boa

code = f"""
@internal
def func_0():
    raise
    
@external
def func_1():
    raise
"""

ct = boa.loads(code)
try:
    res = ct.internal.func_0()
    #res = ct.func_1()
    print(res.output)
except Exception as e:
    print(e)

Calling an internal function will throw an error:

Traceback (most recent call last):
  File "/home/lemy/otitanoboa/titanoboa/test_except.py", line 19, in <module>
    res = ct.internal.func_0()
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/vyper/vyper_contract.py", line 1075, in __call__
    return self.contract.marshal_to_python(computation, typ)
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/vyper/vyper_contract.py", line 782, in marshal_to_python
    self.handle_error(computation)
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/base_evm_contract.py", line 51, in handle_error
    raise strip_internal_frames(b) from b
  File "/home/lemy/otitanoboa/titanoboa/test_except.py", line 19, in <module>
    res = ct.internal.func_0()
boa.contracts.base_evm_contract.BoaError: <exception str() failed>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lemy/otitanoboa/titanoboa/test_except.py", line 23, in <module>
    print(e)
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/base_evm_contract.py", line 132, in __str__
    call_tree = str(self.call_trace)
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/call_trace.py", line 97, in __str__
    text = f"{' ' * self.depth * 4}{self.text}"
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/call_trace.py", line 103, in text
    text = self.source.format(self.input_data, self.output, self.is_error)
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/call_trace.py", line 15, in format
    in_ = self._format_input(input_)
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/call_trace.py", line 25, in _format_input
    decoded = abi_decode(self.args_abi_type, input_)
  File "/usr/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/home/lemy/otitanoboa/titanoboa/boa/contracts/vyper/vyper_contract.py", line 1135, in args_abi_type
    schema, fn_t = self._func_t_helper
TypeError: cannot unpack non-iterable NoneType object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant