Race condition in using ManageOffer operation to modify an offer #181
Labels
bug
CAP that addresses broken behavior in the current protocol.
CAP
Represents an issue that requires a CAP.
help wanted
Open especially for those who want to write a CAP/SEP!
needs draft
This an issue that has no corresponding draft, and as such has not entered the CAP/SEP process.
When using the ManageOffer operation to update an offer, the amount field replaces the currently available (unfilled) amount on the offer, rather than replacing the total liability specified when the offer was made. This leads to the following behavior:
Person A: Submit transaction 1: Sell 100 Marbles @ X1
Network processes transaction 1.
Person B: Submit transaction 2: Buy 90 Marbles @ X1
Person A: Submit transaction 3: Change offer to Sell 100 Marbles @ X2
Person C: Submit transaction 4: Buy 100 Marbles @ X2
Network processes transactions 2,3,4
At the end of this, Person A has sold 190 Marbles because of the race condition, whereas he intended to only sell 100 but update his price.
Pretty much all financial markets allow for atomic changes to orders, but its always very clear in the specs that it updates the total liability, not the outstanding liability, specifically because of the race condition with in-flight messages. For example, Nasdaq's proprietary specification states the following for the quantity field: "Total number of shares liable, inclusive of previous executions and Self Match Prevention decremented shares on this order chain"
The text was updated successfully, but these errors were encountered: