Skip to content

Commit

Permalink
Add if statement that if chain id is zksync testnet.
Browse files Browse the repository at this point in the history
  • Loading branch information
wshino committed Aug 12, 2024
1 parent aab493d commit e21cce1
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 130 deletions.
2 changes: 1 addition & 1 deletion packages/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Then, move `email_auth.zkey` and `email_auth.wasm` in the unzipped directory `pa

Run each integration tests **one by one** as each test will consume lot of memory.
```bash
Eg: forge test --match-test 'testIntegration_Account_Recovery' -vvv --chain 31337 --ffi
Eg: forge test --match-test 'testIntegration_Account_Recovery' -vvv --chain 8453 --ffi
```
#### Deploy Common Contracts.
You need to deploy common contracts, i.e., `ECDSAOwnedDKIMRegistry`, `Verifier`, and implementations of `EmailAuth` and `SimpleWallet`, only once before deploying each wallet.
Expand Down
40 changes: 32 additions & 8 deletions packages/contracts/test/Integration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ contract IntegrationTest is Test {
0x0ea9c777dc7110e5a9e89b13f0cfc540e3845ba120b2b6dc24024d61488d4788;
uint256 startTimestamp = 1723443691; // September 11, 2024, 17:34:51 UTC

bool isZksync = false;

function setUp() public {
if (block.chainid == 300) {
vm.createSelectFork("https://sepolia.era.zksync.dev");
isZksync = true;
} else {
vm.createSelectFork("https://mainnet.base.org");
isZksync = false;
}

vm.warp(startTimestamp);
Expand Down Expand Up @@ -137,10 +141,17 @@ contract IntegrationTest is Test {
vm.deal(address(relayer), 1 ether);

console.log("SimpleWallet is at ", address(simpleWallet));
assertEq(
address(simpleWallet),
0x05A78D3dB903a58B5FA373E07e5044B95B12aec4
);
if (isZksync) {
assertEq(
address(simpleWallet),
0x05A78D3dB903a58B5FA373E07e5044B95B12aec4
);
} else {
assertEq(
address(simpleWallet),
0x18ABd76E471dB6a75A307bf4dD53ceA89A975B1A
);
}
address simpleWalletOwner = simpleWallet.owner();

// Verify the email proof for acceptance
Expand Down Expand Up @@ -173,8 +184,13 @@ contract IntegrationTest is Test {
emailProof.domainName = "gmail.com";
emailProof.publicKeyHash = bytes32(vm.parseUint(pubSignals[9]));
emailProof.timestamp = vm.parseUint(pubSignals[11]);
emailProof
.maskedSubject = "Accept guardian request for 0x05A78D3dB903a58B5FA373E07e5044B95B12aec4";
if (isZksync) {
emailProof
.maskedSubject = "Accept guardian request for 0x05A78D3dB903a58B5FA373E07e5044B95B12aec4";
} else {
emailProof
.maskedSubject = "Accept guardian request for 0x18ABd76E471dB6a75A307bf4dD53ceA89A975B1A";
}
emailProof.emailNullifier = bytes32(vm.parseUint(pubSignals[10]));
emailProof.accountSalt = bytes32(vm.parseUint(pubSignals[32]));
accountSalt = emailProof.accountSalt;
Expand Down Expand Up @@ -252,8 +268,16 @@ contract IntegrationTest is Test {
emailProof.domainName = "gmail.com";
emailProof.publicKeyHash = bytes32(vm.parseUint(pubSignals[9]));
emailProof.timestamp = vm.parseUint(pubSignals[11]);
emailProof
.maskedSubject = "Set the new signer of 0x05A78D3dB903a58B5FA373E07e5044B95B12aec4 to 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720"; // 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 is account 9

// 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 is account 9
if (isZksync) {
emailProof
.maskedSubject = "Set the new signer of 0x05A78D3dB903a58B5FA373E07e5044B95B12aec4 to 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720";
} else {
emailProof
.maskedSubject = "Set the new signer of 0x18ABd76E471dB6a75A307bf4dD53ceA89A975B1A to 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720";
}

emailProof.emailNullifier = bytes32(vm.parseUint(pubSignals[10]));
emailProof.accountSalt = bytes32(vm.parseUint(pubSignals[32]));
require(
Expand Down
120 changes: 60 additions & 60 deletions packages/contracts/test/emails/8453/accept.eml
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
Delivered-To: emailwallet.relayer@gmail.com
Received: by 2002:a05:7108:768a:b0:3a5:7b04:4bb8 with SMTP id w10csp1148426gdt;
Sun, 11 Aug 2024 23:21:32 -0700 (PDT)
X-Received: by 2002:a05:6512:1089:b0:52c:df8c:72cc with SMTP id 2adb3069b0e04-530eea228d1mr6379176e87.43.1723443692771;
Sun, 11 Aug 2024 23:21:32 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1723443692; cv=none;
Delivered-To: rrelayerbob@gmail.com
Received: by 2002:a50:45c6:0:b0:264:9270:cc66 with SMTP id c6csp1350796ecu;
Mon, 12 Aug 2024 08:29:00 -0700 (PDT)
X-Received: by 2002:a05:6214:5701:b0:6bd:699c:59a with SMTP id 6a1803df08f44-6bf4f77408cmr8835936d6.19.1723476540630;
Mon, 12 Aug 2024 08:29:00 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1723476540; cv=none;
d=google.com; s=arc-20160816;
b=pP0SF11rNGNZHVSQWHkbcdmQCjeWDh48mfRxwOEDNe+gjeXNYjBNOVn/30/2wKbgYj
XZnMZotkrlBlZp7cq8J9mZrSM4pjgjgKtxokcdBH6sbXMU+MSL/rVqYKdfpvLL65jfBn
cJFlPfp0Ypj3uwfFg9cjafLk6vAVdA18TNBwjE0NE/CkDSTFXY90SHaXbc2FJ4zQ9+lR
fYe8G4uSDd0veUucwNWVESTIYsQBSWcY++K3JRUaZ5kIVURA4q9Bp+1kIBYu0RtB3X7O
B4il1AIK4bKestqcR8WzU7aEhcV0LobonpXqoq6pkz9RrpATPOe23ZmTGGlBzZLrUs9p
fWxQ==
b=XdhAnSyVPNhLrcDkiFa14s5Ye+7nIVIoAZBrqep75GixiY6xhliTD29zzw41KvPHsQ
I9ZFk4IdAkNtD2PjJQ4urzKkvzU+S42rzKZCU8/91LvIoJbcUHMpQCuySQTGI+v8zDQc
DRsfTo1Gv2QmOkZhjb7kjgLh/ps7hn0BYXKru1JQToe55qfcFQ8HWWQo6CwLphwFhI+0
6c6aRCEcXDymNNYFMEOn8C/mKcvhs5gzSSwktfEZISHLYfAjz3mHP1h3sTnrN3TnfjGP
win5ATBLMi+5eVyKl6gN8ZYn0SwoIX86iK3GrfNcbJsO85rHD+MNzXjfvDzjI20Uq+F7
aeEA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=to:subject:message-id:date:from:mime-version:dkim-signature;
bh=SOpeeAY3pTOG9XvR9db3floNst8fDNhgzYOv8r7rccA=;
fh=AKWw92sdXoMEDdHXKLL06vnizTpObKPGCfYXnoQDKO8=;
b=RRJcc4ruymykRRLGYDOaUSOSHmi8BjZtJ6mRN69fUL4U+MYz47xuQdcatoL9Tdz1VH
hgOT6O5ULSiM8L/r4jrhhXMhavE7IhQxjLJJ69lWvnAAt2k2WcMAfAkrqoDg7vtCMHO7
KJAofPp+DF6IdeunFZq8HlnnrtHYOKf9GHOKylBlfG3WoHpmjbl0l5760iM9p/R1kwS+
ZyOTKsbeFHxajdtVuTYuBGj1y3fielClHfaWoXZA2fNX+Eq2hr8sHTsiCnFO7qSug7CN
qvSwdHi2KSO8LeB1rxijy3ovnc0wO9e07duzTfPub8Ku2UZGoaPphD7w78jBX1F+kilp
KLhA==;
bh=Ha/3DDJ/u01tNH7woB7N10UkCTfbfA/y6SNGNbQZrno=;
fh=OYPr0JdXtRRlM3Htj/E6+khbD9huvtdqkRTmPoW0wko=;
b=mlpmuieLw84UB2iPZrDZeTHtIjSLX2bFQ7uVjcuSqdCeT0Ra8rKHub22VqEDagz6Hh
iQ0OTqs1Pytijcw0g1sHn0O3fw6sQZRTXDRkqtnct6HH5drcJGkd4jjpr9Pym1CQaxnC
SRL48K32C0g/zTL9uCXAWe+qBRlMYd02xg3JLsqBR3PvG2ADLFCnKLnTVudOTc8QUNAQ
hK8xa7nN47mIPV+2p2kv00aJmusOGc4UmDlfafYP5+t6KqJJ1abySEfEu6UQtsc+9boS
RAzuxHHgc4jiEpSakQciy4BKFA3DGJsua8fcIgEy1pnDCCfdqVfgeDpuoqsXE4YsRGcr
pO/A==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass [email protected] header.s=20230601 header.b=L4xZ5Ya+;
spf=pass (google.com: domain of emaiwallet.alice@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=emaiwallet.alice@gmail.com;
dkim=pass [email protected] header.s=20230601 header.b=kIs11UJs;
spf=pass (google.com: domain of emailwalletrelayer987@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=emailwalletrelayer987@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com;
dara=pass [email protected]
Return-Path: <emaiwallet.alice@gmail.com>
Return-Path: <emailwalletrelayer987@gmail.com>
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
by mx.google.com with SMTPS id 2adb3069b0e04-53200ec4ed7sor1060399e87.4.2024.08.11.23.21.32
for <emailwallet.relayer@gmail.com>
by mx.google.com with SMTPS id 6a1803df08f44-6bd82e687b4sor32101386d6.6.2024.08.12.08.29.00
for <rrelayerbob@gmail.com>
(Google Transport Security);
Sun, 11 Aug 2024 23:21:32 -0700 (PDT)
Received-SPF: pass (google.com: domain of emaiwallet.alice@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
Mon, 12 Aug 2024 08:29:00 -0700 (PDT)
Received-SPF: pass (google.com: domain of emailwalletrelayer987@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
Authentication-Results: mx.google.com;
dkim=pass [email protected] header.s=20230601 header.b=L4xZ5Ya+;
spf=pass (google.com: domain of emaiwallet.alice@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=emaiwallet.alice@gmail.com;
dkim=pass [email protected] header.s=20230601 header.b=kIs11UJs;
spf=pass (google.com: domain of emailwalletrelayer987@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=emailwalletrelayer987@gmail.com;
dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com;
dara=pass [email protected]
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1723443692; x=1724048492; dara=google.com;
d=gmail.com; s=20230601; t=1723476540; x=1724081340; dara=google.com;
h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
:date:message-id:reply-to;
bh=SOpeeAY3pTOG9XvR9db3floNst8fDNhgzYOv8r7rccA=;
b=L4xZ5Ya+JmBbErETULE9yOlabSKb+Vm6pWVagLyEXncErms0aqk2w7u8eb1CWzn/Vc
8f2o+vgIE9OK6F5ORm7E/s5ct0i1ZyM1OehZSCPZ1CnMIhEvn9/x/YtovWeYsps7yr2k
ZHGSQXGeemZylE64xWgZVuEMdIXtoCn++Yui+J7AfAXMq5N6OBmLK2ROV1iAWJlqdsEE
KdczgeGntQN9BNE2bFe7m8FnNHEIILQJV7NmBK8JYUW8ylv8/zOW+/uyE+3V7rbqGI2V
IgqqxP/s0meLqGSsAt4io/xPWGkJXWmLYDxNiqBY/hDdwzN7ZU8gzk6GdHT9ymSfb6Jp
iotA==
bh=Ha/3DDJ/u01tNH7woB7N10UkCTfbfA/y6SNGNbQZrno=;
b=kIs11UJsGxLHYsxuMHUikbfKz4X+t4+pdLy8iy6luM0zplvFe24BecDYmohTiFPgLd
ydSOkbBiMJrfsCLqSQSL+La690rsmJz3hH2vWpXHCTxtq9IkOn539mD44EPyI0rpY2pX
+B8V5ppvlYb+PYVyEe1oKtdAw/9U3xgwF0FbBZOsXY9pcXlWe3LCkLHJHsnFThJqO4At
ZEmqakxkwBog3szCj+zStNc2TQKHfgTAIJ0IiC1Qcri8xHw9MZ9t7l8N7f2krGxg/i4q
mH+m5LgHwKiymhpRYpPh4pbXViyJt0ZPX+u8hVNYCu9fuTDw91FZ0h62kQCJU1Fo0gqn
CejQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1723443692; x=1724048492;
d=1e100.net; s=20230601; t=1723476540; x=1724081340;
h=to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=SOpeeAY3pTOG9XvR9db3floNst8fDNhgzYOv8r7rccA=;
b=Z/iwzK6m8ZiJKl0Zm9/JVk5SJ/AJ1sTWGwlq+OmBGo+8DeCLCoQiLVuja32BCzJRt9
9XLyTORExXUeUnsKehhHMGABl048h/E3VdUhYfvNL0vjiPDQR3h9FZ4M811EzY9qSQNC
qdpi7/v11e7iYETlVllAgaHbAg+n3c9nmWxZZ1pE5eUxJ4LqSRvm50sggm0cgaeG/pjA
Aw/KEU6mVoU5c6U/100jddG3xOLxVK+x4lSuFOfz07rHL5CFOo2j5fO5nEyJ5X2HH8TS
PuKiT6LT7PvE8mj/Ea/ZpA14qPT0qLbojSVQMsN1uAIxnUUNwFWFN9LJ6+WEdH+ka9+C
YYiw==
X-Gm-Message-State: AOJu0YxjJ9n/aRobWFNmwXzxQw/TgZFNJgPcjzDUh004WBaTT0kOS9c4
bOysshSBBwejjV6nYqw9YgN+c/VzX+W7l5ZY2IuoBC5sgwcKkzSUUhFWI25pYWc3yRnuKk1p167
SYAPp8/cD4aX/3iPLwOxaT/YZC/lNbQ==
X-Google-Smtp-Source: AGHT+IHGF1mm3a240SBLZcCYxMTcInqmgrlDCVwA1GxF+m+LfdzbU7pTQgMJ/efocrFSGFx+yLoOD+EUeG+pV8xESas=
X-Received: by 2002:a05:6512:3094:b0:52e:969c:db83 with SMTP id
2adb3069b0e04-530ee9951b8mr5321015e87.17.1723443691843; Sun, 11 Aug 2024
23:21:31 -0700 (PDT)
bh=Ha/3DDJ/u01tNH7woB7N10UkCTfbfA/y6SNGNbQZrno=;
b=dCAoi7QTorFaGLllgUbFtLy7SwjjfbmLv2b90AOFzOTDJwxKWuZcuRvIXtn+mNbkxr
R3DSQOVI4kyPn83avG5kJK9rQebgdluW8kRSqTTBGsewDkVoU++XlaH/5Fr4AycL+Jz2
M4H29ErGv5YwfZVkVNchNrZ1wm9PzNmZDryNWfN8MVBSvCyz5rEzbSZYwfPKJ8jdNSpd
m5I4NQn0yaceCbnOvS+ymdLUfH/xsTUiDb12p5mFH1okiffoIH2kba51TERTFQ1cAXhT
6x4oGqDLZ48Wa17J+Pebx22E4kc+qoT44rFbzLKx18UK7QvcDVY84a2rvDK/aHdl89nA
MFcA==
X-Gm-Message-State: AOJu0YxdgZ1gX+YYHJudxoob+1wT6ocah5PIbcqwrkCPA/V6E4p26Ebe
G3qU3UnP4g7Rw60WEroicxfHPklu7dQf0EY42VdDJY7ovlqVUmkTCk8otd8Qag0iY+gMCiaP/ab
5oga2YGGxnm+5Z/FtzkFsnJunAyXQ
X-Google-Smtp-Source: AGHT+IGkhUwt1MpumPRZRv36hsu/nmBtHu3hbsTgn0LxixNgewuPT/XesalvK0ODiL5JhlA73CIktfloJw2rJAZnXDI=
X-Received: by 2002:a05:6214:4906:b0:6b0:6ad8:ebd8 with SMTP id
6a1803df08f44-6bf4f644182mr6446666d6.7.1723476539846; Mon, 12 Aug 2024
08:28:59 -0700 (PDT)
MIME-Version: 1.0
From: emaiwallet.alice@gmail.com
Date: Mon, 12 Aug 2024 15:21:20 +0900
Message-ID: <CAKT76Jc2sGBq17oQXLi2T3t551D7-1jv=d=Q40Xu9X3DWvdaQg@mail.gmail.com>
From: "emailwallet.relayer.2" <emailwalletrelayer987@gmail.com>
Date: Tue, 13 Aug 2024 00:28:48 +0900
Message-ID: <CAKizYf=d4=M0mPicAXU1vd_6GYBt6_qVeoE700Hx-Q6kbcZeeg@mail.gmail.com>
Subject: Accept guardian request for 0x18ABd76E471dB6a75A307bf4dD53ceA89A975B1A
Code 1162ebff40918afe5305e68396f0283eb675901d0387f97d21928d423aaa0b54
To: emailwallet.relayer@gmail.com
Content-Type: multipart/alternative; boundary="0000000000000af8b8061f768148"
To: rrelayerbob@gmail.com
Content-Type: multipart/alternative; boundary="000000000000efbca3061f7e2677"

--0000000000000af8b8061f768148
--000000000000efbca3061f7e2677
Content-Type: text/plain; charset="UTF-8"
--0000000000000af8b8061f768148
--000000000000efbca3061f7e2677
Content-Type: text/html; charset="UTF-8"

<div dir="ltr"><br></div>

--0000000000000af8b8061f768148--
--000000000000efbca3061f7e2677--
Loading

0 comments on commit e21cce1

Please sign in to comment.