Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import logger from "../../../../config/logger";
import { MOONBEAM_EXECUTOR_PRIVATE_KEY, MOONBEAM_RECEIVER_CONTRACT_ADDRESS } from "../../../../constants/constants";
import QuoteTicket from "../../../../models/quoteTicket.model";
import RampState from "../../../../models/rampState.model";
import { RecoverablePhaseError } from "../../../errors/phase-error";
import { BasePhaseHandler } from "../base-phase-handler";
import { StateMetadata } from "../meta-state-types";

Expand Down Expand Up @@ -80,7 +81,10 @@ export class MoonbeamToPendulumPhaseHandler extends BasePhaseHandler {
}
} catch (e) {
logger.error(e);
throw new Error("MoonbeamToPendulumPhaseHandler: Failed to wait for hash registration in split receiver.");
throw new RecoverablePhaseError(
"MoonbeamToPendulumPhaseHandler: Failed to wait for hash registration in split receiver.",
30
);
}

let obtainedHash: `0x${string}` | undefined = moonbeamXcmTransactionHash;
Expand Down Expand Up @@ -129,14 +133,14 @@ export class MoonbeamToPendulumPhaseHandler extends BasePhaseHandler {
}
} catch (e) {
console.error("Error while executing moonbeam split contract transaction:", e);
throw new Error("MoonbeamToPendulumPhaseHandler: Failed to send XCM transaction");
throw new RecoverablePhaseError("MoonbeamToPendulumPhaseHandler: Failed to send XCM transaction", 30);
}

try {
await waitUntilTrue(didInputTokenArriveOnPendulum, 5000);
} catch (e) {
console.error("Error while waiting for transaction receipt:", e);
throw new Error("MoonbeamToPendulumPhaseHandler: Failed to wait for tokens to arrive on Pendulum.");
throw new RecoverablePhaseError("MoonbeamToPendulumPhaseHandler: Failed to wait for tokens to arrive on Pendulum.", 30);
}

return this.transitionToNextPhase(state, this.nextPhaseSelector(state));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler {

await new Promise(resolve => setTimeout(resolve, delay));
} else {
throw new Error(`SquidRouterPhaseHandler: Error waiting for transaction confirmation: ${error}`);
throw this.createRecoverableError(`SquidRouterPhaseHandler: Error waiting for transaction confirmation: ${error}`);
}
}
}
Expand All @@ -220,7 +220,7 @@ export class SquidRouterPhaseHandler extends BasePhaseHandler {
return await publicClient.getTransactionCount({ address });
} catch (error) {
logger.error("Error getting nonce", error);
throw new Error("Failed to get transaction nonce");
throw this.createRecoverableError("Failed to get transaction nonce");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/api/services/phases/phase-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class PhaseProcessor {
private static instance: PhaseProcessor;
private retriesMap = new Map<string, number>();
private readonly MAX_RETRIES = 8;
private readonly MAX_EXECUTION_TIME_MS = 20 * 60 * 1000; // 20 minutes
private readonly MAX_EXECUTION_TIME_MS = 10 * 60 * 1000; // 10 minutes
private lockedRamps = new Set<string>();

/**
Expand Down