Skip to content

Conversation

@onur-ozkan
Copy link
Collaborator

@onur-ozkan onur-ozkan commented Jun 17, 2025

Fixes a bug where maker orders would get removed if swaps failed during the early negotiation phase. Before this change, when someone tried to take your order, the order would get immediately deleted from the orderbook. Which means, because of some unrelated issues (mostly coming from flaky taker peers) you would have to manually recreate it everytime.

The fix adds an order "locking" mechanism instead of immediate deletion. When a swap starts, the maker order gets moved to a locked state where it's temporarily hidden from the orderbook but not actually deleted entirely. If the swap completes successfully, the order gets permanently removed as expected. But if the swap fails or gets aborted, the order automatically gets recovered and put back in the orderbook with a fresh time state, so it shows up for other traders in the network again.

Feature is covered up with test_maker_order_recovery_on_tpu test with 3 nodes (Bob, Alice and Onur) and it's passing as expected.

cc @KomodoPlatform/qa for GUI testing: Please test taking an order, aborting the swap from the taker side and then checking if that order gets recovered by viewing it from a 3rd node.

Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
@onur-ozkan onur-ozkan force-pushed the lock-maker-orders branch 11 times, most recently from 01e814e to 06eec7b Compare June 23, 2025 11:44
@onur-ozkan onur-ozkan marked this pull request as ready for review June 24, 2025 09:50
Signed-off-by: Onur Özkan <[email protected]>
@cipig
Copy link

cipig commented Jun 24, 2025

i call setprice every ~10 minutes... it cancels old order and places a new one with new price and maybe new volume
what happens in this scenario? will i end up having 2 orders instead of one?

@onur-ozkan
Copy link
Collaborator Author

i call setprice every ~10 minutes... it cancels old order and places a new one with new price and maybe new volume what happens in this scenario? will i end up having 2 orders instead of one?

Nothing has changed in that regard, you can still do that.

Signed-off-by: Onur Özkan <[email protected]>
@shamardy shamardy self-requested a review June 24, 2025 19:02
@shamardy
Copy link
Collaborator

i call setprice every ~10 minutes... it cancels old order and places a new one with new price and maybe new volume
what happens in this scenario? will i end up having 2 orders instead of one?

I would like to add that this fix is done only for TPU which @cipig doesn't use yet. @cipig You will need to check if it works in a right way or not when testing TPU.

@shamardy shamardy self-assigned this Jul 7, 2025
@shamardy shamardy removed their request for review July 7, 2025 04:13
…is commit still needs refactoring and will be followed by a force push when done
@shamardy shamardy force-pushed the lock-maker-orders branch 4 times, most recently from b54e187 to 85274f6 Compare July 7, 2025 10:48
@shamardy shamardy marked this pull request as draft July 30, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants