Skip to content

Commit

Permalink
Lev WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPiechota committed Nov 13, 2024
1 parent a1e19bd commit dacd3de
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apps/arweave/src/ar_block_pre_validator.erl
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,13 @@ get_last_step_prev_output(B) ->
end.

validate_poa_against_cached_poa(B, CacheB) ->
case CacheB#block.poa_cache of
{_, _} ->
ok;
_ ->
ID = binary_to_list(ar_util:encode(crypto:strong_rand_bytes(2))),
file:write_file("/opt/arweave/bad-block-" ++ ID, term_to_binary(B))
end,
#block{ poa_cache = {ArgCache, ChunkID}, poa2_cache = Cache2 } = CacheB,
Args = erlang:append_element(erlang:insert_element(5, ArgCache, B#block.poa), ChunkID),
case ar_poa:validate(Args) of
Expand Down
2 changes: 1 addition & 1 deletion apps/arweave/src/ar_data_sync_worker_master.erl
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ process_peer_queue(PeerTasks, State) ->
%% @doc the maximum number of tasks we can have in process - including stasks queued here as well
%% as those scheduled on ar_data_sync_workers.
max_tasks(WorkerCount) ->
WorkerCount * 50.
WorkerCount * 5.

%% @doc The maximum number of tasks we can have queued for a given peer.
max_peer_queue(_Peformance, 0, _WorkerCount) ->
Expand Down
7 changes: 7 additions & 0 deletions apps/arweave/src/ar_http_iface_middleware.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2432,6 +2432,7 @@ post_block(check_transactions_are_present, {BShadow, Peer}, Req, ReceiveTimestam
post_block(enqueue_block, {BShadow, Peer}, Req, ReceiveTimestamp)
end;
post_block(enqueue_block, {B, Peer}, Req, ReceiveTimestamp) ->
try
B2 =
case B#block.height >= ar_fork:height_2_6() of
true ->
Expand Down Expand Up @@ -2459,6 +2460,12 @@ post_block(enqueue_block, {B, Peer}, Req, ReceiveTimestamp) ->
byte_size(term_to_binary(B)));
_ ->
ok
end
catch
error:Reason:Stacktrace ->
ID = binary_to_list(ar_util:encode(crypto:strong_rand_bytes(16))),
file:write_file("/opt/arweave/stacktrace" ++ ID, term_to_binary(Stacktrace)),
?LOG_ERROR("CAUGHT ~p ~p", [Reason, Stacktrace])
end,
{200, #{}, <<"OK">>, Req}.

Expand Down

0 comments on commit dacd3de

Please sign in to comment.