Each event corresponds to a specific layer(height) in the dag, making identifying and preventing cycles way easier, as all parents must exist in previous layers. Additionally, propagation and sync gremlins have been eliminated, and proper validations added
16:14:42 [DEBUG] (2) net::channel::stop(): END => address=tcp+tls://lilith1.dark.fi:5262 remote=485041065
16:14:42 [DEBUG] (2) net::p2p::seed(): P2P::seed() [END]
16:14:42 [DEBUG] (2) net::channel::main_receive_loop(): dnet sending recv msg, remote 485041065
thread '<unnamed>' panicked at src/net/channel.rs:314:32:
called `Option::unwrap()` on a `None` value
So the bug is caused after running p2p.seed(), where after
channel.stop() is called, main_receive_loop() keeps running. Examining
the code further we see ch.stop().await is called and the session is
destroyed but this doesn't give enough time for the channel to finish.
One solution is to modify `net/session/seedsync_session.rs` to this:
let stop_sub = ch.subscribe_stop().await;
ch.stop().await;
stop_sub.recv().await;
stop_sub.unsubscribe().await;
However a better solution is to make channel.stop() itself await until
the channel is fully closed (using the above code inside Channel::stop())
But the better solution is to ensure that StoppableTask.stop() itself
will not finish until the task it's responsible for has finished and
is no longer running. We do that by adding a stop barrier (see diff).
Notable changes:
* Rewritten transport protocols into Dialer and Listener (Nym is TODO)
This simplifies using the transports a lot, as can be seen for example
in src/rpc, and generally around the p2p library. It also defines features
for each transport (all of which are enabled by default). We drop the
socks client for Tor and Nym and use first-class support with the Arti Tor
library, and nym-sphinx/nym-websockets (to be used with nym-client).
* Outbound session healing
The outbound session will now poll and try to fill all the requested
slots more efficiently, and if needed, will activate peer discovery to
find more peers if we can't connect to any known ones. Also if we're
unable to connect to any, we shall drop them from our set.
Additionally, transport mixing is enabled by default, so when we're
allowing transport mixing, and we use Tor, we will also be able to connect
to other transports that Tor can connect to (e.g. tcp://).
* Unix socket transport dropped
We haven't been using this, and it seems we're not going down this path,
so the code has been obsoleted and removed.
* TLS session verification
We fully verify server and client TLS certificates upon connection so
we're able to perform TLS1.3 with forward secrecy.
* lilith pruning
lilith now periodically prunes known peers from its sets if it's unable
to connect to them.
For best and standard practices in Rust, acronyms should be CamelCase,
and capitalization should be avoided; i.e. ZKCircuit -> ZkCircuit
This commit replaces all such occurencies in the codebase.