Skip to content

Remove CoW AMMs - #4624

Merged
fleupold merged 4 commits into
mainfrom
remove-cow-amm
Jul 30, 2026
Merged

Remove CoW AMMs#4624
fleupold merged 4 commits into
mainfrom
remove-cow-amm

Conversation

@fleupold

Copy link
Copy Markdown
Contributor

Description

As we are stopping support for CoW AMMs, this PR removes all occurrences of the concept in our backend code base. It leaves the underlying protocol concept of "surplus capturing jit orders" (the idea that the protocol can define certain accounts, for which the solver can create arbitrary limit orders during the competition and execute them with surplus that counts towards their score), as this is relatively little overhead to maintain and potentially a useful concept down the line.

Note, I'm not intending to merge this PR right away (mainly wanted to get feedback and a feel if I'm missing anything). We still need to talk to solvers and the one remaining LP before we can execute on this.

Changes

  • Remove all CoW AMM related contract artefacts
  • Remove cow amm indexing logic in the autopilot (replaced with an infra configurable list of surplus capturing jit order owners)
  • Remove cow amm order creation logic in the driver
  • Drop cow amm DB table

How to test

CI

Related Issues

https://linear.app/cowswap/issue/BE-99/remove-cow-amm-support

@fleupold
fleupold requested a review from a team as a code owner July 13, 2026 14:59
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

Reminder: Please update the DB Readme and comment whether migrations are reversible (include rollback scripts if applicable).

  • If creating new tables, update the tables list.
  • When adding a new index, consider using CREATE INDEX CONCURRENTLY for tables involved in the critical execution path.
  • For breaking changes, remember that during rollout k8s starts the new autopilot, runs the Flyway migration, and only then shuts down the old pod. That overlap means the previous version can still be processing requests on the migrated schema, so make it compatible first and ship the breaking DB change in the following release.

Resolved

@claude

claude Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 4m 1s —— View job


PR Review: Remove CoW AMMs

  • Read the PR diff against origin/main
  • Analyze changes for correctness & completeness
  • Post inline review comments
  • Post summary

The removal looks clean and consistent: the surplus-capturing JIT order owner concept is correctly preserved (autopilot still forwards the config-driven allowlist to solvers, driver still accepts it in the auction), and the dead code / artifacts / DB table / crate are all removed together. The TABLES list and log filters were updated too. No dangling cow_amm references remain in compiled code, and Maintaining is still needed for the other indexers.

I flagged two rollout-coordination concerns as inline comments — neither is a logic bug, but both can break a deploy:

  1. V113__drop_cow_amms.sql — dropping the table in the same release that removes the indexer means the still-running old autopilot pod (its cow-amm indexer sits in run_essential_maintenance) will error on the migrated schema during the k8s overlap window. Suggest shipping the DROP in a follow-up release.
  2. Config deny_unknown_fields — removing the cow-amm (autopilot) / cow-amms (driver) fields means any environment whose config still has those sections will fail to start. Infra configs need cleaning up as part of the rollout.

One behavioral note (not flagged, appears intentional): surplus-capturing JIT owners are no longer filtered by native-price availability in solvable_orders.rs, since token info isn't known for a plain owner allowlist — responsibility now sits with the solver creating the JIT order.

Given the PR is explicitly not meant to merge yet, these are mainly things to sequence correctly when you do execute.

Comment thread database/sql/V113__drop_cow_amms.sql Outdated
Comment thread crates/configs/src/autopilot/mod.rs
Comment thread database/sql/V113__drop_cow_amms.sql Outdated
Comment thread crates/driver/src/domain/competition/mod.rs
/// surplus in the auction.
#[serde(default)]
pub cow_amm: CowAmmGroupConfig,
pub surplus_capturing_jit_order_owners: Vec<Address>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the infra pr removes the fields and doesnt add any, do we actually need this or could we also remove this field and remove even more things?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it's ok to leave the concept in the codebase (it still seems like a basic protocol feature we might want to reuse one day)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'd argue that we can just come back and re-add it when needed then, otherwise we just have code we're not using and adding noise

either way, doesnt need to be removed in this PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Normally I'd agree with this, but looking at how long it took us to add this feature in the first place, I would rather not rip it out to later re-discuss how it should be added again.

@MartinquaXD MartinquaXD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹
Not sure if we actually need to keep the surplus capturing jit order owner concept but removing this might also be a bit more involved. Starting by ripping out only the cow amm specific stuff is definitely the right call.

@linear-code

linear-code Bot commented Jul 15, 2026

Copy link
Copy Markdown

BE-99

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed.

@fleupold fleupold mentioned this pull request Jul 29, 2026

@jmg-duarte jmg-duarte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This has been disabled in prod already, it's g2g

@fleupold
fleupold added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit 20fe67a Jul 30, 2026
22 checks passed
@fleupold
fleupold deleted the remove-cow-amm branch July 30, 2026 08:52
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants