There should be a check here comparing cached address(this) against the address(this) of the current context. If the compared addresses don't match, it should recalculate the domain separator:
|
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); |
Currently any delegatecalls will result in incorrect domain separator due to the difference in the actual address of the context and the address when the domain separator was cached.