Skip to content

Commit 3eafc62

Browse files
committed
skip ccip calls
1 parent b83ab46 commit 3eafc62

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

src/utils/adapter.ts

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ const setAdapterProgress = async (bridgeDbName: string, chain: string, lastBlock
4444
if (current?.lastSuccessfulBlock && current.lastSuccessfulBlock >= lastBlock) {
4545
return;
4646
}
47-
await setCache(key, {
48-
lastSuccessfulBlock: lastBlock,
49-
lastUpdated: Math.floor(Date.now() / 1000)
50-
}, PROGRESS_TTL);
47+
await setCache(
48+
key,
49+
{
50+
lastSuccessfulBlock: lastBlock,
51+
lastUpdated: Math.floor(Date.now() / 1000),
52+
},
53+
PROGRESS_TTL
54+
);
5155
};
5256

5357
// FIX timeout problems throughout functions here
@@ -104,7 +108,9 @@ const getBlocksForRunningAdapter = async (
104108

105109
const cachedProgress = await getAdapterProgress(bridgeDbName, chain);
106110
if (cachedProgress?.lastSuccessfulBlock && cachedProgress.lastSuccessfulBlock > lastRecordedEndBlock) {
107-
console.log(`[PROGRESS] Using Redis progress for ${bridgeDbName}:${chain}, advancing from block ${lastRecordedEndBlock} to ${cachedProgress.lastSuccessfulBlock}`);
111+
console.log(
112+
`[PROGRESS] Using Redis progress for ${bridgeDbName}:${chain}, advancing from block ${lastRecordedEndBlock} to ${cachedProgress.lastSuccessfulBlock}`
113+
);
108114
lastRecordedEndBlock = cachedProgress.lastSuccessfulBlock;
109115
}
110116

@@ -354,7 +360,16 @@ export const runAllAdaptersTimestampRange = async (
354360
startBlock = (await lookupBlock(startTimestamp, { chain: chainContractsAreOn as Chain })).block;
355361
endBlock = (await lookupBlock(endTimestamp, { chain: chainContractsAreOn as Chain })).block;
356362
}
357-
await runAdapterHistorical(startBlock, endBlock, id, chain as Chain, allowNullTxValues, true, onConflict, false);
363+
await runAdapterHistorical(
364+
startBlock,
365+
endBlock,
366+
id,
367+
chain as Chain,
368+
allowNullTxValues,
369+
true,
370+
onConflict,
371+
false
372+
);
358373
} catch (e: any) {
359374
const errString = `Adapter txs for ${bridgeDbName} on chain ${chain} failed, skipped. ${JSON.stringify(e)}`;
360375
await insertErrorRow({
@@ -373,7 +388,17 @@ export const runAllAdaptersTimestampRange = async (
373388
console.log("runAllAdaptersTimestampRange successfully ran.");
374389
};
375390

376-
const bridgesToSkip = ["wormhole", "layerzero", "hyperlane", "intersoon", "relay", "cashmere", "teleswap", "mayan"];
391+
const bridgesToSkip = [
392+
"wormhole",
393+
"layerzero",
394+
"hyperlane",
395+
"intersoon",
396+
"relay",
397+
"cashmere",
398+
"teleswap",
399+
"mayan",
400+
"ccip",
401+
];
377402

378403
export const runAdapterHistorical = async (
379404
startBlock: number,
@@ -396,12 +421,16 @@ export const runAdapterHistorical = async (
396421
const cachedProgress = await getAdapterProgress(bridgeDbName, chain);
397422
if (cachedProgress?.lastSuccessfulBlock) {
398423
if (cachedProgress.lastSuccessfulBlock >= endBlock) {
399-
console.log(`[SKIP] ${bridgeDbName}:${chain} blocks ${startBlock}-${endBlock} already processed (last: ${cachedProgress.lastSuccessfulBlock})`);
424+
console.log(
425+
`[SKIP] ${bridgeDbName}:${chain} blocks ${startBlock}-${endBlock} already processed (last: ${cachedProgress.lastSuccessfulBlock})`
426+
);
400427
return;
401428
}
402429
if (cachedProgress.lastSuccessfulBlock >= startBlock) {
403430
const newStart = cachedProgress.lastSuccessfulBlock + 1;
404-
console.log(`[PROGRESS] ${bridgeDbName}:${chain} adjusting start from ${startBlock} to ${newStart} (last: ${cachedProgress.lastSuccessfulBlock})`);
431+
console.log(
432+
`[PROGRESS] ${bridgeDbName}:${chain} adjusting start from ${startBlock} to ${newStart} (last: ${cachedProgress.lastSuccessfulBlock})`
433+
);
405434
startBlock = newStart;
406435
}
407436
}

0 commit comments

Comments
 (0)