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

Get_hashes_by_auction_id implementation for multiple settlements #2976

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented Sep 12, 2024

Description

Fixes #2975

Changes

  • ...
  • ...

How to test

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

Approved assuming more PRs will come after this one.

@sunce86 sunce86 enabled auto-merge (squash) September 12, 2024 19:13
@sunce86 sunce86 merged commit e8a5c7a into main Sep 12, 2024
11 checks passed
@sunce86 sunce86 deleted the get-hashes-by-auction-id branch September 12, 2024 19:19
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2024
Ok(Some(hash)) => return Ok(hash),
Ok(hashes) if hashes.is_empty() => {}
Ok(hashes) => {
if let Some(hash) = hashes.into_iter().next() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks quite ugly. Could be a bit nicer with:

            match self
                .persistence
                .find_settlement_transactions(auction_id)
                .await
                .map(|mut hashes| hashes.pop())
            {
                Ok(Some(tx_hash)) => return Ok(tx_hash),
                Ok(None) => {},
                Err(err) => {
                    tracing::warn!(?err, "failed to fetch recent settlement tx hashes");
                }
            }

&self,
auction_id: i64,
) -> anyhow::Result<Option<H256>> {
pub async fn find_settlement_transactions(&self, auction_id: i64) -> anyhow::Result<Vec<H256>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this function might as well be inlined in the infra module to get rid of the file.

Copy link
Contributor

@fleupold fleupold left a comment

Choose a reason for hiding this comment

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

The PR is missing a meaningful description and I'm not sure it's actually fulfilling the desired logic (or at least not fully). Once we submit multiple solutions we want all of them to succeed before considering wait_for_settlement_transaction done and continuing the runloop. Now we would wait for one to get included and move on which seems incorrect.

@sunce86
Copy link
Contributor Author

sunce86 commented Sep 16, 2024

The PR is missing a meaningful description and I'm not sure it's actually fulfilling the desired logic (or at least not fully). Once we submit multiple solutions we want all of them to succeed before considering wait_for_settlement_transaction done and continuing the runloop. Now we would wait for one to get included and move on which seems incorrect.

The scope of the PR is limited. It's not supposed to adjust the /settle logic. We have a separate task for that in #2830 (comment)

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.

feat: Update database::settlements::get_hash_by_auction_id()
5 participants