From 58bd19d2dcc1e1d33bf7d143784c6c30e5f0d566 Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Wed, 5 Mar 2025 22:37:19 +0900 Subject: [PATCH 1/3] Verup --- ebin/hakuzaru.app | 2 +- src/hakuzaru.erl | 2 +- src/hz.erl | 2 +- src/hz_fetcher.erl | 2 +- src/hz_man.erl | 2 +- src/hz_sup.erl | 2 +- zomp.meta | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ebin/hakuzaru.app b/ebin/hakuzaru.app index 38ed048..a856e0c 100644 --- a/ebin/hakuzaru.app +++ b/ebin/hakuzaru.app @@ -3,6 +3,6 @@ {included_applications,[]}, {applications,[stdlib,kernel]}, {description,"Gajumaru interoperation library"}, - {vsn,"0.4.0"}, + {vsn,"0.5.0"}, {modules,[hakuzaru,hz,hz_fetcher,hz_man,hz_sup]}, {mod,{hakuzaru,[]}}]}. diff --git a/src/hakuzaru.erl b/src/hakuzaru.erl index 27b897a..4ae1585 100644 --- a/src/hakuzaru.erl +++ b/src/hakuzaru.erl @@ -6,7 +6,7 @@ %%% @end -module(hakuzaru). --vsn("0.4.0"). +-vsn("0.5.0"). -author("Craig Everett "). -copyright("Craig Everett "). -license("GPL-3.0-or-later"). diff --git a/src/hz.erl b/src/hz.erl index 2eef9c4..e0ba057 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -23,7 +23,7 @@ %%% @end -module(hz). --vsn("0.4.0"). +-vsn("0.5.0"). -author("Craig Everett "). -copyright("Craig Everett "). -license("GPL-3.0-or-later"). diff --git a/src/hz_fetcher.erl b/src/hz_fetcher.erl index 07116dc..ce9b1cd 100644 --- a/src/hz_fetcher.erl +++ b/src/hz_fetcher.erl @@ -1,5 +1,5 @@ -module(hz_fetcher). --vsn("0.4.0"). +-vsn("0.5.0"). -author("Craig Everett "). -copyright("Craig Everett "). -license("MIT"). diff --git a/src/hz_man.erl b/src/hz_man.erl index 16b38d3..20307ef 100644 --- a/src/hz_man.erl +++ b/src/hz_man.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_man). --vsn("0.4.0"). +-vsn("0.5.0"). -behavior(gen_server). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/src/hz_sup.erl b/src/hz_sup.erl index e9f98b8..1c5b3a5 100644 --- a/src/hz_sup.erl +++ b/src/hz_sup.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_sup). --vsn("0.4.0"). +-vsn("0.5.0"). -behaviour(supervisor). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/zomp.meta b/zomp.meta index bd3847a..4f4d256 100644 --- a/zomp.meta +++ b/zomp.meta @@ -2,9 +2,9 @@ {type,app}. {modules,[]}. {prefix,"hz"}. -{desc,"Gajumaru interoperation library"}. {author,"Craig Everett"}. -{package_id,{"otpr","hakuzaru",{0,4,0}}}. +{desc,"Gajumaru interoperation library"}. +{package_id,{"otpr","hakuzaru",{0,5,0}}}. {deps,[{"otpr","sophia",{8,0,1}}, {"otpr","gmbytecode",{3,4,1}}, {"otpr","gmserialization",{0,1,2}}, From ddf375f05ba3afe46539f160df7b0c678e0beabf Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Thu, 6 Mar 2025 16:38:46 +0900 Subject: [PATCH 2/3] Dialyzer fixes (#5) Reviewed-on: https://git.qpq.swiss/QPQ-AG/hakuzaru/pulls/5 Co-authored-by: Craig Everett Co-committed-by: Craig Everett --- src/hz.erl | 25 +++++++++++++------------ src/hz_man.erl | 6 +++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/hz.erl b/src/hz.erl index e0ba057..b76f734 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -78,7 +78,7 @@ %%% Types --export_type([chain_node/0, network_id/0, chain_error/0]). +-export_type([chain_node/0, network_id/0, chain_error/0, aaci/0]). -include_lib("eunit/include/eunit.hrl"). @@ -94,6 +94,7 @@ | {headers, map()} | bad_length | gc_out_of_range. +-type aaci() :: {aaci, term(), term(), term()}. -type pubkey() :: unicode:chardata(). % "ak_" ++ _ -type account_id() :: pubkey(). -type contract_id() :: unicode:chardata(). % "ct_" ++ _ @@ -218,8 +219,10 @@ %%% Get/Set admin functions --spec network_id() -> NetworkID - when NetworkID :: string() | none. +-spec network_id() -> Result + when Result :: {ok, NetworkID} | {error, Reason}, + NetworkID :: string(), + Reason :: term(). %% @doc %% Returns the network ID or the atom `none' if it is unset. %% Checking this is not normally necessary, but if network ID assignment is dynamic @@ -1150,7 +1153,7 @@ read_aci(Path) -> -spec contract_call(CallerID, AACI, ConID, Fun, Args) -> Result when CallerID :: unicode:chardata(), - AACI :: map(), + AACI :: aaci(), ConID :: unicode:chardata(), Fun :: string(), Args :: [string()], @@ -1185,7 +1188,7 @@ contract_call(CallerID, AACI, ConID, Fun, Args) -> -spec contract_call(CallerID, Gas, AACI, ConID, Fun, Args) -> Result when CallerID :: unicode:chardata(), Gas :: pos_integer(), - AACI :: map(), + AACI :: aaci(), ConID :: unicode:chardata(), Fun :: string(), Args :: [string()], @@ -1223,7 +1226,7 @@ contract_call(CallerID, Gas, AACI, ConID, Fun, Args) -> GasPrice :: pos_integer(), Amount :: non_neg_integer(), TTL :: pos_integer(), - AACI :: map(), + AACI :: aaci(), ConID :: unicode:chardata(), Fun :: string(), Args :: [string()], @@ -1390,7 +1393,7 @@ contract_call4(PK, Nonce, Gas, GasPrice, Amount, TTL, CK, CallData) -> -spec prepare_contract(File) -> {ok, AACI} | {error, Reason} when File :: file:filename(), - AACI :: map(), + AACI :: aaci(), Reason :: term(). %% @doc %% Compile a contract and extract the function spec meta for use in future formation @@ -2052,7 +2055,7 @@ zip_record_field({Name, Type}, {Remaining, Missing}) -> end. -spec aaci_lookup_spec(AACI, Fun) -> {ok, Type} | {error, Reason} - when AACI :: {aaci, term(), term(), term()}, % FIXME + when AACI :: aaci(), Fun :: binary() | string(), Type :: {term(), term()}, % FIXME Reason :: bad_fun_name. @@ -2213,8 +2216,6 @@ spend2(DSenderID, end. -decode_account_id(S) when is_list(S) -> - decode_account_id(list_to_binary(S)); decode_account_id(B) -> try {account_pubkey, PK} = gmser_api_encoder:decode(B), @@ -2310,8 +2311,8 @@ verify_signature2(Sig, Message, PK) -> % This is Bitcoin's variable-length unsigned integer encoding % See: https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer -vencode(N) when N < 0 -> - {error, {negative_N, N}}; +vencode(N) when N =< 0 -> + {error, {non_pos_N, N}}; vencode(N) when N < 16#FD -> {ok, <>}; vencode(N) when N =< 16#FFFF -> diff --git a/src/hz_man.erl b/src/hz_man.erl index 20307ef..1c87fe2 100644 --- a/src/hz_man.erl +++ b/src/hz_man.erl @@ -77,7 +77,7 @@ chain_nodes() -> -spec chain_nodes(ToUse) -> ok - when ToUse :: [hz:chain_nodes()]. + when ToUse :: [hz:chain_node()]. chain_nodes(ToUse) -> gen_server:cast(?MODULE, {chain_nodes, ToUse}). @@ -164,7 +164,7 @@ handle_cast({tls, Boolean}, State) -> NewState = do_tls(Boolean, State), {noreply, NewState}; handle_cast({chain_nodes, []}, State) -> - {noreply, State#s{chain_nodes = none}}; + {noreply, State#s{chain_nodes = {[], []}}}; handle_cast({chain_nodes, ToUse}, State) -> {noreply, State#s{chain_nodes = {ToUse, []}}}; handle_cast({timeout, Value}, State) -> @@ -178,7 +178,7 @@ handle_info({'DOWN', Mon, process, PID, Info}, State) -> NewState = handle_down(PID, Mon, Info, State), {noreply, NewState}; handle_info(Unexpected, State) -> - ok = log("Unexpected info: ~tp~n", [Unexpected]), + ok = log(warning, "Unexpected info: ~tp~n", [Unexpected]), {noreply, State}. From 3f226599487acf1ddb9825f91c0466ec97c461d7 Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Thu, 6 Mar 2025 16:35:58 +0900 Subject: [PATCH 3/3] verup --- ebin/hakuzaru.app | 2 +- src/hakuzaru.erl | 2 +- src/hz.erl | 2 +- src/hz_fetcher.erl | 2 +- src/hz_man.erl | 2 +- src/hz_sup.erl | 2 +- zomp.meta | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ebin/hakuzaru.app b/ebin/hakuzaru.app index a856e0c..3372a20 100644 --- a/ebin/hakuzaru.app +++ b/ebin/hakuzaru.app @@ -3,6 +3,6 @@ {included_applications,[]}, {applications,[stdlib,kernel]}, {description,"Gajumaru interoperation library"}, - {vsn,"0.5.0"}, + {vsn,"0.5.1"}, {modules,[hakuzaru,hz,hz_fetcher,hz_man,hz_sup]}, {mod,{hakuzaru,[]}}]}. diff --git a/src/hakuzaru.erl b/src/hakuzaru.erl index 4ae1585..83d3ec1 100644 --- a/src/hakuzaru.erl +++ b/src/hakuzaru.erl @@ -6,7 +6,7 @@ %%% @end -module(hakuzaru). --vsn("0.5.0"). +-vsn("0.5.1"). -author("Craig Everett "). -copyright("Craig Everett "). -license("GPL-3.0-or-later"). diff --git a/src/hz.erl b/src/hz.erl index b76f734..4b326e6 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -23,7 +23,7 @@ %%% @end -module(hz). --vsn("0.5.0"). +-vsn("0.5.1"). -author("Craig Everett "). -copyright("Craig Everett "). -license("GPL-3.0-or-later"). diff --git a/src/hz_fetcher.erl b/src/hz_fetcher.erl index ce9b1cd..ac5ec61 100644 --- a/src/hz_fetcher.erl +++ b/src/hz_fetcher.erl @@ -1,5 +1,5 @@ -module(hz_fetcher). --vsn("0.5.0"). +-vsn("0.5.1"). -author("Craig Everett "). -copyright("Craig Everett "). -license("MIT"). diff --git a/src/hz_man.erl b/src/hz_man.erl index 1c87fe2..2f42366 100644 --- a/src/hz_man.erl +++ b/src/hz_man.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_man). --vsn("0.5.0"). +-vsn("0.5.1"). -behavior(gen_server). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/src/hz_sup.erl b/src/hz_sup.erl index 1c5b3a5..ebded6f 100644 --- a/src/hz_sup.erl +++ b/src/hz_sup.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_sup). --vsn("0.5.0"). +-vsn("0.5.1"). -behaviour(supervisor). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/zomp.meta b/zomp.meta index 4f4d256..44c40c4 100644 --- a/zomp.meta +++ b/zomp.meta @@ -2,9 +2,9 @@ {type,app}. {modules,[]}. {prefix,"hz"}. -{author,"Craig Everett"}. {desc,"Gajumaru interoperation library"}. -{package_id,{"otpr","hakuzaru",{0,5,0}}}. +{author,"Craig Everett"}. +{package_id,{"otpr","hakuzaru",{0,5,1}}}. {deps,[{"otpr","sophia",{8,0,1}}, {"otpr","gmbytecode",{3,4,1}}, {"otpr","gmserialization",{0,1,2}},