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: split execution of large batches #2842

Closed
erwanor opened this issue Jul 17, 2023 · 0 comments · Fixed by #2851
Closed

dex: split execution of large batches #2842

erwanor opened this issue Jul 17, 2023 · 0 comments · Fixed by #2851
Assignees

Comments

@erwanor
Copy link
Member

erwanor commented Jul 17, 2023

Context

When an overflow happen during DEX execution, the engine closes the specific position that was tentatively filled and restarts the process of routing and filling the batch. This approach is predicated on attributing the overflow onto a position (or trading function) rather than the specified swap input. But since trades are aggregated into batches, the effective upper bound on a batch is the minimum of u128::MAX, or all the the circulating supply for that token in the shielded pool. While processing such a large batch at once is unlikely, we still have to deal with the fact that approaching this number increases the likelihood of overflow occurring during internal dex calculations.

Solution

We should detect and split large batches into smaller chunks that are sequentially executed by the DEX engine (to avoid introducing any meaningful notion of economic ordering).

@erwanor erwanor self-assigned this Jul 17, 2023
@erwanor erwanor added this to Testnets Jul 17, 2023
@erwanor erwanor moved this to Testnet 57: Ganymede in Testnets Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Testnet 57: Ganymede
Development

Successfully merging a pull request may close this issue.

1 participant