Skip to content

Redundant first guard in conformStringToMask: both arms subsumed by the reachable-chars guard #53

Closed

Description

@thedavidmeister

Unit

src/lib/mut/LibConformString.sol:31-33 vs :43-45.

Violated property

None behaviourally — this is dead code. mask == 0 makes ((1 << max) - 1) & mask == 0 for every max, and max == 0 makes (1 << 0) - 1 == 0, so the second guard reverts with the identical EmptyStringMask() in both cases. The first guard is unreachable as a distinct behaviour.

Repro

Campaign mutant M01 (first guard's mask==0 arm removed) SURVIVED the full 36-test suite as a true equivalent: no input distinguishes the two guards.

Triage framing

Minor cleanup: delete the first guard (gas/size noise only) or keep it for readability with a comment noting the redundancy. Proved-equivalent by mutation, so removal is test-safe.

🤖 Generated with Claude Code

Activity

  1. thedavidmeister commented on Aug 24, 2026

    @thedavidmeister
    ContributorAuthor

    Closing as completed via #66 (merge ee3f89a): the max parameter and both guards this issue discusses were deleted wholesale — conformStringToMask now derives its reroll modulus from the mask's bit length and keeps a single mask == 0 EmptyStringMask check, which is not redundant (it is the only barrier between a zero mask and a non-terminating reroll). The redundant code was removed structurally rather than surgically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

adversarialFound by adversarial testingauditAudit finding

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions