Skip to content

Commit 4c6eebf

Browse files
feat: implement Indexing Agreements
1 parent 626dae5 commit 4c6eebf

40 files changed

+4415
-88
lines changed

IndexingPaymentsTodo.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Still pending
2+
3+
* Arbitration Charter: Update to support disputing IndexingFee.
4+
* Check code coverage
5+
* Check contract size
6+
* Don't love cancel agreement on stop service / close stale allocation.
7+
* Missing Upgrade event for subgraph service
8+
9+
# Done
10+
11+
* DONE: ~~Switch cancel event in recurring collector to use Enum~~
12+
* DONE: ~~Switch timestamps to uint64~~
13+
* DONE: ~~Check that UUID-v4 fits in `bytes16`~~
14+
* DONE: ~~Double check cancelation policy. Who can cancel when? Right now is either party at any time. Answer: If gateway cancels allow collection till that point.~~
15+
* DONE: ~~If an indexer closes an allocation, what should happen to the accepeted agreement? Answer: Look into canceling agreement as part of stop service.~~
16+
* DONE: ~~Switch `duration` for `endsAt`? Answer: Do it.~~
17+
* DONE: ~~Support a way for gateway to shop an agreement around? Deadline + dedup key? So only one agreement with the dedupe key can be accepted? Answer: No. Agreements will be "signaled" as approved or rejected on the API call that sends the agreement. We'll trust (and verify) that that's the case.~~
18+
* DONE: ~~Test `upgrade` paths~~
19+
* DONE: ~~Fix upgrade.t.sol, lots of comments~~
20+
* DONE: ~~How do we solve for the case where an indexer has reached their max expected payout for the initial sync but haven't reached the current epoch (thus their POI is incorrect)? Answer: Signal in the event that the max amount was collected, so that fisherman understand the case.~~
21+
* DONE: ~~Debate epoch check protocol team. Maybe don't revert but store it in event. Pablo suggest block number instead of epoch.~~
22+
* DONE: ~~Should we set a different param for initial collection time max? Some subgraphs take a lot to catch up. Answer: Do nothing. Make sure that zero POIs allow to eventually sync~~
23+
* DONE: ~~Since an allocation is required for collecting, do we want to expect that the allocation is not stale? Do we want to add code to collect rewards as part of the collection of fees? Make sure allocation is more than one epoch old if we attempt this. Answer: Ignore stale allocation~~
24+
* DONE: ~~If service wants to collect more than collector allows. Collector limits but doesn't tell the service? Currently reverts. Answer: Allow for max allowed~~
25+
* DONE: ~~What should happen if the escrow doesn't have enough funds? Answer: Reverts~~
26+
* DONE: ~~Don't pay for entities on initial collection? Where did we land in terms of payment terms? Answer: pay initial~~
27+
* DONE: ~~Test lock stake~~
28+
* DONE: ~~Reduce the number of errors declared and returned~~
29+
* DONE: ~~Support `DisputeManager`~~
30+
* DONE: ~~Check upgrade conditions. Support indexing agreement upgradability, so that there is a mechanism to adjust the rates without having to cancel and start over.~~
31+
* DONE: ~~Maybe check that the epoch the indexer is sending is the one the transaction will be run in?~~
32+
* DONE: ~~Should we deal with zero entities declared as a special case?~~
33+
* DONE: ~~Support for agreements that end up in `RecurringCollectorCollectionTooLate` or ways to avoid getting to that state.~~
34+
* DONE: ~~Make `agreementId` unique globally so that we don't need the full tuple (`payer`+`indexer`+`agreementId`) as key?~~
35+
* DONE: ~~Maybe IRecurringCollector.cancel(address payer, address serviceProvider, bytes16 agreementId) should only take in agreementId?~~
36+
* DONE: ~~Unify to one error in Decoder.sol~~
37+
* DONE: ~~Built-in upgrade path to indexing agreements v2~~
38+
* DONE: ~~Missing events for accept, cancel, upgrade RCAs.~~
39+
40+
# Won't Fix
41+
42+
* Add upgrade path to v2 collector terms
43+
* Expose a function that indexers can use to calculate the tokens to be collected and other collection params?
44+
* Place all agreement terms into one struct
45+
* It's more like a collect + cancel since the indexer is expected to stop work then and there. When posting a POI that's < N-1 epoch. Answer: Emit signal that the collection is meant to be final. Counter: Won't do since collector can't signal back to data service that payment is maxed out. Could emit an event from the collector, but is it really worth it? Right now any collection where epoch POI < current POI is suspect.

packages/horizon/contracts/data-service/utilities/ProvisionManager.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa
118118
_;
119119
}
120120

121+
modifier onlyAuthorizedForProvisionHack(address caller, address serviceProvider) {
122+
require(
123+
_graphStaking().isAuthorized(serviceProvider, address(this), caller),
124+
ProvisionManagerNotAuthorized(serviceProvider, caller)
125+
);
126+
_;
127+
}
128+
121129
/**
122130
* @notice Checks if a provision of a service provider is valid according
123131
* to the parameter ranges established.

0 commit comments

Comments
 (0)