tool: support reinitializer in slither-check-upgradeability #2534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the
slither-check-upgradeability
tool doesn't support the reinitializer in OZ's Initializable contract. For example, theCounterV2
below is a new implementation ofCounter
which adds a new storage variable and changed thechangeX
function:Since
slither-check-upgradeability
can't recognize thereinitializer
modifier, it will report a high-seveirity finding that the CounterV2.initialize(uint256) does not call the initializer modifier:qiuhao@laptop:~/tmp/foundry_test/upgrade$ slither-check-upgradeability src/Counter.sol Counter --new-contract-name Counte rV2 ... CounterV2.initialize(uint256) (src/Counter.sol#20-22) does not call the initializer modifier. Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializer-is-not-called
This PR supports the
reinitializer
modifier and fixes some tests fortests/tool/check_upgradeability
.