Support quotes without reference prices, drop market order class - #224
Merged
Merged
Conversation
fleupold
requested review from
AryanGodara,
MartinquaXD,
squadgazzz and
tilacog
September 16, 2026 07:16
fleupold
commented
Sep 16, 2026
| @@ -1,5 +1,5 @@ | |||
| //! This test ensures that the Balancer SOR solver properly handles sell and buy | |||
| //! market orders, turning Balancer SOR responses into CoW Protocol solutions. | |||
| //! orders, turning Balancer SOR responses into CoW Protocol solutions. | |||
Collaborator
Author
There was a problem hiding this comment.
Everything below is adjusting tests
MartinquaXD
approved these changes
Sep 16, 2026
MartinquaXD
left a comment
Collaborator
There was a problem hiding this comment.
Changes look good to me.
Given that the zeroex solver is no longer in use we can probably delete the code so that changes like this one don't have to adjust a bunch of dead tests.
Comment on lines
+125
to
+126
| "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": "226932091840732390283", | ||
| "0xba100000625a3754423978a60c9317c58a424e3d": "997070755000000000" |
Collaborator
There was a problem hiding this comment.
These values, executedAmount and fee are now tied to the gas estimate call. Meaning if the mock returns a different gas estimate all these values would change again?
tilacog
approved these changes
Sep 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Since cowprotocol/services#4874 the driver sends every quote as a
limitorder, leading to solvers from this crate failing to create quotes for two reasons"Swap::into_solutionsimulated gas for every limit order. The synthetic quote order is owned by the zero address, and simulation reverts withERC20: transfer to the zero address, so the swap was dropped.Single::into_solutionconverted the gas cost into a sell-token fee withsell_token?, so a missing reference price dropped the solution as well.While porting the upstream fix, this PR also removes the market/limit order distinction. Every order has been a limit order for a long time and since cowprotocol/services#4874 the protocol-fee code path is dead.
Changes
Note, that most changes are trying to fix/improve the tests for this crate.
Only simulate gas when the auction has a sell token price (i.e. in real auctions). Quotes use the gas reported by the DEX, mirroring Always quote with limit orders rebased cowprotocol/services#4874.
Fall back to a zero fee when there is no sell token price. The orderbook API estimates the fee for quotes itself.
Drop
Fee::Protocol/Fee::Surplus,Order::solver_determines_fee()and theorder::Classdomain enum.Tests: all orders are
limitorders now (market_order.rs->limit_order.rs). Some expected amounts change by the fee which is now taken from surplus.Every test declares the JSON-RPC calls it expects through a mock node (
tests::mock::node).Claude repaired three fixtures that only passed because the DEX response failed to parse: Balancer
out_of_price(missingpaths, misspelledreturnAmountRaw), 0xout_of_price(empty response) anddex::wrong_execution(missingdatawrapper, buy-side amounts swapped). They now exercise the checks they describe.How to test
CI