| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
The macro-generated code for `#[deftly(netdoc(flatten))]` relies on
this. The Default impl is genereated by the derive, but a generic
or handwritten `NetdocParseableFields` wouldn't work.
|
| |\
| |
| |
| |
| | |
tor-checkable: Rename Timebound to TimeBound and TimerangeBound to TimeRangeBound
See merge request tpo/core/arti!4215
|
| | | |
|
| | | |
|
| | | |
|
| |/ |
|
| | |
|
| |
|
|
| |
As a shorthand for T::intern_cache().intern(value).
|
| |
|
|
|
| |
This commit implements ItemValueParseable and ItemArgumentParseable for
Intern<T> types. This should be sufficient for the time being.
|
| |\
| |
| |
| |
| | |
tor-netdoc: derives: allow handling deprecated fields
See merge request tpo/core/arti!4118
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This makes it possible to derive from a struct with deprecated fields,
without triggering the warning.
This doesn't yet treat encoding as yet, because the only deprecated
field I encountered was `skip` which means the derived encoder never
mentions it.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We're going to turn these into full-on round-trip tests for both
flavours of consensus.
We must temporarily bodge the more comprehensive test, for plain con
sensuses, to to still use the actual document type from poc. That
allows us to avoid changing the arguments to verify() etc. (poc's
verify is subtly different to the real NetworkStatus's.)
When these tests were in poc, they were gated by the incomplete cfg on
the whole of poc. Now they have one each.
Almost entirely code motion; review with
git show --color-moved --color-moved-ws=allow-indentation-change
|
| | |
| |
| |
| |
| |
| |
| |
| | |
There is no separate poc authcert type any more. This is a perfectly
fine test case.
Almost entirely code motion; review with
git show --color-moved --color-moved-ws=allow-indentation-change
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
clippy complains (clippy::needless_borrows_for_generic_args).
In poc, we have an allow with a TODO asking for this to be done
generally in the Arti codebase.
Let's postpone shaving that yak.
|
| | | |
|
| |/
|
|
|
|
|
|
|
| |
We are going to reuse/move this test code. Ie, it is going to be
testing the real network document types.
The naming outside poc is different. To make future diffs a bit less
noisy, change some type names in the test code and fudge it up with a
use.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In a wip branch I added a variant, and clippy complained. In this
case, I agree with clippy.
warning: all variants have the same postfix: `Authorities`
--> crates/tor-netdoc/src/doc/netstatus.rs:2335:1
|
2335 | / pub(crate) enum VerifyGeneralTrustedAuthorities<'r> {
2336 | | /// Trust these authorities.
2337 | | TrustTheseAuthorities {
2338 | | /// The HKP_auth_id_rsa
... |
2357 | | },
2358 | | }
| |_^
|
= help: remove the postfixes and use full paths to the variants instead of glob imports
= help: for further information visit https://rust-lang.github.io/rust-clippy/beta/index.html#enum_variant_names
note: the lint level is defined here
--> crates/tor-netdoc/src/lib.rs:9:9
|
9 | #![warn(clippy::all)]
| ^^^^^^^^^^^
= note: `#[warn(clippy::enum_variant_names)]` implied by `#[warn(clippy::all)]`
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This avoids passing the threshold around as a bare usize, separated
out from the list of trusted authorities.
Roughly as discussed in
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4065#note_3423775
But, VGTA::HazardouslyAssumeAllAuthCertsAreRealAuthorities contains
n_authorities, not the thtreshold. That's what its user has, and that
allows us to centralise the threshold calculation somewhat.
The situation with votes in poc is a bit odd now: we pass one cert and
then there's one authority so the threshold of 1 is calculated rather
than literal. That's OK, but also we perhaps aren't going to use
verify_general for votes in the production.
|
| | |
|
| |
|
|
| |
No functional change with the existing caller.
|
| |
|
|
| |
No functional change.
|
| |
|
|
|
|
|
|
|
|
|
| |
In an attempt to check that the new verification code makes sense, we
compare it with the freshly rewritten one in poc.
To review this, compare the code being deleted with the body of
verify_general (doc/netstatus.rs, line 2164 et seq).
You'll also want to refer to the body of find_cert and
check_signature (lines 2068-2086).
|
| |
|
|
|
|
|
| |
Like verify_general does.
(This wasn't a bug before, because we could the length of ok, so all
that would happen is we'd do some extra work.)
|
| |
|
|
|
|
| |
Obtain the hash first, like verify_general does.
No significant functional change, and this is poc code anyway.
|
| | |
|
| |
|
|
|
|
| |
This makes the code more like that in verify_general.
No functional change, and this is poc code anyway.
|
| | |
|
| |
|
|
|
| |
Prompted by
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4070#note_3422636
|
| | |
|
| |
|
|
|
|
|
|
| |
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4070#note_3422637
We must allow it in poc, but poc is a thing we're trying to
abolish/replace, so that's OK.
|
| |
|
|
|
|
|
|
| |
This commit adds #[allow(clippy::string_slice)] to all functions in the
code where string slices are used, alongside a TODO comment.
We do this add the function header to have it consistent, as things like
expression based allow's are still experimental.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Apparently, it is only correct to write
[`NetdocParseableUnverified`](derive_deftly_template_NetdocParseableUnverified),
*after* the definition of that template. Before then, the macro isn't
in scope.
Worse, rustdoc just treats it as a filename and doesn't spot the link,
so you don't get any kind of warning. I think this is an upstream bug,
https://github.com/rust-lang/rust/issues/157304
I found rustdoc's behaviour capricious. I don't intend to go through
the arti tree right now looking for similar patterns. Instead let's
hope the upstream bug gets fixed, and in the meantime do this crate::
thing when we notice we need it.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The NetdocParseableUnverified derive macro implements this
trait (amongst other things). Traits and derive macros should have
aligned names.
This is only used for parsing, so let's keep the "Parseable" part of
the name.
I don't think the effort of deprecated alias, for downstream
compatibility, is worth it, our compatibility policy notwithstanding.
|
| |
|
|
|
|
|
| |
The trait is called NetdocUnverified, but the template is
NetdocParseableUnverified. This fixes a dead docs link (which somehow
isn't spotted by rustdoc, but is instead taken to refer to a
nonexistent file).
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As pointed out in
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413185
this was a duplicate.
The new NoFurtherArguments
* Implements encoding
* Implements more traits
* Is in the right module (types::misc - it's not just for parsing)
* Has a slightly better name
* Had an open-coded parsing impl (which we now replace)
* Had minor differences to docs (so we add a line to NoFurtherArguments)
|
| |
|
|
|
| |
Replacing poc's. The new define_fixed_string macro is really helping
here.
|
| |
|
|
|
| |
Defining a struct gives us a place to hang the documentation, and
avoids an accidentally-exhaustive tuple.
|
| |
|
|
|
|
|
| |
This is more code than the poc version but much of the extra is
documentation, and it seems much less magical this way.
We still need a handwritten parser for plain consensuses, sadly.
|
| |
|
|
|
|
|
|
| |
The order of arguments of poc's ns_type macro is different to that of
the real code. This is very confusing!
However, the type is correct, once we've added the singleton signature
for votes.
|
| |
|
|
|
| |
This is the whole of the footer section, with docs, appropriate
derives, and so on.
|
| | |
|
| | |
|
| |
|
|
| |
ns_type! is a non-path type.
|
| | |
|