Skip to content

link quotes to auctions - #4712

Open
MartinquaXD wants to merge 3 commits into
mainfrom
link-quotes-to-auction
Open

link quotes to auctions#4712
MartinquaXD wants to merge 3 commits into
mainfrom
link-quotes-to-auction

Conversation

@MartinquaXD

@MartinquaXD MartinquaXD commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

for the fast path order execution we need to have real solver competition data for fast path quotes.
The plan is to create new entries in competition_auctions, proposed_solutions, and proposed_trade_executions and link them to the quotes via the new auction_id.

Changes

  • adds auction_id to quotes and order_quotes
  • documents new columns in the readme

How to test

extended existing roundtrip test
but primarily there will be an e2e test at the end

Related Issues

BE-56

@MartinquaXD
MartinquaXD requested a review from a team as a code owner August 6, 2026 21:07
@MartinquaXD

Copy link
Copy Markdown
Contributor Author

@claude

@claude

claude Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished @MartinquaXD's task in 1m 43s —— View job


PR Review: link quotes to auctions

Reviewed the diff. Threading auction_id through the DAO structs and query builders looks correct and consistent, and every current writer setting None is fine as a first step. I posted 2 inline findings:

  • crates/database/src/orders.rs:404 — the upsert assigns auction_id = $10 unconditionally, but the commit message says it should COALESCE to avoid erasing an earlier link on the ethflow reorg path. Latent bug once the orderbook flow starts populating the column.
  • database/sql/V119__…sql:8V119 alters both tables while V120__add_auction_id_to_order_quotes.sql is an empty 0-byte file. The order_quotes ALTER likely belongs in V120 (or delete the empty file).

Nothing else stood out — README docs and test coverage additions look good.

@github-actions

github-actions Bot commented Aug 7, 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.

Caused by:

Comment thread crates/database/src/orders.rs
Comment thread database/sql/V120__add_auction_id_to_quotes.sql
MartinquaXD and others added 3 commits August 7, 2026 11:23
First step in linking a stored quote to the full solver competition it
came from. Adds the column and threads it through the DAO structs; every
current writer sets it to None. Downstream steps will populate it from
the orderbook quote flow.

The upsert on `order_quotes` uses `COALESCE(EXCLUDED.auction_id, ...)`
so a subsequent write without an auction_id (e.g. an ethflow reorg
path) doesn't erase an earlier link.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MartinquaXD
MartinquaXD force-pushed the link-quotes-to-auction branch from 576e622 to 5aab4ce Compare August 7, 2026 11:24
Comment thread database/README.md
verified | boolean | not null | information if quote was verified
metadata | json | not null | additional data associated with the quote in json format
creation\_timestamp | timestamptz | not null | when the entry was created (DEFAULT NOW() for new and 1970-01-01 for historical data)
auction\_id | bigint | nullable | the auction competition that was the basis for this quote

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.

Do I understand correctly that this column will be populated only for the fast path quotes? If so, it is hard to understand from the naming and description. The same applies to the rust code.

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.

Yes - only for fast path orders. I didn't want to codify this by calling it something like "fast_path_auction" or so in case we want to more generally migrate towards this system of storing quotes.

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.

Ok, but maybe a comment/description should explain that?

@squadgazzz squadgazzz 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.

LGTM, assuming some context regarding the auction id will be added.

@AryanGodara AryanGodara left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. reviewing this in the stack PRs, but the addition here looks good 👌🏼
Just one nit question below


-- Copy of quotes.auction_id preserved when the quote is attached
-- to an order.
ALTER TABLE order_quotes ADD COLUMN auction_id bigint;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

order_quotes.auction_id is added here but never populated, insert_order still sets it as None, and neither of the stacked follow-ups (#4713/#4714) touches this path; they only set quotes.auction_id. Is the order-creation copy meant for a a specifc later 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.

3 participants