Skip to content

Remove uniform clearing prices from winner selection#4313

Open
jmg-duarte wants to merge 1 commit intomainfrom
jmgd/ucp/1
Open

Remove uniform clearing prices from winner selection#4313
jmg-duarte wants to merge 1 commit intomainfrom
jmgd/ucp/1

Conversation

@jmg-duarte
Copy link
Copy Markdown
Contributor

@jmg-duarte jmg-duarte commented Apr 7, 2026

Description

Uniform clearing prices (UCP) are no longer part of the core CoW Protocol scoring mechanism since CIP-67. In winner selection, the UCP variables were already dead code (_uniform_sell_price / _uniform_buy_price). All scoring uses calculate_custom_prices_from_executed() from per-trade executed amounts instead.

This is the first PR in a series to remove UCP from the entire backend. It targets only the winner-selection crate and its integration points in the autopilot, which is low-risk since the code was already unused.

Changes

  • Remove prices: HashMap<Address, U256> field and prices() accessor from winner_selection::Solution
  • Remove dead _uniform_sell_price / _uniform_buy_price lookups in compute_order_score()
  • Stop passing clearing prices when constructing winsel::Solution in the autopilot
  • Set clearing_prices to Default::default() in the run loop (kept to avoid breaking the solver competition API)
  • Update test in settlement/mod.rs to match new Solution::new() signature

How to test

  1. cargo nextest run -p winner-selection
  2. cargo nextest run -p autopilot
  3. cargo clippy --locked -p winner-selection -p autopilot --all-features --all-targets -- -D warnings

Staging test

Value Before After
0.1 0x749d2 0x13873

@jmg-duarte jmg-duarte requested a review from a team as a code owner April 7, 2026 13:00
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the prices field and its associated logic from the Solution struct across the winner-selection and autopilot crates. Key changes include updating the Solution constructor, removing the prices() getter, and simplifying the compute_order_score function by removing unused uniform clearing price lookups. Additionally, the clearing_prices field in the solver competition API is now defaulted to an empty map to maintain backward compatibility. I have no feedback to provide as the existing review comment was informational and did not meet the required severity or actionability thresholds defined in the style guide.

Uniform clearing prices (UCP) are no longer used in winner selection
scoring since CIP-67. The variables were already prefixed with `_`
(unused). This removes the dead `prices` field from the winner-selection
`Solution` struct, the unused UCP lookups in `compute_order_score()`,
and stops passing/populating clearing prices from the autopilot.
Copy link
Copy Markdown
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense as the lowest risk first step. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants