Skip to content

Sync/upstream merge 20250808#7

Merged
xdecentralix merged 12 commits intomainfrom
sync/upstream-merge-20250808
Aug 7, 2025
Merged

Sync/upstream merge 20250808#7
xdecentralix merged 12 commits intomainfrom
sync/upstream-merge-20250808

Conversation

@xdecentralix
Copy link
Collaborator

Description

Changes

  • ...
  • ...

How to test

squadgazzz and others added 12 commits July 30, 2025 14:46
# Description
Updates the HooksTrampoline SC to the new version.

- Update the SC address
- ABI schema
- Forked e2e test
- Also, fixes cowprotocol#3466, since @fleupold identified the issue
# Description
Gnosis pay hardcodes the HooksTrampoline SC address, so we should
continue using the old one in services.

To double-check the old address:
https://github.com/cowprotocol/services/pull/3528/files
# Description
Since we made the switch to combinatorial auctions
(cowprotocol#3423,
cowprotocol#3385 and
cowprotocol#3384) we no longer have the
need for the old, single winner max score, implementation.

This PR removes all logic related to the legacy implementation as well
as any support code used to allow switching between implementations
(legacy or combinatorial).

This PR does not deal with legacy database table removal, as these are
covered already by cowprotocol#3366 and
cowprotocol#3362

# Changes
<!-- List of detailed changes (how the change is accomplished) -->

- Use always combinatorial auction implementation on the autopilot,
without cutover logic.
- Removed legacy `max_score` implementation
- Removed the `Arbitrator` trait used to abstract and define common
operations of both `max_score` and `combinatorial` implementation. Now
all the operations are defined directly on the `combinatorial` mod.
- Removed competition logic that stored scores on the legacy
`settlement_score` table
- Removed the `local_node_fairness_check ` e2e test, as it was designed
for the legacy implementation and we are already covering that logic for
combinatorial auctions with other tests
- Adjusted the Uniswap V2 e2e test to stop relying on the legacy
database tables.

## How to test
I rely on the existing test passing, as no behavior should change.

## Related Issues
cowprotocol#3424

---------

Co-authored-by: ilya <ilya@cow.fi>
# Description
We are seeing significant performance degradation (mainly for solvers'
time to solve) when using external RPC providers
(cowprotocol#3409).

This PR implements some optimizations related to driver async tasks that
can be done in parallel.

Questions:
- [Token information
fetching](https://github.com/cowprotocol/services/blob/main/crates/driver/src/infra/api/routes/solve/dto/solve_request.rs#L28)
is not made into a task for simplicity, as there is not much performance
to be gained (it's already heavily cached)
- Bad token filtering needs all the orders (including CoW AMM orders) to
be included in the auction before filtering. Ideally we would like to do
bad token filtering only once as a data fetching task, but it would mean
drastically alter the current logic (we are adding CoW AMM orders very
late into the execution). So I'm not sure about it including it in this
PR.

# Changes
- [x] Remove the AuctionProcessor, as currently it acts as a bottleneck
and some of the operations (like `sort_orders`) should be done in each
solver.
- [x] Encapsulate the data fetching tasks (balances, app data and cow
amm orders) into shared futures so they can be awaited from multiple
solvers. Internally we use a `Mutex` per auction to avoid duplicating
work per solver (similar approach as the `AuctionProcessor`
implemented).
- [x] Refactor the liquidity fetching into a data fetching task, which
now it's done only once per all solvers.
- [x] Run the bad token filtering in parallel with the liquidity
fetching
- [x] Run the order sorting in parallel with all the data fetching tasks

## How to test
All existing tests pass

## Related Issues
This PR implements one of the optimizations mentioned in
cowprotocol#3409, the parallel
liquidity fetching.

But this PR goes a bit beyond that to parallelize all common async tasks
in the driver

---------

Co-authored-by: MartinquaXD <martin.beckmann@protonmail.com>
Co-authored-by: ilya <ilya@cow.fi>
# Description

The instrument macro doesn't instrument a sync function that returns a
future properly, we need to wrap that future in Instrument instead. This
came up after looking at the values in Grafana where this span length
was in microseconds.
# Description

As a continuation of adding instruments throughout the service as seen
in cowprotocol#3520 and
cowprotocol#3519 this PR is adding
instrumentation for `autopilot`.
…)" (cowprotocol#3544)

This reverts cowprotocol#3450 since it seems like it causes some issues. A rework
will be done in a separate PR.
Addresses all the compiler/clippy complaints.
# Description
Sometimes it is not clear whether autopilot is encountering issues with
the DB because of the long-awaited queries or something else. This PR
adds simple DB pool metrics that record active and idle connections to
the DB. This can potentially be useful in future investigations.

## How to test
Grafana
# Description
This PR adds some tracing logs to the auction runloop to improve
observability during debugging issues when autopilot crashloops. With
that, we can probably understand if a specific operation precedes the
crashloop.

## How to test
Dynamicly enable the following logs:
```
autopilot::run_loop=trace,autopilot::solvable_orders=trace
```
@github-actions
Copy link

github-actions bot commented Aug 7, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


0 out of 4 committers have signed the CLA.
@squadgazzz
@mrnaveira
@fafk
@xdecentralix
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@xdecentralix xdecentralix merged commit b2da3b1 into main Aug 7, 2025
8 of 11 checks passed
@xdecentralix xdecentralix deleted the sync/upstream-merge-20250808 branch August 7, 2025 22:52
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2025
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.

4 participants