Rule
discarded-shielded-send-result
Canonical shielded send or mint metadata is discarded or retained only by unused immutable aliases.
Specimen 04 of 96 · Audit-default ordinary rules
- Severity
- info
- Confidence
- varies
- Maturity
- experimental
- Selection
- Audit default
- Policy intent
- not required
- Release
- v0.1.1
- Engine facts used
resolved-source-referencestyped-source-constants
Selection and scope#
Selected by the default audit profile, so an ordinary scan runs it.
./.nightshade/node_modules/.bin/nightshade ./contracts --detectors discarded-shielded-send-result
./.nightshade/node_modules/.bin/nightshade detector show discarded-shielded-send-resultThe first command runs only this rule; --detectors takes a comma-separated list. The second prints the rule's metadata from your installed version.
Severity is review priority. It does not express exploitability or impact. Confidence is detector metadata, not a probability. All built-in rules are experimental.
Compiler scope: the engine supports the pinned profiles 0.28.0, 0.29.0, 0.30.0, 0.31.1, 0.33.0-rc.2, 0.34.0, 0.35.0-rc.1 and 0.35.0, with ZKIR2 by default. Support for this rule can be narrower; the rule documentation below states any narrower scope.
Corpus checks#
Synthetic corpus checks for this rule in the 0.1.1 proof run. A check counts only with compiler acceptance and complete analysis.
| Positive detected | Corrected quiet | Lookalike quiet | Other negative quiet | Incomplete |
|---|---|---|---|---|
| 5/5 | 5/5 | 5/5 | 0/0 | 0 |
No deviations were recorded for this rule.
These are behavior checks on synthetic fixtures, not a precision or recall estimate. See evaluation.
Rule documentation#
From docs/detectors/discarded-shielded-send-result.md at v0.1.1.
Availability: default; informational severity, high confidence in the source observation. No policy required.
Informational source-use review; no policy required. Select it alone with --detectors discarded-shielded-send-result.
The rule observes discarded results from canonical stdlib sendImmediateShielded and sendShielded, and coin descriptors from mintShieldedToken, in structurally reachable root-source circuits. It recognizes expression statements (including transparent disclosure/identity casts) and unused immutable local identity alias chains. Imported aliases keep canonical identity; custom same-name helpers do not match. A helper consisting only of an exact return of a producer or another transparent helper also qualifies. Helpers with setup, branches, partial field returns or computed returns remain outside. Any non-alias reference, including field selection, assignment, capture or return, conservatively retains the result.
The returned ShieldedSendResult contains sent: ShieldedCoinInfo and change: Maybe<ShieldedCoinInfo>. Review whether the application needs that metadata. Discard does not establish lost funds, spendability or exploitation: wallet or transaction machinery may independently retain metadata. A use of one field silences the rule without proving all metadata is handled correctly. Returning the original input coin does not retain a discarded output descriptor.
This bounded source pass has a separate mode/cache and preserves ordinary, validation and comparison allowances. It shares existing constant-source reach, short-circuit and definite-rejection handling. Sequence-prefix discard, arbitrary forwarding helpers, recipient policy and off-chain retention are outside scope. Callback reach is structural and does not prove execution or nonzero iterations. Exhaustion yields an incomplete-rule diagnostic and no findings. Main and Counter scans route this rule through source-only analysis; no engine transfer changes.
Suppress a match#
If a match is intentional, suppress it on the line before with the exact rule ID and a reason of at least eight characters:
// nightshade-disable-next-line discarded-shielded-send-result -- Reason this match is intentionalDiagnostics cannot be suppressed, and an unmatched directive for a selected rule makes analysis incomplete. See configuration for fingerprint suppressions and baselines.