aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-units/src
Commit message (Collapse)AuthorAgeFilesLines
...
* address lint warningsDaniel Eades2021-12-091-4/+2
|
* tor-netdir: Resolve an XXXX about type uglinessNick Mathewson2021-12-081-0/+35
| | | | | | | | | | | | | | | We had no function to infallibly convert BoundedInt32<{0 or 1},H> into a u32, even though we could have. Because of that, we were treating weight_scale as an i32 when logically it's a u32 or a NonZeroU32. Moreover, it turns out we were using an incorrect minimum for the bwweightscale param, which would in theory have allowed the authorities to make us divide by zero. This patch introduces the necessary From<> implementation and uses it. It corrects the binimum bwweightscale, and prevents a division-by-zero issue in case weight_scale is zero.
* Get tor-units grcov line coverage to 100%Nick Mathewson2021-12-021-0/+40
| | | | | | | | | | | | | | | | | | | | | | | This is mostly a finger exercise, and an experiment in "what does grcov consider to be coverage". Here's what I've found out... * In grcov's eyes, most #[derive(Foo)] lines count as containing code; but calling any one derived function counts as calling those lines. * Unlike with tarpaulin, it is actually possible to reach 100% grcov line coverage. (Tarpaulin likes to pick "}" lines and tell you that you never reached them; or sometimes it picks expression statements that have the effect of a return, and tells you that they're unreached. Even with these tests, tarpaulin claims that the line coverage of tor-units is only 97.3%.) * In rust, it may be a bit hopeless trying to get high function coverage. Even though we've hit every line of the tor-units crate, the function coverage from its own tests is only 9.38% (55.41% from other crates). I think this is probably due to derived functions, or maybe due to generics getting instantiated? I've got no idea; the denominator for the function coverage lines fluctuates oddly.
* Implement Eq,PartialEq for BoundedInt32.Nick Mathewson2021-12-021-1/+1
|
* add semicolons if nothing returnedDaniel Eades2021-11-251-0/+1
|
* More typo fixes that I forgot to save :(Nick Mathewson2021-11-241-1/+1
|
* enable checked_conversions lint.Nick Mathewson2021-10-091-0/+1
|
* Initial backend implementation for guard node manager.Nick Mathewson2021-10-071-0/+11
| | | | | | | There are some missing parts here (like persistence and tests) and some incorrect parts (I am 90% sure that the "exploratory circuit" flag is bogus). Also it is not integrated with the circuit manager code.
* Add an IntegerDays numeric type.Nick Mathewson2021-09-091-0/+54
|
* Use macros and traits to simplify the declaration of parameters.Nick Mathewson2021-09-091-0/+29
| | | | | | | | | | | | | | | | Previously, we'd have to declare the field for a parameter in one place, its default in a second, and its consensus key in a third. That's error-prone and not so fun! This patch changes the way we declare parameters so that we declare a structure once, and macros expand it to all do the right thing. This required a few new traits and implementations to ensure uniformity across the types that can go in parameters: We need every parameter type to implement TryFrom<i32> and to implement SaturatingFromInt32. Eventually we might want SaturatingFromInt32 to be a more generic SaturatingFrom, but that's not for now.
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-6/+9
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+525
This will cause some pain for now, but now is really the best time to do this kind of thing.