CIP-17: Making slippage symmetric

CIP: 17
title: Making slippage symmetric
author: harisang
status: Active
created: 2022-12-07

Simple summary

This post proposes that the protocol treats slippage incurred by solvers symmetrically; in the case of negative slippage, a solver would be penalized with an amount equal to the negative slippage incurred (as is the case now), while in the case of positive slippage, the protocol would reimburse the solver with an amount equal to the positive slippage generated.

Motivation

Slippage management in CoW Protocol is the sole responsibility of solvers. A settlement can incur slippage as follows: the winning solution reports the uniform clearing price vector, which locks prices at the moment the winning solver is chosen. However, from the moment the winner is picked offchain until the moment the winning solution is mined onchain, several seconds might pass and in the meantime, there can be market shifts. Thus, a solution that expects a certain amount of tokens to be returned by an AMM interaction might end up receiving less, or more, from that AMM interaction. The case where the settlement contract receives more is a case of “positive” slippage for the solver, while the case where the settlement contract receives less, and thus has to use some of its own internal buffers to cover the difference, is a case of “negative” slippage for the solver.

The protocol tracks all instances of slippage on a per solver basis, and during each week’s payout, it accounts for all positive and negative slippage each solver incurred, and aggregates this into a single value for each solver which we call weekly net slippage. This weekly net slippage is computed by converting all token imbalances to ETH, by using the price with respect to ETH of each token involved at a slippage settlement (where the price is estimated around the time the settlement took place; see here for the exact way slippage is computed and aggregated). Weekly net slippage is always denominated in ETH, and can be either positive, zero, or negative.

In each week’s payout (currently taking place on Tuesdays each week), the solvers that end up with a negative weekly net slippage are penalized by this negative slippage value (i.e., they pay this amount back to the protocol) while solvers that end up with positive weekly net slippage do not gain anything, and the slippage accounting is reset. This means that in the case where solvers have positive net slippage, this is not paid out to them and it also cannot be used to balance out potential future negative slippage, so from the solver’s perspective, it is lost.

In other words, slippage is currently treated asymmetrically. One of the reasons this was set up in such a way is because slippage in any case is inherently stochastic, so solvers would, more or less, see a net slippage close to zero if they settle enough batches; i.e., on expectation, net slippage should be close to zero. This means that solvers would most likely not view slippage as a source of consistent profit.

However, this asymmetry also creates some issues.

  1. As we move towards a more decentralized stage of the competition, having this asymmetry in slippage is a decentralization barrier, as the protocol interferes with what would otherwise be fully managed by each solver, separately. A counter-argument for this is that there is inherent risk with accumulating slippage in tons of different tokens and then aggregating this to a single ETH value; in particular, in the weekly accounting, positive slippage in a random token can balance out negative slippage in ETH, which means that the protocol accepts the risk of treating all tokens in a uniform way. Nevertheless, we believe that making slippage symmetric and thus allowing solvers to fully manage and own their net slippage is one step towards the right direction.

We note here that solvers can already fully own the slippage they generate/suffer, by using an intermediate contract that will be responsible for executing all AMM/liquidity interactions (and there is at least one solver already implementing this strategy). However, this adds some gas overhead, and until the competition reaches a stage where each solver will have their own separate contract, we think that the protocol should allow solvers to fully own their positive slippage.

  1. From an external point of view, a case could be made that the protocol attempts to profit, whenever possible, from the positive slippage that solvers might generate; however, this is not in the protocol’s intentions.

  2. A solver that has accumulated significant positive slippage might be tempted to aggressively spend it, by setting, for example, very loose slippage tolerances in order to avoid reverts. However, we do not believe this adds any real value to the protocol, on average it does not benefits users and in most cases simply results in overspending and sloppy slippage management. This can be made worse by the fact that slippage accounting is reset each week, so positive slippage cannot be used to balance out potential negative slippage across different weeks.

In other words, this limited time window in which slippage is accounted for can potentially skew the distribution of slippage and not make it centered around zero, which can incentivize solvers in the wrong ways. Since doing payouts and accounting regularly is a practical necessity, making slippage symmetric completely removes the distortion that a limited time horizon might create.

Positive slippage in the past 3 months

To get an idea of how much positive slippage was kept in the protocol, we checked positive slippage generated by solvers during a 12-week period (September 22- November 22), and it turns out it is 23.368 ETH. Data was collected using this query, that is used for the weekly slippage accounting.

A more detailed weekly breakdown is the following:

  • Sep 6-13: +0.572
  • Sep 13-20: +0.990
  • Sep 20-27: +2.569
  • Sep 27-Oct 4: +0.470
  • Oct 4-11: +0.009
  • Oct 11-18: +2.975
  • Oct 18-25: +1.597
  • Oct 25-Nov 1: +0.258
  • Nov 1-8: +2.625
  • Nov 8-15: +8.049 (FTX hacker trades, this is why the increase)
  • Nov 15-22: +1.521
  • Nov 22-29: +1.733

Specification

We propose that we remove this asymmetry and make slippage treatment completely symmetric, as we believe that the benefits far outweigh the risks. In particular, using the slippage accounting methods that are already used in the protocol, solvers should be reimbursed for positive slippage while they should be penalized (as they are, now) for negative slippage. In the case of negative slippage, the protocol would deduct the slippage amount in ETH from the gas reimbursements (as it is the case now), while in the case of positive slippage, the protocol would send this positive slippage, measured in ETH, in the rewards address of each solver, along with the COW rewards sent each week.

Rationale

There were a few options regarding the implementation of this proposal. The protocol could decide to not pay out positive slippage, but instead keep accounting of the positive slippage for larger time windows (and not just weekly ones). However, we believe that this might still create wrong incentives for solvers, as positive slippage would still not be fully owned by them. Thus, we propose that positive slippage is explicitly payed to solvers, and the simplest way to do this is by sending the corresponding ETH amount to the solver rewards addresses, so that solvers have full control over it.

6 Likes

This problem might be fixed by forcing each solver heave their own settlement contract.
It might require some change in the infra, but helps removing the need of a shared pool of dust.

  • User approves relayer
  • User creates order
  • Driver uses solver address + custom settlement contract
  • Relayer sends token to settlement
  • Solver address is used to execute (allowlisted in solver custom settlement contract)
  • Relayer/OtherSC sends agreed token amounts to User
1 Like

Thanks for the draft @harisang !

While the ETH reimbursed to solvers for gas expenses is sent to the solver address, it would be better is the surplus resulting from positive slippage is sent to the rewards address. In that case, solver teams can choose how they’ll use the surplus.

1 Like

Indeed, that would be the “cleanest” and probably the most “correct” solution but I don’t think this is an option for the very near future. And it would also add the burden to solvers to create and maintain this dust in tons of tokens (at least when the solver is a general-purpose solver) so as to ensure that small slippage does not cause reverts due to lack of buffers in various tokens.

2 Likes

This is mostly an implementation detail and I guess your suggestion makes more sense, so that solvers can utilize potential positive slippage any way they want.

2 Likes

Some numbers (I also added them in the original post).

I checked how much the protocol would have paid solvers in positive slippage during a 12-week period (September 22- November 22), and it turns out it is 23.368 ETH . Data was collected using this query, that is used for the weekly slippage accounting.

A more detailed weekly breakdown is the following:

  • Sep 6-13: +0.572
  • Sep 13-20: +0.990
  • Sep 20-27: +2.569
  • Sep 27-Oct 4: +0.470
  • Oct 4-11: +0.009
  • Oct 11-18: +2.975
  • Oct 18-25: +1.597
  • Oct 25-Nov 1: +0.258
  • Nov 1-8: +2.625
  • Nov 8-15: +8.049 (FTX hacker trades, this is why the increase)
  • Nov 15-22: +1.521
  • Nov 22-29: +1.733
2 Likes

I believe the benefits of this far outweigh the risks (solvers taking the positive slippage as opposed to users). The main benefit is getting rid of the current weekly slippage accounting process, which has been creating misaligned solver incentives depending on their slippage accrual prior to weekly closing.

That said, given it opens some attack vectors vs. users, I am wondering if users should be advised to use cautious limit prices before users are soundly protected via “envy-freeness of AMMs”, at least on pairs where only limited amount of solvers can settle the order.

1 Like

Indeed, this is a good point. Technically, even today this is an issue for certain tokens where only one or two solvers can trade, as solvers can still use so-called trampoline contracts to capture all the surplus and pass just a bit to the users. However, such solutions can definitely be penalized by social consensus rules, as they clearly violate the promise of delivering fair market prices (and actually, the best possible prices) to our users.

Interestingly, 1inch is implementing a similar non symmetrical treatment of slippage towards its users.
This has become a way to accrue value to the protocol without explicitly stating anything in advance to the user.

Admittedly, I think this is a bad practice, and still it seems to provide some competitive advantage to aggregators that implement it.

They can capture value while still offering the same attractive quotes as before

Should this be considered from the business perspective of CoW Protocol’s value capture and solver payouts?

1 Like

Interestingly, 1inch is implementing a similar non symmetrical treatment of slippage towards its users.
This has become a way to accrue value to the protocol without explicitly stating anything in advance to the user.

Interesting point.

So, are you thinking of something like revenue sharing between the protocol, solvers, potentially token holders etc, instead of just solvers fully owning this positive slippage?

In general, not having it symmetric for solvers does create complications when it comes to deciding optimal solver strategies, and makes risk-management on the solver side even trickier. But, I am definitely open and interested in hearing about alternatives, if those add some value.

1 Like

Yes I think this is an option to consider.

I personally really don’t like our competitors non-symmetric approach towards users because I think it just allows a hidden way to charge users without mentioning it at order placement.

I think the situation is different in CoW Swap because after a winning solution is picked, users cannot incur negative slippage, so not giving them the positive slippage makes more sense. (basically eliminating the rewards but also the RISKS for our users)
So yeah, it does make sense that solvers are responsible for both downside risk and upside reward of execution.

This means protocol revenue will require an up front stated fee to be taken from the user. That’s completely fair and fine.

The problem that I see is a bit more of a product/business problem.
We obviously want that users will be able to compare quotes with competitors and (ideally) see that the quote on CoW Swap is better or at least as-good.
But reality is a bit different:

  • CoW Swap users are getting a better product that eliminates hard-to-manage risks
  • They are presented with a protocol fee when placing their order
  • Actual execution price is expected to be better on CoW Swap as users are not exposed to execution risks/rewards at all while on competition they are exposed just to execution risk without reward
  • This means the quotes will seem worse on CoW Swap compared to competition that expose users to above-mentioned risks and charge their revenue from positive slippage (something that is not incorporated into their quote)

So overall I’m not agains the proposal of symmetric slippage for solvers.
Just wanted to point out this interesting point and start a discussion around it

1 Like

Yes, I agree with both of these. To me, positive slippage for the protocol is not supposed to be a central means of profitability for the protocol, or at least I wasn’t thinking about slippage that way. And this is why I think that making slippage symmetric is the natural way to go and simplifies a lot the solvers’ strategies.

I also agree that this means that we will need to move to a state where there has to be an explicit protocol fee that will account for the service provided, which is full risk-management from the protocol (protection from MEV, no revert costs etc).

1 Like

I agree that thinking about the protocol’s business strategy, profitability and revenue streams is an interesting and important discussion and I’d be keen to see this be surfaced more prominently.

Here, I believe, we are improving an aspect about the reward mechanism that can be captured with some extra technical indirection by solvers already today (and in fact some solvers do).
While slippage happened to be a revenue stream of the protocol, I don’t think it was intentional (in fact, solvers were incentivised to pay back their positive slippage to random other users before the accounting period was over, to increase their chances of winning more rewards).

Did a minor edit in the original post, to explicitly state that the positive slippage, if any, will be paid in ETH in the solver rewards address of each solver, along with the COW rewards.

Since this CIP-draft has been around for some time and I feel there is consensus in moving forward with this, I am planning to move this to voting in the next two days, unless there is some concern raised in the meantime.

1 Like

Sorry to nitpick on this, but would appreciate if you can fit the proposal into the formal CIP template.

There are no formal rules for dealing with CIPs that deviate from the standard format, so it shouldn’t change anything about the CIP process.

But I think it is a good practice to use the format for better readability and orderly review of CIPs.

2 Likes

The proposal has been moved to voting.

https://snapshot.org/#/cow.eth/proposal/0xf9c98a2710dc72c906bbeab9b8fe169c1ed2e9af6a67776cc29b8b4eb44d0fb2

1 Like

The CIP has reached quorum!

4 Likes