What does `_disableInitializers();` function mean?

Hi @migbash,

_disableInitializers() was added in Contracts v4.6.0 as part of the reinitializers support. The Caution note in Initializer provides more details on why this is needed.

By putting it in the constructor, this prevents initialization of the implementation contract itself, as extra protection to prevent an attacker from initializing it.

Thank you for mentioning the difference with the upgrades documentation. The contructor() initializer {} usage was recommended for previous version of Contracts. I've opened an issue to update the upgrades documentation to refer to _disableInitializers().

2 Likes