gruelbox/orko

Hidden Order Integration Tests Failing

AwooOOoo opened this issue · 2 comments

Describe the bug
Running the integration tests via circleci fails on Hidden Order Integration tests. See: https://app.circleci.com/pipelines/github/AwooOOoo/orko/3/workflows/dae1b184-9074-4394-bc03-b06af97a4728/jobs/4/steps

To Reproduce
Steps to reproduce the behavior:

  1. Forked, and Commited and pushed a fix
  2. Opened Circleci pipeline and saw integration test failed (Received 11 instead of 1)

Expected behavior

  1. A Value of 1

Screenshots
If applicable, add screenshots to help explain your problem.
Trading -- Hidden orders (failed)

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser: Firefox (haven't got around to installing Chrome yet)
  • Version 79.0 (64 bit)

Additional context
Commented out the 4 integration tests for the time being and the pipeline is now successful

I have found this test to simply be flaky. Re-running the circle CI workflow from the failed job usually fixes it.

Would love to understand why.

Ok,
Thanks for the info. My guess would be that placement of the orders within createHiddenOrder starts an asynchronous call for order placement. While this is going on your return and start the checkCancelServerSideOrder, but the order may not yet be placed. Once you cascade a few of these buy and sells in succession, one of the orders actually triggers hence the difference being similar to your order sizes.

To check you could change all the amounts for each test by an order of magnitude and then when you see the error is the difference between two of them, that would be the problem. To fix it, I would imagine you need to wrap the order in a promise for completion so you know one order is complete before moving to the check etc.

I'll look into it.