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

this line throws error(division by zero) while our simulation #16

Open
Hyung-bharvest opened this issue Jan 13, 2020 · 3 comments
Open
Assignees

Comments

@Hyung-bharvest
Copy link

Hyung-bharvest commented Jan 13, 2020

@alessio

below line throws error(division by zero) while our simulation

proRataRecip := sdk.OneDec().Quo(proRataDec)

in orderbook, we see an residual order with amount 0.0000.
i suspect this is a decimal control issue.
because we tested only with integer amount, there is no way for orderbook to have
such small residual order.

@mslipper
Copy link
Contributor

Hi there,

Could you please provide some more info on your simulation? I'd like to reproduce this using our automated test suite so that we can definitively prevent this in the future. Specifically, can you provide information on what orders you entered into the book to make this occur?

@Hyung-bharvest
Copy link
Author

Sorry we dont have enough time to inform you exact reproduction process because it was random and deleted.

I will drop some possible case here.

Order matching happens with three bids with 1 token and 1 ask with 1 token.
Each bid will remain 2/3 amount but not exactly 2/3 because of decimal roundup

Comes new ask with 2 tokens, result in each bid remains very epsilon amount

Another ask comes with 1 tokens, but remaining amount for each bid is too small that it becomes zero after decimal rounding. Then the stated lines will throw error division by zero.

@nodebreaker0-0
Copy link

There is another problem.
Absence of input validation, consensus fail when very small value is included in order price and quantity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants