bug: some orders are ignored when computing total surplus #2289
Labels
bug
Something isn't working
E:4.2 Protocol Fee Implementation
See https://github.com/cowprotocol/pm/issues/29 for details
Problem
We noticed some instances in Sepolia where
total_surplus
is not being computed as expected.While debugging the corresponding DB query, I noticed that this happens because some order uids aren't available in the order_execution table and this causes these orders to be ignored when computing the surplus.
As we recently changed how the
order_execution
table works, the query might need to be updated accordingly.Example of orders that are ignored for the surplus: this one or this one. This user has many orders but only the most recent orders count for it.
Impact
/api/v1/users/{address}/total_surplus returns lower values than expected.
To reproduce
I used the following simplified version of the
total_surplus
database query. first with the last join and then without to see that some useful orders are missing. (Tried in Sepolia staging.)Expected behaviour
The query should include the surplus of the two example orders in the description.
services version/commit hash and environment
72ce082
The text was updated successfully, but these errors were encountered: