Skip to content

Commit

Permalink
Add and use a PubSub system in place of ar_gossip
Browse files Browse the repository at this point in the history
  • Loading branch information
halturin authored and ldmberman committed Aug 11, 2021
1 parent 311f17a commit 50d6433
Show file tree
Hide file tree
Showing 25 changed files with 958 additions and 989 deletions.
5 changes: 5 additions & 0 deletions apps/arweave/c_src/Makefile
Expand Up @@ -31,6 +31,11 @@ else ifeq ($(UNAME_SYS), Linux)
CXXFLAGS ?= -O3 -finline-functions -Wall
endif

ifneq (, $(shell which pkg-config))
CFLAGS += `pkg-config --cflags gmp`
LDFLAGS += `pkg-config --libs gmp`
endif

CFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) -I /usr/local/include -I ../lib/RandomX/src
CXXFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) -I ../lib/RandomX/src

Expand Down
17 changes: 0 additions & 17 deletions apps/arweave/include/ar.hrl
Expand Up @@ -417,23 +417,6 @@
reward = 0 % The fee in Winstons.
}).

%% Gossip protocol state.
%% Passed to and from the gossip library functions of `ar_gossip`.
-record(gs_state, {
peers, % A list of the peers known to this node.
heard = [], % Hashes of the messages received thus far.
loss_probability = 0, % Message loss probability for network simulation.
delay = 0, % Message passing delay for network simulation.
xfer_speed = undefined % Transfer speed in bytes/s for network simulation.
}).

%% A message intended to be handled by the internal gossip protocol
%% library, `ar_gossip`.
-record(gs_msg, {
hash,
data
}).

%% Peering performance of a node.
-record(performance, {
bytes = 0,
Expand Down
3 changes: 2 additions & 1 deletion apps/arweave/include/ar_config.hrl
Expand Up @@ -113,7 +113,8 @@
arql => ?MAX_PARALLEL_ARQL_REQUESTS,
gateway_arql => ?MAX_PARALLEL_GATEWAY_ARQL_REQUESTS,
get_sync_record => ?MAX_PARALLEL_GET_SYNC_RECORD_REQUESTS
}
},
debug = false
}).

-endif.
141 changes: 0 additions & 141 deletions apps/arweave/src/adt_simple.erl

This file was deleted.

6 changes: 5 additions & 1 deletion apps/arweave/src/ar.erl
Expand Up @@ -49,7 +49,6 @@
ar_tx_db,
ar_tx,
ar_wallet,
ar_gossip,
ar_serialize,
ar_block,
ar_difficulty_tests,
Expand Down Expand Up @@ -226,6 +225,9 @@ show_help() ->
{"randomx_bulk_hashing_iterations",
"The number of hashes RandomX generates before reporting the result back"
" to the Arweave miner. The faster CPU hashes, the higher this value should be."
},
{"debug",
"Enable extended logging."
}
]
),
Expand Down Expand Up @@ -353,6 +355,8 @@ parse_cli_args(["max_disk_pool_data_root_buffer_mb", Num | Rest], C) ->
parse_cli_args(Rest, C#config { max_disk_pool_data_root_buffer_mb = list_to_integer(Num) });
parse_cli_args(["randomx_bulk_hashing_iterations", Num | Rest], C) ->
parse_cli_args(Rest, C#config { randomx_bulk_hashing_iterations = list_to_integer(Num) });
parse_cli_args(["debug" | Rest], C) ->
parse_cli_args(Rest, C#config { debug = true });
parse_cli_args([Arg|_Rest], _O) ->
io:format("~nUnknown argument: ~s.~n", [Arg]),
show_help().
Expand Down

0 comments on commit 50d6433

Please sign in to comment.