From ede98b9e96bf4dda6fcdf67f82a3363744be1fc5 Mon Sep 17 00:00:00 2001 From: SpiveeWorks Date: Fri, 28 Feb 2025 23:59:00 +1100 Subject: [PATCH 1/3] Fix function spec AACI preparation --- src/hz.erl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/hz.erl b/src/hz.erl index 1fec2c3..27a22cf 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -1453,7 +1453,7 @@ convert_function_spec(#{name := NameBin, arguments := Args, returns := Result}) convert_arg(#{name := NameBin, type := TypeDef}) -> Name = binary_to_list(NameBin), - {ok, Type} = opaque_type([], TypeDef), + Type = opaque_type([], TypeDef), {Name, Type}. convert_namespace_typedefs(#{namespace := NS}) -> @@ -1561,7 +1561,7 @@ opaque_type_name(Name) -> binary_to_list(Name). annotate_function_specs([], _Types, Specs) -> Specs; annotate_function_specs([{Name, ArgsOpaque, ResultOpaque} | Rest], Types, Specs) -> - {ok, Args} = annotate_types(ArgsOpaque, Types, []), + {ok, Args} = annotate_bindings(ArgsOpaque, Types, []), {ok, Result} = annotate_type(ResultOpaque, Types), NewSpecs = maps:put(Name, {Args, Result}, Specs), annotate_function_specs(Rest, Types, NewSpecs). @@ -2358,3 +2358,14 @@ state_coerce_test() -> {ok, {[], Output}} = aaci_lookup_spec(AACI, "init"), try_coerce(Output, 0, 0). +param_test() -> + Contract = " + contract C = + type state = int + entrypoint init(x): state = x + ", + {ok, AACI} = aaci_from_string(Contract), + {ok, {[{"x", Input}], Output}} = aaci_lookup_spec(AACI, "init"), + try_coerce(Input, 0, 0), + try_coerce(Output, 0, 0). + -- 2.30.2 From 4efc38d319f0657a9ad210e843c6ab126eab6918 Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Sat, 1 Mar 2025 12:42:23 +0900 Subject: [PATCH 2/3] Make dryrun operate on the top block. --- src/hz.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hz.erl b/src/hz.erl index 27a22cf..f6e1854 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -619,9 +619,9 @@ dry_run(TX) -> %% supplied accounts. dry_run(TX, Accounts) -> - case kb_current_hash() of - {ok, Hash} -> dry_run(TX, Accounts, Hash); - Error -> Error + case top_block() of + {ok, #{"hash" := Hash}} -> dry_run(TX, Accounts, Hash); + Error -> Error end. -- 2.30.2 From 23b6256aaee911e8f805b6740598aa687985953a Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Sat, 1 Mar 2025 12:47:41 +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 | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ebin/hakuzaru.app b/ebin/hakuzaru.app index b2de17c..5670719 100644 --- a/ebin/hakuzaru.app +++ b/ebin/hakuzaru.app @@ -3,6 +3,6 @@ {included_applications,[]}, {applications,[stdlib,kernel]}, {description,"Gajumaru interoperation library"}, - {vsn,"0.3.1"}, + {vsn,"0.3.2"}, {modules,[hakuzaru,hz,hz_fetcher,hz_man,hz_sup]}, {mod,{hakuzaru,[]}}]}. diff --git a/src/hakuzaru.erl b/src/hakuzaru.erl index d134594..dbed4b7 100644 --- a/src/hakuzaru.erl +++ b/src/hakuzaru.erl @@ -6,7 +6,7 @@ %%% @end -module(hakuzaru). --vsn("0.3.1"). +-vsn("0.3.2"). -author("Craig Everett "). -copyright("Craig Everett "). -license("GPL-3.0-or-later"). diff --git a/src/hz.erl b/src/hz.erl index f6e1854..948f1ef 100644 --- a/src/hz.erl +++ b/src/hz.erl @@ -23,7 +23,7 @@ %%% @end -module(hz). --vsn("0.3.1"). +-vsn("0.3.2"). -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 66de62d..d9b3049 100644 --- a/src/hz_fetcher.erl +++ b/src/hz_fetcher.erl @@ -1,5 +1,5 @@ -module(hz_fetcher). --vsn("0.3.1"). +-vsn("0.3.2"). -author("Craig Everett "). -copyright("Craig Everett "). -license("MIT"). diff --git a/src/hz_man.erl b/src/hz_man.erl index 9cdfe85..bd0fc12 100644 --- a/src/hz_man.erl +++ b/src/hz_man.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_man). --vsn("0.3.1"). +-vsn("0.3.2"). -behavior(gen_server). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/src/hz_sup.erl b/src/hz_sup.erl index 90bec77..856067c 100644 --- a/src/hz_sup.erl +++ b/src/hz_sup.erl @@ -9,7 +9,7 @@ %%% @end -module(hz_sup). --vsn("0.3.1"). +-vsn("0.3.2"). -behaviour(supervisor). -author("Craig Everett "). -copyright("Craig Everett "). diff --git a/zomp.meta b/zomp.meta index 8be1d9a..0a9753b 100644 --- a/zomp.meta +++ b/zomp.meta @@ -4,7 +4,7 @@ {prefix,"hz"}. {author,"Craig Everett"}. {desc,"Gajumaru interoperation library"}. -{package_id,{"otpr","hakuzaru",{0,3,1}}}. +{package_id,{"otpr","hakuzaru",{0,3,2}}}. {deps,[{"otpr","sophia",{8,0,1}}, {"otpr","gmbytecode",{3,4,1}}, {"otpr","gmserialization",{0,1,2}}, -- 2.30.2