-
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 1 commit
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, | ||||||
) ( | ||||||
offchainUpdates *types.OffchainUpdates, | ||||||
) { | ||||||
|
@@ -521,6 +522,12 @@ func (k Keeper) PlaceStatefulOrdersFromLastBlock( | |||||
} | ||||||
|
||||||
order := orderPlacement.GetOrder() | ||||||
|
||||||
// Prioritize placing post-only orders if the flag is set. | ||||||
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:
Suggested change
|
||||||
if onlyPlacePostOnly && !order.IsPostOnlyOrder() { | ||||||
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. We call this function twice, second time with 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. Ah good catch. Meant to do this for all orders |
||||||
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.
Nit: current naming might suggest that if
false
, the function processes ALL orders including post-only. How abt sth likepostOnlyFilter
and comment explicitly what this var does?