Commit Graph

101 Commits

Author SHA1 Message Date
Nick Mathewson 329bde58dd Bump tor-netdir and tor-guardmgr versions
tor-netdir needs to bump because tor-netdoc bumped, even though
there were no other changes in tor-netdir.  Whoops.

tor-guardmgr needs to bump because it already published, with the
older tor-netdir.
2022-01-31 11:05:34 -05:00
Nick Mathewson 01d9937308 Bump the patch version of every crate that changed since 0.0.3 2022-01-31 10:30:52 -05:00
Nick Mathewson 98d8171610 Fix test failure in tor_dirmgr::state::test::get_microdescs_state
This failure occurred because our tests use canned data to exercise
the directory state functionality, and the canned consensus has
suddenly become very expired.

There are better fixes possible, but this is a minimal one that
should get CI working on main again.
2022-01-27 17:13:38 -05:00
Nick Mathewson 30b3818a9e Make the native-tls crate optional.
This commit puts the native-tls crate behind a feature.  The feature
is off-by-default in the tor-rtcompat crate, but can be enabled
either from arti or arti-client.

There is an included script that I used to test that tor-rtcompat
could build and run its tests with all subsets of its features.

Closes #300
2022-01-26 14:06:58 -05:00
Nick Mathewson d1c362f308 bootstrap reporting: Documentation fixups from review. 2022-01-19 08:22:42 -05:00
Nick Mathewson f34faec7d9 tor-dirmgr: Create a bootstrap-status exporting mechanism.
The interface is similar to the one exposed by `arti-client`: it
internally uses postage::watch to give a series of events showing
when a bootstrap status is changing.

Thanks to the existing state/driver separation in the DirMgr design
we don't need much new logic: each download state needs to expose
(internally) how far along it is in its download, which the
bootstrap code passes to the DirMgr if it has changed.

I believe that in the long run, we'll probably want to expose more
(or different) information here, and we'll want to process it
differently.  With that in mind, I've made the API for
`DirBootstrapStatus` deliberately narrow, so that we can change its
of its internal later on without breaking code that depends on it.

(The information exposed by this commit is not yet summarized in
`arti-client`.)

Part of #96.
2022-01-18 13:06:08 -05:00
Nick Mathewson 7d3482ca1a Bump all crate versions to 0.0.3. 2022-01-11 09:40:32 -05:00
eta de1b19c22a Fixup broken doc comment from arti!220
That's what I get for blindly trusting @nickm :p
2022-01-10 15:10:41 +00:00
eta da848a1b9c Merge branch 'ticket_178' into 'main'
Fix ticket 178: Don't use a NetDir until we have microdescriptors for all of our primary guards.

Closes #178

See merge request tpo/core/arti!220
2022-01-10 14:02:24 +00:00
eta 4b1a3976cb Merge branch 'bug274' into 'main'
Fix busy-loop when consensus is near expiring.

Closes #274

See merge request tpo/core/arti!223
2022-01-10 13:47:52 +00:00
Nick Mathewson 4841b50c9f Minimize the required version for each dependency.
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.
2022-01-07 19:08:58 -05:00
Nick Mathewson d9b423c17f Fix busy-loop when consensus is near expiring.
When our current consensus is getting close to being invalid (but
it isn't invalid yet), we try to get a new one. So far, so good.

But we had a bug: when we went to get a new consensus, we'd see that we
had a perfectly fine not-yet-invalid consensus in our cache, reload it,
find that it was ready, and continue!

This patch fixes our behavior: If we have a usable consensus, then
when we reset the bootstrapping process, we ignore any cached consensus.

Fixes bug #274.
2022-01-07 13:16:06 -05:00
Nick Mathewson e8e0f67336 Only replace netdir once we have enough guard MDs.
This prevents a security-failure condition that could happen if our
directory caches don't give us these microdescriptors, but we
nevertheless decide that the directory is usable.

Closes #178
2022-01-06 15:58:43 -05:00
Daniel Eades 592642a9e6 extend lints to include 'clippy::all' 2021-12-28 20:15:40 +00:00
Tor CI Release e17359bc18 fallbackdir: Update list generated on December 15, 2021
Signed-off-by: Tor CI Release <no-email@torproject.org>
2021-12-16 11:52:22 -05:00
Nick Mathewson 9f6e09b4d1 tor-dirmgr: retain cache_usage on reset.
Previously we didn't retain the value of our cache_usage field when
calling reset() from GetMicrodescsState.

This resolves an XXXX comment.
2021-12-16 09:31:23 -05:00
eta e62212112c Merge branch 'flag-publish-2' into 'main'
Refactor directory events to use a new FlagPublisher mechanism.

See merge request tpo/core/arti!188
2021-12-16 14:28:51 +00:00
Nick Mathewson b5672cb2c7 tor-dirmgr: Warn on a bug case.
This warning occurs if we ask for microdescriptors from our local
cache, and our cache gives us something we didn't ask for.  It
shouldn't be possible, so let's warn when it occurs.

This patch resolves an XXXX.
2021-12-16 08:51:34 -05:00
Nick Mathewson 7f4578bec1 Refactor directory events to use a FlagPublisher mechanism.
This approach tries to preserve the current interface, but uses a
counter-based event backend to implement a coalescing stream of
events that can be represented as small integers.  The advantage
here is that publishing events no longer needs to be a blocking
operation, since there is no queue to fill up.
2021-12-14 14:05:02 -05:00
eta 8040f7afb2 Merge branch 'reconfigure' into 'main'
Make most arti-client fields reconfigurable.

See merge request tpo/core/arti!181
2021-12-13 14:49:23 +00:00
Trinity Pointard 9753a7ee06 fix nightly clippy errors 2021-12-09 12:16:23 +01:00
Trinity Pointard 7dd1a20d42 update rusqlite and revert minimal version change 2021-12-09 11:51:39 +01:00
Nick Mathewson 4536c2ac87 Upgrade to digest v0.10.0
We generally try to track the latest rust-crypto traits when we can:
fortunately, this upgrade didn't break much, considering.
2021-12-07 20:33:46 -05:00
Nick Mathewson b3b6a92145 Add a few tests to tor-config. 2021-12-07 19:52:49 -05:00
Nick Mathewson 42ae8c7a2a Make override_net_params take effect sooner.
This is still not as soon as I'd like: a real change here will require
refactoring DirMgr::notify().
2021-12-07 19:26:01 -05:00
Nick Mathewson e8ca0d7742 Make much of DirMgrConfig reconfigurable.
We can't change the authorities while in-flight: that would be pretty
miserable to implement.

Similarly we can't change the cache while in-flight.

Everything else should be fair game, though there are a couple of tricky
bits.  I've tried to document those.
2021-12-07 17:36:16 -05:00
Nick Mathewson 606d64eac5 Sketch API for reconfiguration.
This patch doesn't actually make anything reconfigurable, but it
does create an API that will tell you "you can't change the value of
that!"  If the API looks reasonable, I can start making it possible
to change the values of individual items.
2021-12-07 15:42:14 -05:00
Nick Mathewson 31b385c5b2 Resolve roughly half of the XXXXs.
We want to only use TODO in the codebase for non-blockers, and open
tickets for anything that is a bigger blocker than a TODO.  These
XXXXs seem like definite non-blockers to me.

Part of arti#231.
2021-12-06 15:11:03 -05:00
eta a4ec8476a7 Merge branch 'tor-dirmgr' into 'main'
Don't warn in bootstrap_from_config when error is  Error::ManagerDropped

See merge request tpo/core/arti!157
2021-12-01 13:00:39 +00:00
Nick Mathewson a49ee4d5f4 Merge remote-tracking branch 'origin/mr/159' 2021-11-30 13:53:53 -05:00
Nick Mathewson 3b072c5420 Merge branch 'readme_fixes' 2021-11-30 09:12:51 -05:00
dagon 9a8d883f35 remember utf8 check 2021-11-30 23:26:47 +10:00
dagon 0122e15339 dont warn on bootstrap error when error == manager dropped 2021-11-30 21:50:27 +10:00
Nick Mathewson eef81d9d57 Bump every crate by one patch version. 2021-11-29 15:21:58 -05:00
Nick Mathewson eb861b7edd Merge branch 'config-updates-and-tests' 2021-11-29 13:59:41 -05:00
dagon d5c48c616f run ./maint/readmes.sh 2021-11-29 21:29:28 +10:00
Nick Mathewson f2034ac6e2 Add basic tests for high-level builders
Make sure that we can change elements, and we can reconstruct builders
that give us the same thing.
2021-11-25 09:40:16 -05:00
Daniel Eades db16d13df4 add semicolons if nothing returned 2021-11-25 13:20:37 +00:00
Daniel Eades 052f51ff71 deglob some enums, use concise iteration syntax 2021-11-25 12:39:52 +00:00
Nick Mathewson 3e7e599a22 More typo fixes that I forgot to save :( 2021-11-24 18:23:12 -05:00
Nick Mathewson 40ff7113d4 Make every Config type implement Eq.
Doing this is necessary for reconfiguration support, and will help a lot
with testing, too.
2021-11-21 12:06:15 -05:00
Nick Mathewson 97f5a7a357 Give every ConfigBuilder a From<Config> implementation.
This will make it more convenient to reconfigure things.
2021-11-21 10:54:34 -05:00
Nick Mathewson 934412586e Use named fields for the elements of ConfigBuildError 2021-11-18 14:31:34 -05:00
Nick Mathewson 96659a850b Rename RetryConfig to DownloadSchedule, fold in parallelism. 2021-11-18 12:33:08 -05:00
Nick Mathewson 5184f5ba84 Move top-level configuration downwards from `arti` to `arti-config`.
To do this at all neatly, I had to split out `tor-config` from
`arti-config` again, and putting the lower level stuff (paths,
builder errors) into tor-config.  I also changed our use of
derive_builder to always use a common error type, to avoid
error type proliferation.
2021-11-18 11:37:48 -05:00
Nick Mathewson 2439129899 tor-dirclient: Put routerdesc download behind a feature.
Part of #125
2021-11-12 13:38:02 -05:00
Nick Mathewson e9ea7515bc tor-dirmgr: put routerdesc storage behind a feature.
(We keep routerdescs in the schema, since we don't want _that_ to
fragment.)

Part of #125.
2021-11-12 12:15:48 -05:00
Dimitris Apostolou ad3c18a456
Fix typos 2021-11-12 13:54:50 +02:00
Nick Mathewson 99aefe4bb8 Remove usage of tracing-test 0.1
It requires tracing-subscriber 0.2, which is a lower version than we
want, and which causes trouble with our minimal-versions CI test.

There is a pending issue to fix this; we can reinstate tracing-test
once it is merged:  https://github.com/dbrgn/tracing-test/pull/11
2021-11-11 11:01:32 -05:00
Nick Mathewson 4717bb270f Tests for tor-dirmgr::bootstrap 2021-11-11 08:58:48 -05:00