Race condition in using ManageOffer operation to modify an offer
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- backend-api-design, fintech-quant
Research direction
Start with the ManageOffer operation and its amount field, then compare the issue's race-condition scenario with the cited Nasdaq OUCH specification. Done means the protocol clearly defines an atomic offer modification that updates total liability rather than only the currently unfilled amount, preventing the described over-sale.
Written by the indexing model from the issue text.
Description
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"
- Dominant language
- RPC
- Stars
- 632
- Forks
- 399
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stellar/stellar-protocol
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
stellar/stellar-protocol#2010 ·
-
stale
Difficulty 5/5 Over a week Newbie friendliness 42/100
stellar/stellar-protocol#1928 · 6 comments ·
-
needs draft SEP
stellar/stellar-protocol#773 · 12 comments · 1 assignee ·
-
CAP help wanted needs draft
Difficulty 5/5 Over a week Newbie friendliness 35/100
stellar/stellar-protocol#324 · 11 comments ·
-
help wanted needs draft SEP
Difficulty 5/5 Over a week Newbie friendliness 25/100
stellar/stellar-protocol#316 · 4 comments ·
All issues in stellar/stellar-protocol
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-api#45 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·