Skip to content

Commit f166bf4

Browse files
committed
fix: get to next stage in test
failed locally so it's easier to test, so wanted to save making progress from before
1 parent 31f6432 commit f166bf4

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

packages/auth-server/composables/useConfigurableAccount.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@ export const useConfigurableAccount = () => {
99
const webauthnValidatorAddress = contractsByChain[defaultChain.id].webauthnValidator;
1010

1111
// Get current block to calculate safe fromBlock (avoid RPC block range limits)
12-
// Add timeout to prevent hanging RPC calls in CI (4s to leave room for event queries)
12+
// Add timeout to prevent hanging RPC calls (5s should be sufficient)
1313
const currentBlockPromise = publicClient.getBlockNumber();
14-
const timeoutPromise = new Promise<never>((_, reject) =>
15-
setTimeout(() => reject(new Error("Timeout getting block number after 4 seconds")), 4000),
14+
const blockTimeoutPromise = new Promise<never>((_, reject) =>
15+
setTimeout(() => reject(new Error("Timeout getting block number after 5 seconds")), 5000),
1616
);
17-
const currentBlock = await Promise.race([currentBlockPromise, timeoutPromise]);
17+
const currentBlock = await Promise.race([currentBlockPromise, blockTimeoutPromise]);
1818

19-
// Query last 100k blocks or from genesis, whichever is more recent
20-
const fromBlock = currentBlock > 100000n ? currentBlock - 100000n : 0n;
19+
// Use smaller block range for faster queries (10k blocks should cover recent activity)
20+
// This significantly improves performance - 100k blocks was causing 10s+ query times
21+
const blockRange = 10000n;
22+
const fromBlock = currentBlock > blockRange ? currentBlock - blockRange : 0n;
2123

2224
// FIXME: events should be scoped to the origin domain
2325
// As well, this doesn't seem to be a reliable way of retrieving a `credentialId`
2426
// but works for now.
25-
const [events, removedEvents] = await Promise.all([
27+
28+
// Add timeout to event queries to prevent hanging (10s to handle multiple accounts in test environments)
29+
const eventsPromise = Promise.all([
2630
publicClient.getContractEvents({
2731
address: webauthnValidatorAddress,
2832
abi: WebAuthnValidatorAbi,
@@ -45,6 +49,12 @@ export const useConfigurableAccount = () => {
4549
}),
4650
]);
4751

52+
const eventsTimeoutPromise = new Promise<never>((_, reject) =>
53+
setTimeout(() => reject(new Error("Timeout querying PasskeyCreated/PasskeyRemoved events after 10 seconds")), 10000),
54+
);
55+
56+
const [events, removedEvents] = await Promise.race([eventsPromise, eventsTimeoutPromise]);
57+
4858
if (!events || events.length === 0) {
4959
throw new Error("Account not found");
5060
}

packages/auth-server/pages/recovery/guardian/(actions)/confirm-guardian.vue

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,7 @@ const confirmGuardianAction = async () => {
288288
if (isConnectedSsoGuardian.value) {
289289
// User is logged in as the guardian SSO account - use SSO client with paymaster
290290
confirmationState.value = "getting_sso_client";
291-
292-
// Add timeout to prevent hanging in CI environments (5s - must be shorter than test's 6s check)
293-
const clientPromise = getConfigurableAccount({ address: guardianAddress.value, usePaymaster: true });
294-
const timeoutPromise = new Promise<never>((_, reject) =>
295-
setTimeout(() => reject(new Error("Timeout getting SSO client after 5 seconds")), 5000),
296-
);
297-
298-
client = (await Promise.race([clientPromise, timeoutPromise]))!;
291+
client = (await getConfigurableAccount({ address: guardianAddress.value, usePaymaster: true }))!;
299292
confirmationState.value = "got_sso_client";
300293
} else {
301294
// User needs to connect with wallet (either not logged in or using different account)

packages/auth-server/stores/local-node.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"rpcUrl": "http://localhost:8545",
33
"chainId": 1337,
44
"deployer": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720",
5-
"eoaValidator": "0x6cFA08b105a8674B3249CaA3B4405783A0D8a58B",
6-
"sessionValidator": "0x7079ade5d4C71aE7868E6AC8553148FfC3D8d660",
7-
"webauthnValidator": "0xE619369f26285FEd402bd0c3526aEb1faf2BE2C0",
8-
"guardianExecutor": "0x85ed36BD17265a4eb2f6d87FAd3E6277066986f0",
9-
"accountImplementation": "0xE604bd7C1d6dde44Ebe434d3BE6FD5fD9145C860",
10-
"beacon": "0xb3b3496CC339d80b2182a3985FeF5EBE60bc896C",
11-
"factory": "0x197072f17a5e1A35C1909999e6f3cFEDe5A42BB8",
12-
"testPaymaster": "0xfE88Fdf39d345eD27a600852962A51f9EC6Ee3f4",
13-
"mockPaymaster": "0xfE88Fdf39d345eD27a600852962A51f9EC6Ee3f4",
5+
"eoaValidator": "0xEc5AB17Cc35221cdF54EaEb0868eA82d4D75D9Bf",
6+
"sessionValidator": "0xd512108c249cC5ec5370491AD916Be31bb88Dad2",
7+
"webauthnValidator": "0xadF4aCF92F0A1398d50402Db551feb92b1125DAb",
8+
"guardianExecutor": "0x0efdDbB35e9BBc8c762E5B4a0f627210b6c9A721",
9+
"accountImplementation": "0xd7400e73bA36388c71C850aC96288E390bd22Ebe",
10+
"beacon": "0xbe38809914b552f295cD3e8dF2e77b3DA69cBC8b",
11+
"factory": "0xb11632A56608Bad85562FaE6f1AF269d1fE9e8e6",
12+
"testPaymaster": "0x287E8b17ce85B451a906EA8A179212e5a24680A3",
13+
"mockPaymaster": "0x287E8b17ce85B451a906EA8A179212e5a24680A3",
1414
"entryPoint": "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
1515
"bundlerUrl": "http://localhost:4337"
1616
}

packages/auth-server/tests/guardian.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,9 @@ test("Guardian flow: full recovery execution", async ({ page, context: baseConte
833833
break;
834834
}
835835

836-
// If stuck in getting state for more than 6 seconds, that's the issue
837-
if (i >= 3 && currentState?.includes("getting")) {
836+
// If stuck in getting state for more than 16 seconds, that's the issue
837+
// (Allows 5s for getBlockNumber + 10s for event queries + buffer)
838+
if (i >= 8 && currentState?.includes("getting")) {
838839
console.log(`⚠️ Stuck in ${currentState} for ${i * 2} seconds`);
839840
await guardianPage.screenshot({ path: "test-results/stuck-getting-client-debug.png" });
840841
const bodyText = await guardianPage.locator("body").textContent();

0 commit comments

Comments
 (0)