Created
December 6, 2018 23:12
-
-
Save jacqueswww/f842c614f6b3ca6c9aa5c352f06322cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_______________________________________________________________ test_struct_return_abi ________________________________________________________________ | |
data_type = '(int128,bool)', data_value = (1, True) | |
def abi_sub_tree(data_type, data_value): | |
if data_type is None: | |
return ABITypedData([None, data_value]) | |
try: | |
> base, sub, arrlist = data_type | |
E ValueError: too many values to unpack (expected 3) | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/web3/utils/abi.py:504: ValueError | |
During handling of the above exception, another exception occurred: | |
get_contract_with_gas_estimation = <function get_contract_with_gas_estimation.<locals>.get_contract_with_gas_estimation at 0x7ff375710bf8> | |
def test_struct_return_abi(get_contract_with_gas_estimation): | |
code = """ | |
struct Voter: | |
weight: int128 | |
voted: bool | |
@public | |
def test() -> Voter: | |
a: Voter = Voter({weight: 1, voted: True}) | |
return a | |
""" | |
out = compile_code(code, ['abi']) | |
abi = out['abi'][0] | |
assert abi['name'] == 'test' | |
c = get_contract_with_gas_estimation(code) | |
> assert c.test() == [] | |
tests/parser/functions/test_return_struct.py:23: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/conftest.py:247: in decorator | |
return decorated_function(*args, **kwargs) | |
tests/conftest.py:243: in decorated_function | |
result = fn(*args, **kwargs) | |
tests/conftest.py:39: in __call__ | |
return self.__prepared_function(*args, **kwargs) | |
tests/conftest.py:54: in __prepared_function | |
return getattr(self._function(*args), modifier)(modifier_dict) | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/web3/contract.py:1115: in call | |
**self.kwargs | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/web3/contract.py:1400: in call_contract_function | |
normalized_data = map_abi_data(_normalizers, output_types, output_data) | |
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__ | |
??? | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/web3/utils/abi.py:442: in map_abi_data | |
return pipe(data, *pipeline) | |
cytoolz/functoolz.pyx:589: in cytoolz.functoolz.pipe | |
??? | |
cytoolz/functoolz.pyx:565: in cytoolz.functoolz.c_pipe | |
??? | |
cytoolz/functoolz.pyx:232: in cytoolz.functoolz.curry.__call__ | |
??? | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/web3/utils/abi.py:459: in abi_data_tree | |
in zip(types, data) | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/web3/utils/abi.py:458: in <listcomp> | |
for data_type, data_value | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/web3/utils/abi.py:506: in abi_sub_tree | |
base, sub, arrlist = process_type(data_type) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
type_str = '(int128,bool)' | |
def process_type(type_str): | |
normalized_type_str = normalize(type_str) | |
abi_type = parse(normalized_type_str) | |
type_str_repr = repr(type_str) | |
if type_str != normalized_type_str: | |
type_str_repr = '{} (normalized to {})'.format( | |
type_str_repr, | |
repr(normalized_type_str), | |
) | |
if isinstance(abi_type, TupleType): | |
raise ValueError( | |
"Cannot process type {}: tuple types not supported".format( | |
> type_str_repr, | |
) | |
) | |
E ValueError: Cannot process type '(int128,bool)': tuple types not supported | |
../../.virtual_envs/vyper/lib/python3.6/site-packages/eth_abi/utils/parsing.py:25: ValueError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment