Correctly handle ArgTypes in create_calldata
This commit is contained in:
parent
62aa06cc3a
commit
eb77a73d15
@ -39,11 +39,12 @@
|
|||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% Handle calldata
|
%%% Handle calldata
|
||||||
|
|
||||||
create_calldata(FunName, Args, ArgTypes, RetType) ->
|
create_calldata(FunName, Args, ArgTypes0, RetType) ->
|
||||||
{<<TypeHashInt:?HASH_SIZE/unit:8>>, _, _, _} =
|
ArgTypes = {tuple, ArgTypes0},
|
||||||
function_type_info(list_to_binary(FunName), ArgTypes, RetType),
|
<<TypeHashInt:?HASH_SIZE/unit:8>> =
|
||||||
|
function_type_hash(list_to_binary(FunName), ArgTypes, RetType),
|
||||||
Data = aeso_heap:to_binary({TypeHashInt, list_to_tuple(Args)}),
|
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) ->
|
get_type_info_and_hash(#{type_info := TypeInfo}, FunName) ->
|
||||||
FunBin = list_to_binary(FunName),
|
FunBin = list_to_binary(FunName),
|
||||||
@ -90,8 +91,8 @@ get_function_hash_from_calldata(CallData) ->
|
|||||||
|
|
||||||
-spec function_type_info(function_name(), [typerep()], typerep()) ->
|
-spec function_type_info(function_name(), [typerep()], typerep()) ->
|
||||||
function_type_info().
|
function_type_info().
|
||||||
function_type_info(Name, Args, OutType) ->
|
function_type_info(Name, ArgTypes, OutType) ->
|
||||||
ArgType = {tuple, [T || {_, T} <- Args]},
|
ArgType = {tuple, ArgTypes},
|
||||||
{ function_type_hash(Name, ArgType, OutType)
|
{ function_type_hash(Name, ArgType, OutType)
|
||||||
, Name
|
, Name
|
||||||
, aeso_heap:to_binary(ArgType)
|
, aeso_heap:to_binary(ArgType)
|
||||||
|
@ -388,7 +388,9 @@ to_bytecode([Op|Rest], Options) ->
|
|||||||
to_bytecode([], _) -> [].
|
to_bytecode([], _) -> [].
|
||||||
|
|
||||||
extract_type_info(#{functions := Functions} =_Icode) ->
|
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,
|
|| {Name, Attrs, Args,_Body, TypeRep} <- Functions,
|
||||||
not is_tuple(Name),
|
not is_tuple(Name),
|
||||||
not lists:member(private, Attrs)
|
not lists:member(private, Attrs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user