-
Notifications
You must be signed in to change notification settings - Fork 48
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
cmd/debug: add DeleteOrder command #358
Conversation
@@ -770,7 +770,8 @@ func (s *Server) syncLocalOrderState() error { | |||
context.Background(), orderNonce, | |||
) | |||
if err != nil { | |||
return fmt.Errorf("unable to fetch order state: %v", err) | |||
return fmt.Errorf("unable to fetch order(%v): %v", |
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 is needed so the user knows which ones are the offender orders
0667523
to
9bdcb8e
Compare
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.
Code looks good to me. Though I wonder if updating the state to StateCanceled
wouldn't also solve the issue for the user and fail a bit more gracefully if the order was ever matched?
I think it would not. The problem this is is trying to solve is when the user has some orders in the local db that the server does not know about so those ones need to be deleted (the order sync fails). Updating the status to Cancel would make the client fail during the start up process too (unable to sync that order anyway). This is just an extra
|
Agreed, we do something similar today when it comes to syncing up batches, but don't do this for orders. The great part about this design is that the server can't spoof orders since they're all signed by the trader. |
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.
LGTM 🛤
Should also get some basic itest coverage on the server side as well.
Enable deleting orders in the local db using the debug cli. This can be used to clean the local db in case it gets out of sync with the server.
DANGER: if the user deletes an order from the local db and that order exists in the server, the user will get disconnected when that order matches (and won't be able to trade). The only solution then is to nuke the local db, restore the account and recreate the orders.
unblocks #357