caching #12

Merged
zxq9 merged 3 commits from caching into master 2025-12-22 10:04:17 +09:00
Showing only changes of commit 1978ca59b3 - Show all commits

View File

@ -1189,7 +1189,7 @@ read_aci(Path) ->
-spec contract_call(CallerID, AACI, ConID, Fun, Args) -> Result -spec contract_call(CallerID, AACI, ConID, Fun, Args) -> Result
when CallerID :: unicode:chardata(), when CallerID :: unicode:chardata(),
AACI :: aaci(), AACI :: aaci() | {aaci, Label :: term()},
ConID :: unicode:chardata(), ConID :: unicode:chardata(),
Fun :: string(), Fun :: string(),
Args :: [string()], Args :: [string()],
@ -1224,7 +1224,7 @@ contract_call(CallerID, AACI, ConID, Fun, Args) ->
-spec contract_call(CallerID, Gas, AACI, ConID, Fun, Args) -> Result -spec contract_call(CallerID, Gas, AACI, ConID, Fun, Args) -> Result
when CallerID :: unicode:chardata(), when CallerID :: unicode:chardata(),
Gas :: pos_integer(), Gas :: pos_integer(),
AACI :: aaci(), AACI :: aaci() | {aaci, Label :: term()},
ConID :: unicode:chardata(), ConID :: unicode:chardata(),
Fun :: string(), Fun :: string(),
Args :: [string()], Args :: [string()],
@ -1262,7 +1262,7 @@ contract_call(CallerID, Gas, AACI, ConID, Fun, Args) ->
GasPrice :: pos_integer(), GasPrice :: pos_integer(),
Amount :: non_neg_integer(), Amount :: non_neg_integer(),
TTL :: non_neg_integer(), TTL :: non_neg_integer(),
AACI :: aaci(), AACI :: aaci() | {aaci, Label :: term()},
ConID :: unicode:chardata(), ConID :: unicode:chardata(),
Fun :: string(), Fun :: string(),
Args :: [string()], Args :: [string()],
@ -2233,7 +2233,7 @@ lookup_aaci(Label) ->
-spec aaci_lookup_spec(AACI, Fun) -> {ok, Type} | {error, Reason} -spec aaci_lookup_spec(AACI, Fun) -> {ok, Type} | {error, Reason}
when AACI :: aaci(), when AACI :: aaci() | {aaci, Label :: term()},
Fun :: binary() | string(), Fun :: binary() | string(),
Type :: {term(), term()}, % FIXME Type :: {term(), term()}, % FIXME
Reason :: bad_fun_name | aaci_not_found. Reason :: bad_fun_name | aaci_not_found.
@ -2243,15 +2243,15 @@ lookup_aaci(Label) ->
%% prepare_contract/1. This type information, particularly the return type, is %% prepare_contract/1. This type information, particularly the return type, is
%% useful for calling decode_bytearray/2. %% useful for calling decode_bytearray/2.
aaci_lookup_spec({aaci, Label}, Fun) ->
case hz_man:lookup_aaci(Label) of
{ok, AACI} -> aaci_lookup_spec(AACI, Fun);
error -> {error, aaci_not_found}
end;
aaci_lookup_spec({aaci, _, FunDefs, _}, Fun) -> aaci_lookup_spec({aaci, _, FunDefs, _}, Fun) ->
case maps:find(Fun, FunDefs) of case maps:find(Fun, FunDefs) of
A = {ok, _} -> A; A = {ok, _} -> A;
error -> {error, bad_fun_name} error -> {error, bad_fun_name}
end;
aaci_lookup_spec({aaci, Label}, Fun) ->
case hz_man:lookup_aaci(Label) of
{ok, AACI} -> aaci_lookup_spec(AACI, Fun);
error -> {error, aaci_not_found}
end. end.
-spec min_gas_price() -> integer(). -spec min_gas_price() -> integer().
@ -2278,15 +2278,15 @@ min_gas() ->
200000. 200000.
encode_call_data({aaci, Label}, Fun, Args) ->
case hz_man:lookup_aaci(Label) of
{ok, AACI} -> encode_call_data(AACI, Fun, Args);
error -> {error, aaci_not_found}
end;
encode_call_data({aaci, _ContractName, FunDefs, _TypeDefs}, Fun, Args) -> encode_call_data({aaci, _ContractName, FunDefs, _TypeDefs}, Fun, Args) ->
case maps:find(Fun, FunDefs) of case maps:find(Fun, FunDefs) of
{ok, {ArgDef, _ResultDef}} -> encode_call_data2(ArgDef, Fun, Args); {ok, {ArgDef, _ResultDef}} -> encode_call_data2(ArgDef, Fun, Args);
error -> {error, bad_fun_name} error -> {error, bad_fun_name}
end;
encode_call_data({aaci, Label}, Fun, Args) ->
case hz_man:lookup_aaci(Label) of
{ok, AACI} -> encode_call_data(AACI, Fun, Args);
error -> {error, aaci_not_found}
end. end.
encode_call_data2(ArgDef, Fun, Args) -> encode_call_data2(ArgDef, Fun, Args) ->