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
Add update_maker_order RPC #926
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the comments 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few more change proposals 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 🔥
@tonymorony Could you please arrange a test of the following case:
- Setup a maker order on the node.
- Ensure that it's displayed on other nodes' order books.
- Call
update_maker_order
. - Check that order books are updated.
It's not required for all nodes to use the mm2.1-update-maker-order
. Only the order creator node should be on this branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following requested case: #926 (review)
No issues found, order is updated on all nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed 1 tricky situation, cc @tonymorony @cipig I would like to know your opinion on this, please check the comment below 🙂
After discussion with @artemii235 Request now should be:
"new_volume" is now "volume_delta" which will be more beneficial for the GUI as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last of the last review iteration 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully, this is really the last review iteration.
mm2src/lp_ordermatch.rs
Outdated
reserved_amount | ||
); | ||
} | ||
update_msg = update_msg.with_new_max_volume((new_volume - order.reserved_amount()).into()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This results in invalid volume being set for order:
- Let's say the current
max_base_vol = 5
,reserved = 3
soavailable = 2
. - We set
volume_delta = 2
in the request. Thenew_volume = original_volume + volume_delta = 7
. - Then we deduct
new_volume - reserved_amount
somax_base_vol = 7 - 3 = 4
, which is even lower than initial one.
You also have let reserved_amount = order.reserved_amount();
in a couple of lines above, you can reuse it to avoid calculation duplication overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I had it after order.apply_updated(&update_msg)
but must have messed it up later. Will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can also use reserved_amount
from here https://github.com/KomodoPlatform/atomicDEX-API/blob/db9c095995cc586c65573a68eada05752189f95c/mm2src/lp_ordermatch.rs#L3370
avoiding calculation in let reserved_amount = order.reserved_amount();
too, since we made sure It won't change through the update call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did it, great! 😄
fixes #814