Closed Kyrrui closed 2 years ago
@Kyrrui I disagree with the audit suggestion here, I don't think we should use the actual chainId value. The value of chainId that we're using is actually arbitrary, it doesn't have to match the real chainId. It's really just used to make sure that a message signed for one chain cannot be replayed on another. It's up to us to deploy to each chain with a different chainId.
We're using the same pattern that DAI uses for EIP712 permit. See https://etherscan.io/address/0x6b175474e89094c44da98b954eedeac495271d0f#code#L110
also if we used the actual chainId value here, and the chainId was changed by a hardfork, it would invalidate all existing signed messages
WARNING: Some tests fail, needs to be looked at
NOTE: If we upgrade to solidity 0.8.0 we can get some gas savings here by using block.chainId