__AccessControl_init()

I have an upgradable contract using
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";

In the constructor (initializer) for such contract i do:
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
and some other stuff

I saw another contract importing the access control upgradeable and in the initializer there is this call:
__AccessControl_init()

What is the purpose of this call ? Does this should be put on any contract having upgradeability and access control ? Thanks!

Hi,

Because the __AccessControl_init() is empty is not really necessary at the moment but it is a good practice to call the init methods of all parent to avoid uninitializing a contract that needs to.

Thanks @JulissaDantes for your answer... buy, sorry, if it is empty
what is the purpose of such initializer and what's the point to call it if nothing will be executed ?

thanks!

1 Like