Skip to content

Commit ab70871

Browse files
authored
Merge pull request #853 from crytic/dev-improve-upgradeability
Relax detection of initialization functions
2 parents 9239269 + 17cd9bc commit ab70871

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

slither/tools/upgradeability/checks/initialization.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22

3+
from slither.core.declarations import Function
34
from slither.slithir.operations import InternalCall
45
from slither.tools.upgradeability.checks.abstract_checks import (
56
AbstractCheck,
@@ -14,8 +15,18 @@ class MultipleInitTarget(Exception):
1415
pass
1516

1617

18+
def _has_initiliaze_modifier(function: Function):
19+
if not function.modifiers:
20+
return False
21+
return any((m.name == "initializer") for m in function.modifiers)
22+
23+
1724
def _get_initialize_functions(contract):
18-
return [f for f in contract.functions if f.name == "initialize" and f.is_implemented]
25+
return [
26+
f
27+
for f in contract.functions
28+
if (f.name == "initialize" or _has_initiliaze_modifier(f)) and f.is_implemented
29+
]
1930

2031

2132
def _get_all_internal_calls(function):

0 commit comments

Comments
 (0)