Skip to content

Commit 4cd30d5

Browse files
committed
chore: fix prettier lint
1 parent 8ed88d6 commit 4cd30d5

File tree

12 files changed

+242
-171
lines changed

12 files changed

+242
-171
lines changed

l2-to-l1-relayer/FINALIZE_README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
Your transaction has been successfully verified and is ready for L1 execution!
66

7-
**L2 Transaction**: `0xb20b44bf8761c6592d3e367b0633ccbf038c123d7e40b9b623095abeb2273de4`
7+
**L2 Transaction**:
8+
`0xb20b44bf8761c6592d3e367b0633ccbf038c123d7e40b9b623095abeb2273de4`
89

910
**Status**:
1011

@@ -22,6 +23,7 @@ The executor address needs Sepolia ETH to pay for gas:
2223
### Get Sepolia ETH
2324

2425
1. **Alchemy Faucet** (Recommended):
26+
2527
- Visit: <https://www.alchemy.com/faucets/ethereum-sepolia>
2628
- Enter address: `0x18ac402d33706c303cD559FA6B2F2f14Fae75307`
2729
- Receive ~0.1 ETH
@@ -79,15 +81,19 @@ You should see:
7981

8082
When the transaction executes:
8183

82-
1. **Shadow Account Deployment**: Your shadow account on L1 gets deployed (if first time)
84+
1. **Shadow Account Deployment**: Your shadow account on L1 gets deployed (if
85+
first time)
86+
8387
- Address: Deterministic based on your L2 account
8488

8589
2. **Bundle Execution**: Shadow account executes the Aave deposit:
90+
8691
- Calls Aave WETH Gateway
8792
- Deposits 0.01 ETH into Aave Pool
8893
- Receives aWETH tokens
8994

90-
3. **Check Aave Balance**: After execution, check your aave balance in the wallet app
95+
3. **Check Aave Balance**: After execution, check your aave balance in the
96+
wallet app
9197

9298
## 🔍 Monitoring
9399

@@ -121,7 +127,8 @@ https://sepolia.etherscan.io/tx/0x...
121127

122128
### Error: "Could not get L2-to-L1 proof"
123129

124-
**Cause**: Transaction not finalized yet (needs ~15 minutes from L2 transaction time)
130+
**Cause**: Transaction not finalized yet (needs ~15 minutes from L2 transaction
131+
time)
125132

126133
**Solution**: Wait and try again later
127134

l2-to-l1-relayer/README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# L2-to-L1 Relayer Service
22

3-
Automated relayer service that monitors L2 `sendBundleToL1` transactions and executes them on L1 Sepolia after finalization.
3+
Automated relayer service that monitors L2 `sendBundleToL1` transactions and
4+
executes them on L1 Sepolia after finalization.
45

56
## Overview
67

78
When users deposit/withdraw via Aave on the passkey wallet app:
89

9-
1. **L2 Transaction**: User signs transaction calling `L2InteropCenter.sendBundleToL1()`
10+
1. **L2 Transaction**: User signs transaction calling
11+
`L2InteropCenter.sendBundleToL1()`
1012
2. **~15 min wait**: L2-to-L1 message gets proven/finalized on L1
11-
3. **L1 Execution**: This relayer automatically calls `L1InteropHandler.receiveInteropFromL2()` to execute the bundle
13+
3. **L1 Execution**: This relayer automatically calls
14+
`L1InteropHandler.receiveInteropFromL2()` to execute the bundle
1215

1316
## Architecture
1417

@@ -56,13 +59,15 @@ npm install
5659

5760
The `.env` file is already configured with:
5861

59-
- Executor private key: `0x1cfcab2cf5ad255cb3387f7fdca2651a61377b334a2a3daa4af86eb476369105`
62+
- Executor private key:
63+
`0x1cfcab2cf5ad255cb3387f7fdca2651a61377b334a2a3daa4af86eb476369105`
6064
- L2 RPC: ZKSync OS Testnet
6165
- L1 RPC: Sepolia
6266
- L2InteropCenter: `0xc64315efbdcD90B71B0687E37ea741DE0E6cEFac`
6367
- L1InteropHandler: `0xB0dD4151fdcCaAC990F473533C15BcF8CE10b1de`
6468

