summaryrefslogtreecommitdiff
path: root/crates/tor-units
Commit message (Collapse)AuthorAgeFilesLines
* Bump all crate versions to 0.0.3.Nick Mathewson2022-01-111-1/+1
|
* Minimize the required version for each dependency.Nick Mathewson2022-01-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found these versions empirically, by using the following process: First, I used `cargo tree --depth 1 --kind all` to get a list of every immediate dependency we had. Then, I used `cargo upgrade --workspace package@version` to change each dependency to the earliest version with which (in theory) the current version is semver-compatible. IOW, if the current version was 3.2.3, I picked "3". If the current version was 0.12.8, I picked "0.12". Then, I used `cargo +nightly upgrade -Z minimal-versions` to downgrade Cargo.lock to the minimal listed version for each dependency. (I had to override a few packages; see .gitlab-ci.yml for details). Finally, I repeatedly increased the version of each of our dependencies until our code compiled and the tests passed. Here's what I found that we need: anyhow >= 1.0.5: Earlier versions break our hyper example. async-broadcast >= 0.3.2: Earlier versions fail our tests. async-compression 0.3.5: Earlier versions handled futures and tokio differently. async-trait >= 0.1.2: Earlier versions are too buggy to compile our code. clap 2.33.0: For Arg::default_value_os(). coarsetime >= 0.1.20: exposed as_ticks() function. curve25519-dalek >= 3.2: For is_identity(). generic-array 0.14.3: Earlier versions don't implement From<&[T; 32]> httparse >= 1.2: Earlier versions didn't implement Error. itertools at 0.10.1: For at_most_once. rusqlite >= 0.26.3: for backward compatibility with older rustc. serde 1.0.103: Older versions break our code. serde_json >= 1.0.50: Since we need its Value type to implement Eq. shellexpand >= 2.1: To avoid a broken dirs crate version. tokio >= 1.4: For Handle::block_on(). tracing >= 0.1.18: Previously, tracing_core and tracing had separate LevelFilter types. typenum >= 1.12: Compatibility with rust-crypto crates x25519-dalek >= 1.2.0: For was_contributory(). Closes #275.
* extend lints to include 'clippy::all'Daniel Eades2021-12-281-0/+1
|
* 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
|
* Bump every crate by one patch version.Nick Mathewson2021-11-291-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
|
* Bump all crate versions to 0.0.1Nick Mathewson2021-10-291-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-082-6/+12
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-273-0/+566
This will cause some pain for now, but now is really the best time to do this kind of thing.