diff --git a/test/erc20-transfers/src/processor.ts b/test/erc20-transfers/src/processor.ts index f90588989..aede83036 100644 --- a/test/erc20-transfers/src/processor.ts +++ b/test/erc20-transfers/src/processor.ts @@ -8,7 +8,10 @@ const CONTRACT = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase() const processor = new EvmBatchProcessor() - .setPortal('https://portal.sqd.dev/datasets/ethereum-mainnet') + .setPortal({ + url: 'https://portal.sqd.dev/datasets/ethereum-mainnet', + bufferThreshold: 100 * 1024 * 1024 + }) // .setRpcEndpoint(process.env.ARB_NODE_WS) .setFinalityConfirmation(500) .setBlockRange({from: 0}) @@ -30,18 +33,19 @@ processor.run(new TypeormDatabase({supportHotBlocks: true}), async ctx => { for (let log of block.logs) { if (log.address == CONTRACT && erc20.events.Transfer.is(log)) { // let {from, to, value} = erc20.events.Transfer.decode(log) - // transfers.push(new Transfer({ - // id: log.id, - // blockNumber: block.header.height, - // timestamp: new Date(block.header.timestamp), - // tx: log.transactionHash, - // from, - // to, - // amount: value - // })) + transfers.push(new Transfer({ + // id: log.id, + // blockNumber: block.header.height, + // timestamp: new Date(block.header.timestamp), + // tx: log.transactionHash, + // from, + // to, + // amount: value + })) } } } + // ctx.log.info(`found ${transfers.length} transfers`) // await ctx.store.insert(transfers) }) diff --git a/util/portal-client/src/client.ts b/util/portal-client/src/client.ts index 4b6e4c361..6046fa6e5 100644 --- a/util/portal-client/src/client.ts +++ b/util/portal-client/src/client.ts @@ -93,16 +93,18 @@ export class PortalClient { let toBlock = query.toBlock ?? Infinity while (fromBlock <= toBlock) { + let archiveQuery = {...query, fromBlock} + let res = await this.http .request('POST', this.getRouterUrl(`stream`), { - json: {...query, fromBlock}, + json: archiveQuery, retryAttempts: 3, httpTimeout: this.queryTimeout, stream: true, }) .catch( withErrorContext({ - archiveQuery: query, + archiveQuery, }) ) diff --git a/util/util-internal-ingest-tools/src/archive.ts b/util/util-internal-ingest-tools/src/archive.ts index 0cfd14b89..b0d4872fa 100644 --- a/util/util-internal-ingest-tools/src/archive.ts +++ b/util/util-internal-ingest-tools/src/archive.ts @@ -64,7 +64,7 @@ export function archiveIngest(args: ArchiveIngestOptions): Asyn assert(lastBlock >= beg) beg = lastBlock + 1 - if (beg > top) { + if (top < beg) { top = await height.get() }