Skip to content

chore: silence cosmetic lints in the vendored crates instead of patching them - #600

Open
blacks1ne wants to merge 3 commits into
QuilibriumNetwork:v2.1.0.25from
blacks1ne:chore/warnings-vendored-lint-allows
Open

chore: silence cosmetic lints in the vendored crates instead of patching them#600
blacks1ne wants to merge 3 commits into
QuilibriumNetwork:v2.1.0.25from
blacks1ne:chore/warnings-vendored-lint-allows

Conversation

@blacks1ne

@blacks1ne blacks1ne commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

classgroup, bulletproofs, jmt, libp2p-tls, dkls23 and ed448-rust are
vendored upstream forks. Rather than edit them and create a patch that
re-vendoring has to re-apply, each gets a scoped [lints.rust] table in its
Cargo.toml, commented with the upstream it tracks — 72 warnings, no source
changes. Plus -Wno-unused-variable on classgroup's three cc::Build
invocations for the two C++ warnings out of src/vdf.cpp.

Only cosmetic lints are listed. Soundness lints are deliberately left
enabled
— see the two soundness PRs in this series, and the sixteen classgroup
FFI warnings that I am writing up rather than silencing.

libp2p-tls already had a [lints.rust] section; this appends to it rather than
adding a second.

One subtlety documented in the manifest itself: classgroup's
deprecated = "allow" covers build.rs, but does not reach src/gmp/,
which opens with #![warn(deprecated)] — an in-source attribute beats the level
the manifest passes on the command line. The seven warnings that survive there
are the mem::uninitialized calls, left visible on purpose. I removed that key
at one point believing it was dead config; it is not, and the comment now says
exactly what it does and does not reach so the next person does not repeat that.


Series

Part of the warning-cleanup series that starts with #597. The eight PRs are
disjoint and each stands on its own, but they are meant to be read in order —
please take #597 first: it is the only one of the eight that fixes a bug
rather than a warning, and it is the shortest.

Happy to re-pace these, drop any of them, or squash the set into a single PR if
you would rather review it in one pass — just say which.

Drafted with Claude Code; every site was read individually and the reasoning is
in the commit message.

…them

`classgroup`, `ed448-bulletproofs`, `jmt`, `libp2p-tls`, `dkls23` and
`ed448-rust` are vendored forks of upstream projects. Between them they
emit 79 cosmetic rustc warnings on every `task build_node_amd64_linux`,
`task build_qclient_amd64_linux` and `task test_rust_amd64_linux` run.

Fixing those in place would make every future re-vendor or upstream sync
a conflict for no functional gain, so each crate gets a scoped
`[lints.rust]` allow table in its own Cargo.toml, with a comment naming
the upstream it tracks. The crate source stays byte-comparable with
upstream; nothing is compiled differently.

Only cosmetic lints are silenced. The soundness warnings in these same
crates are deliberately left enabled and are NOT addressed here:

- `classgroup`: `invalid_value` x6 (`mem::uninitialized::<mpz_struct>()`)
  and `clashing_extern_declarations` x3 (`__gmpz_cmpabs`,
  `__gmpz_sizeinbase`, `__gmpz_export` declared with signatures that
  disagree with `gmp/mpz.rs`).
- `ed448-bulletproofs`: `static_mut_refs` x2.

`classgroup`'s two vendored C++ warnings (unused `sgn` in `fast_reduce`,
unused `f_` in `gmp_nudupl`) are silenced the same way — a
`-Wno-unused-variable` flag on the three `cc::Build` invocations rather
than an edit to `src/vdf.cpp`.

Note the allow tables also cover `deprecated`, which in `classgroup`
includes two `cc::Build::static_flag` calls that are now no-ops. Removing
them is a real (if tiny) build-script change and is left for the author.

(cherry picked from commit f1f12560c37154ad9cc37689684f8511bc4af263)
Two things in that comment were wrong.

It claimed the allow-rather-than-patch approach keeps the tree
byte-comparable with poanetwork/vdf so re-vendoring need not re-apply a
cleanup patch. classgroup has already diverged from upstream — `src/vdf.cpp`
and `build.rs` have both been substantially rewritten in-tree — so wholesale
re-vendoring is not on the table and that was not a real constraint. Keeping
the diff small and reviewable is the honest reason; being unpatchable is not.

It also said the warnings surviving in src/gmp/ were eight `mem::uninitialized`
calls. There were six of those, in a set of sixteen. Those are being fixed
directly rather than silenced, so the sentence is dropped instead of corrected.

The load-bearing half of the comment — that `deprecated = "allow"` here does
not reach src/gmp/, because that module's own `#![warn(deprecated)]` beats the
level cargo passes on the command line, and so the key must not be deleted as
dead config — is unchanged.
The justification attached to this flag was wrong in the same way the
Cargo.toml comment corrected in eecdb52 was: it claimed the flag existed
so `src/vdf.cpp` would stay "byte-identical to upstream". It is not —
`git log -- crates/classgroup/` shows `src/vdf.cpp` rewritten in-tree
(+116/-90). There was no upstream copy to preserve, so there was no
reason not to simply delete the two variables.

Both are provably unused:

- `sgn` in `fast_reduce()` — declared beside `delta` and `gamma`, which
  are used; `sgn` never is.
- `f_` in `gmp_nudupl()` — declared as `form F, f_;` and never
  initialised, written or read. (An earlier function in the same file has
  its own live `f_`, which is what makes this one easy to miss.)

Deleting them lets the C++ compile under the default warning set, which
is the point: -Wno-unused-variable would have hidden any future unused
variable in this file too.
@blacks1ne
blacks1ne force-pushed the chore/warnings-vendored-lint-allows branch from a8dfbbe to 8973c5f Compare August 18, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant