Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
ar_tx_db,
ar_unbalanced_merkle,
ar_util,
ar_verify_chunks,
ar_wallet,
ar_webhook,
ar_pool,
Expand Down
1 change: 1 addition & 0 deletions apps/arweave/include/ar_config.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
init = false,
port = ?DEFAULT_HTTP_IFACE_PORT,
mine = false,
verify = false,
peers = [],
block_gossip_peers = [],
local_peers = [],
Expand Down
26 changes: 26 additions & 0 deletions apps/arweave/include/ar_poa.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-ifndef(AR_POA_HRL).
-define(AR_POA_HRL, true).

-record(chunk_proof, {
absolute_offset :: non_neg_integer(),
tx_root :: binary(),
tx_path :: binary(),
data_root :: binary(),
data_path :: binary(),
tx_start_offset :: non_neg_integer(),
tx_end_offset :: non_neg_integer(),
block_start_offset :: non_neg_integer(),
block_end_offset :: non_neg_integer(),
chunk_id :: binary(),
chunk_start_offset :: non_neg_integer(),
chunk_end_offset :: non_neg_integer(),
validate_data_path_ruleset ::
'offset_rebase_support_ruleset' |
'strict_data_split_ruleset' |
'strict_borders_ruleset',
tx_path_is_valid = not_validated :: 'not_validated' | 'valid' | 'invalid',
data_path_is_valid = not_validated :: 'not_validated' | 'valid' | 'invalid',
chunk_is_valid = not_validated :: 'not_validated' | 'valid' | 'invalid'
}).

-endif.
14 changes: 14 additions & 0 deletions apps/arweave/include/ar_verify_chunks.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-ifndef(AR_VERIFY_CHUNKS_HRL).
-define(AR_VERIFY_CHUNKS_HRL, true).

-record(verify_report, {
start_time :: non_neg_integer(),
total_error_bytes = 0 :: non_neg_integer(),
total_error_chunks = 0 :: non_neg_integer(),
error_bytes = #{} :: #{atom() => non_neg_integer()},
error_chunks = #{} :: #{atom() => non_neg_integer()},
bytes_processed = 0 :: non_neg_integer(),
progress = 0 :: non_neg_integer()
}).

-endif.
12 changes: 8 additions & 4 deletions apps/arweave/src/ar.erl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ show_help() ->
"Useful if you have multiple machines (or replicas) "
"and you want to monitor them separately on pool"},
{"rocksdb_flush_interval", "RocksDB flush interval in seconds"},
{"rocksdb_wal_sync_interval", "RocksDB WAL sync interval in seconds"}
{"rocksdb_wal_sync_interval", "RocksDB WAL sync interval in seconds"},
{"verify", "Run in verify mode. In verify mode, the node won't join the network and won't compute or request VDF steps. Also no mining or packing."}
]
),
erlang:halt().
Expand Down Expand Up @@ -373,6 +374,8 @@ read_config_from_file(Path) ->
parse_cli_args([], C) -> C;
parse_cli_args(["mine" | Rest], C) ->
parse_cli_args(Rest, C#config{ mine = true });
parse_cli_args(["verify" | Rest], C) ->
parse_cli_args(Rest, C#config{ verify = true });
parse_cli_args(["peer", Peer | Rest], C = #config{ peers = Ps }) ->
case ar_util:safe_parse_peer(Peer) of
{ok, ValidPeer} ->
Expand Down Expand Up @@ -675,10 +678,11 @@ start(Config) ->
timer:sleep(2000),
erlang:halt()
end,
ok = application:set_env(arweave, config, Config),
filelib:ensure_dir(Config#config.log_dir ++ "/"),
Config2 = ar_config:set_dependent_flags(Config),
ok = application:set_env(arweave, config, Config2),
filelib:ensure_dir(Config2#config.log_dir ++ "/"),
warn_if_single_scheduler(),
case Config#config.nonce_limiter_server_trusted_peers of
case Config2#config.nonce_limiter_server_trusted_peers of
[] ->
VDFSpeed = ar_bench_vdf:run_benchmark(),
?LOG_INFO([{event, vdf_benchmark}, {vdf_s, VDFSpeed / 1000000}]);
Expand Down
6 changes: 5 additions & 1 deletion apps/arweave/src/ar_block_index.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-module(ar_block_index).

-export([init/1, update/2, member/1, get_list/1, get_list_by_hash/1, get_element_by_height/1,
get_block_bounds/1, get_intersection/2, get_intersection/1, get_range/2]).
get_block_bounds/1, get_intersection/2, get_intersection/1, get_range/2, get_last/0]).

%%%===================================================================
%%% Public interface.
Expand Down Expand Up @@ -96,6 +96,10 @@ get_range(Start, End) ->
{error, invalid_start}
end.

%% @doc Return the last element in the block index.
get_last() ->
ets:last(block_index).

%%%===================================================================
%%% Private functions.
%%%===================================================================
Expand Down
Loading