-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description I noticed that when placing a too optimistically quoted order on Gnosis Chain (which cannot fill) and later placing another more realistic order on top, the second order only gets filled once the first one is expired or cancelled. This is because the driver filters out the second order as it looks like the user only has balance for the first. However, in theory we should sort orders by their expected chance of filling (taking the external auction prices into account), meaning the second order with a more lax limit price should have priority over the first order: https://github.com/cowprotocol/services/blob/fd7f12dded72359c087be6f3c04b898241c3eb20/crates/driver/src/domain/competition/auction.rs#L176-L195 The root cause seems to be that likelihood wasn't implemented correctly, which this PR ixes # Changes - Add unit tests for the likelihood method - Inverse the ratio that is returned by the method to comply with its documentation (higher value means higher likelihood) ## How to test Unit tests, also redo the test where we set an order with extremely tight slippage tolerance that doesn't fill and place a higher slippage order afterwards. <!-- ## Related Issues Fixes # -->
- Loading branch information
Showing
4 changed files
with
11 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters