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

Revert "Use quote id just for debugging (#3054)" #3096

Merged
merged 3 commits into from
Oct 31, 2024
Merged

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented Oct 30, 2024

This reverts commit cea22f6.
Then implements #3100

Description

Reverts the change introduced by the PR #3054

Apparently the current implementation is not good at recovering the right quote as it sometimes finds the quote that is too old, while the order was intended to be created with the most recent quote.

A different fix is implemented to actually continue using quote_id, but compute the fresh quote if quote_id cant be found.

@sunce86 sunce86 requested a review from a team as a code owner October 30, 2024 11:36
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.

Didn't actually get from the description why this revert is even required.

@MartinquaXD
Copy link
Contributor

Didn't actually get from the description why this revert is even required.

The problem is a bit subtle. Under most circumstances we only use the quote to see if an order was created out of market to classify it either as a limit or a market order.
For Ethflow orders we do something extra. To avoid people spamming ethflow orders and draining the automatic refund service we require them to create the ethflow order based off a reasonable quote. If the quote we recover or compute just in time suggest the order is out-of-market at the time of creation the order is not eligible for automatic refunding.
If we don't look up the quote exactly by ID and instead do a fuzzy match we frequently end up finding the wrong quote which leads to us having to manually refund the order which is annoying for us and the user.

@sunce86 could you implement the change within this PR or merge the revert and new implementation together? The reason is that some wallets already rely on the fact that they can create orders and have a quote generated if none can be found.

# Description
A fix on top of the #3096
for easier reviewing.

We want to always compute the fresh quote when provided quote_id is not
found in database. This is now enabled for all orders, not just for
ETHFlow orders.

A bit more context can be found
#3096 (comment)

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

- [ ] Changed behavior of the function `get_or_create_quote`

## How to test
Existing tests updated.
@sunce86 sunce86 enabled auto-merge (squash) October 31, 2024 09:03
@sunce86 sunce86 merged commit 1182a6d into main Oct 31, 2024
12 checks passed
@sunce86 sunce86 deleted the revert-quote-id-logic branch October 31, 2024 09:08
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
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.

3 participants