Initializer modifier for constructor

Hi Team,

@frangio

I am using

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

My contracts look like this:

contract ACL is Initializable {

    constructor() initializer {
        
    }
}
contract Component is Initializable {

}
contract Awesome is Component, ACL {
    
    constructor() initializer {

    }
}

When I deploy the Awesome, it fails with: Reason provided by the contract: "Initializable: contract is already initialized".

Point 1: even though, ACL is a separate contract, I still need its constructor to have initializer keyword. The reason is some people might want to deploy ACL directly(let's just assume this) and if constructor doesn't have initializer, then it's a problem with proxies. I hope you know what I mean(Openzeppelin published an article asking people to add constructor initializer instead of just only constructor.

Point 2. If we got initialize functions instead of constructors and those both initialize functions also have the initializer modifier, now it works and I understand why.

How can I also make it work so that I got initializers on constructors as well ? If you ask me to remove initializer from ACL's constructor, in my case, it will work, but as I said, if anybody decides to deploy ACL with proxies, then the contract is not gonna be safe. I also don't want to make initialize function on ACL internal which would solve this.

Hope you get the idea...

Yes this is a good point. We have an upcoming change that should fix this.

As a workaround, I think you could define a contract like:

contract Base is Initializable { // or some other name
  constructor() initializer {}
}

and then inherit that in both ACL and Awesome. That way you will not get a conflict.