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

Fix div by 0 in slippage computation #2024

Merged
merged 3 commits into from
Oct 28, 2023

Conversation

MartinquaXD
Copy link
Contributor

Description

If some external API returns a 0 amount for a buy order it will pass the execution_respects_order check and will cause a panic in this slippage computation due to div by 0.

Changes

Returns errors when slippage computation would encounter any div by zero (simply use .checked_div()).

How to test

All unit tests should continue to pass

@MartinquaXD MartinquaXD requested a review from a team as a code owner October 28, 2023 06:07
@sunce86 sunce86 merged commit fdefdfe into main Oct 28, 2023
7 checks passed
@sunce86 sunce86 deleted the fix-divide-by-zero-in-slippage-computation branch October 28, 2023 09:21
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2023
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.

2 participants