Skip to content

testRequireContractNameAcceptedNamesAreIdentifiers oracle is an inlined copy of the implementation #60

Description

@thedavidmeister

Audit scope: whole-repo, commit 7aa85a4

Dimension 5 (correctness/intent) · low

Location: test/src/lib/LibCodeGen.requireContractName.t.sol:133-153

Path note: PR #56 is open and unmerged as of filing. On main today this file is test/lib/LibCodeGen.requireContractName.t.sol; it becomes test/src/lib/LibCodeGen.requireContractName.t.sol after #56 merges.

Problem

Lines 138-141 restate LibCodeGen.requireContractName's range comparisons
character for character (isLetter/isDigit/isUnderscoreOrDollar, same i > 0
guard). The sibling test at line 207 exists specifically because that is the
wrong oracle — its own docstring says it must not follow the library "the way an
inlined copy of its own arithmetic would". A copy still kills mutants but cannot
detect a design error present in both, and the file already carries an
independent oracle. Its accept branch is also thin: measured 101/2048.

Proposed fix

One line: replace lines 134-145 with if (LibCodeGenSlow.isContractNameSlow(name)) {, keeping the string generator so
the two tests still differ in domain. Verified passing.

Metadata

Metadata

Labels

auditAudit findinglowAudit findingpass5Audit finding

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions