Overview
This is a proposal to require that Indexers submit more recent PoIs in order to collect indexing rewards on a subgraph.
Motivation
The current behavior as specified in the yet-to-be-ratified draft of the Arbitration Charter is that PoIs should be submitted for the first block of the epoch in which an allocation is closed, or the epoch before that. In effect, this means, that PoIs may be submitted that are up to 48 hours behind the chain head.
Last week, the current rules allowed for a situation in which the Synthetix subgraph had no Indexers allocating stake to it that were synced within 5% of the chain head. Effectively, this was an outage from the perspective of the Synthetix subgraph.
In the following Indexer Office Hours it was revealed that there actually were several Indexers fully synced on the Synthetix subgraph, however, they had not bothered allocating stake towards the Synthetix subgraph and thus were not discoverable for sending queries. The stated reason for not allocating stake was that there was already so much stake allocated by Indexers (the ones that were >5% behind the chain head) that there was little reason to allocate stake.
This proposal aims to address this issue by requiring that more recent PoIs are submitted in order to receive indexing rewards.
How it works
- Add a
poiBlock
field to thecloseAllocation
method of theStaking
contract. - Do not allow indexing rewards to be collected for PoIs that are submitted some threshold behind the chainhead.
- There are two ways this requirement might be implemented.
Variation 1 - Enforce at smart contract layer
The requirement to submit recent PoIs may be implemented at the smart contract level. This would leverage the block.blockhash global function which only makes the most recent 256 block hashes available.
This means that the threshold could not be enforced for durations longer than about an hour, which is likely fine for all subgraphs in The Graph today, but could be unnecessarily strict for subgraphs that are only concerned w/ i.e. historical data.
An additional downside of this variation is that it would also impose new gas costs on closing allocations.
Variation 2 - Enforce at arbitration layer
Another variation is to enforce the requirements on PoI freshness through the Arbitration Charter. For example, collecting indexing rewards by submitting a PoI is outside the target threshold could be made a slashable offense.
This would require adding an additional field to the closeAllocation
method in order to revert the transaction if it is not mined in time, to mitigate the risk of Indexers accidentally submitting PoIs that are outside the threshold during periods of high blockchain congestion.
An additional downside of this approach is that it expands the role of the Arbitrator, and generally we are looking to minimize the role of the Arbitrator over time.
Next Steps
- Get feedback from Indexers and subgraph developers on both of these approaches (cc @Oliver)
- Evaluate the gas costs of the first variation, using gas optimization tricks (cc @ari).
- Make sure PoI cross-checking in the Indexer Agent would still work even with Indexers submitting PoIs for different blocks (cc @Ford)
- Evaluate an appropriate default threshold that is both sufficiently large to be achievable for Indexders on most subgraphs but also sufficiently small to be useful for most subgraph and dapp developers.
Future Work
Future iterations on this proposal could be to allow Subgraph Developers or Curators to specify the threshold behind the chain head for which PoIs would be accepted, to allow for historical or analytics-focused subgraphs that may not be as concerned with data freshness.