cowprotocol / cowprotocol/services

chore(autopilot): make auction post-processing db operations atomic

Open
#3,437 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tech-debt track:maintenance
Dominant language
Rust
Stars
318
Forks
189
Avg merge
2d 2h
Merged PRs (30d)
121

Description

Background

Currently, the post_processing function on the autopilot performs multiple database saving operations in parallel. While this is good for performance, it opens the door for database inconsistencies in case the autopilot restarts between database operations.

Ideally we would like all the database operations (specially storing the winners and reference scores) to be done atomically.

Details

More in detail, the database operations are in the post_processing function:

save_auction
save_solutions // affects the proposed_solutions table
save_competition // affects the settlement_scores
save_surplus_capturing_jit_order_owner
store_fee_policies
Acceptance criteria

All previously indicated database operations are done atomically. Ideally with minimal performance impact.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the autopilot post_processing function and tracing save_auction, save_solutions, save_competition, save_surplus_capturing_jit_order_owner, and store_fee_policies. Determine how these operations can share an atomic database boundary without significant performance impact. Done means all listed writes commit or fail together, including proposed_solutions and settlement_scores.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.