-
Notifications
You must be signed in to change notification settings - Fork 115
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
[CT-1327] place post only orders first in prepare check state #2618
Changes from 5 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -496,6 +496,7 @@ func (k Keeper) PlaceStatefulOrdersFromLastBlock( | |
ctx sdk.Context, | ||
placedStatefulOrderIds []types.OrderId, | ||
existingOffchainUpdates *types.OffchainUpdates, | ||
onlyPlacePostOnly bool, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: current naming might suggest that if |
||
) ( | ||
offchainUpdates *types.OffchainUpdates, | ||
) { | ||
|
@@ -521,6 +522,12 @@ func (k Keeper) PlaceStatefulOrdersFromLastBlock( | |
} | ||
|
||
order := orderPlacement.GetOrder() | ||
|
||
// Skip the order if it is a post-only order and we are only placing post-only orders. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: comment could be more accurate/complete - right now it just describes one of the two scenarios |
||
if onlyPlacePostOnly != order.IsPostOnlyOrder() { | ||
continue | ||
} | ||
|
||
// Validate and place order. | ||
_, orderStatus, placeOrderOffchainUpdates, err := k.AddPreexistingStatefulOrder( | ||
ctx, | ||
|
@@ -579,6 +586,7 @@ func (k Keeper) PlaceConditionalOrdersTriggeredInLastBlock( | |
ctx sdk.Context, | ||
conditionalOrderIdsTriggeredInLastBlock []types.OrderId, | ||
existingOffchainUpdates *types.OffchainUpdates, | ||
onlyPlacePostOnly bool, | ||
) ( | ||
offchainUpdates *types.OffchainUpdates, | ||
) { | ||
|
@@ -608,7 +616,12 @@ func (k Keeper) PlaceConditionalOrdersTriggeredInLastBlock( | |
} | ||
} | ||
|
||
return k.PlaceStatefulOrdersFromLastBlock(ctx, conditionalOrderIdsTriggeredInLastBlock, existingOffchainUpdates) | ||
return k.PlaceStatefulOrdersFromLastBlock( | ||
ctx, | ||
conditionalOrderIdsTriggeredInLastBlock, | ||
existingOffchainUpdates, | ||
onlyPlacePostOnly, | ||
) | ||
} | ||
|
||
// PerformOrderCancellationStatefulValidation performs stateful validation on an order cancellation. | ||
|
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.
Potential issue with using a post-only order in this test case
In the test case
"TakeProfit/Buy post-only conditional order can place, trigger, cross, and be removed from state"
, you have changed the order to a post-only order by usingLongTermOrder_Dave_Num0_Id0_Clob0_Sell025BTC_Price50000_GTBT10_PO
. Post-only orders are intended to add liquidity and will not execute immediately against existing orders. This may prevent the expected cross and removal from state, which contradicts the test's objective to verify that the conditional order can cross and be removed from state.Consider using a non-post-only order to ensure the test behaves as intended.
Apply this diff to fix the issue:
📝 Committable suggestion