feat: stop unpaid indexing after a DIPs agreement is canceled#1225
Merged
MoonBoi9001 merged 5 commits intoJun 1, 2026
Merged
Conversation
A payer-canceled agreement kept its allocation open forever, so the indexer kept indexing a subgraph it would no longer be paid for. Now the allocation is freed to close once its final fees have been collected; closing any earlier makes the final collection fail on-chain. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7837320 to
1a97e23
Compare
Maikol
reviewed
May 29, 2026
| // allocation to be open), so a canceled agreement must keep its allocation | ||
| // alive until its final fees have been collected. Two cases protect: | ||
| // - an Accepted agreement: still live, closing would cancel it on-chain; | ||
| // - a payer-canceled agreement whose fees aren't fully collected yet. |
Member
There was a problem hiding this comment.
nit: this entire comment feels out of place, maybe we can move to where hasActiveDipsAgreement is called.
Member
Author
There was a problem hiding this comment.
Addressed in follow up commits, also tightened this block
Member
There was a problem hiding this comment.
Given the changes to the implementation of this function I would rename this since it's no longer looking for active agreements but checking if the agreement is collectable.
Member
Author
There was a problem hiding this comment.
renamed in follow up commit
The check protects an allocation from closing while a DIPS agreement can still collect fees; closing early makes the on-chain collection revert and strands them. It now covers live agreements and canceled ones that are not yet drained, which "active" no longer described. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The note explained why closing an allocation can strand DIPS fees, but it sat inside the lookup that only answers whether fees are still collectable. Move it next to the unallocate guard that actually decides whether to block the close, where that reasoning is needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Refusing to close an allocation that still has a DIPS agreement printed a message that claimed closing would cancel the agreement on-chain. That is wrong for an agreement the payer already canceled but whose fees are still draining; reword it to fit both cases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A repo check flags any run of four or more consecutive comment lines. The allocation-close protection note ran to six lines and a POI-validation note to four; condense both, keeping why an early close strands fees and the zero-POI sentinel rule. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Maikol
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
When a payer cancels a DIPs agreement, the indexer used to keep its allocation open indefinitely, indexing a subgraph it would no longer be paid for. This lets that allocation close once the agreement's final payment has been collected, so the indexer stops doing unpaid work and frees the stake. It waits for the final payment first, because the payment can only be collected while the allocation is still open.
Motivation
A DIPs agreement pays an indexer to index a particular subgraph, and while the agreement is live the indexer's allocation for it is protected from being closed. When the payer cancels the agreement, that protection used to stay in place forever, so the allocation never closed and the indexer carried on indexing — with its stake locked in place — for a subgraph nobody was paying for.
The allocation can't simply close on cancellation, though: the final payment for work already done can only be collected while the allocation is still open, so closing too early would forfeit it. This change keeps the allocation protected only until that final payment has been collected, then releases it so the indexer's normal housekeeping can close it and put the stake to use elsewhere.
Summary