| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
| |
Removed unnecessary lint
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The Microdesc type having a copy of the document hash was always
weird, and it's weirder now that there's all these parse2 types that
don't have it and parse2 derives on Microdesc that don't touch it.
Make a new type for the descriptor and its hash.
Use deref to arrange that the new type works almost like the old one.
Adjust the use lines in the dependencies to temporarily import
MicrodescAndHash as Microdesc.
|
| |
|
|
|
|
|
| |
"iter" wasn't an iterator per se. Changed it to "sampled_items", and
renamed other variables to call the items more generically "items" than
"relay", since the mixed usage was a little confusing, and the function
doesn't really know anything about relays.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
We have more useful context in the caller, `pick_n_relays`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tests our implementation of sampling to ensure the behavior is
as-expected. It also updates the implementation so that the tests pass
(It was broken when updating to rand 0.10; see
https://gitlab.torproject.org/tpo/core/arti/-/work_items/1907#note_3426398).
This removes the direct testing of
`rand::IndexedRandom::sample_weighted`, since this is now an
impplementation detail of `pick_n_filtered_weighted`, which is itself
tested.
Verified that this fixes the case of sometimes not being able to select
a Guard in integration tests.
<https://gitlab.torproject.org/tpo/core/chutney/-/work_items/40057#note_3426299>
<https://gitlab.torproject.org/tpo/core/arti/-/work_items/1907#note_3408157>
<https://gitlab.torproject.org/tpo/core/arti/-/work_items/2209>
|
| | |
|
| | |
|
| |
|
|
|
| |
This should be a no-op refactor to callers. It's a step towards
decoupling the weighting and filtering from the sampling.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This commit executes maint/add_warning with the just added change to
deny string slices except in tests.
I recommend auditing this by checking out the previous commit followed
by running the script yourself and then verifying that the diff is
identical to this commit.
This commit makes cargo clippy fail. We will add exceptions in the next
commit.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The `choose_weighted` behavior given an empty sequence isn't well
documented and has changed over time. Handle it ourselves for
consistency.
Currently, the `choose_weighted` behavior appears to be to return
WeightError::InvalidInput. This means the corresponding `is_empty`
branch when handling WeightError::InsufficientNonZero was never
exercised. (Though may have been with previous versions of the rand
crate).
|
| |
|
|
|
|
|
|
|
|
|
| |
When the circ-padding feature is enabled, we use maybenot, which does
not yet support rand 0.10. In the meantime, enabling this feature pulls
in rand 0.9. This is not ideal, but should be okay as a temporary
situation.
This also replaces the use of ReseedingRng (which was removed in 0.10)
with the reseeding_rng crate. This is somewhat less performant, but it
should be okay.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This abolishes the NetDefn type, and turns DenseRangeDb into a map to
one or (optionally!) two types.
For the DBs we ship, which don't have asn information, this saves
about 2.5 MiB.
(It also probably saves a bit more, since the niche optimization
didn't apply to NetDefn as it existed before, since it tried
to distinguish Some(None,None) from None.)
|
| |
|
|
|
| |
This required correcting some errors in our previous
ersatz geoip databases.
|
| |
|
|
| |
In particular to help debug arti#1907
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
`clippy::collapsible_if` started triggering after bumping the MSRV to
1.88.
Since this triggers from a lot of places, and since there even are a
couple of instances where we explicitly allow `clippy::collapsible_ifs`,
I've opened #2342 for deciding what to do about it.
|
| |
|
|
| |
This adds the lint to all our crates.
|
| |\
| |
| |
| |
| |
| |
| | |
Refactor common code that builds circtargets for HS.
Closes #1223
See merge request tpo/core/arti!3530
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This code was duplicated across hsclient and hsservice.
Logically, it belongs in netdir, since that's where we have the
latest required-protocol information, and the ability to look up
relays by IDs.
Closes #1223
|
| |/
|
|
|
|
|
|
|
| |
Fixes part of #2193.
(Edits from nickm: I selected the cases here that I could verify
were correct from immediate context.)
Edited-by: Nick Mathewson <[email protected]>
|
| |
|
|
|
|
|
| |
Abolish the constants with the transitional names.
This also abolishes the controversial name `H_S_DIR`, which Rust case
transformation rules generated from `HSDir`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
We're going to separate RelayFlag from RelayFlags.
We could continue to provide a bunch of constant values for
RelayFlags, for each individual type, but that would involve an ad-hoc
derive, and would still be a bit of an unusual API.
Instead, we're going to make ``RelayFlag` a normal enum.
In this commit, we change everyone to refer to it by its singular
name. Hopefully separating out this bulk change makes both this, and
the core commit, easier to review.
|
| |
|
|
| |
I would do `#[deprecated]` but empirically that has no effect...
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
|
|
|
| |
We had two functions with different return types but identical
semantics. Replace them with one function returning `impl Iterator`.
Make it return owned addresses. These are small.
|
| |
|
|
|
|
|
|
| |
This will let us model the actual structure of routerstatus entries in
netdocs more closely. They don't have the addresses in a single list.
When this code was written this would have been much more awkward,
but now we have RPITIT.
|
| |
|
|
| |
This feature has been removed from nightly, in favor of doc_cfg.
|
| |
|
|
|
|
|
|
| |
Replaced use of [`static_assertions::const_assert`] with the newly
available "assert in const" pattern. This completely removes the
dependency on `static_assertions` for `tor-netdir`.
Signed-off-by: hashcatHitman <[email protected]>
|
| |
|
|
| |
Now we only need one type.
|
| |
|
|
|
| |
Our approach to sharing code between md and plain consensuses is now
the new "variety" system, not generics.
|
| |
|
|
|
|
|
|
|
|
| |
The two main causes of errors were:
- Since some of the lifetime rules have changed, we no longer need
to do as many "bind a variable and immediately return it"
patterns, and so clippy now warns about them.
- We needed to adjust the explicit captures (`use<...>`)
in a couple of our RPIT instances.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, run
```
git grep -l "^edition =" |
xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;'
```
Second, manually verify that all Cargo.toml files have changed,
and nothing else has changed.
Third, run cargo fmt again.
|
| | |
|
| |
|
|
| |
Made with https://crates.io/crates/typos-cli
|
| |
|
|
| |
See #2060.
|
| |
|
|
|
|
| |
We will construct this object based on the circuit parameters _and_
on the target's supported protocol versions, so we need to do so
when we have both pieces of info.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we logged a warning whenever `choose_multiple_weighted`
returns `Ok(iter)`, whenever `iter` contains fewer relays than
requested.
However, this is expected behavior of `choose_multiple_weighted` if the
filtered list of relays doesn't have the requested number of relays, in
which case it should return all of the relays in the filtered list.
In particular, this condition occurs regularly in test networks when
looking for candidate relays to add to the potential guard set while
excluding those already in the potential guard set.
We still warn if the returned list is fewer than requested, *and* fewer
than available in the filtered list.
|
| |
|
|
|
|
| |
Now that choose_multiple_weighted can once more return
fewer items than requested, we should warn when it does so,
to be consistent with our other cases of warning about #1907.
|
| |
|
|
|
|
|
|
| |
Rand 0.9.1 reverted the changes that caused #1903,
in https://github.com/rust-random/rand/pull/1623.
This broke our test that made sure that rand wasn't going to change
their behavior _again_ :)
|
| |
|
|
|
| |
This name reflects its purpose better than the original one,
since it includes required protocols as well as recommended ones.
|
| | |
|