diff --git a/packages/indexer-common/src/indexer-management/allocations.ts b/packages/indexer-common/src/indexer-management/allocations.ts index d892d14e1..797c54476 100644 --- a/packages/indexer-common/src/indexer-management/allocations.ts +++ b/packages/indexer-common/src/indexer-management/allocations.ts @@ -484,8 +484,9 @@ export class AllocationManager { epoch: createAllocationEventLogs.epoch.toString(), }) + // TODO: deprecated // Remember allocation - await this.network.receiptCollector.rememberAllocations(actionID, [ + await this.network.receiptCollector?.rememberAllocations(actionID, [ createAllocationEventLogs.allocationID, ]) @@ -638,12 +639,16 @@ export class AllocationManager { logger.info('Identifying receipts worth collecting', { allocation: closeAllocationEventLogs.allocationID, }) + let isCollectingQueryFees = false const allocation = await this.network.networkMonitor.allocation(allocationID) - // Collect query fees for this allocation - const isCollectingQueryFees = await this.network.receiptCollector.collectReceipts( - actionID, - allocation, - ) + if (this.network.receiptCollector) { + // TODO: deprecated + // Collect query fees for this allocation + isCollectingQueryFees = await this.network.receiptCollector.collectReceipts( + actionID, + allocation, + ) + } // Upsert a rule so the agent keeps the deployment synced but doesn't allocate to it logger.debug( @@ -925,11 +930,15 @@ export class AllocationManager { try { allocation = await this.network.networkMonitor.allocation(allocationID) // Collect query fees for this allocation - isCollectingQueryFees = await this.network.receiptCollector.collectReceipts( - actionID, - allocation, - ) - logger.debug('Finished receipt collection') + + // TODO: deprecated + if (this.network.receiptCollector) { + isCollectingQueryFees = await this.network.receiptCollector.collectReceipts( + actionID, + allocation, + ) + logger.debug('Finished receipt collection') + } } catch (err) { logger.error('Failed to collect receipts', { err, diff --git a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts index 385c9a424..8a6b58a39 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts @@ -711,11 +711,12 @@ export default { allocation: closeAllocationEventLogs.allocationID, }) + // TODO: deprecated // Collect query fees for this allocation - const isCollectingQueryFees = await receiptCollector.collectReceipts( - 0, - allocationData, - ) + let isCollectingQueryFees = false + if (receiptCollector) { + isCollectingQueryFees = await receiptCollector.collectReceipts(0, allocationData) + } logger.debug( `Updating indexing rules, so indexer-agent keeps the deployment synced but doesn't reallocate to it`, @@ -1016,11 +1017,12 @@ export default { allocation: closeAllocationEventLogs.allocationID, }) - // Collect query fees for this allocation - const isCollectingQueryFees = await receiptCollector.collectReceipts( - 0, - allocationData, - ) + // TODO: deprecated + let isCollectingQueryFees = false + if (receiptCollector) { + // Collect query fees for this allocation + isCollectingQueryFees = await receiptCollector.collectReceipts(0, allocationData) + } logger.debug( `Updating indexing rules, so indexer-agent will now manage the active allocation`, @@ -1061,6 +1063,7 @@ export default { } }, + // TODO: deprecated submitCollectReceiptsJob: async ( { allocation, @@ -1092,7 +1095,10 @@ export default { }) // Collect query fees for this allocation - const collecting = await receiptCollector.collectReceipts(0, allocationData) + let collecting = false + if (receiptCollector) { + collecting = await receiptCollector.collectReceipts(0, allocationData) + } logger.info(`Submitted allocation receipt collection job for execution`, { allocationID: allocation, diff --git a/packages/indexer-common/src/network.ts b/packages/indexer-common/src/network.ts index d955c494d..13b5d9ff8 100644 --- a/packages/indexer-common/src/network.ts +++ b/packages/indexer-common/src/network.ts @@ -47,7 +47,10 @@ export class Network { networkProvider: providers.StaticJsonRpcProvider transactionManager: TransactionManager networkMonitor: NetworkMonitor - receiptCollector: AllocationReceiptCollector + + // TODO: deprecated + receiptCollector: AllocationReceiptCollector | undefined + tapCollector: TapCollector | undefined specification: spec.NetworkSpecification paused: Eventual @@ -61,7 +64,7 @@ export class Network { networkProvider: providers.StaticJsonRpcProvider, transactionManager: TransactionManager, networkMonitor: NetworkMonitor, - receiptCollector: AllocationReceiptCollector, + receiptCollector: AllocationReceiptCollector | undefined, tapCollector: TapCollector | undefined, specification: spec.NetworkSpecification, paused: Eventual, @@ -272,16 +275,22 @@ export class Network { // -------------------------------------------------------------------------------- // * Allocation Receipt Collector // -------------------------------------------------------------------------------- - const scalarCollector = await AllocationReceiptCollector.create({ - logger, - metrics, - transactionManager: transactionManager, - models: queryFeeModels, - allocationExchange: contracts.allocationExchange, - allocations, - networkSpecification: specification, - networkSubgraph, - }) + let scalarCollector: AllocationReceiptCollector | undefined = undefined + if (!(tapContracts && tapSubgraph)) { + logger.warn( + "deprecated scalar voucher collector is enabled - you probably don't want this", + ) + scalarCollector = await AllocationReceiptCollector.create({ + logger, + metrics, + transactionManager: transactionManager, + models: queryFeeModels, + allocationExchange: contracts.allocationExchange, + allocations, + networkSpecification: specification, + networkSubgraph, + }) + } // -------------------------------------------------------------------------------- // * TAP Collector