Commit Graph

547 Commits

Author SHA1 Message Date
Nick Mathewson a81ab391ae Bump patchlevel on crates with non-breaking changes
For these crates, the changes are nontrivial, so we
_do_ bump the versions on which their dependent crates depend.

Fortunately, since they are all pre-1.0, we don't need to
distinguish semver-additions from other changes.  (Except for arti,
which _is_ post-1.0, but gets a patchlevel bump anyway.)

These are unstable crates with breaking changes:

```
tor-hscrypto
tor-hsclient
```

These have new or extended APIs:

```
safelog
tor-bytes
tor-cell
tor-linkspec
tor-llcrypto
tor-proto
tor-cert
arti-client
```

These have new unstable APIs or features:
```
tor-netdoc
tor-circmgr (also broke some unstable APIs)
arti (is post-1.0)
```

These have bugfixes only:
```
caret
tor-dirmgr
```
2023-03-31 08:24:39 -04:00
Nick Mathewson 26ee1feeb1 Upgrade dependency to latest rusqlite. 2023-03-30 08:33:44 -04:00
Ian Jackson d24a47c1d9 Sort out some TODOs in bdtest.rs 2023-03-21 13:08:14 +00:00
Nick Mathewson 552acbf07f Fix a bunch of needless-conversion warnings.
Apparently 1.68 now warns when you call into_iter() on something
that's already an iterator.  Fair enough.  Let's stop doing that.
2023-03-10 07:09:50 -05:00
Nick Mathewson ac5469d0b6 tor-dirmgr: Don't try to mark consensus usable in a read-only store.
Doing this means that any attempt to use a read-only store would
crash as soon as it found that the consensus was usable.

It seems that this bug was introduced at some point doing all the
dirmgr refactors we did over the past year.  Perhaps there should be
a test for running with a read-only store.

Fixes #779
2023-03-08 07:08:17 -05:00
Nick Mathewson 2c9f8e3547 Follow-on patchlevel bumps for crates with changed dependencies
These crates didn't have any changes until now, when I bumped
the versions of some other crates they depend on:

tor-consdiff
arti-hyper
arti-bench
arti-testing
2023-02-28 07:18:37 -05:00
Nick Mathewson f41449d0bd Patchlevel bumps for remaining changed crates.
These crates have had small code changes, but no API additions:

tor-config
tor-socksproto
tor-cert
tor-chanmgr
tor-ptmgr
tor-guardmgr
tor-circmgr
tor-dirclient
tor-dirmgr
arti
tor-hsservice
tor-congestion

These crates have had API extensions:

fs-mistrust
tor-llcrypto
tor-bytes
tor-checkable
tor-linkspec
tor-netdoc
tor-persist
arti-client
2023-02-28 07:13:27 -05:00
Nick Mathewson 3e257a7cb5 Bump minor versions for significant breaking changes.
This includes tor-cell, tor-proto, and tor-netdir.
2023-02-28 07:05:15 -05:00
Nick Mathewson 2b515c8d25 tor-dirmgr: Work around an apparent regression in `time`.
Some code in our tests that worked fine with time 0.3.17 no
longer works with 0.3.19, despite the semver.

See https://github.com/time-rs/time/issues/552 for the upstream bug.
2023-02-17 14:36:19 -05:00
Ian Jackson f69d7f96ac tor-netdoc: Change fill_from_previous_netdir
* Remove the return value, which was not used anywhere.
  Also remove the code to calculate the return value.

* Take an Arc<NetDir> rather than a reference.  We are going to want
  this for HS support.  This has no overall effect on the lifetime of
  the4 Arc, which was owned at the one call site and then imediately
  dropped.

* Change the documentation to explain what the function's role is in
  the netdir API, rather than the fiddly details of what it actually
  does internally.  Relegate the latter to a code comment.
  (When we have HS, this will do more, or, at least, make further
  arrangements.)
2023-02-09 12:56:18 +00:00
Nick Mathewson 8ee04ac203 Merge branch 'logs' into 'main'
Report causes of errors

Closes #680

See merge request tpo/core/arti!997
2023-02-01 18:19:33 +00:00
Nick Mathewson 7c1b6a5a81 Bump the patch version of every crate that had API additions
These crates had API or behavior changes that may affect downstream
crates. Fortunately, they're all version 0.x, and don't need minor
bumps for this.
2023-02-01 10:36:29 -05:00
Nick Mathewson 66f594a4b6 Bump the patch-level version of crates with _minor_ changes.
These changes influence behavior, but not effect compatibility.
(If I messed up, and any crate except for `arti` has non-breaking
API changes, that's still fine, since they are all version
0.x.)
2023-02-01 10:23:58 -05:00
Ian Jackson 37edcd688a Use ErrorReport - run rustfmt
Split off for ease of review and possible rebase.
2023-01-30 18:52:32 +00:00
Ian Jackson aa7397bc0f Use ErrorReport's .report() for two errors in error! in bridgedesc.rs
No functional change, just using the new idiom.
2023-01-30 18:52:32 +00:00
Ian Jackson dc9352b515 Use ErrorReport for errors in warn! in tor-dirmgr 2023-01-30 18:52:32 +00:00
Ian Jackson cc6cf7f973 Use ErrorReport for errors in info! in tor-dirmgr 2023-01-30 18:04:57 +00:00
Nick Mathewson 2127c6b088 "Fix" remaining unchecked-subtraction warnings.
In both cases I think it's fine to panic; but it's best to do so
explicitly.
2023-01-27 09:16:41 -05:00
Nick Mathewson a6dd92843e Allow clippy::unchecked_duration_subtraction in tests
This panics on error, and we're fine with a panic on misbehavior in
tests.
2023-01-27 08:28:02 -05:00
Nick Mathewson bf04641c68 Disable clippy::unlinlined-format-args
This warning kind of snuck up on us! (See #748)  For now, let's
disable it.  (I've cleaned it up in a couple of examples, since
those are meant to be more idiomatic and user-facing.)

Closes #748.
2023-01-27 08:27:47 -05:00
Nick Mathewson 889206cde4 Complete our migration to base64ct.
This is in lieu of upgrading to the latest base64 crate, which has
a different API from the old one.  Since we have to migrate either
way, we might as well use base64ct everywhere.

I don't think that most of these cases _require_ constant-time
base64, but it won't hurt.
2023-01-20 08:06:30 -05:00
eta 118050e54c Merge branch 'test-lints' into 'main'
Add test lint blocks to all "mod test"

See merge request tpo/core/arti!937
2023-01-06 17:16:09 +00:00
Emil Engler 8579bc66a8
doc: consistent summary line for the READMEs
This commit introduces a consistency to the summary line of all
README.md files in each and every crate.
2022-12-20 14:31:47 +01:00
Ian Jackson 125a455bdc test lint blocks: Add many many automatically
This is precisely the result of running the rune in
maint/adhoc-add-lint-blocks.
2022-12-12 18:00:30 +00:00
Ian Jackson baf78361e8 test lint blocks: Do some semi-manually
This is the hunks from running the rune in maint/adhoc-add-lint-blocks
but which require some subsequent manual fixup: usually, deleting
now-superfluous outer allows, but in some cases manually putting back
lints that the adhoc script deleted.
2022-12-12 18:00:29 +00:00
Ian Jackson 4e74104e70 Merge branch 'spelling-20221206' into 'main'
A few spelling fixes for bridgedescmgr code

See merge request tpo/core/arti!925
2022-12-06 18:25:43 +00:00
Ian Jackson 2321d0ba0b Merge branch 'faravahar-removal' into 'main'
dirauth: Remove Faravahar

See merge request tpo/core/arti!924
2022-12-06 16:02:22 +00:00
Nick Mathewson 02d340e4b2 dirmgr: Spelling fixes and normali[sz]ations 2022-12-06 09:02:48 -05:00
David Goulet 5ea8c8eed0 dirauth: Remove Faravahar
See https://gitlab.torproject.org/tpo/core/tor/-/issues/40688

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-12-06 09:01:34 -05:00
David Goulet 43aa24b231 dirauth: New v3 identity key for moria1
We are rotating moria1's key due to a break-in few weeks ago. See
https://gitlab.torproject.org/tpo/core/tor/-/issues/40722 for more
details.

The original MR for C-tor (tor.git) done by Roger Dingledine, moria1's
operator, is here:
https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/662

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-12-06 08:42:09 -05:00
Nick Mathewson e0aeda3071 Remove semver.md files now that 1.1.0 is released. 2022-11-30 17:10:29 -05:00
Nick Mathewson 38bef96b99 Bump the minor version of every crate.
We made this job easy this time around: by incrementing our MSRV, we
have forced ourselves to do at least a minor bump everywhere.
2022-11-30 15:10:16 -05:00
Ian Jackson 1c085cf401 bridge desc mgr: Add dormancy comment to effective_parallelism
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/861#note_2856922
2022-11-23 18:20:58 +00:00
Ian Jackson 68acedccfd bridge desc mgr: Test dormancy 2022-11-23 18:20:58 +00:00
Ian Jackson e0c4eed549 bridge desc mgr: Honour specified dormancy
Fixes #630
2022-11-23 18:20:58 +00:00
Ian Jackson a33df9a5f5 bridge desc mgr: Introduce effective_parallelism helper 2022-11-23 18:20:58 +00:00
Ian Jackson 2c98351e2d bridge desc mgr: Move set_dormancy to impl that is for mock too 2022-11-23 18:20:58 +00:00
Ian Jackson ee87097dc1 BridgeConfig: Replace all Arc<BridgeConfig> with BridgeConfig
BridgeConfig is itself an Arc now, so these are redundant.
2022-11-22 15:33:21 +00:00
Ian Jackson 285a7988bb Merge branch 'fix_nightly_20221118' into 'main'
Fix warnings and breakage in nightly (2022-11-18 edition)

See merge request tpo/core/arti!872
2022-11-18 16:43:16 +00:00
Nick Mathewson 829cb708e2 Fix a couple of rustdoc issues.
These slipped in while nightly was broken.
2022-11-18 10:19:54 -05:00
Nick Mathewson d51162e55b Fix a bunch of "needless borrow" warnings on nightly
It looks like, despite a few false starts, they've got this warning
right; there weren't any false positives.
2022-11-18 10:12:05 -05:00
Nick Mathewson 9f661e264f dirmgr: make "bridge-client" non-experimental. 2022-11-18 08:53:47 -05:00
Ian Jackson 58fc19dc8d Merge branch 'store3' into 'main'
dirmgr: Expopse DirMgrStore

See merge request tpo/core/arti!851
2022-11-14 17:01:10 +00:00
Ian Jackson 7efbc600c0 Merge branch 'bdm-dormant' into 'main'
bridge descriptor dormancy: Define an enum and semantics

See merge request tpo/core/arti!845
2022-11-14 17:00:40 +00:00
Ian Jackson 92939439a6 dirmgr Store: Have constructors take DirMgrStore
Now the Store is constructed by arti_client, solving the problem
described here
  https://gitlab.torproject.org/tpo/core/arti/-/issues/631#note_2853665
but in a different way.
2022-11-14 15:48:17 +00:00
Ian Jackson 5e16c55f9e dirmgr Store: Introduce DirMgrStore and use for BridgeDescMgr (fmt)
rustfmt only, broken out to ease review.
2022-11-14 15:48:17 +00:00
Ian Jackson cf362f9806 dirmgr Store: Introduce DirMgrStore and use for BridgeDescMgr
We are going to change DirMgr's constructors to also take a DirMgrStore.
2022-11-14 15:48:17 +00:00
Ian Jackson d9f231e099 dirmgr Store: Abolish redundant trait impl 2022-11-14 15:47:04 +00:00
Ian Jackson 527ab06376 dirmgr Store: Use `**` syntax and deref to trait objects
This will allow us to get rid of a needless trait impl.
2022-11-14 15:47:04 +00:00
Ian Jackson bf7d45b7b9 dirmgr Store: Move Send and 'static bounds to Store trait
This seems tidier to me.

(It saved a lot of typing when I was trying to make some complicated
pub supertrait with sealed private supertrait, but apparently not
now.)
2022-11-14 15:33:58 +00:00
Ian Jackson c6234428e3 bridge descriptor dormancy: Accept the dormancy value
But right now, don't do anything with it.  That will come in a future MR.
2022-11-11 15:34:35 +00:00
Ian Jackson eeb6d52678 bridge descriptor dormancy: Add a TODO for this enum 2022-11-11 15:26:42 +00:00
Nick Mathewson 936920b26e bump rust-version to 1.60 in every crate. 2022-11-10 10:57:33 -05:00
Ian Jackson eacb5dc2e3 bridge descriptor dormancy: Define an enum and semantics
This is part of #630.
2022-11-10 15:17:36 +00:00
Nick Mathewson d9788c16b3 Merge branch 'bridge-error' into 'main'
Use ErrorKind::TorAccessFailed for misbehaving bridges

See merge request tpo/core/arti!842
2022-11-10 13:50:47 +00:00
Nick Mathewson 3c29dfd99d Merge branch 'bdm-process-doc-test' into 'main'
bridge descs: Add tests for process_document

See merge request tpo/core/arti!841
2022-11-10 13:50:23 +00:00
Nick Mathewson 6454896d95 Merge branch 'bdm-params' into 'main'
Remove TODO re BridgeDescDownloadConfig defaults

See merge request tpo/core/arti!839
2022-11-10 13:49:54 +00:00
trinity-1686a 614cf34284 Check more targets 2022-11-10 13:34:17 +00:00
Ian Jackson 42dd5d7746 bridge desc: Drop a done TODO
We have a separate BridgeDescMgr, rather than reusing DirMgr, so we
will not be implementing BridgeDescProvider for DirMgr.
2022-11-08 18:54:31 +00:00
Ian Jackson 8fbff3a27f Use ErrorKind::TorAccessFailed for misbehaving bridges
(Use semantic linefeed for the doc comment.)
2022-11-08 18:52:57 +00:00
Ian Jackson d808f70a13 bridge descs: Add tests for process_document 2022-11-08 18:42:34 +00:00
Ian Jackson f1f4ca56a8 Remove TODO re BridgeDescDownloadConfig defaults 2022-11-08 17:34:25 +00:00
Ian Jackson 05cad7c0eb bridge desc: todo re config: weaken and reference a new ticket 2022-11-08 17:34:13 +00:00
Nick Mathewson ec9e9c86e7 Merge branch 'store' into 'main'
Persistently cache bridge descriptors

Closes #619

See merge request tpo/core/arti!831
2022-11-08 15:10:21 +00:00
Ian Jackson ea369e8385 bridge descs: Rename BridgeDescMgr from BridgeDescManager
This is more consistent with our naming elsewhere.

Suggested-by: Nick Mathewson <nickm@torproject.org>
2022-11-08 14:40:28 +00:00
eta 53f62eb8be Merge branch 'store-yak-misc' into 'main'
Small misc yaks for bridge descriptor persistence

See merge request tpo/core/arti!828
2022-11-08 14:28:14 +00:00
Ian Jackson d9d9cdeac9 bridge descs: Apply sensitive() to bridge identity in error log msg 2022-11-08 13:19:42 +00:00
Ian Jackson 93a150229a sqlite cache: Document reasoning about timestamps
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/831#note_2851764
2022-11-08 13:00:51 +00:00
Dimitris Apostolou 9c7d1802f5
Fix typos 2022-11-06 06:51:58 +02:00
Ian Jackson 5b66a5e199 bridge desc tests: Test caching and if-modified-since 2022-11-04 19:08:32 +00:00
Ian Jackson 78f7916a88 bridge desc tests: Break out queues_are_empty helper 2022-11-04 19:08:32 +00:00
Ian Jackson 40c21b7d19 bridge desc tests: Provide a sqlite connection
The current test case doesn't use this.
2022-11-04 19:08:32 +00:00
Ian Jackson 636bff3193 bridge desc: Implement storage functions at the DB layer 2022-11-04 19:08:32 +00:00
Ian Jackson 6bb2eb9902 bridge desc: Make Downloaded be Debug 2022-11-04 19:08:32 +00:00
Ian Jackson 5bc1d40a2b bridge desc: Implement cache reuse logic and if-modified-since
This introduces the new API functions to Store.
But currently they are all no-ops.
So all this machinery doesn't actually do anything.

Also, it changes the API to the mockable downloader, to allow it to
support if-modified-since.  So this isn't used either.  But it is more
convenient to do this all at once in BridgeDescManager, since care
needs to be taken about the intraction between if-modified-since and
the persistent cache.
2022-11-04 19:08:32 +00:00
Ian Jackson 279a169031 bridge desc: Rename one more variable to text 2022-11-04 19:02:23 +00:00
Ian Jackson eaaa61a8e2 bridge desc: Catch panics in the download functionality 2022-11-04 19:02:23 +00:00
Ian Jackson 3f3f27193c bridge desc: Provide a Store to the bridge desc manager
We use the one in the dirmgr.  That means that our constructor now has
to take a dirmgr.  And, the dirmgr must have a circmgr.

This is all rather odd, TBH.

Add .. to the binding of the return values from setup, as
future-proofing.

The tests now need to provide a Store too.  Make the sqlite::new_empty
function pub(crate) so we can use it.

We must retain the _db_tmp_dir, since when it goes away the tmp
directory is deleted and the db goes readonly.
2022-11-04 19:02:23 +00:00
Ian Jackson 1fa9dd62b3 bridge desc tests: Apply tracing_test::traced_test
This lets us see the log messages.  They look fine, as it happens.
2022-11-04 19:02:23 +00:00
Ian Jackson 9424b0970d tor-dirmgr: impl AsRef<dyn Error> for Error
This allows use with tor_error::Report.
2022-11-04 19:01:24 +00:00
Ian Jackson dcdd8053b4 dirmgr: Make store be in an Arc
This will let us share it with the bridge descriptor manager.
(As discussed with Nick.)
2022-11-04 19:01:24 +00:00
Ian Jackson 9a285ec4ad dirmgr sqlite store: Improve schema updates
* Centralise applying the schema updates, in a closure
 * Make the schema update SQL texts be in an array so we can loop
 * Make the version update statement generic, not cloned-and-hacked

This will make it possible to add another schema version without
error-prone conditions etc.
2022-11-04 19:01:24 +00:00
Ian Jackson bf563f3bdf bridgedesc: Rename "text" from "output"
This was confusing, because it's the output of the donwload, but
nowhere near the output of the whole process.  And it's going to
become even less so.
2022-11-03 19:00:47 +00:00
Ian Jackson 17ceae724e bridgedesc: Make process_document into a free function
It deserves this treatment, I think.
2022-11-03 18:59:50 +00:00
Ian Jackson c7a7ce5c20 bridgedesc: Introduce Downloaded
This gives names to things and makes things clearer, and this will be
even more true in a moemnt.
2022-11-03 18:59:50 +00:00
Ian Jackson d2b31f7796 bridgedesc: download: Break out process_document
We're going to want to reuse this for handling cached stuff.
2022-11-03 18:57:40 +00:00
Ian Jackson 6fbf3059cd bridgedesc: Prepare Mockable trait for if-modified-since 2022-11-03 18:57:40 +00:00
Nick Mathewson 932fe48eaf Run add_warnings. 2022-11-03 11:06:02 -04:00
Ian Jackson 70b420adf8 bridge descriptors tests: Fix flaky test 2022-11-03 11:46:20 +00:00
Ian Jackson daf7eac60a bridge descriptors tests: Test set_bridges more thoroughly (fix)
The RetryDelays are being triggered for the 2nd time here, so their
timeouts can be longer.  We must bump the sleep to make sure we don't
have a flaky test.
2022-11-03 11:37:30 +00:00
Ian Jackson 7a99601721 bridge descriptors: logging: Log addition and removal (fmt)
Worsify formatting as demanded by rustfmt.
2022-11-03 11:37:30 +00:00
Ian Jackson 269808336e bridge descriptors: logging: Log addition and removal
This involves breaking the calls to `new_bridges.remove` into a helper
that does the logging.
2022-11-03 11:37:30 +00:00
Ian Jackson 17c766fde4 bridge descriptors: logging: Log download start and outcome 2022-11-03 11:37:30 +00:00
Ian Jackson 1ccd9db9af bridge descriptors tests: Test set_bridges more thoroughly
Prior to the previous commit, set_bridges would malfunction if there
were bridges which where (i) in current (ii) in queued or running
(iii) in the new bridge set.

This test failed then and passes now.
2022-11-03 11:37:30 +00:00
Ian Jackson 4a830e1ac2 bridge descriptors: Rewrite set_bridges
This was fundamentally confused and irregular.  Now it is more
regular: it does the same things to all the elements of Tracked,
and a simple filtering on current.

This fixes a bug, for which I'm about to add a test case.
2022-11-03 11:37:30 +00:00
Ian Jackson 0571674a64 bridge descriptors tests: Add another couple of test cases 2022-11-03 11:37:30 +00:00
Ian Jackson 6db3403820 bridge descriptors tests: stream_drain_ready returns event count
We'll use this in a moment.
2022-11-03 11:37:30 +00:00
Ian Jackson 53c1cf0c6d bridge descriptors tests: Break out bad_bridge helper function 2022-11-03 11:37:30 +00:00
Ian Jackson 42b1b08fdf bridge descriptors: Change default max_refetch
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/820#note_2850269
2022-11-03 11:37:30 +00:00
Ian Jackson 2ae8a52371 bridge descriptors: Add clarification about bridge states 2022-11-03 11:37:30 +00:00