<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/arti.git/crates/tor-proto/src/circuit.rs, branch arti-v1.4.0</title>
<subtitle>mirror of https://gitlab.torproject.org/tpo/core/arti
</subtitle>
<id>http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.4.0</id>
<link rel='self' href='http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.4.0'/>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/'/>
<updated>2025-02-06T13:33:05Z</updated>
<entry>
<title>tor-proto: Turn some CtrlMsgs into CtrlCmds.</title>
<updated>2025-02-06T13:33:05Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2025-02-05T15:11:48Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=af9a154a4333685c20847cc83262a24a4cd3161e'/>
<id>urn:sha1:af9a154a4333685c20847cc83262a24a4cd3161e</id>
<content type='text'>
All `CtrlMsg`s to which the reactor did not respond by sending a cell
down the channel are now `CtrlCmd`s.

Most of this is code motion, best reviewed with `--color-moved`.
</content>
</entry>
<entry>
<title>tor-proto: Make shutdown a CtrlCmd.</title>
<updated>2025-02-06T13:33:05Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2025-02-05T15:11:48Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=558dc7d21199ed7b49f3351fe5fc4aa1de15e7c5'/>
<id>urn:sha1:558dc7d21199ed7b49f3351fe5fc4aa1de15e7c5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>proto: Remove ConversationInHandler</title>
<updated>2025-02-04T16:08:43Z</updated>
<author>
<name>David Goulet</name>
<email>dgoulet@torproject.org</email>
</author>
<published>2025-01-30T18:44:52Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=5a9b05e38881e3d227b929b0a2103e9d552cbf71'/>
<id>urn:sha1:5a9b05e38881e3d227b929b0a2103e9d552cbf71</id>
<content type='text'>
It is unused but most importantly it allows any RELAY cell to be sent
from anywhere in the code which is really not desirable because it is
skipping congestion control.

It also allows us to remove the `control_tx` from the reactor which is
one less channel to track/understand/think about.

This opens up the door to all sorts of problems especially side channel
that can be exploited if we are not careful.

We can always bring this back if we need it but for now, it is unused
and allows us to remove the `CtrlMsg::SendRelayCell` control message.

No code behavior change.

Signed-off-by: David Goulet &lt;dgoulet@torproject.org&gt;
</content>
</entry>
<entry>
<title>tor-proto: Ensure rx end of chan reactor output sink is not dropped in test.</title>
<updated>2025-02-03T11:30:41Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2025-02-03T10:41:14Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=164d6b4d6c5dca240866e92ce0e083fec8cc73c0'/>
<id>urn:sha1:164d6b4d6c5dca240866e92ce0e083fec8cc73c0</id>
<content type='text'>
This hopefully fixes #1832.

I haven't been able to repro the failure from #1832 locally, but judging
from the logs, I suspect it's triggered by interleavings like:

  - `extend_fut` executes up until `circ.extend_ntor(..).await`, where
    it's blocked `await`ing a completion notification from the circuit
    reactor
  - `reply_fut` starts running:
    * `CircuitExtender` installs a meta-handler in the circuit reactor,
      and waits for an `EXTENDED2` cell
    * `test_extend()` reads a cell from the receiving end of the fake
      channel's output sink (`rx`)
    * `test_extend()` sends the `EXTENDED2` cell to the circuit reactor
      over `CircuitRxSender`
    * `rx` is dropped
  - `reply_fut` completes
  - in the channel reactor's `run_once()`, `select_biased!` resolves
    to an error, because the receiving end of the `output` sink (`rx`) was
    dropped. The reactor logs `got sink error: SendError { kind:
    Disconnected }` (see [`SendError`]), and exits
  - the circuit reactor exits too, because the receiving end of its
    `chan_sender` (which was in the channel reactor) was dropped

Returning the `rx` of the fake channel's output sink from `reply_fut`
*should* stop it from being dropped, and fix #1832.

[`SendError`]: https://docs.rs/futures/latest/futures/channel/mpsc/struct.SendError.html#method.is_disconnected
</content>
</entry>
<entry>
<title>tor-proto: Rewrite circuit reactor run_once() loop to use select!.</title>
<updated>2025-01-29T14:34:58Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2025-01-28T15:09:33Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=2eb09f4f925569e08cc54b69d4062a53d01bdfe1'/>
<id>urn:sha1:2eb09f4f925569e08cc54b69d4062a53d01bdfe1</id>
<content type='text'>
This rewrites the circuit reactor main loop to use `select_biased!` to poll
multiple futures simultaneously.

The new `run_once()`, like the old, first waits for an initial
`CtrlMsg::Create`. Then, it uses a `select_biased!` to poll the
`chan_sender` sink and shutdown channel for readiness.

When the channel sink is ready, we poll the `control` and `input`
channels like before, as well as the new `ready_streams` `Stream`
(`ready_streams` is a `futures::Stream` that replaces the previous
`send_outbound()` function).

Most of the implementation remains unchanged, except the `handle_input`,
`handle_cell` and `handle_control` functions no longer send anything on
the `chan_sender` channel. Instead, they may do some (synchronous)
processing, and send instructions for the remaining work that needs to
be done (for example, for writing the cell to the `chan_sender`
channel). These instructions are handled at the end of `run_once()`,
and are encoded in the `RunOnceCmdInner` enum.

What this change does **not** do:
  * the control channel *still* bypasses congestion control. We could
    fix this by making the various reactor functions send the
    `RunOnceCmdInner` commands to `run_once()` via a channel
    (instead of returning them). This would enable the reactor to stop
    reading the commands (except for handle `Sendme`, which would be
    handled separately) if it's blocked on congestion control.
</content>
</entry>
<entry>
<title>tor-proto: Use SendRelayCell within CtrlMsg::SendRelayCell.</title>
<updated>2025-01-29T14:26:27Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2025-01-28T17:54:30Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=3ff6964d1653450e49b85aace526b9141aa711a9'/>
<id>urn:sha1:3ff6964d1653450e49b85aace526b9141aa711a9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tor-proto: Derive Default for MutableState.</title>
<updated>2025-01-28T14:07:53Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2025-01-20T11:24:14Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=44c65f3e3baa973162aec0b84d1b7dd1ac2f65ab'/>
<id>urn:sha1:44c65f3e3baa973162aec0b84d1b7dd1ac2f65ab</id>
<content type='text'>
This enables us to get rid of two lines from the circuit reactor
constructor.
</content>
</entry>
<entry>
<title>tor-proto: Replace sleep() in test with advance_until_stalled().</title>
<updated>2025-01-16T18:03:31Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2025-01-16T17:57:09Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=7d1d131265b3f0cf112e65e9477071eae7f33803'/>
<id>urn:sha1:7d1d131265b3f0cf112e65e9477071eae7f33803</id>
<content type='text'>
This test spuriously failed on my !2720 branch
(https://gitlab.torproject.org/gabi-250/arti/-/jobs/811495):

```
failures:
---- circuit::test::invalid_circ_sendme stdout ----
E tor_proto::channel::reactor: UniqId(71): Running reactor
E tor_proto::circuit::reactor: Circ 23.17: Running circuit reactor
E tor_proto::circuit::reactor: Circ 23.17: reactor received AddFakeHop { relay_cell_format: V0, fwd_lasthop: false, rev_lasthop: false, params: CircParameters { extend_by_ed25519_id: true, ccontrol: CongestionControlParams { alg: FixedWindow(FixedWindowParams { circ_window_start: 1000, circ_window_min: 100, circ_window_max: 1000 }), cwnd_params: CongestionWindowParams { cwnd_init: 124, cwnd_inc_pct_ss: Percentage { value: 100 }, cwnd_inc: 1, cwnd_inc_rate: 31, cwnd_min: 124, cwnd_max: 4294967295, sendme_inc: 31 }, rtt_params: RoundTripEstimatorParams { ewma_cwnd_pct: Percentage { value: 50 }, ewma_max: 10, ewma_ss_max: 2, rtt_reset_pct: Percentage { value: 100 } } } }, done: Sender { complete: false } }
E tor_proto::circuit::reactor: Circ 23.17: reactor received AddFakeHop { relay_cell_format: V0, fwd_lasthop: true, rev_lasthop: true, params: CircParameters { extend_by_ed25519_id: true, ccontrol: CongestionControlParams { alg: FixedWindow(FixedWindowParams { circ_window_start: 1000, circ_window_min: 100, circ_window_max: 1000 }), cwnd_params: CongestionWindowParams { cwnd_init: 124, cwnd_inc_pct_ss: Percentage { value: 100 }, cwnd_inc: 1, cwnd_inc_rate: 31, cwnd_min: 124, cwnd_max: 4294967295, sendme_inc: 31 }, rtt_params: RoundTripEstimatorParams { ewma_cwnd_pct: Percentage { value: 50 }, ewma_max: 10, ewma_ss_max: 2, rtt_reset_pct: Percentage { value: 100 } } } }, done: Sender { complete: false } }
E tor_proto::circuit::reactor: Circ 23.17: reactor received BeginStream { hop_num: HopNum(2), message: Begin(Begin { addr: [119, 119, 119, 46, 101, 120, 97, 109, 112, 108, 101, 46, 99, 111, 109], port: 443, flags: BeginFlags(IPV6_OKAY) }), sender: Sender { tx: Sender { closed: false }, mq: TypedParticipation(Participation(Noop)) }, rx: Receiver { inner: ReceiverInner { state: Mutex { data: Ok(ReceiverState { rx: StreamUnobtrusivePeeker { buffered: None, poll_waker: None, inner: Some(Receiver { closed: false }) }, mq: TypedParticipation(Participation(Noop)), collapse_callbacks: 0 }), poisoned: false, .. } } }, done: Sender { complete: false }, cmd_checker: DataCmdChecker { expecting_connected: true } }
  Using RNG seed ARTI_TEST_PRNG=62d085c0fb1213c4f41d1a0a5c3f92dd10223a27c42bfda3caedfe60e011e95d
E tor_proto::circuit::reactor: Circ 23.17: handling cell: Relay(Relay { body: .. })
  Using RNG seed ARTI_TEST_PRNG=fd2f2f045a7340f1189972b13645346943efa2c42f43afd2161420c692bb4ff0
E tor_proto::circuit::reactor: Circ 23.17: handling cell: Relay(Relay { body: .. })
E tor_proto::circuit::reactor: Circ 23.17: Circuit reactor stopped: Err(CircProto("Mismatched tag on circuit SENDME"))
E tor_proto::channel::reactor: UniqId(71): reactor received CloseCircuit(CircId(128))
E tor_proto::channel::reactor: UniqId(71): Circuit 128 is gone; sending DESTROY
thread 'circuit::test::invalid_circ_sendme' panicked at crates/tor-proto/src/circuit.rs:2262:21:
reactor continued running after invalid sendme
failures:
    circuit::test::invalid_circ_sendme
test result: FAILED. 142 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out; finished in 4.93s
```

This is probably because of the `sleep()`-based check. This branch
changes the test to use `MockRuntime`, replacing the `sleep()` with
`advance_until_stalled()`.
</content>
</entry>
<entry>
<title>congestion: Remove FixedWindow start window default value</title>
<updated>2025-01-16T14:16:01Z</updated>
<author>
<name>David Goulet</name>
<email>dgoulet@torproject.org</email>
</author>
<published>2025-01-08T19:53:39Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=14ee43b3ae64d2c64cfa14c2cd054965c5b7c366'/>
<id>urn:sha1:14ee43b3ae64d2c64cfa14c2cd054965c5b7c366</id>
<content type='text'>
In unit tests, we set a 1000 by default but else, we don't set a default
so our implementation doesn't forget to set the right value from the
consensus.

Signed-off-by: David Goulet &lt;dgoulet@torproject.org&gt;
</content>
</entry>
<entry>
<title>test: Fix circuit unit tests</title>
<updated>2025-01-16T14:16:01Z</updated>
<author>
<name>David Goulet</name>
<email>dgoulet@torproject.org</email>
</author>
<published>2024-12-16T19:10:30Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=a1388a166ab22cb79ef663b132f0ee22a7a0d87e'/>
<id>urn:sha1:a1388a166ab22cb79ef663b132f0ee22a7a0d87e</id>
<content type='text'>
Signed-off-by: David Goulet &lt;dgoulet@torproject.org&gt;
</content>
</entry>
</feed>
