Skip to content

Commit

Permalink
hn: add more descriptive logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shanefontaine committed Jun 25, 2024
1 parent 1a05dea commit d21cbfe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/hop-node/src/cctp/db/OnchainEventIndexerDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ export class OnchainEventIndexerDB extends DB<string, DBValue> {
const syncKey = this.#getLastBlockSyncedKey(primaryKey)
batch.put(syncKey, { syncedBlockNumber })

this.logger.debug(`Putting ${logs.length} logs with primaryKey ${primaryKey} and syncedBlockNumber ${syncedBlockNumber}. ${logs.length ? JSON.stringify(logs) : ''}`)
let message = `Writing syncedBlockNumber ${syncedBlockNumber} for primaryKey ${primaryKey}`
if (logs.length) {
message += ` on chainId ${logs[0].context.chainId} with ${logs.length} logs. ${JSON.stringify(logs)}`
}
return batch.write()
}

Expand Down
2 changes: 1 addition & 1 deletion packages/hop-node/src/cctp/indexer/OnchainEventIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export abstract class OnchainEventIndexer<T, U, LookupKey extends string> implem
endBlockNumber
}

this.logger.info(`Syncing events for filterId ${filterId} from block ${startBlockNumber} to ${endBlockNumber}`)
this.logger.info(`Syncing events for chainId: ${chainId} and filterId ${filterId} from block ${startBlockNumber} to ${endBlockNumber}`)
for await (const { endBlockNumber, logs } of this.#getEventLogsForRange(getEventLogsInput)) {
const filteredLogs = logs.filter(log => this.filterIrrelevantLog(log))
// Note: There can be an updated lastBlockSynced even if the logs are empty, so don't skip the update
Expand Down

0 comments on commit d21cbfe

Please sign in to comment.