Why ERC2771ContextUpgradeable has a constructor?

I don't understand why in contracts-upgradeable there is a constructor that sets sets the _trustedForwarder state variable even though in all the upgradeable contracts we take care of using an init function instead.
Indeed by OZ own words "the code within a logic contract’s constructor will never be executed in the context of the proxy’s".
Moreover if I want to inherits ERC2771ContextUpgradeable I have to create a constructor in my child contract which is also useless because it is proxied.
Am I missing something or is it an error in OZ contract ?

I had this same question and asked in Github, got a response from them here: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues/147

1 Like