Skip to content

chore: annotate the intentionally-unused code paths and drop orphaned test fixtures - #602

Open
blacks1ne wants to merge 1 commit into
QuilibriumNetwork:v2.1.0.25from
blacks1ne:chore/warnings-dead-code
Open

chore: annotate the intentionally-unused code paths and drop orphaned test fixtures#602
blacks1ne wants to merge 1 commit into
QuilibriumNetwork:v2.1.0.25from
blacks1ne:chore/warnings-dead-code

Conversation

@blacks1ne

@blacks1ne blacks1ne commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

49 warnings, and the most opinionated PR in the series — this is the one to
push back on if any of it reads wrong.

Almost none of these are accidental leftovers. They are ported-for-parity
mirrors of the Go implementation, accessors on library surfaces the node itself
does not call, or scaffolding for a feature that is implemented but not wired up.
So each gets #[allow(dead_code)] and a one-line note saying why, following the
annotation already on AppShardProposal::state_bytes. Scoped per item rather
than per crate, so genuinely new dead code still warns.

Two exceptions are deleted, both #[cfg(test)] fixtures with no surviving test
referencing them: token_intrinsic/pending.rs's five builders (69 lines) and
global_intrinsic/conversions.rs::sample_addr_sig.

The unreachable _ => return None in consensus_wire is annotated rather than
removed — its comment says it exists so that regenerating the protos drops an
unported variant instead of breaking the build, which seems worth keeping.

Two things I flagged but did not change

  • engines::require_traversal_proof_for_inputs is dead code. Its own doc
    comment says that without this gate "an attacker can fabricate inputs whose
    values they choose and mint QUIL from nothing". The check is implemented;
    nothing calls it. I annotated it with a NOTE pointing at that rather than
    wiring it up, because wiring it up is a decision about the token dispatch path,
    not a warning fix. Flagging it here because it should not stay invisible.
  • thread_worker's JoinHandle is never awaited — shutdown goes through the
    CancellationToken only.

Merge-order note — resolved

This PR and #599 used to touch adjacent lines of the same
channel::json_to_metadata signature, and would have conflicted on whichever
merged second. Rather than leave you to hit it, the whole site now lives here
(+1): the unused ratchet_state parameter is renamed in this PR alongside the
annotation and the comment, since that entire function is dead, which is what
this bucket is about. #599 keeps the rename on metadata_to_json, which is live.
The warning is still fixed exactly once across the series — it changed bucket,
it was not dropped. Verified: the two now merge in either order and produce an
identical tree.


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.

… test fixtures

rustc reports 47 dead_code/unreachable_patterns warnings in the first-party
crates. Almost none of them are accidental leftovers: they are ported-for-
parity mirrors of the Go implementation, accessors on library surfaces the
node itself does not call, or scaffolding for a feature that is implemented
but not yet wired up. Deleting them would lose work; leaving them warning
trains reviewers to skim past the lint.

So each site gets #[allow(dead_code)] plus a one-line note saying why it is
unused, following the annotation already on AppShardProposal::state_bytes.
Scoped per item rather than per crate, so genuinely new dead code still warns.
That struct now carries the attribute at the struct level, since four of its
five fields were write-only.

Two exceptions are deleted outright, because they are #[cfg(test)] fixtures
no remaining test references:
  - token_intrinsic/pending.rs: make_recipient/make_output/make_modern_input/
    make_legacy_input/make_tx (69 lines); the four surviving round-trip tests
    build their structs inline.
  - global_intrinsic/conversions.rs: sample_addr_sig.

One arm is annotated rather than removed: the '_ => return None' in
consensus_wire::canonical_request_from_proto is unreachable today because
every Request variant is ported, but its comment says it exists so that
regenerating the protos drops an unported variant instead of breaking the
build. That intent is worth keeping.

Two things worth a second look, flagged but not changed here:
  - engines::require_traversal_proof_for_inputs is dead. Its own doc comment
    explains that without this gate 'an attacker can fabricate inputs whose
    values they choose and mint QUIL from nothing'. The check is implemented
    but nothing calls it.
  - thread_worker's JoinHandle is never awaited; shutdown goes through the
    CancellationToken only.

The unused `ratchet_state` parameter on `json_to_metadata` is renamed
here rather than in the unused-imports-and-bindings bucket, so that the
whole of this dead function -- annotation, comment and parameter -- is
described by one PR. Without that the two buckets touch adjacent lines
of the same signature and conflict on whichever merges second. The
warning is still fixed exactly once across the series; it has just moved
buckets. `metadata_to_json`, which is live, keeps its rename there.
@blacks1ne
blacks1ne force-pushed the chore/warnings-dead-code branch from 7213053 to e0fc7ac 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