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

Status 500 when trying to put more precise order. #611

Open
SvetJordanov opened this issue Jul 25, 2019 · 3 comments
Open

Status 500 when trying to put more precise order. #611

SvetJordanov opened this issue Jul 25, 2019 · 3 comments

Comments

@SvetJordanov
Copy link

When putting order on HyperDex for example 3.77 Morty to KMD it hits status code 500(Internal server error) with message in the developer tools -> "Access to fetch at 'http://127.0.0.1:49933/' from origin 'app://-' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."
I can put an order of 3 (Integer number), also can put an order of 3.7, but with more precise numbers like 3.77 and 3.777 it gets the error.


HyperDEX Nightly 0.0.0-c2d7531-19.7.24.1745
Electron 5.0.8
win32 10.0.10586
Locale: en-US

@lukechilds
Copy link
Member

lukechilds commented Aug 1, 2019

Thanks for the detailed report @SvetJordanov, I'm able to reproduce this.

Unfortunately we can't read the error response due to a bug in marketmaker (see here), that's what's causing the cryptic CORS error.

However reproducing the issue and grabbing the exact request as cURL in devtools and then re-playing in a shell shows the error:

$ curl 'http://127.0.0.1:56497/' -H 'Referer: http://localhost:8080/dev.html' -H 'Origin: http://localhost:8080' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) HyperDEX/0.4.0 Chrome/73.0.3683.121 Electron/5.0.2 Safari/537.36' -H 'Content-Type: text/plain;charset=UTF-8' --data-binary '{"method":"buy","gtc":1,"base":"MORTY","rel":"RICK","price":2.1,"volume":3.7777,"userpass":"<redacted>"}' --compressed
{"error":"rpc:229] lp_ordermatch:598] The amount 7.93317000 is larger than available 5.77440600, balance: 5.774406, locked by swaps: 0.00000000"}

You can see volume is clearly set as "volume":3.7777, however marketmaker seems to interpret this as 7.93317000 for some reason. This is throwing an error because the value that marketmaker is interpreting is larger than the available balance (at least in my case).

@artemii235 are you aware of this issue? Possibly an overflow/rounding error inside marketmaker?

@cipig
Copy link

cipig commented Aug 1, 2019

The error is correct, because "volume":3.7777 * "price":2.1 = 7.93317
https://github.com/artemii235/developer-docs/blob/mm/docs/basic-docs/atomicdex/atomicdex-api.md#buy

@lukechilds
Copy link
Member

Woops, my mistake, thanks @cipig.

@SvetJordanov could that also be the issue you were experiencing?

If you try a smaller more precise number do you still get errors?

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

No branches or pull requests

3 participants