Rule

field-recomposition-range-review

Enforced Field recomposition retains quotient/remainder envelopes beyond the modulus.

Release v0.1.1View Markdown

Specimen 08 of 96 · Audit-default ordinary rules

Severity
info
Confidence
high
Maturity
experimental
Selection
Audit default
Policy intent
not required
Release
v0.1.1
Engine facts used
owned-numeric-expressions successful-predicates resolved-types

Selection and scope#

Selected by the default audit profile, so an ordinary scan runs it.

Shell
./.nightshade/node_modules/.bin/nightshade ./contracts --detectors field-recomposition-range-review
./.nightshade/node_modules/.bin/nightshade detector show field-recomposition-range-review

The 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 detectedCorrected quietLookalike quietOther negative quietIncomplete
5/54/54/50/00

Deviations recorded for this rule:

CaseKindExpected to observed linesIssue
synthetic-regressions.json / field-recomposition-range-review-86corrected[7] to [7]control hit
synthetic-regressions.json / field-recomposition-range-review-86lookalike[7] to [7]control hit

These are behavior checks on synthetic fixtures, not a precision or recall estimate. See evaluation.

Rule documentation#

From docs/detectors/field-recomposition-range-review.md at v0.1.1.

Availability: default. Severity: info. Confidence: high.

field-recomposition-range-review reports an informational source observation. It reviews an enforced Field equality (including negated comparisons) whose owned numeric expression is a shallow quotient * constant + remainder, allowing commuted operands. The constant must be a power of two greater than one. Both scalar operands must preserve an exact raw entry-parameter or witness source identity, have no ledger dependencies, and be distinct after successful scalar equality normalization. Names do not establish quotient/remainder intent. Native results, ledger reads and derived operands are outside this first shape.

The rule uses existing numeric observation machinery and reconstructs integer constraints separately for each completed successful history. Equality aliases, checked numeric casts, retained integer domains, orderings and exclusions can constrain the exact operand envelopes. It reports when their mathematical multiply-plus-add upper endpoint reaches the Field modulus. Histories at the same entry, equality site and matched side share a stable finding with separate retained envelopes; bounds from sibling histories are never combined.

The report establishes only a retained envelope fact. It does not establish joint operand feasibility, integer decomposition intent, ambiguity, an invalid execution, proof failure or deployed impact. Relation matching is shallow: expanded Boolean formulas, recursive algebra and alternate decompositions are outside scope. Successful equality against the modular result is not an integer range certificate. Missing exact evidence, unfinished requested entries, contradictory constraint reconstruction and allowance exhaustion produce rule-scoped incomplete diagnostics and no partial finding set.

The rule distinguishes a bounded quotient from a wider value that can wrap during recomposition. Compiler acceptance is checked separately; no proof or runtime execution is used. Intentional modular arithmetic can satisfy the same source shape. Review whether integer reconstruction is intended before changing a bound; the envelope is not proof the operands jointly reach it or a concrete execution wraps.

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:

Compact
// nightshade-disable-next-line field-recomposition-range-review -- Reason this match is intentional

Diagnostics cannot be suppressed, and an unmatched directive for a selected rule makes analysis incomplete. See configuration for fingerprint suppressions and baselines.

References#