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

dex: implement forced ranking for positions #2928

Closed
erwanor opened this issue Aug 14, 2023 · 1 comment
Closed

dex: implement forced ranking for positions #2928

erwanor opened this issue Aug 14, 2023 · 1 comment
Assignees
Labels
_P-medium Medium priority

Comments

@erwanor
Copy link
Member

erwanor commented Aug 14, 2023

Is your feature request related to a problem? Please describe.
One of the intuition behind the current DEX design is that the total processing costs caused by a single position are limited by the fact that prices move around, which means that a position is only ever surfaced when its price and market price are within range of each other. However, this is not always the case like for trading pairs that have stable exchange rates (e.g. two IBC-equivalent assets with different canonical representations). In that scenario, a position close to the tip of the orderbook will be surfaced for consideration over-and-over again which could have adverse effect on the performance of routing execution.

Describe the solution you'd like
We should implement a forced ranking (aka. stack ranking) for position indices, limiting the total amount of chain state that can be persistently utilized, and evicting those positions that are least competitive (on price, inventory, and ultimately fees). This amendment to the DEX engine does not rely on special-casing stablekind pairs.

One way to do this is to scan the set of open positions at the end of each epoch. For each trading pair, we can compare the top of the order-book to the long tail of positions below it and use some criterion to close all of those that are below a certain threshold.

Describe alternatives you've considered
Instead of scanning the set of open positions every epoch, we could build an incremental index of positions.

@erwanor erwanor added this to Testnets Aug 14, 2023
@erwanor erwanor moved this to Next (Steal from here) in Testnets Aug 14, 2023
@erwanor erwanor self-assigned this Aug 14, 2023
@conorsch conorsch moved this from Next to Future in Testnets Oct 18, 2023
@aubrika aubrika added this to Penumbra Oct 30, 2023
@github-project-automation github-project-automation bot moved this to 🗄️ Backlog in Penumbra Oct 30, 2023
@hdevalence hdevalence added the _P-medium Medium priority label Feb 8, 2024
@hdevalence
Copy link
Member

Now tracked in #4077

@hdevalence hdevalence closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2024
@github-project-automation github-project-automation bot moved this from 🗄️ Backlog to Done in Penumbra Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
_P-medium Medium priority
Projects
Archived in project
Status: Future
Development

No branches or pull requests

2 participants