Commit Graph

2093 Commits

Author SHA1 Message Date
dasman
214458322a add deg2 (dag_browser) code 2024-04-07 04:40:18 +03:00
draoi
f9f3fa2bf1 session: cleanup SessionBitFlags
Add an additional byte to SessionBitFlags to accommodate SESSION_REFINE
and reduce the risk of logic errors.

Additionally:

* `!SESSION_SEED & !SESSION_REFINE` is now referred to as `SESSION_DEFAULT`
* `!SESSION_REFINE` is refered to as `SESSION_NET`.
* `SESSION_ALL` has been deleted since it was conceptually out-dated
* Binaries have been updated.
2024-04-06 15:14:49 +02:00
draoi
2b18e5307b session: cleanup SessionBitFlags
Add an additional byte to SessionBitFlags to accommodate SESSION_REFINE
and reduce the risk of logic errors.

Additionally:

* `!SESSION_SEED & !SESSION_REFINE` is now referred to as `SESSION_DEFAULT`
* `!SESSION_REFINE` is refered to as `SESSION_NET`.
* `SESSION_ALL` has been deleted since it was conceptually out-dated
* Binaries have been updated.
2024-04-06 11:40:07 +02:00
zero
91bc56bee6 darkirc: add commented log and verbose settings + description to default toml config 2024-04-05 11:45:49 +02:00
skoupidi
930a511309 blockchain: major hashes cleanup 2024-04-04 22:00:51 +03:00
draoi
8dad8dfc8f lilith: add missing safety check 2024-04-04 13:45:39 +02:00
zero
564089646d sdk: add hex decoding fns 2024-04-03 08:34:48 +02:00
zero
c781936b12 replace usage of blake3::Hash for tx hashes with TransactionHash type. Change all occurances of let txs: Vec<blake3::Hash> = block.txs.iter().map(|x| blake3::hash(&serialize(x))).collect(); to let txs: Vec<TransactionHash> = block.txs.iter().map(|tx| tx.hash()).collect(); 2024-04-03 07:36:59 +02:00
zero
732b9ae38a drk: 'fix' make clippy error (just a temp patch) 2024-04-01 17:57:07 +02:00
skoupidi
34dd60a9b7 blockchain/block_store: unified all trees into a single store structure 2024-04-01 16:40:12 +03:00
draoi
52e6ea0530 net: implement greylist downgrade and goldlist upgrade 2024-04-01 13:33:38 +02:00
draoi
1cd330b798 net: create RefineSession
* Move greylist refinery and ping self process into Session.
* Remove hosts/ submodule and return store to net/hosts.rs
* Temporarily disable Gold/ Grey list upgrade and downgrade (we will move into RefineSession)
2024-04-01 13:33:38 +02:00
draoi
1f1bfd3dce net: flatten move_hosts() so unregister call happens outside function
this leads to cleaner code since depending on the use case we still do
different things with the HostState following move_host(). However it
does mean that unregister() has to be called manually in some cases.
2024-04-01 13:33:38 +02:00
draoi
69c6530a5d net: move downgrade to greylist into remove_sub_on_stop()
Previously there was a bug which happened v rarely in which:

> Outbound and Manual Session are waiting on a stop signal
> Outbound/ Manual receives a stop signal, de-registers channel (in move_host)
> Channel is selected by Slot 1 to be connected to, state is changed to Connect
> remove_sub_on_stop() receives a stop signal, de-registers channel
> Channel is selected by Slot 5 connected to, state is changed to Connect
> Slot 1 connects, state is changed to Connected
> Slot 5 connects -> panic!

To avoid this happening, we move unregister() out of move_host and perform the sequence:

recv stop signal -> move_host to greylist (if outbond/manual) -> unregister()

We do this inside the shared method remove_sub_on_stop to ensure the execution path always happens in the same way.
2024-04-01 13:33:38 +02:00
zero
5c9e3bd4a1 tx: change tx.hash() -> Result<blake3::Hash> to tx.hash() -> TransactionHash, by calling .unwrap() on blake3 hasher. This should be safe (see code comment in tx/mod.rs:188 inside fn hash() ) 2024-04-01 11:59:17 +02:00
foo
1383e7bd47 doc: Remove reference to quarantine settings
They have been deleted and replaced with the greylist system
2024-03-28 20:12:06 -04:00
zero
b2d29aaa0a sdk/python: add missing SparseMerklePath 2024-03-28 09:47:24 +01:00
draoi
4bad13e687 net: create darklist for unknown transports + share darklist (not greylist)
In monero, nodes broadcast addrs from their whitelist. Receiving nodes
save the information on their greylist.

This is to ensure that honest nodes only broadcast active (i.e. whitelist)
nodes to the network. Dishonest nodes can send garbage info through
the hostlist, and therefore all information received from other nodes
is considered hostile and placed in the greylist, until we independently
verify it is accessible via the refinery.

Previously, darkfi deviated from this design as follows:

* Since peers on the greylist that do not match our transports never
  enter the refinery, we assume that the greylist consists of
  unsupported transports.
* We broadcast the greylist in ProtocolAddr, in an attempt to
  ensure that all transports are propagated.

Rather than simply assuming the greylist contains unsupported
transports, it is better to assume the greylist is hostile (since it
comes from other nodes).

We create a `darklist` specifically for storing unknown/ unsupported
transports. When we receive information from other peer, unsupported
addrs are added to our `darklist`, which is then broadcast to other
peers in ProtocolAddr. This fulfils to requirement (of broadcasting all
transports) without also involving honest peers in the propagating of
hostile info.

Specifically:

* Hostile peers can still broadcast garbage info in their gold, white
  and dark lists.

* Since info from other nodes is potentially hostile, honest peers save
  this info on their greylist and do not broadcast it to other peers
  unless a) it passes the refinery b) we connect to in outbound session
  c) we do not support this transport.

* There is a potential attack in which an attacker could fill their
  darklist with garbage e.g. Nym addresses, and honest nodes that do not
  support Nym will continue sharing these addresses via the dark list.
  The hostile peers will continue to be shared until a Nym-supporting
  node receives them and they pass via the refinery.

* Note that this attack is less severe, since providing the nodes stay
  on the Dark list they are ignored by the refinery and outbound connect
  loop and do not eat up resources of the node. The only time it will
  potentially cause pressure on a node if is the e.g. Nym node receives
  a list of hostile fake Nym addresses and they enter its greylist,
  causing it to refine many garbage addresses and potentially slowing
  its ability to make outbound connections. The latter can be prevented
  by increasing the settings `anchor_connect_count` and
  `white_connection_percent` (meaning outbound connections will not
  select from the greylist, or select less).

* Since there exists a potential attack vector of garbage entries in the
  Dark list, we limit the Dark list size to 1000 peers.

* This also means that supporting all transports is the best setup for a
  since it increases the security of the network (wrt the dark list).
2024-03-27 10:44:28 +01:00
skoupidi
3fc0fb19ed minerd: use (de)serialize_async 2024-03-26 15:46:01 +02:00
skoupidi
fbeb88ad45 darkfid: cleaned up unused PoWReward fields, use (de)serialize_async 2024-03-26 15:43:42 +02:00
skoupidi
4b12c9de4f chore: clippy 2024-03-26 15:18:08 +02:00
skoupidi
2956207cc5 chore: clippy 2024-03-26 15:02:21 +02:00
parazyd
41045f4433 drk: Use async (de)serialisation and prefer base64 over base58 for txs. 2024-03-26 10:24:56 +01:00
skoupidi
4d74247c9f drk: fixed erroneous eprintlns 2024-03-26 01:35:50 +02:00
zero
48d23df367 create zkrender tool to plot circuit layouts 2024-03-24 10:23:43 +01:00
zero
74b7d2f7b8 py: Proof.create() return None when failing rather than use .unwrap() 2024-03-24 09:39:35 +01:00
skoupidi
8871f0898d validator: eat ze bugs 2024-03-23 19:50:40 +02:00
skoupidi
7edbac5c65 darkfid/tests: minor fix 2024-03-22 20:55:19 +02:00
skoupidi
b70ade1922 validator: permanently store ranks as blockchain expands 2024-03-22 20:19:44 +02:00
dasman
acb3aeb3b9 bin/tau: update cargo's package description 2024-03-21 03:33:45 +03:00
dasman
f7d0b7a5ac bin/tau: print info on cli when access denied 2024-03-20 23:32:19 +03:00
dasman
d47eac66a4 bin/tau: setting access types as read-write and read-only(default) 2024-03-20 23:30:55 +03:00
skoupidi
5623914db7 Removed swapd 2024-03-20 20:12:50 +02:00
draoi
5f55e877ae net: enable hostlist migration + bugfixes
Fixes several bugs:

