Skip to content

Commit 65e4520

Browse files
authored
[Bridging] Update bridge information table creation logic. (#3095)
1 parent 548de98 commit 65e4520

File tree

2 files changed

+26
-52
lines changed

2 files changed

+26
-52
lines changed

indexer/services/comlink/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const configSchema = {
112112
ZERODEV_API_KEY: parseString({ default: '' }),
113113
ZERODEV_API_BASE_URL: parseString({ default: 'https://rpc.zerodev.app/api/v3' }),
114114
BRIDGE_THRESHOLD_USDC: parseInteger({ default: 20 }),
115-
CALL_POLICY_VALUE_LIMIT: parseBigInt({ default: BigInt(100_000_000_000) }),
115+
CALL_POLICY_VALUE_LIMIT: parseBigInt({ default: BigInt(100_000_000_000_000_000_000) }),
116116
// on-chain signer to kick off the skip bridge.
117117
APPROVAL_SIGNER_PUBLIC_ADDRESS: parseString({ default: '0x3FC11ff27e5373c88EA142d2EdF5492d0839980B' }),
118118
// if policy approvals are enabled.

indexer/services/comlink/src/controllers/api/v4/skip-bridge-controller.ts

Lines changed: 25 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -498,35 +498,6 @@ class BridgeController extends Controller {
498498
},
499499
});
500500

501-
// Create bridge information record before sending the transaction
502-
const bridgeRecord: BridgeInformationCreateObject = {
503-
from_address: fromAddress,
504-
chain_id: chainId,
505-
amount,
506-
created_at: new Date().toISOString(),
507-
};
508-
509-
let bridgeRecordId: string | undefined;
510-
try {
511-
const createdRecord = await BridgeInformationTable.create(bridgeRecord);
512-
bridgeRecordId = createdRecord.id;
513-
logger.info({
514-
at: `${controllerName}#startEvmBridge`,
515-
message: 'Bridge information record created',
516-
bridgeRecordId,
517-
fromAddress,
518-
chainId,
519-
amount,
520-
});
521-
} catch (error) {
522-
logger.error({
523-
at: `${controllerName}#startEvmBridge`,
524-
message: 'Failed to create bridge information record',
525-
error,
526-
});
527-
// Continue with bridge operation even if tracking fails
528-
}
529-
530501
// sending the userop to chain via zerodev kernel.
531502
try {
532503
const encoded = await kernelClient.account.encodeCalls(callData);
@@ -549,28 +520,31 @@ class BridgeController extends Controller {
549520
});
550521

551522
// Update bridge information record with transaction hash
552-
if (bridgeRecordId) {
553-
try {
554-
await BridgeInformationTable.updateTransactionHash(
555-
bridgeRecordId,
556-
receipt.transactionHash,
557-
);
558-
logger.info({
559-
at: `${controllerName}#startEvmBridge`,
560-
message: 'Bridge information record updated with transaction hash',
561-
bridgeRecordId,
562-
transactionHash: receipt.transactionHash,
563-
});
564-
} catch (error) {
565-
logger.error({
566-
at: `${controllerName}#startEvmBridge`,
567-
message: 'Failed to update bridge information record with transaction hash',
568-
bridgeRecordId,
569-
transactionHash: receipt.transactionHash,
570-
error,
571-
});
572-
// Don't throw error here as the bridge operation was successful
573-
}
523+
try {
524+
// Create bridge information record before sending the transaction
525+
const bridgeRecord: BridgeInformationCreateObject = {
526+
from_address: fromAddress,
527+
chain_id: chainId,
528+
amount,
529+
transaction_hash: receipt.transactionHash,
530+
created_at: new Date().toISOString(),
531+
};
532+
await BridgeInformationTable.create(
533+
bridgeRecord,
534+
);
535+
logger.info({
536+
at: `${controllerName}#startEvmBridge`,
537+
message: 'Bridge information record created',
538+
transactionHash: receipt.transactionHash,
539+
});
540+
} catch (error) {
541+
logger.error({
542+
at: `${controllerName}#startEvmBridge`,
543+
message: 'Failed to create bridge information record',
544+
transactionHash: receipt.transactionHash,
545+
error,
546+
});
547+
// Don't throw error here as the bridge operation was successful
574548
}
575549
} catch (error) {
576550
logger.error({

0 commit comments

Comments
 (0)