---
# System prepended metadata

title: GIP 00XX -- Linear Indexer Rebates and Slashing

---

# GIP 00XX -- Linear Indexer Rebates and Slashing

## Abstract

Adoption of The Graph by dapps creates opportunities for indexers to collect query fees. Yet, the main source of revenue for indexers today is indexing rewards, which were designed as a bootstrapping mechanism to attract indexers. With indexers now present, the protocol is transitioning to a state where (hopefully) indexers can reliably and profitably serve queries for dapps. Unfortunately, current mechanisms in the protocol _discourage_ query-focused indexers from serving many queries and disproportionately  penalize indexers with limited capital. This lack of alignment and fairness can be addressed by changing the query-fee-based incentives for indexers. Specifically, we propose replacing Cobb Douglas rebates and percentage-based slashing with simpler linear rebates and linear slashing. Theoretical justification and numerical examples are provided.

## Overview

(Summarize Indexer Query Fee Rebates and Indexing Rewards.)



The motivation for this proposal is aptly described by way of three examples.

**Example 1.** Suppose Cobb-Douglas rebates$$^\star$$ are used with two indexers, Alice and Bob. Alice is a poor indexer, but works hard. On the other hand, Bob is a wealthy and lazy indexer. After a round of work by each, suppose it is time to collect rebates. Alice served queries accounting for 75% of the query volume, an impressive 3X that of Bob. However, Bob is wealthy and has 93% of stake. As a result, Bob gets over 2.1X as much rebate as Alice, _i.e._ Bob gets paid over 6X the amount of Alice per unit of work. In other words, Alice is punished for being poor and has to give a notable portion of her rewards to Bob. (REWRITE)

**Example 2.** (Refer to stories of Juan and Ricky about query fees being excessively burnt).
* What percentage of query fees are being burnt over 30 epochs
* Particular example

**Example 3.** (Gaming on timing of allocation closing).
* Max allocation closing varying wildly
* How does that affect profitability over time?

These examples illustrate i) the unfair penalties to indexers that have limited capital to stake, ii) the incredible inefficiency in the protocol due to burnt query fees, and iii) the undue cognitive load for indexers to "game" with each other on matters like closing allocations. We aim to simultaneously alleviate each of these shortcomings in this proposal.

${^\star}$Here we assume the Cobb-Douglas function uses parameter $\alpha=0.5$. 

## Proposal Description

 
The reward and penalty are the two core parts of the expected utility for indexers when serving queries. For this reason, the two changes are coupled in this proposal. Provide direct rebates, subject to staking constraint, and slash proportionally to query fee prices.

Indexers today are penalized by slashing a percentage of their stake. This proposal suggests slashing an indexer for erring by making the penalty equal to a fixed multiple of the erred query's price. We emphasize the indexer chooses this multiple when they allocate to a subgraph.

Indexers are required to stake in order to offer collateral for slashing.

(DEFINE HONEST INDEXER)

**Linear Rebates.** We propose the following.

1. Allow indexers to collect from payment channels anytime.
2. Burn query fees upon collection if stakes is less than either miminum penalty or query fees.
3. Send all collected query fees to indexer stake.$^\star$
4. Allow withdrawals from stake subject to thawing period.


$^\star$This is distinct from today where indexers can withdraw payments directly to their wallets.

**Linear Slashing.** We propose the following. Set a minimum penalty (_e.g._ 1000 GRT), which indexers must have slashed

$$(\text{penalty}) = \max\left( (\text{minimum penalty}),\ (\text{multiplier})\cdot(\text{query fee})\right).$$
 
## Backwards Compatibility

This proposal is backwards compatible. It uses the same input data and the required upgrade can happen on a ??? by ??? basis.... 





## Rationale and Alternatives

The goals for these mechanisms are as follows.

1. Indexers are not worse off by increasing stake.
2. Profitable indexers stake enough to cover their expected penalties.
3. Indexers with many resources cannot directly exploit indexers without such resources.$^\star$
4. Indexers do not need to "game" with each other for rebates  (_e.g._ when to close allocations).
5. Query fees are paid in full$^{\star\star}$ to proficient indexers.

$^\star$For example, in the Alice and Bob setting, Bob is able to "take" a portion of Alice's rewards by staking more than Alice. 

$^{\star\star}$Here paid in "full" means the entirety that can be paid to indexers after accounting for curation and (1% burning??).

Below is a high-level justification of the proposed rebate and slashing rules. It makes specific comparisons between the existing and proposed mechanisms. Further details for the given statements (_e.g._ proofs of the lemmas) are in this [technical report](https://thegraph.com).

### Rebates


Various schemes can be used to incentivize indexers to stake.  

#### Cobb-Douglas-based Rebates

The intention of using Cobb-Douglas-based rebates is to incentivize indexers to stake the same amount as the work they do. However, erroneous claims were made in the original [work](https://protocol.0x.org/en/latest/_static/protocol-fees.pdf) proposing such rebates to achieve this goal.  In particular, this rebate does not incentivize indexers to stake the same amount as their labor, as summarized by the following lemma.

**No Equilibrium Lemma:** Indexers *always* are able to generate more return for themselves by staking more, regardless of what other indexers do.

The following observations are about this stuff...

1. Huge inefficiencies observed in protocol, often with 50+% of query fees burnt.
2. Indexers may stake as much capital as they have available.
3. Indexer whales are able to exploit the poor indexers.
4. Indexers are incentivized to "game" with each other (*e.g.* when to close allocations).



#### Direct Rebate

The basic idea is indexers are paid in full if they faithfully serve queries and stake the expected. This yields the following.

1. Query fees are paid in full to honest indexers.
2. Profitable indexers stake the expected amount that can be slashed.
3. All indexers are treated equally by the mechanism, regardless of size.
4. Indexers do not need to worry about the actions of others.


### Slashing

Below we consider a direct rebate to indexers and two slashing mechanisms. Throughout, we use two simplifying assumptions to get intuitive explanations of relevant results.



**Assumption 1**: The probability that an indexer accidentally fails to serve a query is the same for all queries.

**Assumption 2**: All queries served by an indexer result in the same query fee.

#### Slashing by Stake Percentage

Two key points are noteworthy for the present mechanism: indexers are incentivized to limit the number of queries served and, if they do not collect indexing rewards, they are incentivized to maintain stake minimally.

**Lemma:** (Large Stake $\rightarrow$ Expect Losses). _Suppose  indexers are penalized by slashing a fixed percentage of stake for each bad query. If an indexer has sufficiently large stake and continually reinvests all query fees into stake, then expected stake will **decrease** by serving queries._

**Remark:** The above result shows it is unprofitable for indexers to serve queries if they reinvest all of it into stake. This property contradicts one of the stated goals.
 

#### Slashing Proportionally to Query Fee Price

**Lemma:** (Profitable Indexers' Stake Covers Expected Liabilities). If indexers are penalized query errors in proportion to query fees and reinvests all query fees into stake, then the stake constraint ensures profitable indexers stake more than the *expected* penalties for erring.

**Lemma:** (Rewards Proportional to Work). _Suppose an indexer is penalized for erring by slashing a fixed multiple $m \geq 1$ of query price. If the probability of erring is less than one over the multiplier (i.e. $1/m$) and the indexer continually reinvests query fees into stake, then expected stake increases linearly with the number of queries._

**Remark:** This lemma shows indexers can predictably increase their query fee revenue by serving more queries. Additionally, they are not harmed by indexing more.  


**Lemma:** (Equilibrium Stake). _If indexers serve queries at a consistent rate and collect them at least as often as the thawing period, then continually withdrawing as much stake as possible makes stake converge to an equilibrium state where stake equals the average query fees served (minus average penalty)  per thawing period._

**Remark:** This lemma shows 


These lemmas are illustrated in this [Jupyter Notebook](https://colab.research.google.com/drive/1SYGnSylVn7q_K5xe8TgLfG7R6sHa2Y6T?usp=sharing)


## Risks and Security Considerations


(ANI TALK ABOUT RISKS ASSOCIATED WITH SMALL MULTIPLIERS, GIVE CONCRETE EXAMPLE LIKE UNISWAP)

## Future Work

This work does not address...

1. address malicious indexers that simply seek to harm the protocol...
2. Small indexers on subgraphs will high query volume might not be able to stake enough...
3. Channel capacity...
4. Mass Slashing Event...
5. Reduce 100K GRT threshold to match appropriate expected penalty.
6. Establish standards within The Graph for measuring economic security. These may include
    a. Stake
    b. The multiplier selected by indexers
    c. A Boolean telling whether indexers have enough stake to pay the penalty for a query.

## Copyright Waiver

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).