chore: remove reallocate step and add continuous RAV collection for long lived allocation#1181
chore: remove reallocate step and add continuous RAV collection for long lived allocation#1181
Conversation
52f343d to
e559039
Compare
| private epochSubgraph: SubgraphClient, | ||
| ) {} | ||
|
|
||
| async hasActiveDipsAgreement(allocationId: string): Promise<boolean> { |
There was a problem hiding this comment.
I ran this query against network sub and got Type 'Query' has no field 'indexingAgreements' just making a note here, although likely doesnt matter anyway as we have the other subgraph. The note here is more for incase this doesnt get looked at again later.
| { allocationId: allocationId.toLowerCase() }, | ||
| ) | ||
| return (result.data?.indexingAgreements?.length ?? 0) > 0 | ||
| } catch { |
There was a problem hiding this comment.
Suggestion: After fixing the above query, we could change catch { return false } to catch { return true } and log a warning so the failure is observable.
At the moment if the error path is hit because the query doesnt work, then we can't determine agreement status, but the unallocate action goes through anyway.
| private async pendingRAVs(): Promise<ReceiptAggregateVoucherV2[]> { | ||
| return await this.models.receiptAggregateVouchersV2.findAll({ | ||
| where: { last: true, final: false }, | ||
| where: { final: false }, |
There was a problem hiding this comment.
Dropping last: true also pulls in old RAVs that dont need to be collected since their value is already included in the latest RAV.
Suggested: { last: true, final: false }
markRavsAsFinal requires last = TRUE, so old RAVs can't be archived.
|
|
||
| return await this.models.receiptAggregateVouchersV2.findAll({ | ||
| where: { redeemedAt: null, final: false, last: true }, | ||
| where: { final: false }, |
|
|
||
| if (isActive) { | ||
| // Active allocation: update cooldown, don't mark as redeemed | ||
| this.lastCollectedAt.set(rav.rav.collectionId.toLowerCase(), Date.now()) |
There was a problem hiding this comment.
Nit: lastCollectedAt entries are added for active allocations, but never removed when the allocation closes.
No description provided.