1. Gold list upgrades were getting blocked since it required the
   following state change that was not permitted: Connected() -> Move
   We have fixed this by enabling this state change and making Move
   take an Option<ChannelPtr> so that we can immediately reset Gold
   upgrades to Connected(ChannelPtr) once the upgrade has successfully
   completed.

2. Previously we were not downgrading peers when they disconnect, this
   has now been fixed.

3. Previously move_host() was not properly atomic. While HostState
   protects single host from being misused (like being Refined and Moved
   at the same time), HostState does not protect the hostlists
   themselves from being written to, creating race conditions when hosts
   are being removed from hostlists, like so:

        thread1: assert!(get_index(host_a) == 0)
        thread2: assert!(get_index(host_b) == 1)
        thread1: remove(0)
        thread2: remove(1) -> panic!

    We resolve this by moving write locks higher up in the code so that
    the entire sequence of looking up an index and removing it is
    atomic.

4. Manual session had a bug in which we proceeded to establish a
   Connector with an address even if try_register() failed. This has
   been fixed. We now only try to connect to address that are valid,
   otherwise we wait outbound_connect_timeout and retry
   manual_attempt_limit tries.
2024-03-20 12:10:02 +01:00
parazyd
1e5e56c9ea darkirc/nickserv: Feed RLN identity through REGISTER 2024-03-20 11:31:58 +01:00
parazyd
a9a6cb4ef9 darkirc: NickServ account registration
This currently just creates a sled tree for the account and generates a keypair.
2024-03-20 09:24:54 +01:00
skoupidi
41c9bd28ba validator: updated sled-overlay version and use new diffs logic for finalization 2024-03-19 16:47:33 +02:00
parazyd
1c163c546b darkirc: Preliminary services implementation 2024-03-15 13:49:36 +01:00
hishope
bd456cb839 chore: fix some typos
Signed-off-by: hishope <csqiye@126.com>
2024-03-15 09:53:37 +01:00
draoi
00582c94a7 chore: remove deceptive comment in lilith whitelist refinery 2024-03-15 08:24:16 +01:00
dasman
5dec33a632 bin/tau: accept RefID in any length 2024-03-11 16:18:37 +03:00
skoupidi
3a446cecfd darkfid,minerd: better mining abort signaling between the two daemons 2024-03-11 15:06:39 +02:00
dasman
66d5e760b9 bin/tau: accept full RefIDs as IDs as well 2024-03-11 15:29:52 +03:00
draoi
094c7f957a lilith: upgrade to new hosts API 2024-03-10 10:20:18 +01:00
skoupidi
39223c6a98 darkfid: fixed fork sync issues 2024-03-08 15:38:33 +02:00
skoupidi
c6637029fe darkfid: remove second miners p2p
The usage of a second p2p network for miners was a premature optimization for faster block propagation between block producers, but in reality we don't know if its required yet, therefore we eliminate the extra complexity it introduces
2024-03-08 15:38:33 +02:00
skoupidi
99d149dd9b darkfid/tests: forks sync test added 2024-03-08 15:38:33 +02:00
skoupidi
e8d5b312aa validator: clippy chore | darkfid/task/miner: minor logs added 2024-03-08 15:38:33 +02:00
parazyd
8778d57b42 chore: Update crate dependencies 2024-03-07 14:17:17 +01:00
parazyd
30ebc50b3a chore: clippy lints 2024-03-07 12:40:44 +01:00