cowprotocol / services

Off-chain services for CoW Protocol
https://cow.fi/
Other
181 stars 69 forks source link

feat: Allow multiple solution submissions for one auction #2830

Open fleupold opened 2 months ago

fleupold commented 2 months ago

Problem

We frequently see competing solutions in which some orders are matched in the first and some other orders are matched in the other solution. Currently we chose the single best solution from all candidate, potentially leaving order that had been matched unsettled. This can cause delay and increase the user's "time to happy moo"

Suggested solution

Allow mutually exclusive solutions (ie solutions that don't overlap in any order) to be settled in the same auction.

Additional context

This will have non-trivial impact on other parts of the protocol (e.g. solver payouts) so we should proceed with a lot of care. Maybe we can first experiment with this in sepolia to see which parts of the existing backend system would break and then coordinate with the remaining teams to see if there are issues with also enabling this in prod.

Acceptance criteria

There should be a way to configure the maximum number of solutions that can be settled per auction (default to 1 like today). If set to more than one, the top n solvers should receive a settle call. Settlement indexing and all other post trade features (fetching trades, solutions, etc) should be working no n>1 as it is today.

sunce86 commented 4 weeks ago

Tasks preferably implemented in a given order:

fleupold commented 3 weeks ago

As for scope creep, can we agree that for the speed initiative we still want solvers to combine solutions as much as possible (that is each solver will only receive on settle call). I think this reduces scope and in the absence of the new fairness rule (which may disqualify batched bids) I don't think this is needed.

fleupold commented 3 weeks ago

I think the main thing I'm missing from a design perspective is how we are going to match solution candidates with settlement observations? Will there be some aspect about the solution (like the orders that were promised, prices or similar) or some form of solutions id that needs to get encoded (similar to auction id) or will we match on msg.sender of the transaction?

If we told 3 solvers to settle and observe 2 settlements later on chain, how do we know which one is which?

sunce86 commented 3 weeks ago

We can match on orders since no common tokens are allowed to exist in winning solutions.