diff --git a/src/aeso_abi.erl b/src/aeso_abi.erl index 455ba21..d4b371b 100644 --- a/src/aeso_abi.erl +++ b/src/aeso_abi.erl @@ -39,11 +39,12 @@ %%%=================================================================== %%% Handle calldata -create_calldata(FunName, Args, ArgTypes, RetType) -> - {<>, _, _, _} = - function_type_info(list_to_binary(FunName), ArgTypes, RetType), +create_calldata(FunName, Args, ArgTypes0, RetType) -> + ArgTypes = {tuple, ArgTypes0}, + <> = + function_type_hash(list_to_binary(FunName), ArgTypes, RetType), Data = aeso_heap:to_binary({TypeHashInt, list_to_tuple(Args)}), - {ok, Data, {tuple, [word, {tuple, ArgTypes}]}, RetType}. + {ok, Data, {tuple, [word, ArgTypes]}, RetType}. get_type_info_and_hash(#{type_info := TypeInfo}, FunName) -> FunBin = list_to_binary(FunName), @@ -90,8 +91,8 @@ get_function_hash_from_calldata(CallData) -> -spec function_type_info(function_name(), [typerep()], typerep()) -> function_type_info(). -function_type_info(Name, Args, OutType) -> - ArgType = {tuple, [T || {_, T} <- Args]}, +function_type_info(Name, ArgTypes, OutType) -> + ArgType = {tuple, ArgTypes}, { function_type_hash(Name, ArgType, OutType) , Name , aeso_heap:to_binary(ArgType) diff --git a/src/aeso_compiler.erl b/src/aeso_compiler.erl index 30e1136..d25ed8d 100644 --- a/src/aeso_compiler.erl +++ b/src/aeso_compiler.erl @@ -388,7 +388,9 @@ to_bytecode([Op|Rest], Options) -> to_bytecode([], _) -> []. extract_type_info(#{functions := Functions} =_Icode) -> - TypeInfo = [aeso_abi:function_type_info(list_to_binary(lists:last(Name)), Args, TypeRep) + ArgTypesOnly = fun(As) -> [ T || {_, T} <- As ] end, + TypeInfo = [aeso_abi:function_type_info(list_to_binary(lists:last(Name)), + ArgTypesOnly(Args), TypeRep) || {Name, Attrs, Args,_Body, TypeRep} <- Functions, not is_tuple(Name), not lists:member(private, Attrs)