65-
**Important**: Make sure the executor address has ETH on **L1 Sepolia** to pay gas fees!
69+
**Important**: Make sure the executor address has ETH on **L1 Sepolia** to pay
70+
gas fees!
6671

6772
### 3. Fund the Executor
6873

@@ -194,7 +199,8 @@ The relayer automatically retries after 5 minutes.
194199

195200
For production, consider:
196201

197-
1. **Persistent Storage**: Store pending messages in a database (Redis, PostgreSQL)
202+
1. **Persistent Storage**: Store pending messages in a database (Redis,
203+
PostgreSQL)
198204
2. **Multiple Relayers**: Run multiple instances for redundancy
199205
3. **Better RPC**: Use paid RPC providers (Alchemy, Infura) for reliability
200206
4. **Monitoring**: Add Prometheus metrics and alerting

packages/bundler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ Send ERC-4337 user operations to: `http://localhost:4337`
109109

110110
Send standard JSON-RPC calls (e.g. `eth_getBalance`) to: `http://localhost:4339`
111111

112-
Both proxies automatically forward requests and add permissive CORS headers
113-
for browser compatibility.
112+
Both proxies automatically forward requests and add permissive CORS headers for
113+
browser compatibility.
114114

115115
## Development
116116

passkey-wallet-app/DEPLOYMENT_SCRIPT.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
## Overview
44

5-
This script allows you to deploy a smart account using an EOA (Externally Owned Account) with Sepolia ETH,
6-
instead of relying on the bundler to deploy it.
5+
This script allows you to deploy a smart account using an EOA (Externally Owned
6+
Account) with Sepolia ETH, instead of relying on the bundler to deploy it.
77

88
## Why Use This?
99

10-
The bundler's counterfactual deployment can fail with `AA13 initCode failed or OOG` errors. Using this script, you can:
10+
The bundler's counterfactual deployment can fail with
11+
`AA13 initCode failed or OOG` errors. Using this script, you can:
1112

1213
- Deploy the account from an EOA that you control
1314
- Verify the deployment succeeded
@@ -27,7 +28,8 @@ Edit `.env` and add your private key:
2728
DEPLOYER_PRIVATE_KEY=0x... # Your EOA private key (must have Sepolia ETH)
2829
```
2930

30-
**⚠️ Security Warning**: Never commit `.env` to git! It's already in `.gitignore`.
31+
**⚠️ Security Warning**: Never commit `.env` to git! It's already in
32+
`.gitignore`.
3133

3234
### 2. Get Your Passkey Data
3335

@@ -130,21 +132,24 @@ Once deployed, you can:
130132
## Important Notes
131133

132134
1. **Origin Must Match**: The script uses `http://localhost:3000` as the origin.
133-
If you're using a different origin in the app, update line 90 in `deploy-account.js`.
135+
If you're using a different origin in the app, update line 90 in
136+
`deploy-account.js`.
134137

135138
2. **One-Time Operation**: You only need to deploy the account once. After that,
136-
it exists on-chain forever (for that specific passkey).
139+
it exists on-chain forever (for that specific passkey).
137140

138141
3. **Gas Costs**: Deployment costs approximately 0.005-0.01 ETH on Sepolia.
139142

140-
4. **Same Passkey = Same Account**: The account address is deterministic based on your credential ID.
141-
Same passkey always generates the same account address.
143+
4. **Same Passkey = Same Account**: The account address is deterministic based
144+
on your credential ID. Same passkey always generates the same account
145+
address.
142146

143147
## Alternative: Deploy from App (Advanced)
144148

145-
If you want to avoid using this script, you can also deploy programmatically by funding the account address BEFORE deployment,
146-
then the first transaction will deploy it automatically.
147-
However, this is more complex and requires careful gas estimation.
149+
If you want to avoid using this script, you can also deploy programmatically by
150+
funding the account address BEFORE deployment, then the first transaction will
151+
deploy it automatically. However, this is more complex and requires careful gas
152+
estimation.
148153

149154
## Security Best Practices
150155

passkey-wallet-app/FIXES_APPLIED.md

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,34 @@ startAuthentication() was not called correctly
1111
TypeError: base64URLString.replace is not a function
1212
```
1313

14-
**Root Cause:**
15-
The `startAuthentication` function from `@simplewebauthn/browser` expects base64url **strings**, but we were passing arrays/bytes.
14+
**Root Cause:** The `startAuthentication` function from
15+
`@simplewebauthn/browser` expects base64url **strings**, but we were passing
16+
arrays/bytes.
1617

1718
**Fix Applied:**
1819

1920
```javascript
2021
// Before (WRONG):
2122
const authOptions = {
22-
challenge: Array.from(challenge), // ❌ Array
23-
allowCredentials: [{
24-
id: base64UrlToBytes(passkeyData.credentialId), // ❌ Bytes
25-
type: 'public-key',
26-
}],
23+
challenge: Array.from(challenge), // ❌ Array
24+
allowCredentials: [
25+
{
26+
id: base64UrlToBytes(passkeyData.credentialId), // ❌ Bytes
27+
type: "public-key",
28+
},
29+
],
2730
};
2831

2932
// After (CORRECT):
30-
const challengeBase64 = bytesToBase64Url(challenge); // Convert to base64url string
33+
const challengeBase64 = bytesToBase64Url(challenge); // Convert to base64url string
3134
const authOptions = {
32-
challenge: challengeBase64, // ✅ String
33-
allowCredentials: [{
34-
id: passkeyData.credentialId, // ✅ String (already base64url)
35-
type: 'public-key',
36-
}],
35+
challenge: challengeBase64, // ✅ String
36+
allowCredentials: [
37+
{
38+
id: passkeyData.credentialId, // ✅ String (already base64url)
39+
type: "public-key",
40+
},
41+
],
3742
};
3843
```
3944

@@ -50,24 +55,23 @@ AbiFunctionNotFoundError: Function not found on ABI.
5055
Make sure you are using the correct ABI and that the function exists on it.
5156
```
5257

53-
**Root Cause:**
54-
Using `encodeFunctionData` with `parseAbiParameters` is incorrect.
55-
`encodeFunctionData` expects a full function ABI with a function name,
56-
while `parseAbiParameters` only provides parameter types.
58+
**Root Cause:** Using `encodeFunctionData` with `parseAbiParameters` is
59+
incorrect. `encodeFunctionData` expects a full function ABI with a function
60+
name, while `parseAbiParameters` only provides parameter types.
5761

5862
**Fix Applied:**
5963

6064
```javascript
6165
// Before (WRONG):
6266
return encodeFunctionData({
63-
abi: parseAbiParameters('bytes, string, uint256, uint256, bytes'),
67+
abi: parseAbiParameters("bytes, string, uint256, uint256, bytes"),
6468
values: [authenticatorData, clientDataJSON, r, s, credentialId],
6569
});
6670

6771
// After (CORRECT):
6872
return encodeAbiParameters(
69-
parseAbiParameters('bytes, string, uint256, uint256, bytes'),
70-
[authenticatorData, clientDataJSON, r, s, credentialId]
73+
parseAbiParameters("bytes, string, uint256, uint256, bytes"),
74+
[authenticatorData, clientDataJSON, r, s, credentialId],
7175
);
7276
```
7377

@@ -87,7 +91,8 @@ Changes made:
8791

8892
1. Convert challenge to base64url string before passing to `startAuthentication`
8993
2. Use original base64url credential ID string (not bytes)
90-
3. Replace `encodeFunctionData` with `encodeAbiParameters` for signature encoding
94+
3. Replace `encodeFunctionData` with `encodeAbiParameters` for signature
95+
encoding
9196

9297
```javascript
9398
async function signWithPasskey(hash) {
@@ -97,12 +102,14 @@ async function signWithPasskey(hash) {
97102
const challengeBase64 = bytesToBase64Url(challenge);
98103

99104
const authOptions = {
100-
challenge: challengeBase64, // ✅ String format
101-
allowCredentials: [{
102-
id: passkeyData.credentialId, // ✅ String format
103-
type: 'public-key',
104-
}],
105-
userVerification: 'preferred',
105+
challenge: challengeBase64, // ✅ String format
106+
allowCredentials: [
107+
{
108+
id: passkeyData.credentialId, // ✅ String format
109+
type: "public-key",
110+
},
111+
],
112+
userVerification: "preferred",
106113
timeout: 60000,
107114
};
108115

@@ -112,8 +119,8 @@ async function signWithPasskey(hash) {
112119

113120
// ✅ FIX 2: Use encodeAbiParameters instead of encodeFunctionData
114121
return encodeAbiParameters(
115-
parseAbiParameters('bytes, string, uint256, uint256, bytes'),
116-
[authenticatorDataHex, clientDataJSONString, r, s, credentialIdHex]
122+
parseAbiParameters("bytes, string, uint256, uint256, bytes"),
123+
[authenticatorDataHex, clientDataJSONString, r, s, credentialIdHex],
117124
);
118125
}
119126
```
@@ -160,11 +167,13 @@ return keccak256(packed);
160167
### When to Use Each Encoding Function
161168

162169
1. **`encodeFunctionData`**
170+
163171
- Use for: Encoding function calls with function name
164172
- Requires: Full function ABI with `name`, `inputs`, `outputs`
165173
- Example: `execute(address to, uint256 value, bytes data)`
166174

167175
2. **`encodeAbiParameters`**
176+
168177
- Use for: Encoding raw parameters without function name
169178
- Requires: Only parameter types via `parseAbiParameters`
170179
- Example: Encoding struct data, signature data, or raw parameters
@@ -241,14 +250,15 @@ Do not convert these to arrays or bytes - keep them as base64url strings!
241250

242251
### Why These Errors Occurred
243252

244-
1. **API Expectations Mismatch**: The `@simplewebauthn/browser` library has specific format requirements
245-
that weren't immediately obvious from the documentation.
253+
1. **API Expectations Mismatch**: The `@simplewebauthn/browser` library has
254+
specific format requirements that weren't immediately obvious from the
255+
documentation.
246256

247-
2. **Function Naming Confusion**: `encodeFunctionData` and `encodeAbiParameters` sound similar
248-
but have different purposes and requirements.
257+
2. **Function Naming Confusion**: `encodeFunctionData` and `encodeAbiParameters`
258+
sound similar but have different purposes and requirements.
249259

250260
3. **Type Conversion**: JavaScript's flexibility with types (strings, arrays,
251-
Uint8Arrays) can lead to passing the wrong type without compile-time errors.
261+
Uint8Arrays) can lead to passing the wrong type without compile-time errors.
252262

253263
### Prevention
254264

@@ -270,12 +280,12 @@ Bundler error: EntryPoint 0x0000000071727De22E5E9d8BAf0edAc6f37da032 not support
270280
supported EntryPoints: 0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108
271281
```
272282

273-
**Root Cause:**
274-
The ZKsync SSO bundler uses a custom EntryPoint contract at `0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108` instead of the
275-
standard ERC-4337 v0.7 EntryPoint.
283+
**Root Cause:** The ZKsync SSO bundler uses a custom EntryPoint contract at
284+
`0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108` instead of the standard ERC-4337
285+
v0.7 EntryPoint.
276286

277-
**Fix Applied:**
278-
Updated the EntryPoint address to match the bundler's supported address:
287+
**Fix Applied:** Updated the EntryPoint address to match the bundler's supported
288+
address:
279289

280290
```javascript
281291
// Before:

0 commit comments

Comments
 (0)