aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-hsservice/src/pow/v1.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-hsservice: Fix typo.Wesley Aptekar-Cassels2025-07-231-4/+4
|
* tor-hsservice: Remove remaining `as` casts from suggested effort update.Wesley Aptekar-Cassels2025-07-231-12/+23
| | | | | This basically converts everything to use the num_traits conversion function, and explicitly panics on errors.
* tor-hsservice: Remove another use of `as`.Wesley Aptekar-Cassels2025-07-231-3/+6
| | | | | | This pulls in num_traits (which is already a dependency for PoW) to allow f64 casts that for reasons I do not understand are not implemented via TryFrom in the standard library.
* tor-hsservice: Convert as into checked conversion.Wesley Aptekar-Cassels2025-07-231-1/+1
| | | | | This should never happen, as the queue size is limited to well below u32. However, it's still nicer not to use `as`.
* tor-hsservice: Make num_dequeued u32 instead of usize.Wesley Aptekar-Cassels2025-07-231-2/+2
| | | | | | | | | | | | We need to divide a Duration by this, and Duration only supports division by u32. This is, in a sense, just pushing around where the overflow would happen, (from the conversion in the suggested update to the increment when a item is dequeued). However, this overflow is so unlikely to happen (it would require more that 14 million requests per second) that it does not seem worth slowing down the increment operation to try to handle it.
* tor-hsservice: Fix typos.Wesley Aptekar-Cassels2025-07-231-6/+6
|
* tor-hsservice: Use Mutex for suggested_effort.Wesley Aptekar-Cassels2025-07-231-16/+16
| | | | | | | | This has fewer weird edge cases than RwLock does. It might also be reasonable to make this a AtomicU32 (or AtomicEffort which wraps AtomicU32), but that's slightly more complex, so I've opted for a mutex for now.
* tor-hsservice: Add tests for PowManager control loop.Wesley Aptekar-Cassels2025-07-231-21/+244
| | | | | | This modifies the code to be more testable (making it generic over RendRequest, getting the time from the runtime rather than Instant::now(), etc) and adds some tests for the PoW control loop.
* tor-hsservice: Make PowManager generic over RendRequests.Wesley Aptekar-Cassels2025-07-231-12/+15
|
* tor-hsservice: Initial work towards mocking RendRequest.Wesley Aptekar-Cassels2025-07-231-24/+39
|
* tor-hsservice: Allow mocking PowManager.Wesley Aptekar-Cassels2025-07-231-4/+16
|
* tor-hsservice: Enforce maximum RendRequest queue size.Wesley Aptekar-Cassels2025-07-231-0/+12
|
* tor-hsservice: Update suggested effort in PowManager main loop.Wesley Aptekar-Cassels2025-07-231-1/+51
|
* tor-hsservice: Add suggested effort update function.Wesley Aptekar-Cassels2025-07-231-0/+63
|
* tor-hsservice: Give PowManager reference to RendRequestReceiver.Wesley Aptekar-Cassels2025-07-231-3/+8
|
* tor-hsservice: Allow constructing RendRequestReceiver without spawning.Wesley Aptekar-Cassels2025-07-231-19/+21
| | | | | | This will allow the PowManager to have a copy of RendRequestReceiver, which is important to allow the PowManager update loop to control the suggseted_effort updating.
* tor-hsservice: Add state for prop362 update loop.Wesley Aptekar-Cassels2025-07-231-1/+45
|
* tor-hsservice: Change storage of PoW suggested_effort.Wesley Aptekar-Cassels2025-07-231-4/+21
| | | | | | | This makes the suggested_effort value a Arc<RwLock<Effort>>, which is shared between the PowManager (as a reader) and the RendRequestReceiver (as a writer), since the RendRequestReceiver has the information needed to update the suggested_effort value.
* tor-hsservice: Implement PoW queue with BTreeSet.Wesley Aptekar-Cassels2025-07-231-6/+6
| | | | | | | | | | | | | The updated PoW control loop in prop362 requires this data structure to be double ended, which BinaryHeap is not. I benchmarked [email protected] against BTreeSet on a synthetic benchmark based on what I expected typical load to look like, and found that BTreeSet performed much better. It is additionally in the standard library, and is maintained, which no third-party double ended priority queue crate seems to be. Given that, BTreeSet seems like a reasonable thing to build on, although we should provide metrics on the performance of this queue so operators can let us know if it seems to be a problem in real-world use.
* tor-hsservice: RendRequestOrdByEffort use time as tiebreaker.Wesley Aptekar-Cassels2025-07-231-5/+15
| | | | | | | Since this will be used in a BTreeSet, we need to ensure that in practice no two requests will be equal. Ordering by a combination of effort and time received should be sufficient for this, and gives us the behaviour we want.
* Typo fixes (automatic and hand-verified)Nick Mathewson2025-07-091-2/+2
| | | | Made with https://crates.io/crates/typos-cli
* hspow: Add a clippy::cognitive_complexity exceptionNick Mathewson2025-07-031-0/+1
|
* tor-hsservice: Fix typo.Wesley Aptekar-Cassels2025-05-271-1/+1
|
* tor-hsservice: Warn instead of panic on KeyMgr error in PowManager.Wesley Aptekar-Cassels2025-05-271-4/+8
|
* tor-hsservice: Refactor PoW error handling.Wesley Aptekar-Cassels2025-05-271-16/+27
| | | | | | This adds a error type for internal errors, and in error cases where we previously panicked, returns a Result instead. The publisher then simply doesn't publish the pow_params line and warns the user.
* tor-hsservice: Make PoW publisher_update_tx closed a warning.Wesley Aptekar-Cassels2025-05-271-4/+3
| | | | | This shouldn't happen, but there's not a good reason to panic if it does.
* tor-hsservice: Make PowManager persist state.Wesley Aptekar-Cassels2025-05-271-6/+53
|
* tor-hsservice: Add ReplayLog to PowManager.Wesley Aptekar-Cassels2025-05-271-12/+47
|
* tor-hsservice: Explicitly don't use memquota for publisher update queue.Wesley Aptekar-Cassels2025-05-271-1/+5
|
* tor-hsservice: Add PoW priority queue and checking of solves.Wesley Aptekar-Cassels2025-05-271-21/+237
|
* tor-hsservice: Use Pin<Box<dyn Stream>>> instead of mpsc::Receiver.Wesley Aptekar-Cassels2025-05-271-1/+1
| | | | | This will allow us to more easily switch out the implementation of this queue as is needed for PoW.
* tor-hsservice: Initial parts of PowManager.Wesley Aptekar-Cassels2025-05-271-0/+356
This adds PowManager, as described in doc/dev/notes/service-side-pow.md, hooks it into IptManager and Publisher, and adds code to publish and rotate seeds, and to keep a updated list of Verifier instances for currently active seeds.