Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix solver competition loading for multiple winners #3049

Merged
merged 4 commits into from
Oct 14, 2024

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented Oct 10, 2024

Description

A breaking change of SolverCompetitionAPI, which now potentially returns more than 1 transaction associated with the competition (will notify all teams on slack soon).

Resolves one of the points from #2830 (comment)

Changes

  • SolverCompetitionAPI now returns Vec<TransactionHash>, instead of Option<TransactionHash>

How to test

Refactored unit test to prove it works and that no regression issues were introduced.
Existing e2e test for solver competition proves that competition is properly returned.

@sunce86 sunce86 added the E:6.2 Time to Happy Moo See https://github.com/cowprotocol/pm/issues/77 for details label Oct 10, 2024
@sunce86 sunce86 self-assigned this Oct 10, 2024
@sunce86 sunce86 requested a review from a team as a code owner October 10, 2024 12:05
Copy link
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.

LGTM. Nice tests. 👍

Copy link
Contributor

@m-lord-renkse m-lord-renkse left a comment

Choose a reason for hiding this comment

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

LGMT.

Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +62 to +72
WITH competition AS (
SELECT sc.id
FROM solver_competitions sc
JOIN settlements s ON sc.id = s.auction_id
WHERE s.tx_hash = $1
)
SELECT sc.json, sc.id, COALESCE(ARRAY_AGG(s.tx_hash) FILTER (WHERE s.tx_hash IS NOT NULL), '{}') AS tx_hashes
FROM solver_competitions sc
JOIN settlements s ON sc.id = s.auction_id
WHERE s.tx_hash = $1
WHERE sc.id = (SELECT id FROM competition)
GROUP BY sc.id
Copy link
Contributor

Choose a reason for hiding this comment

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

Initially, I thought the query could be simplified, but it looks like this is not the case.

@sunce86 sunce86 enabled auto-merge (squash) October 14, 2024 07:13
@sunce86 sunce86 merged commit d736be3 into main Oct 14, 2024
11 checks passed
@sunce86 sunce86 deleted the fix-solver-competition-loading branch October 14, 2024 07:17
@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
E:6.2 Time to Happy Moo See https://github.com/cowprotocol/pm/issues/77 for details
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants