Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow external solvers to withhold fees #2440

Closed
fleupold opened this issue Feb 27, 2024 · 5 comments
Closed

feat: Allow external solvers to withhold fees #2440

fleupold opened this issue Feb 27, 2024 · 5 comments
Assignees
Labels
E:4.2 Protocol Fee Implementation See https://github.com/cowprotocol/pm/issues/29 for details help wanted Extra attention is needed

Comments

@fleupold
Copy link
Contributor

Problem

Solvers raised interest in doing the fee computation and withholding themselves even if they are using the CoW provided driver logic. This means they would return trades with all fees incorporated (network and protocol fees) and require the driver to skip any further adjustments

Suggested solution

  • allow a per solver config flag describing whether the driver should apply fees or not
  • forward all fee policies to the solver

Alternatives considered

Don't implement this and instead use this as an argument for solvers to switch to full co-location

Additional context

This should only be implemented for the new solver engine interface (not legacy http solver) as the latter will be discontinued in less than one month.

Acceptance criteria

Solvers that use private liquidity can withhold the protocol fee by offering a slightly worse quote.

@sunce86
Copy link
Contributor

sunce86 commented Mar 4, 2024

Note that this would cause gas cost fees to be shown as 0 for these orders as we wouldn't have a way to calculate them (on the autopilot side).

If we want this, I assume we first need to make a long term plan how we want to show the gas fees to the user.

@sunce86
Copy link
Contributor

sunce86 commented Mar 4, 2024

I also think the solver accounting needs to refactor their total fees calculation to not use autopilots calculation (observation) in this case (at least until solvers run their own driver and are paying for their submission themselves).

@fleupold
Copy link
Contributor Author

fleupold commented Mar 4, 2024

As far as I understand protocol fees are computed based on the executed amounts and fee policies from the auction (not based on the adjusted clearing price vector as this one includes both protocol as well as gas fees). @fhenneke can you confirm if this is the case?

As to how we show fees to the user, I think this challenge is not related to allowing solvers to withhold protocol fees. We can compute the protocol fees regardless of the solver specified fees and display those to the user. As for network fees, with "rank by surplus" solvers can already "price in" the network fee (and e.g. charge you 0 for a limit order if they settle it with own inventory at a slightly worse price).

@fhenneke
Copy link

fhenneke commented Mar 4, 2024

As far as I understand protocol fees are computed based on the executed amounts and fee policies from the auction (not based on the adjusted clearing price vector as this one includes both protocol as well as gas fees). @fhenneke can you confirm if this is the case?

This is correct. Protocol fees are computed from executed amounts and fee policies.
There is one subtle exception for the volume cap of out-of-market sell orders. But I would not worry about that and potentially it is changed with the initial implementation of CIP-38 anyways.

m-lord-renkse added a commit that referenced this issue Mar 27, 2024
# Description
Related to #2440

Forwards fee policies from `driver` to `solvers`. 

I assume same will need to be added to `gnosis/solvers` repo.

Potentially breaking the api, depends how external solvers parse unknown
fields.

## How to test
Existing tests.

<!--
## Related Issues

Fixes #2544
-->

---------

Co-authored-by: Mateo <[email protected]>
Co-authored-by: sunce86 <[email protected]>
Co-authored-by: Martin Beckmann <[email protected]>
@m-lord-renkse
Copy link
Contributor

Done in #2544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E:4.2 Protocol Fee Implementation See https://github.com/cowprotocol/pm/issues/29 for details help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants