vyperlang / titanoboa

a vyper interpreter
https://titanoboa.readthedocs.io
Other
247 stars 49 forks source link

`DecodeError` on `selfdestruct` #269

Closed Leminkay closed 4 days ago

Leminkay commented 1 month ago
@external
def foo(x: bool) -> (bool):
    if x:
        selfdestruct(msg.sender)
    return x

Passing True to the foo will result in an eth.codecs.abi.exceptions.DecodeError: Error decoding '0x' as '(bool)' - Value length is not the expected size of 32 bytes exception.

At the same time, executing the same code without return values won't result in an error.

@external
def foo(x: bool):
    if x:
        selfdestruct(msg.sender)

The cause is in the marshal_to_python function, which is trying to encode non-existent return value, as well as selfdestruct does not set computation.is_error. The case could be handled by looking at the beneficiaries attribute of BaseComputation.

charles-cooper commented 1 month ago

Wow. Thanks for the bug report!