@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.
Passing
True
to thefoo
will result in aneth.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.
The cause is in the
marshal_to_python
function, which is trying to encode non-existent return value, as well asselfdestruct
does not setcomputation.is_error
. The case could be handled by looking at thebeneficiaries
attribute ofBaseComputation
.