Skip to content

Commit

Permalink
improve(finalizer): Increase margin of error for finalizer to cover f…
Browse files Browse the repository at this point in the history
…or multiple day downtime (#1536)
  • Loading branch information
nicholaspai authored May 19, 2024
1 parent 722faba commit b6a208c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/finalizer/utils/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function arbitrumOneFinalizer(
// Arbitrum takes 7 days to finalize withdrawals, so don't look up events younger than that.
const redis = await getRedisCache(logger);
const [fromBlock, toBlock] = await Promise.all([
getBlockForTimestamp(chainId, getCurrentTime() - 9 * 60 * 60 * 24, undefined, redis),
getBlockForTimestamp(chainId, getCurrentTime() - 14 * 60 * 60 * 24, undefined, redis),
getBlockForTimestamp(chainId, getCurrentTime() - 7 * 60 * 60 * 24, undefined, redis),
]);
logger.debug({
Expand Down
4 changes: 1 addition & 3 deletions src/finalizer/utils/cctp/l1ToL2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export async function cctpL1toL2Finalizer(
spokePoolClient: SpokePoolClient,
l1ToL2AddressesToFinalize: string[]
): Promise<FinalizerPromise> {
// Let's just assume for now CCTP transfers don't take longer than 1 day and can
// happen very quickly.
const lookback = getCurrentTime() - 60 * 60 * 24;
const lookback = getCurrentTime() - 60 * 60 * 24 * 7;
const redis = await getRedisCache(logger);
const fromBlock = await getBlockForTimestamp(hubPoolClient.chainId, lookback, undefined, redis);
logger.debug({
Expand Down
2 changes: 1 addition & 1 deletion src/finalizer/utils/cctp/l2ToL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function cctpL2toL1Finalizer(
hubPoolClient: HubPoolClient,
spokePoolClient: SpokePoolClient
): Promise<FinalizerPromise> {
const lookback = getCurrentTime() - 60 * 60 * 24;
const lookback = getCurrentTime() - 60 * 60 * 24 * 7;
const redis = await getRedisCache(logger);
const fromBlock = await getBlockForTimestamp(hubPoolClient.chainId, lookback, undefined, redis);
logger.debug({
Expand Down
2 changes: 1 addition & 1 deletion src/finalizer/utils/opStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export async function opStackFinalizer(
// - Don't try to withdraw tokens that are not past the 7 day challenge period
const redis = await getRedisCache(logger);
const [earliestBlockToFinalize, latestBlockToProve] = await Promise.all([
getBlockForTimestamp(chainId, getCurrentTime() - 14 * 60 * 60 * 24, undefined, redis),
getBlockForTimestamp(chainId, getCurrentTime() - 7 * 60 * 60 * 24, undefined, redis),
getBlockForTimestamp(chainId, getCurrentTime() - 60 * 60 * 24, undefined, redis),
]);
const { recentTokensBridgedEvents = [], olderTokensBridgedEvents = [] } = groupBy(
spokePoolClient.getTokensBridged(),
Expand Down
2 changes: 1 addition & 1 deletion src/finalizer/utils/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function polygonFinalizer(
const { chainId } = spokePoolClient;

const posClient = await getPosClient(signer);
const lookback = getCurrentTime() - 60 * 60 * 24;
const lookback = getCurrentTime() - 60 * 60 * 24 * 7;
const redis = await getRedisCache(logger);
const fromBlock = await getBlockForTimestamp(chainId, lookback, undefined, redis);

Expand Down
2 changes: 1 addition & 1 deletion src/finalizer/utils/zkSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function zkSyncFinalizer(
// older than 2 days and earlier than 1 day.
const redis = await getRedisCache(logger);
const [fromBlock, toBlock] = await Promise.all([
getBlockForTimestamp(l2ChainId, getCurrentTime() - 2 * 60 * 60 * 24, undefined, redis),
getBlockForTimestamp(l2ChainId, getCurrentTime() - 8 * 60 * 60 * 24, undefined, redis),
getBlockForTimestamp(l2ChainId, getCurrentTime() - 1 * 60 * 60 * 24, undefined, redis),
]);
logger.debug({
Expand Down

0 comments on commit b6a208c

Please sign in to comment.