Commit Graph

8603 Commits

Author SHA1 Message Date
skoupidi
b89c4196a4 drk: updated basic dao handling 2024-05-22 13:44:28 +03:00
draoi
5f9b862e9a refine_session: bugfix
Fix bug that was causing peers to pass the refinery even when the version exchange failed. We use futures::select instead of the system method timeout() for more fine grained control over the different return types.
2024-05-22 12:30:40 +02:00
draoi
0dea915843 p2p: better start(), stop() sequences
Before we would start the refine() session first because it contains a
SelfHandshake that ProtocolAddr/Seed were dependent on.

Since it's an internal process that deals with locks and HostState it
feels more logical to start() stop() it last in the sequence.
2024-05-22 11:50:05 +02:00
draoi
e6cdcc80e1 outbound_session: don't add to greylist if Connector stops
Also add a FIXME/ TODO note and various improved debug statements.
2024-05-22 11:30:53 +02:00
draoi
5828da13e3 net: rm SelfHandshake
Previously we would do a version exchange with our own external
address and perform a time stamp when the version exchange occured
successfully. This tuple of (external_addr, last_seen) would be shared
with other nodes in ProtocolAddr and ProtocolSeed.

This commit removes SelfHandshake. Instead, we simply set the last_seen
to now when we send our addrs in ProtocolAddr/Seed.

Rationale:

1. Doing a version exchange with ourselves requires creating two
   channels, an inbound and an outbound channel. This causes unintended
   message broadcasting to our own addrs in p2p.broadcast(), and race
   conditions when one of the two channels disconnects.

2. Being reachable by our own node does not guarantee our node is
   reachable by other nodes, so it's not a reliable method for
   determining whether an address is accessible.

3. As the external addrs ends up on the greylist of other peers, the
   work is essentially redundant, since they will also ping the address
   via their GreylistRefinery.

One notable impact of this change is that setting the timestamp to now
means that external addresses from other nodes will be placed on the top
of our greylist. Hostlists are sorted by last_seen, with the most
recently seen timestamp on the top of the list. However, this does not
impact the refinery ordering because refinery selects peers to refine
randomly.

The one area this could impact is outbound session, since we
search for an address to connect to by looping through the hostlists
(incl. greylist) starting from index 0 (i.e. the most recently seen
node). Therefore, this commit increases the probability of connecting to
a node that has recently sent its address to us (or marking that node as
"Suspend" if we cannot connect to it).
2024-05-21 17:05:53 +02:00
draoi
1915b38f8e net: rename anchor[..] to gold[..]
We have already mostly made this change so it's just for consistency.
2024-05-21 17:05:53 +02:00
darkfi
667035a159 book: extend wallet.md section with specifics on plugins wrt to scene graph 2024-05-21 13:05:03 +02:00
dasman
e093c5ed57 bin/deg: update README 2024-05-21 01:34:49 +03:00
foo
ed4385de0c fuzz: Add dictionaries, improve README 2024-05-20 11:16:57 -04:00
draoi
55e9cc21d0 session: manually stop the connector on slot.stop()
This change required adding a new abstraction called Slot that stores a
Connector, and refactoring ManualSession significantly such that it more
closely resembles the format of other sessions.

We also use FuturesUnordered to stop process concurrently wherever
relevant.
2024-05-20 16:45:30 +02:00
draoi
eca97916f6 connector: add a stop signal to abort the Connector
Connector can be prematurely stopped even if a connection is in
progress.
2024-05-20 16:22:57 +02:00
draoi
a092f0d0eb transport: non-blocking tcp connect
`socket2::connect_with_timeout()` is blocking, and so would wait up to
`outbound_connect_timeout` seconds before returning even when the
underlying connection has been stopped.

To make the connection non-blocking, we wrap it in an Async object and
wait for it to complete using the socket method `take_error()`. If
there's a timeout configured, we use futures::select to return whatever
completes first. Otherwise, we wait on the connection.

For more info, see: https://github.com/rust-lang/socket2/issues/466

Also helpful: https://stackoverflow.com/questions/73101446/non-blocking-tcp-socket-fails-to-connect-using-socket2
2024-05-20 16:22:57 +02:00
draoi
007500d8e7 net/test: check all hostlists, not just 1 random hostlist
also give the seed node enough time to run the refinery twice, to ensure
peers have at least 1 addr from the seed node (since the node that was
refined will filter out its own addr in the first addr propagation).
2024-05-20 16:22:57 +02:00
draoi
efb3d05449 doc: adjust log level on session/mod.rs 2024-05-20 16:22:57 +02:00
draoi
85fb7bc684 protocol_seed: only append to greylist if addrs msg is not empty 2024-05-20 16:22:57 +02:00
draoi
f4d93104b5 seedsync: refactor to enable reseed on CondVar.notify()
We introduce a new abstraction called Slot which runs a connector for
each seed specified in Settings. On `p2p.start()`, seed slots are
started but sit in a pending state until a subsequent call to
`notify()`.

This change allows us to have more fine grained control over the `Connector`
(such as allowing us to stop the `Connector` when it is in progress).

Notably there has been a change to the error handling since we no longer
return a success or failure from the seedsync process. Instead, we store
success or failure of a given `Slot` in a AtomicBool, which allows us to
notify other parts of the codebase if all attempts to seed have failed.
2024-05-20 16:22:57 +02:00
skoupidi
e93b6cca95 contract/dao/{entrypoint, client}: replaced asserts with error returns and fixed log targets 2024-05-20 15:14:13 +03:00
skoupidi
0fb90b0978 contract/deployooor/client: replaced asserts with error returns and added log targets 2024-05-20 14:18:05 +03:00
skoupidi
5c126999a1 contract/money/client: replaced asserts with error returnes and added log targets 2024-05-20 14:11:11 +03:00
darkfi
aa6cff4f2e wallet: add a z_index property to control draw ordering of objs 2024-05-19 09:52:20 +02:00
darkfi
e72751a02b book: contrib tor section, add info on setting gitconfig name/email. 2024-05-19 09:25:16 +02:00
dasman
8c455abd0a bin/deg: drop deg config, and use args instead 2024-05-19 01:59:37 +03:00
rsx
28aaec3bba wallet: add stubs for plugin subsystem 2024-05-18 10:30:37 +02:00
rsx
1369300ba2 wallet: add PropertyStatus.EXPR 2024-05-18 10:30:37 +02:00
dasman
b83e2a782f bin/deg: fix multiple args 2024-05-18 04:01:57 +03:00
skoupidi
0243560e1f drk: added fee call to deployoOor calls 2024-05-17 20:18:04 +03:00
skoupidi
4661d797cd drk: attach-fee added and fixed otc swap 2024-05-17 20:04:42 +03:00
rsx
62994d050b wallet: deprecate pyo2, replace with rustpython 2024-05-17 17:02:33 +02:00
rsx
633aeb447a wallet: instantly show the window as priority 2024-05-17 17:02:01 +02:00
rsx
76d1ec7a04 wallet: add an expr engine for fast evaluation of exprs inside render loops 2024-05-17 14:35:18 +02:00
parazyd
f87382e856 serial: Use mutable references for non-async {en,de}code functions 2024-05-17 12:49:32 +02:00
skoupidi
c3433efe2e drk: cleanup on swap aisle 2024-05-16 22:07:20 +03:00
rsx
199485d071 wallet: impl properties with PY_EXPR subtype which are dynamically evaluated every frame. 2024-05-16 20:37:30 +02:00
skoupidi
c37618f354 drk: fixed token freezing and added its fee call 2024-05-16 14:14:14 +03:00
skoupidi
f52b4573e9 contract/money: switched auth_token_mint and token_mint execution order 2024-05-16 12:10:04 +03:00
dasman
840d3e745e bin/deg: fix graphing intertwined merges and forks 2024-05-16 03:28:09 +03:00
skoupidi
e262b08a85 src/system/condvar: chore clippy 2024-05-15 21:07:44 +03:00
skoupidi
8280857a00 contract/money: renamed TokenFreeze to AuthTokenFreeze and removed redundant proof 2024-05-15 20:48:48 +03:00
skoupidi
aa1c5d80d2 contract/money: shuffled functions enum 2024-05-15 19:47:15 +03:00
skoupidi
e3e8e3a8be contract/money: removed unused coin from auth token mint call 2024-05-15 18:13:27 +03:00
skoupidi
0008360eb2 contract/money: replaced entrypoints code asserts with errors 2024-05-15 15:37:27 +03:00
rsx
3b4a64c054 system: StoppableTask, add non-async stop_nowait(), and make Drop call this automatically so tasks are auto-cleaned up on exit. 2024-05-15 09:32:42 +02:00
dasman
b13e3b81ac bin/deg: update requirements 2024-05-15 04:42:40 +03:00
dasman
96a16b0de1 bin/deg: remove forgotten unnecessary prints 2024-05-14 03:09:34 +03:00
dasman
4186860fe5 bin/darkirc: RPC method to recreate DAG from replay log upon request from DEG 2024-05-14 00:57:37 +03:00
dasman
2fc118af51 eventgraph: rewrite eg replay functions and actually log the events 2024-05-14 00:55:23 +03:00
rsx
c21773be28 system/condvar: add a unit test to make sure condvar can be double awaited. 2024-05-13 17:34:19 +02:00
skoupidi
9e71055a9d drk: fixed token minting and added its fee call 2024-05-13 15:42:46 +03:00
dasman
fae90c18f7 bin/deg: increase RPC buffer limit 2024-05-13 00:39:16 +03:00
dasman
d250c22196 bin/deg: add eventgraph replay mode 2024-05-13 00:38:35 +03:00