From 862e418d8bf4870a95ea01156057ca25e1b92e9b Mon Sep 17 00:00:00 2001 From: speeddragon Date: Wed, 31 Dec 2025 18:44:08 +0000 Subject: [PATCH 1/2] fix: ans104_wasm_test --- src/hb_http.erl | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/hb_http.erl b/src/hb_http.erl index 2f20d1764..03b36f638 100644 --- a/src/hb_http.erl +++ b/src/hb_http.erl @@ -1162,16 +1162,16 @@ cors_get_test() -> ). ans104_wasm_test() -> - TestStore = [hb_test_utils:test_store()], - TestOpts = + ServerStore = [hb_test_utils:test_store()], + ServerOpts = #{ force_signed => true, - store => TestStore, + store => ServerStore, priv_wallet => ar_wallet:new() }, ClientStore = [hb_test_utils:test_store()], ClientOpts = #{ store => ClientStore, priv_wallet => hb:wallet() }, - URL = hb_http_server:start_node(TestOpts), + URL = hb_http_server:start_node(ServerOpts), {ok, Bin} = file:read_file(<<"test/test-64.wasm">>), Msg = hb_message:commit( @@ -1188,14 +1188,21 @@ ans104_wasm_test() -> ), ?assert(hb_message:verify(Msg, all, ClientOpts)), ?event({msg, Msg}), + %% TODO: We could resolve before return, but I don't think that + %% is the desired behaviour. {ok, Res} = post( URL, Msg#{ <<"path">> => <<"/init/compute/results">> }, ClientOpts ), - ?event({res, Res}), - ?assertEqual(6.0, hb_ao:get(<<"output/1">>, Res, ClientOpts)). + %% TODO: Is there a better way to do this? + {link, LinkID, _ } = maps:get(<<"output">>, Res), + %% We need to resolve agaisnt the server cache + {ok, #{<<"body">> := Body}} = post(URL, Msg#{<<"path">> => <<"/", LinkID/binary, "/1">>}, ClientOpts), + ?assertEqual(<<"6.00000000000000000000e+00">>, Body). + %% This is a simple alternative, but I would avoid call internal functions. + %%?assertEqual(6.0, hb_ao:get(<<"output/1">>, Res, ServerOpts)). send_large_signed_request_test() -> % Note: If the signature scheme ever changes, we will need to run the @@ -1253,4 +1260,4 @@ index_request_test() -> }, #{} ), - ?assertEqual(<<"i like dogs!">>, hb_ao:get(<<"body">>, Res, #{})). + ?assertEqual(<<"i like dogs!">>, hb_ao:get(<<"body">>, Res, #{})). \ No newline at end of file From 0e3d0c471e4aaf3c33cfa75871e12fb8557f8b91 Mon Sep 17 00:00:00 2001 From: speeddragon Date: Tue, 6 Jan 2026 15:55:16 +0000 Subject: [PATCH 2/2] impr: Remove TODOs --- src/hb_http.erl | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/hb_http.erl b/src/hb_http.erl index 03b36f638..902455f2e 100644 --- a/src/hb_http.erl +++ b/src/hb_http.erl @@ -1188,21 +1188,16 @@ ans104_wasm_test() -> ), ?assert(hb_message:verify(Msg, all, ClientOpts)), ?event({msg, Msg}), - %% TODO: We could resolve before return, but I don't think that - %% is the desired behaviour. {ok, Res} = post( URL, Msg#{ <<"path">> => <<"/init/compute/results">> }, ClientOpts ), - %% TODO: Is there a better way to do this? {link, LinkID, _ } = maps:get(<<"output">>, Res), %% We need to resolve agaisnt the server cache {ok, #{<<"body">> := Body}} = post(URL, Msg#{<<"path">> => <<"/", LinkID/binary, "/1">>}, ClientOpts), ?assertEqual(<<"6.00000000000000000000e+00">>, Body). - %% This is a simple alternative, but I would avoid call internal functions. - %%?assertEqual(6.0, hb_ao:get(<<"output/1">>, Res, ServerOpts)). send_large_signed_request_test() -> % Note: If the signature scheme ever changes, we will need to run the @@ -1260,4 +1255,4 @@ index_request_test() -> }, #{} ), - ?assertEqual(<<"i like dogs!">>, hb_ao:get(<<"body">>, Res, #{})). \ No newline at end of file + ?assertEqual(<<"i like dogs!">>, hb_ao:get(<<"body">>, Res, #{})).