Rule

shared-module-once-gate

Distinct importing module wrappers expose one canonical false-guard then true-write Boolean gate.

Release v0.1.1View Markdown

Specimen 87 of 96 · Other active opt-ins / State and collections

Severity
info
Confidence
high
Maturity
experimental
Selection
Opt-in
Policy intent
not required
Release
v0.1.1
Engine facts used
resolved-model canonical-module-identities

Selection and scope#

Not selected by default. Select it with --detectors or the detectors list in nightshade.json. Either one replaces profile selection, so list every rule you want.

Shell
./.nightshade/node_modules/.bin/nightshade ./contracts --detectors shared-module-once-gate
./.nightshade/node_modules/.bin/nightshade detector show shared-module-once-gate

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
2/22/22/21/10

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/shared-module-once-gate.md at v0.1.1.

Availability: opt-in with --detectors shared-module-once-gate. Severity: info. Confidence: high for the resolved source fact.

Two distinct importing module instances expose direct wrappers calling the same canonical gate. The supported gate body consists exactly of an assertion that a Boolean ledger flag is false followed by an assignment of true to that flag. The assertion message must be parser-confirmed literal data; every operand has an exact supported shape. Wrappers and gates accept no arguments and return []. Resolved module, import and call identities distinguish shared gates from separate instances. No names or assertion messages establish initialization intent.

A successful gate write contradicts its next false-state guard unless storage is reset. This does not prove an actual cross-transaction failure, independent initialization intent, or deployed compiler behavior. Intentional shared initialization receives the same review finding. Multiple aliases of a single wrapper module are quiet because they do not create distinct importing modules. Distinct compiler path/module identities remain distinct even when physical parsing shares bytes.

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 shared-module-once-gate -- 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#