Commit Graph

7714 Commits

Author SHA1 Message Date
lunar-mining
ae5b4d0a69 net/store: reimplement test_greylist_store() 2023-12-29 17:21:53 +01:00
lunar-mining
2a2d516ac4 net: if a greylist peer is non responsive, remove it from the greylist 2023-12-29 17:21:42 +01:00
lunar-mining
0639e9bdf7 net: working greylist protocol
Working on this commit:

* Nodes connect to a seed node, do ProtocolAddr, ping themselves and send over their ADDR if the address is reachable.
* Seed nodes add addresses into greylist, probe them to make sure they're reachable, then promote to whitelist and send to other peers.
* On receiving whitelisted addresses, nodes add to greylist and after performing refinery process, promote to whitelist.

Still TODO:

* reimplement address filtering
* test: unstable_sort_by_key
* implement "anchor" connections when we've already established a connection to a node
* keep track of how many times we ping ourselves to avoid redundant self ping
* idle handshake protocol
2023-12-29 17:21:17 +01:00
lunar-mining
de2fb840bf net: invoke GreylistRefinery in p2p.rs and cleanup 2023-12-29 17:20:48 +01:00
lunar-mining
748c659f93 lilith: fix warnings 2023-12-29 17:20:38 +01:00
lunar-mining
066d3dc9c5 net: fix warnings and cargo fmt 2023-12-29 17:20:28 +01:00
lunar-mining
7cf5a1e081 net: delete hosts.rs 2023-12-29 17:20:18 +01:00
lunar-mining
c2ba96dc6f net: move GreylistRefinery and ping_node() to new hosts submodule. rename hosts.rs to hosts/store.rs. update host imports and ping_node usage 2023-12-29 17:20:07 +01:00
lunar-mining
d4541d4315 net: fix typo in protocol/mod.rs documentation 2023-12-29 17:19:40 +01:00
lunar-mining
de743a03b6 lilith: remove all peerlist filtering logic 2023-12-29 17:19:22 +01:00
lunar-mining
c0a47457f8 net: BUGFIX: stop duplicate entries in greylist
check if we have the peer and update it's last seen if we do.
this commit also standardizes the format of send_my_addrs across
ProtocolSeed and ProtocolAddr, so we can perhaps extract the
functionality to protocol/mod.rs at some point.
2023-12-29 17:19:11 +01:00
lunar-mining
175f6e78a1 net: commit working test 2023-12-29 17:18:40 +01:00
lunar-mining
cc602048d6 net: standardize format + fix logic error on protocol_seed, protocol_address self_my_addrs() 2023-12-29 17:15:38 +01:00
lunar-mining
519353ae42 hosts: fix minor typo 2023-12-29 17:15:18 +01:00
lunar-mining
a7b4f60af4 net: implement ping_node() in OutboundSession and ping self before sending own address in ProtocolAddr, ProtocolSeed
also clean up GreylistRefinery accordingly
2023-12-29 17:15:09 +01:00
lunar-mining
9f25cb4f10 net/ settings: add "advertise" to settings (default value = true) 2023-12-29 17:14:58 +01:00
lunar-mining
491ad0a318 net: add debug statements 2023-12-29 17:14:30 +01:00
lunar-mining
cf3642fb3a net/ lilith: change last_seen to use UNIXEPOCH instead of SystemTime 2023-12-29 17:14:20 +01:00
lunar-mining
406a37bbb4 net: only run GreylistRefinery if the greylist is not empty. also properly initalize Weak<OutboundSession> 2023-12-29 17:14:09 +01:00
lunar-mining
3c30fe64ab net: properly integrate GreylistRefinery in outbound session 2023-12-29 17:14:00 +01:00
lunar-mining
a19e20e006 net: cleanup 2023-12-29 17:13:49 +01:00
lunar-mining
4f0c4cdc0a net/lilith: move refresh_whitelist() process out of hosts and back into lilith. 2023-12-29 17:13:39 +01:00
lunar-mining
053cb71a52 net: move refresh_greylists() out from hosts and implement GreylistRefinery struct/ process in outbound session
it's cleaner to keep hosts.rs for simple hostlist utilities. for
anything that involves async execution, establishing channels etc, treat
that as a process in Session
2023-12-29 17:13:27 +01:00
lunar-mining
a6c74eda87 net: migrate to new AddrMessage format <Url, u64> 2023-12-29 17:13:18 +01:00
lunar-mining
2c01db5270 net: migrate outbound sessions over to new protocol. also replace lilith periodic_purge with periodic_cleanse.
periodic_cleanse doesn't remove any connections, it simply updates the
last_seen field when it is able to establish a connection, per:
2023-12-29 17:13:07 +01:00
lunar-mining
03ce1324bd net: ProtocolSeed stores addrs on the greylist, and broadcasts own address with last_seen.
also run cargo fmt
2023-12-29 17:12:54 +01:00
lunar-mining
9a09e8c6cd net: remove HostPtr from ProtocolVersion and update probe_node() 2023-12-29 17:12:45 +01:00
lunar-mining
7952b8ad41 lilith: store last_seen in host list. also change outbound_session to run new protocol 2023-12-29 17:12:28 +01:00
lunar-mining
efe3ca7214 net: move whitelist_fetch_address_with_lock() to hosts, and change whitelist_downgrade() function call to take an url, not an (addr, u64) 2023-12-29 17:12:19 +01:00
lunar-mining
c074282301 net: remove channel from the whitelist and add to the greylist if we fail to establish a connection. 2023-12-29 17:12:09 +01:00
lunar-mining
00fdaaa0ea hosts: reimplement test_greylist_store() 2023-12-29 17:12:00 +01:00
lunar-mining
d7d80b6f11 net: implement a new ProtocolAddr that sends addrs from the whitelist and receives to greylist
We change the AddrMessage format to pass (Url, u64). We also update the
greylist_store() method to properly parse the address format
(filtered_addresses2).

Several other associated methods are also updated to handle Vec<(Url,
u64)> instead of Vec<Url>
2023-12-29 17:11:19 +01:00
lunar-mining
f3b71f4fdc net: call refresh_greylist() inside outbound_session::run()
also cleanup the refresh_greylist() method
2023-12-29 17:11:07 +01:00
lunar-mining
a74557131b outbound_session: create run2() method that changes run() behavior to new whitelist protocol.
get an address from the whitelist using whitelist_fetch_address_with_lock().

try to establish a connection to it. on success, update the last_seen field for the address on the whitelist.

TODO: we're still using try_connect here which quarantines a peer on failure to connect. In the greylist update we will simply drop this connection and move on.
2023-12-29 17:10:42 +01:00
lunar-mining
b13ecb2811 hosts: create store_greylist() and store_whitelist() methods and tests 2023-12-29 17:10:31 +01:00
lunar-mining
e4b366cf68 hosts: write test and convenience methods 2023-12-29 17:10:03 +01:00
lunar-mining
240263cf84 hosts: remove whitelisted peers from the greylist and improve random greylist selection process 2023-12-29 17:09:46 +01:00
lunar-mining
82da1ef2bb hosts: if lists reach max size, remove the oldest entry from the list. 2023-12-29 17:08:56 +01:00
lunar-mining
80d6eae22e hosts: create methods to store hosts in greylist after version exchange and periodically probe_nodes, whitelisting them if responsive 2023-12-29 17:08:43 +01:00
lunar-mining
090e8fddfd hosts: add probe_node() method 2023-12-29 17:08:24 +01:00
zero
b0899f8f4b book/contrib: expand tutorial idea 2023-12-29 11:51:23 +01:00
zero
d6d45a4c0d book: edit contrib guide 2023-12-29 11:46:52 +01:00
zero
fa3b0ce573 contrib page: mark completed DAO tasks 2023-12-29 11:03:42 +01:00
zero
7d80e22ba8 dao: auth_xfer add verifiable encryption for all coins produced by money::transfer() 2023-12-28 16:29:05 +01:00
lunar-mining
42edf060d2 doc: update TODOs on arch/p2p-network.md 2023-12-28 14:06:19 +01:00
parazyd
8f6d404ce0 contract/money/fee: Reorder some state transition code more logically 2023-12-28 11:24:46 +01:00
zero
7e6a60bfc0 dao: s/get_current_slot/get_verifying_slot/ 2023-12-28 11:22:35 +01:00
zero
43bdf5eab9 money::transfer(): MoneyNote add TODO about removing value_blind and token_blind 2023-12-28 11:22:08 +01:00
zero
68f938cdb2 dao: replace get_blockchain_time() with get_current_slot() 2023-12-27 08:33:26 +01:00
parazyd
5f1f754524 contract/money/fee: WIP initial fee client API implementation 2023-12-26 17:23:37 +01:00