Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Regression coverage for https://github.com/crytic/slither/issues/930
//
// A public constant that overrides an interface getter must NOT be flagged
// by the naming-convention detector for failing UPPER_CASE_WITH_UNDERSCORES.
// The behavior is already covered by the public-constant branch in
// slither/detectors/naming_convention/naming_convention.py, but the existing
// no_warning_for_public_constants.sol fixture does not exercise the `override`
// variant. This file locks that in.
interface I {
function version() external view returns (uint256);
}

contract C is I {
uint256 public constant override version = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Regression coverage for https://github.com/crytic/slither/issues/930
//
// A public constant that overrides an interface getter must NOT be flagged
// by the naming-convention detector for failing UPPER_CASE_WITH_UNDERSCORES.
// The behavior is already covered by the public-constant branch in
// slither/detectors/naming_convention/naming_convention.py, but the existing
// no_warning_for_public_constants.sol fixture does not exercise the `override`
// variant. This file locks that in.
interface I {
function version() external view returns (uint256);
}

contract C is I {
uint256 public constant override version = 1;
}
10 changes: 10 additions & 0 deletions tests/e2e/detectors/test_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,16 @@ def id_test(test_item: Test):
"no_warning_for_public_constants.sol",
"0.7.6",
),
Test(
all_detectors.NamingConvention,
"no_warning_for_public_constants_with_override.sol",
"0.6.11",
),
Test(
all_detectors.NamingConvention,
"no_warning_for_public_constants_with_override.sol",
"0.7.6",
),
Test(
all_detectors.ControlledDelegateCall,
"controlled_delegatecall.sol",
Expand Down