Skip to content

Commit 3abea08

Browse files
committed
chore: remove paymaster for rich accounts
will go back to paymaster again soon
1 parent 503b6b2 commit 3abea08

File tree

7 files changed

+93
-111
lines changed

7 files changed

+93
-111
lines changed

examples/nft-quest/tests/main.spec.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ test.beforeEach(async ({ page }) => {
4545
});
4646

4747
test("Create account, session key, and mint NFT", async ({ page, context }) => {
48+
test.setTimeout(180000); // 3 minutes for this complex test
49+
4850
// Click the Let's Go button and wait for popup
4951
const popupPromise = context.waitForEvent("page");
5052
await page.getByRole("button", { name: "Let's Go" }).click();
@@ -112,14 +114,25 @@ test("Create account, session key, and mint NFT", async ({ page, context }) => {
112114
// Click connect to authorize the session - this triggers another passkey signature
113115
await popup.getByTestId("connect").click();
114116

115-
// Wait for passkey signature prompt and session creation to complete
116-
await page.waitForTimeout(3000);
117+
// Wait for popup to close (indicates session was created successfully)
118+
await popup.waitForEvent("close", { timeout: 15000 });
119+
120+
// Wait a bit more for session to be fully initialized
121+
await page.waitForTimeout(2000);
122+
123+
// Listen for any console errors during mint
124+
page.on("console", (msg) => {
125+
if (msg.type() === "error") {
126+
console.log(`Main page error: ${msg.text()}`);
127+
}
128+
});
117129

118130
// Mint your NFT
119131
await page.getByRole("button", { name: "Mint 100% free NFT" }).click();
120132

121133
// Wait for minting to complete - this can take longer as it involves UserOperation submission
122-
await expect(page.getByTestId("spinner")).not.toBeVisible({ timeout: 60000 });
134+
// Increased timeout to 120s to allow for slower e2e environment
135+
await expect(page.getByTestId("spinner")).not.toBeVisible({ timeout: 120000 });
123136

124137
// Verify successful mint
125138
await expect(page.getByText("You've got Zeek.")).toBeVisible({ timeout: 15000 });

packages/auth-server-api/src/handlers/deploy-account.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,14 @@ export const deployAccountHandler = async (req: Request, res: Response): Promise
128128
// Extract deployed address from logs
129129
let deployedAddress: Address;
130130
try {
131+
console.log("Receipt logs count:", receipt.logs.length);
132+
if (receipt.logs.length > 0) {
133+
console.log("First log topics:", receipt.logs[0].topics);
134+
}
131135
deployedAddress = getAccountAddressFromLogs(receipt.logs);
132136
} catch (error) {
133137
console.error("Failed to extract address from logs:", error);
138+
console.error("All receipt logs:", JSON.stringify(receipt.logs, null, 2));
134139
const errorMessage = error instanceof Error ? error.message : "";
135140
res.status(500).json({
136141
error: `Deployment failed: Could not extract account address from logs. ${errorMessage}`,
@@ -140,6 +145,24 @@ export const deployAccountHandler = async (req: Request, res: Response): Promise
140145

141146
console.log("Account deployed at:", deployedAddress);
142147

148+
// Fund the newly created account with ETH for gas (development only)
149+
try {
150+
const fundingAmount = BigInt("1000000000000000000"); // 1 ETH
151+
const fundingHash = await walletClient.sendTransaction({
152+
to: deployedAddress,
153+
value: fundingAmount,
154+
});
155+
console.log("Funding transaction sent:", fundingHash);
156+
157+
await waitForTransactionReceipt(publicClient, {
158+
hash: fundingHash,
159+
});
160+
console.log("Account funded with 1 ETH");
161+
} catch (error) {
162+
console.error("Failed to fund account:", error);
163+
// Don't fail the deployment if funding fails
164+
}
165+
143166
// Return success response
144167
res.json({ address: deployedAddress });
145168
} catch (error) {
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"beacon": "0xF7ee83801f5937E357412dE4d4408bb88408b272",
3-
"eoaValidator": "0xaEb7C09a35f1FD63F510Dce81BffAF9FEEAcd507",
4-
"sessionValidator": "0x7f052D5a131E90147D33573D01f406A8181A0F4d",
5-
"webauthnValidator": "0xa7146dB81e9E0f3919DA7fbeC4e23b019d2cfc4f",
6-
"factory": "0xA8B1d13371e2310D39EfE63b4a75ce9A1e53cbdd",
2+
"beacon": "0xd49b4bf75E90f8A839e2a93D8aa950370062259a",
3+
"eoaValidator": "0xde612c1b1C06982551157FB53E61a123c6045DFC",
4+
"sessionValidator": "0x41b6892Bf7aFB4feeACDd96AAf34205124380A47",
5+
"webauthnValidator": "0xE854be130245223cBDD20c85f4F126996669Cf08",
6+
"factory": "0x099961116Ba4371a2516034233177Ee3eFcdaf39",
77
"bundlerUrl": "http://localhost:4337",
8-
"paymaster": "0x6A1855c023776da2f8049D453bB1B9902133C3B4"
8+
"paymaster": ""
99
}

packages/sdk-4337/src/client-auth-server/Signer.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -156,29 +156,10 @@ export class Signer implements SignerInterface {
156156
});
157157

158158
// Build paymaster configuration if paymaster address is available
159-
const paymasterAddress = chainInfo.paymaster;
160-
const paymasterConfig = paymasterAddress
161-
? {
162-
async getPaymasterData() {
163-
// For a simple verifying paymaster, we just need to specify the paymaster address
164-
// The MockPaymaster doesn't require any additional data
165-
return {
166-
paymaster: paymasterAddress,
167-
paymasterData: "0x" as `0x${string}`,
168-
paymasterVerificationGasLimit: 500_000n,
169-
paymasterPostOpGasLimit: 100_000n,
170-
};
171-
},
172-
async getPaymasterStubData() {
173-
return {
174-
paymaster: paymasterAddress,
175-
paymasterData: "0x" as `0x${string}`,
176-
paymasterVerificationGasLimit: 500_000n,
177-
paymasterPostOpGasLimit: 100_000n,
178-
};
179-
},
180-
}
181-
: undefined;
159+
// NOTE: Paymaster support is currently DISABLED to avoid signature issues
160+
// When paymaster fields are included in the UserOperation but not in the signature hash,
161+
// it causes AA24 signature validation errors
162+
const paymasterConfig = undefined; // Paymaster disabled
182163

183164
this.bundlerClients[chain.id] = createBundlerClient({
184165
client: publicClient,

packages/sdk-4337/src/client/ecdsa/account.ts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -133,28 +133,21 @@ export async function toEcdsaSmartAccount<
133133
async signUserOperation(params) {
134134
const sender = await this.getAddress();
135135

136-
// Create params for hash computation
137-
const hashParams = new EncodeGetUserOperationHashParams(
138-
sender,
139-
params.nonce.toString(),
140-
params.callData,
141-
params.callGasLimit.toString(),
142-
params.verificationGasLimit.toString(),
143-
params.preVerificationGas.toString(),
144-
params.maxFeePerGas.toString(),
145-
params.maxPriorityFeePerGas.toString(),
146-
);
147-
148-
// Add paymaster fields if present (for sponsored operations)
149-
if (params.paymaster) {
150-
hashParams.paymaster = params.paymaster;
151-
hashParams.paymasterData = params.paymasterData || "0x";
152-
hashParams.paymasterVerificationGasLimit = params.paymasterVerificationGasLimit?.toString();
153-
hashParams.paymasterPostOpGasLimit = params.paymasterPostOpGasLimit?.toString();
154-
}
155-
156-
// Encode call data for EntryPoint.getUserOpHash() using Rust SDK
157-
const callData = encode_get_user_operation_hash_call_data(hashParams) as Hex;
136+
// Encode call data for EntryPoint.getUserOpHash()
137+
// NOTE: We do NOT include paymaster fields in the hash computation
138+
// This ensures the signature is computed without paymaster data
139+
const callData = encode_get_user_operation_hash_call_data(
140+
new EncodeGetUserOperationHashParams(
141+
sender,
142+
params.nonce.toString(),
143+
params.callData,
144+
params.callGasLimit.toString(),
145+
params.verificationGasLimit.toString(),
146+
params.preVerificationGas.toString(),
147+
params.maxFeePerGas.toString(),
148+
params.maxPriorityFeePerGas.toString(),
149+
),
150+
) as Hex;
158151

159152
// Result is the bytes32 hash from EntryPoint.getUserOpHash()
160153
const { data: userOpHash } = await client.call({

packages/sdk-4337/src/client/passkey/account.ts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -140,28 +140,21 @@ export async function toPasskeySmartAccount<
140140
async signUserOperation(params) {
141141
const sender = await this.getAddress();
142142

143-
// Create params for hash computation
144-
const hashParams = new EncodeGetUserOperationHashParams(
145-
sender,
146-
params.nonce.toString(),
147-
params.callData,
148-
params.callGasLimit.toString(),
149-
params.verificationGasLimit.toString(),
150-
params.preVerificationGas.toString(),
151-
params.maxFeePerGas.toString(),
152-
params.maxPriorityFeePerGas.toString(),
153-
);
154-
155-
// Add paymaster fields if present (for sponsored operations)
156-
if (params.paymaster) {
157-
hashParams.paymaster = params.paymaster;
158-
hashParams.paymasterData = params.paymasterData || "0x";
159-
hashParams.paymasterVerificationGasLimit = params.paymasterVerificationGasLimit?.toString();
160-
hashParams.paymasterPostOpGasLimit = params.paymasterPostOpGasLimit?.toString();
161-
}
162-
163-
// Encode call data for EntryPoint.getUserOpHash() using Rust SDK
164-
const callData = encode_get_user_operation_hash_call_data(hashParams) as Hex;
143+
// Encode call data for EntryPoint.getUserOpHash()
144+
// NOTE: We do NOT include paymaster fields in the hash computation
145+
// This ensures the signature is computed without paymaster data
146+
const callData = encode_get_user_operation_hash_call_data(
147+
new EncodeGetUserOperationHashParams(
148+
sender,
149+
params.nonce.toString(),
150+
params.callData,
151+
params.callGasLimit.toString(),
152+
params.verificationGasLimit.toString(),
153+
params.preVerificationGas.toString(),
154+
params.maxFeePerGas.toString(),
155+
params.maxPriorityFeePerGas.toString(),
156+
),
157+
) as Hex;
165158

166159
// Result is the bytes32 hash from EntryPoint.getUserOpHash()
167160
const { data: userOpHash } = await client.call({

packages/sdk-4337/src/client/session/account.ts

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -172,43 +172,22 @@ export async function toSessionSmartAccount<
172172
verificationGasLimit: verificationGasLimit.toString(),
173173
preVerificationGas: preVerificationGas.toString(),
174174
});
175-
console.debug("[toSessionSmartAccount] signUserOperation paymaster params:", {
176-
paymaster: params.paymaster || "(none)",
177-
paymasterData: params.paymasterData || "(none)",
178-
paymasterVerificationGasLimit: params.paymasterVerificationGasLimit?.toString() || "(none)",
179-
paymasterPostOpGasLimit: params.paymasterPostOpGasLimit?.toString() || "(none)",
180-
});
181-
182-
// Create params for hash computation
183-
const hashParams = new EncodeGetUserOperationHashParams(
184-
sender,
185-
nonce.toString(),
186-
(params.callData ?? "0x") as Hex,
187-
callGasLimit.toString(),
188-
verificationGasLimit.toString(),
189-
preVerificationGas.toString(),
190-
maxFeePerGas.toString(),
191-
maxPriorityFeePerGas.toString(),
192-
);
193-
194-
// Add paymaster fields if present (for sponsored operations)
195-
if (params.paymaster) {
196-
hashParams.paymaster = params.paymaster;
197-
hashParams.paymasterData = params.paymasterData || "0x";
198-
hashParams.paymasterVerificationGasLimit = params.paymasterVerificationGasLimit?.toString();
199-
hashParams.paymasterPostOpGasLimit = params.paymasterPostOpGasLimit?.toString();
200-
console.debug("[toSessionSmartAccount] Paymaster fields set:", {
201-
paymaster: hashParams.paymaster,
202-
paymasterData: hashParams.paymasterData,
203-
paymasterVerificationGasLimit: hashParams.paymasterVerificationGasLimit,
204-
paymasterPostOpGasLimit: hashParams.paymasterPostOpGasLimit,
205-
});
206-
} else {
207-
console.debug("[toSessionSmartAccount] No paymaster in params");
208-
}
209175

210176
// Encode call data for EntryPoint.getUserOpHash()
211-
const callData = encode_get_user_operation_hash_call_data(hashParams) as Hex;
177+
// NOTE: We do NOT include paymaster fields in the hash computation
178+
// This ensures the signature is computed without paymaster data
179+
const callData = encode_get_user_operation_hash_call_data(
180+
new EncodeGetUserOperationHashParams(
181+
sender,
182+
nonce.toString(),
183+
(params.callData ?? "0x") as Hex,
184+
callGasLimit.toString(),
185+
verificationGasLimit.toString(),
186+
preVerificationGas.toString(),
187+
maxFeePerGas.toString(),
188+
maxPriorityFeePerGas.toString(),
189+
),
190+
) as Hex;
212191

213192
// Get user operation hash from EntryPoint
214193
const { data: userOpHash } = await client.call({

0 commit comments

Comments
 (0)