Skip to content
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

fix corner case issue, cannot start indexing on ganache without ADDRESS_FILE #775

Merged
merged 3 commits into from
Jan 14, 2025
Merged
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
27 changes: 14 additions & 13 deletions src/components/Indexer/crawlerThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,21 @@ export async function processNetworkData(
): Promise<void> {
stoppedCrawling = startedCrawling = false
let contractDeploymentBlock = getDeployedContractBlock(rpcDetails.chainId)
if (!isDefined(contractDeploymentBlock) && !isDefined(await getLastIndexedBlock())) {
if (rpcDetails.chainId === DEVELOPMENT_CHAIN_ID) {
rpcDetails.startBlock = contractDeploymentBlock = 0
INDEXER_LOGGER.warn(
'Cannot get block info for local network, starting from block 0'
)
} else {
INDEXER_LOGGER.logMessage(
`chain: ${rpcDetails.chainId} Both deployed block and last indexed block are null/undefined. Cannot proceed further on this chain`,
true
)
const isLocalChain = rpcDetails.chainId === DEVELOPMENT_CHAIN_ID
if (isLocalChain && !isDefined(contractDeploymentBlock)) {
rpcDetails.startBlock = contractDeploymentBlock = 0
INDEXER_LOGGER.warn('Cannot get block info for local network, starting from block 0')
} else if (
!isLocalChain &&
!isDefined(contractDeploymentBlock) &&
!isDefined(await getLastIndexedBlock())
) {
INDEXER_LOGGER.logMessage(
`chain: ${rpcDetails.chainId} Both deployed block and last indexed block are null/undefined. Cannot proceed further on this chain`,
true
)

return null
}
return null
}
// if we defined a valid startBlock use it, oterwise start from deployed one

Expand Down
Loading