GIP-0027: Create altruistic allocations and close stale allocations

This GIP is a collaboration between @ariel and myself. It’s focused on providing a (non-penalized) way for the public to close allocations that are expired. It also carves out an exception for Indexers that want to serve queries altruistically.

I will update this thread with a Radicle link once my PR is live.

Abstract

Provide a mechanism so that indexers can opt-out of indexing rewards by allocating zero tokens to a subgraph. This would be useful for an indexer who wants to altruistically serve queries. In addition, this implementation allows the public to close stale allocations after the max allocation period, however, nobody can close an altruistic allocation.

This GIP arose from the least contentious ideas in this forum discussion: Rewarded force-close mechanism to eliminate stale allocations - #8 by yondon.

Background

An indexer’s allocation toward a particular subgraph has a maximum allocation period of 28 epochs (i.e., maxAllocationEpoch), after which the indexer should close the allocation. If an indexer leaves an allocation open beyond 28 epochs, we call this allocation stale.

The mechanism for closing state allocations after the maxAllocationEpoch was introduced to prevent indexers from withholding rewards and never distributing them to delegators. Additionally, it promotes liveness in the protocol state changes that affect other stakeholders’ decisions.

An indexer’s stale allocation is still eligible for indexing rewards. If an indexer were to close their stale allocation (at some point beyond epoch 28) with a non-zero Proof of Indexing (non-zero PoI indicates to the protocol that the Indexer did valid work). However, any delegator can close their indexer’s stale allocation with a zero PoI which indicates to the protocol that it should not distribute indexing rewards for that allocation.

When an indexer’s allocation is closed with a non-zero PoI, then the protocol will calculate the amount of indexing rewards owed to the indexer. The amount of indexing rewards owed to an indexer is proportional to the indexer’s allocated stake relative to the total of all allocated stake on the same subgraph.

The two paragraphs above imply that if an “active” indexer closes an allocation that is less than 28 epochs old (i.e. it is not stale), but there is another indexer with a stale allocation currently open on the same subgraph, then the active indexer will receive less indexing rewards than they would have had the stale indexer not been allocated.

Motivation

  1. Stale allocations affect the stability of the network when an indexer that has a big proportional allocated stake on a subgraph does not keep it active, as other indexers won’t want to allocate if it already has a big allocation. Stale allocations also reduce the speed of how value flows through the protocol, reducing the frequency at which curators and delegators get their share of rewards and fees. Currently, delegators of an indexer are the only ones who can close stale allocations, but this is an unnecessary validation considering that anyone could turn into a delegator, even with the smallest amount of tokens, and then close it. For a summary of the current stale allocation statistics, see the “Allocation Age” histogram here: Dune.

  2. Today, indexers must allocate more than zero tokens. However, indexers might want to index and serve queries on a particular subgraph altruistically by opting out of rewards. Today indexers can serve queries altruistically by presenting an empty PoI on closeAllocation, however, this is not efficient because they must still pay Ethereum transaction fees to “refresh” (i.e., close and re-open) their allocations. By allowing altruistic indexers to allocate zero tokens, we can skip all the code paths for updating indexing rewards and provide a huge gas improvement.

High-Level Description

This GIP proposes to make the following changes:

  • Indexers can allocate zero-tokens to a subgraph to advertise they are indexing and serving queries but have opted out of indexing rewards. We call these altruistic allocations.

  • Even if indexers allocate zero tokens, they are still required to have the minimum stake (currently 100,000 GRT).

  • Altruistic allocations cannot be closed after the maxAllocationEpoch by the public - only by the indexer or the indexer’s operator.

  • Anyone can now close an indexer’s allocation after the maxAllocationEpoch.

Implementation

Copyright Waiver

Copyright and related rights waived via CC0.

7 Likes

I’m still in favor of some of the more contentious options in the linked thread :wink: My main concern with this approach it still requires someone to eat the cost of closing the allocation on the Lazy Indexer’s behalf.

That being said, this seems like a reasonable first step, to evaluate the impact of before introducing anything more complex.

2 Likes

I think we should move forward with this GIP, regardless of where we go with rewarded force-closes or when. Altruistic allocations are an orthogonal concern.

2 Likes

Just posting here to show agreement.

1 Like

This proposal has advanced in the governance process and has been approved by the Council: Snapshot voting

6 Likes

The Council executed transaction 0xcdda6d13bb9adf50aa204a98256fe2e019b5ef9504f997a3d60ef961f4ac63f4 on Mainnet Ethereum to upgrade the Staking contract to implementation 0x0Cf97E609937418eBC8C209404B947cBC914F599. It enables the Altruistic Allocations feature, allowing indexers to create zero-token allocations, which are much more gas-efficient but have the effect of effectively opting out of any rewards. In addition, anyone can now close stale allocations after the max allocation epoch, previously could only be done by delegators.

5 Likes