Skip to content

Fix arbitrum getBlockNumber #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions src/update-feeds-loops/update-feeds-loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const calculateStaggerTimeMs = (
};

export const readActiveDataFeedBatch = async (
provider: ethers.JsonRpcProvider,
airseekerRegistry: AirseekerRegistry,
chainId: string,
fromIndex: number,
Expand Down Expand Up @@ -130,7 +131,9 @@ export const readActiveDataFeedBatch = async (
return isRegistered;
});

const blockNumber = decodeGetBlockNumberResponse(getBlockNumberReturndata!);
// NOTE: https://api3workspace.slack.com/archives/C05TQPT7PNJ/p1713441156074839?thread_ts=1713438669.278119&cid=C05TQPT7PNJ
const blockNumber =
chainId === '42161' ? await provider.getBlockNumber() : decodeGetBlockNumberResponse(getBlockNumberReturndata!);

return {
batch,
Expand Down Expand Up @@ -160,7 +163,7 @@ export const runUpdateFeeds = async (providerName: ProviderName, chain: Chain, c
logger.debug(`Fetching first batch of data feeds batches.`);
const firstBatchStartTimeMs = Date.now();
const goFirstBatch = await go(
async () => readActiveDataFeedBatch(airseekerRegistry, chainId, 0, dataFeedBatchSize),
async () => readActiveDataFeedBatch(provider, airseekerRegistry, chainId, 0, dataFeedBatchSize),
{ totalTimeoutMs: dataFeedUpdateIntervalMs }
);
if (!goFirstBatch.success) {
Expand Down Expand Up @@ -205,6 +208,7 @@ export const runUpdateFeeds = async (providerName: ProviderName, chain: Chain, c
const dataFeedBatchIndexStart = batchIndex * dataFeedBatchSize;
const dataFeedBatchIndexEnd = Math.min(activeDataFeedCount!, dataFeedBatchIndexStart + dataFeedBatchSize);
const activeBatch = await readActiveDataFeedBatch(
provider,
airseekerRegistry,
chainId,
dataFeedBatchIndexStart,
Expand Down