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

router(dex): document safety assumptions in routing execution #2424

Merged
merged 9 commits into from
Apr 27, 2023

Conversation

erwanor
Copy link
Member

@erwanor erwanor commented Apr 27, 2023

The initial goal of this PR was to prove (via a dust fill test) that during routing execution, it was possible to craft positions such that a saturating input would be zero. It turns out that this isn't possible, so this PR instead lays out why this isn't possible, and document various SAFETY assumptions that the DEX engine makes.

@erwanor erwanor temporarily deployed to smoke-test April 27, 2023 19:25 — with GitHub Actions Inactive
// direction.
// + accumulated_effective_price != 0, because for each position
// we have p, q != 0.
unreachable!("current_value is nonzero")
Copy link
Member Author

Choose a reason for hiding this comment

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

@hdevalence you were right! it should be impossible to hit that branch, which is a relief. In the process of proving why i realized that a much more load bearing aspect of routing is in the end-to-end effective price calculation, so this is the next item on my TODO of double-checking assumptions. They are already marked as TODOs in the code.

@erwanor erwanor merged commit c51db73 into main Apr 27, 2023
@erwanor erwanor deleted the dust_fill_zero_current_value branch April 27, 2023 19:54
@cratelyn cratelyn added the A-dex Area: Relates to the dex label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dex Area: Relates to the dex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants