Skip to content

Commit

Permalink
fixup! Make sure we rotate VDF servers on uninformative updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Berman committed May 22, 2024
1 parent f7fe12c commit 9538331
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions apps/arweave/src/ar_http_iface_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ get_vdf_update(Peer) ->
{ok, {{<<"200">>, _}, _, Bin, _, _}} ->
ar_serialize:binary_to_nonce_limiter_update(Bin);
{ok, {{<<"404">>, _}, _, _, _, _}} ->
not_found;
{error, not_found};
{ok, {{Status, _}, _, ResponseBody, _, _}} ->
{error, {Status, ResponseBody}};
Reply ->
Expand All @@ -535,7 +535,7 @@ get_vdf_session(Peer) ->
{ok, {{<<"200">>, _}, _, Bin, _, _}} ->
ar_serialize:binary_to_nonce_limiter_update(Bin);
{ok, {{<<"404">>, _}, _, _, _, _}} ->
not_found;
{error, not_found};
{ok, {{Status, _}, _, ResponseBody, _, _}} ->
{error, {Status, ResponseBody}};
Reply ->
Expand All @@ -548,7 +548,7 @@ get_previous_vdf_session(Peer) ->
{ok, {{<<"200">>, _}, _, Bin, _, _}} ->
ar_serialize:binary_to_nonce_limiter_update(Bin);
{ok, {{<<"404">>, _}, _, _, _, _}} ->
not_found;
{error, not_found};
{ok, {{Status, _}, _, ResponseBody, _, _}} ->
{error, {Status, ResponseBody}};
Reply ->
Expand Down
4 changes: 1 addition & 3 deletions apps/arweave/src/ar_nonce_limiter_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ handle_cast(pull, State) ->
{noreply, State2}
end
end;
not_found ->
{error, not_found} ->
%% The server might be restarting. Try another one, if there are any.
{noreply, State#state{ remote_servers = queue:in(RawPeer, Q2) }};
{error, Reason} ->
Expand Down Expand Up @@ -170,8 +170,6 @@ fetch_and_apply_session(Peer) ->
case ar_http_iface_client:get_vdf_session(Peer) of
{ok, Update} ->
ar_nonce_limiter:apply_external_update(Update, Peer);
not_found ->
not_found;
{error, Reason} = Error ->
?LOG_WARNING([{event, failed_to_fetch_vdf_session},
{peer, ar_util:format_peer(Peer)},
Expand Down
11 changes: 9 additions & 2 deletions apps/arweave/src/ar_storage_module.erl
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,15 @@ packing_label(Packing) ->
label_by_id("default") ->
"default";
label_by_id(StoreID) ->
M = get_by_id(StoreID),
label(M).
case get_by_id(StoreID) of
not_found ->
%% Occurs in tests on application shutdown.
?LOG_WARNING([{event, store_id_for_label_not_found},
{store_id, StoreID}]),
"error";
M ->
label(M)
end.

%% @doc Return the storage module with the given identifier or not_found.
%% Search across both attached modules and repacked in-place modules.
Expand Down

0 comments on commit 9538331

Please sign in to comment.