Commit 31564f2e authored by James Kim's avatar James Kim

use different eip712 version from semver

parent 5bb0ade5
...@@ -139,7 +139,7 @@ contract OptimistInviter_Initializer is Test { ...@@ -139,7 +139,7 @@ contract OptimistInviter_Initializer is Test {
_issueInviteWithEIP712Domain( _issueInviteWithEIP712Domain(
_privateKey, _privateKey,
bytes("OptimistInviter"), bytes("OptimistInviter"),
bytes(optimistInviter.version()), bytes(optimistInviter.EIP712_VERSION()),
block.chainid, block.chainid,
address(optimistInviter) address(optimistInviter)
); );
...@@ -275,7 +275,7 @@ contract OptimistInviter_Initializer is Test { ...@@ -275,7 +275,7 @@ contract OptimistInviter_Initializer is Test {
ClaimableInviteEIP712TypedData.getDigest( ClaimableInviteEIP712TypedData.getDigest(
_claimableInvite, _claimableInvite,
bytes("OptimistInviter"), bytes("OptimistInviter"),
bytes(optimistInviter.version()), bytes(optimistInviter.EIP712_VERSION()),
block.chainid, block.chainid,
address(optimistInviter) address(optimistInviter)
); );
...@@ -452,7 +452,7 @@ contract OptimistInviterTest is OptimistInviter_Initializer { ...@@ -452,7 +452,7 @@ contract OptimistInviterTest is OptimistInviter_Initializer {
) = _issueInviteWithEIP712Domain( ) = _issueInviteWithEIP712Domain(
bobPrivateKey, bobPrivateKey,
"OptimismInviter", "OptimismInviter",
bytes(optimistInviter.version()), bytes(optimistInviter.EIP712_VERSION()),
1, 1,
address(optimistInviter) address(optimistInviter)
); );
...@@ -476,7 +476,7 @@ contract OptimistInviterTest is OptimistInviter_Initializer { ...@@ -476,7 +476,7 @@ contract OptimistInviterTest is OptimistInviter_Initializer {
) = _issueInviteWithEIP712Domain( ) = _issueInviteWithEIP712Domain(
bobPrivateKey, bobPrivateKey,
"OptimismInviter", "OptimismInviter",
bytes(optimistInviter.version()), bytes(optimistInviter.EIP712_VERSION()),
block.chainid, block.chainid,
address(0xBEEF) address(0xBEEF)
); );
......
...@@ -43,6 +43,14 @@ contract OptimistInviter is Semver, EIP712Upgradeable { ...@@ -43,6 +43,14 @@ contract OptimistInviter is Semver, EIP712Upgradeable {
*/ */
event InviteClaimed(address indexed issuer, address indexed claimer); event InviteClaimed(address indexed issuer, address indexed claimer);
/**
* @notice Version used for the EIP712 domain separator. This version is separated from the
* contract semver because the EIP712 domain separator is used to sign messages, and
* changing the domain separator invalidates all existing signatures. We should only
* bump this version if we make a major change to the signature scheme.
*/
string public constant EIP712_VERSION = "1.0.0";
/** /**
* @notice EIP712 typehash for the ClaimableInvite type. * @notice EIP712 typehash for the ClaimableInvite type.
*/ */
...@@ -114,16 +122,15 @@ contract OptimistInviter is Semver, EIP712Upgradeable { ...@@ -114,16 +122,15 @@ contract OptimistInviter is Semver, EIP712Upgradeable {
/** /**
* @notice Initializes this contract, setting the EIP712 context. * @notice Initializes this contract, setting the EIP712 context.
* *
* When upgrading this contract, make sure to re-initialize and to update the version * Only update the EIP712_VERSION when there is a change to the signature scheme.
* in the EIP712 context to the up-to-date semver by calling __EIP712_init again. After * After the EIP712 version is changed, any signatures issued off-chain but not
* the EIP712 version is changed, any signatures that were issued off-chain but not * claimed yet will no longer be accepted by the claimInvite function. Please make
* claimed yet, will no longer be accepted by the claimInvite function. Please make
* sure to notify the issuers that they must re-issue their invite signatures. * sure to notify the issuers that they must re-issue their invite signatures.
* *
* @param _name Contract name * @param _name Contract name
*/ */
function initialize(string memory _name) public initializer { function initialize(string memory _name) public initializer {
__EIP712_init(_name, version()); __EIP712_init(_name, EIP712_VERSION);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment