Skip to content

Commit

Permalink
fix: marshal output for tuple return
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Dec 31, 2024
1 parent 3f241fe commit 6d53c63
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions boa/contracts/abi/abi_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,22 @@ def __call__(self, *args, value=0, gas=None, sender=None, **kwargs):
contract=self.contract,
)

match self.contract.marshal_to_python(computation, self.return_type):
val = self.contract.marshal_to_python(computation, self.return_type)

# this property should be guaranteed by abi_decode inside marshal_to_python,
# assert it again just for clarity
# note that val should be a tuple.
assert len(self._abi["outputs"]) == len(val)

match val:
case ():
return None
case (single,):
return _parse_complex(self._abi["outputs"][0], single, name=self.name)
case multiple:
return _parse_complex(self._abi["outputs"], multiple, name=self.name)
item_abis = self._abi["outputs"]
cls = type(multiple) # should be tuple
return cls(_parse_complex(abi, item, name=self.name) for (abi,item) in zip(item_abis, multiple))


class ABIOverload:
Expand Down

0 comments on commit 6d53c63

Please sign in to comment.