Skip to content

Commit

Permalink
undo
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyaoy committed Jun 6, 2024
1 parent 915e31f commit e4bb2dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
17 changes: 8 additions & 9 deletions protocol/x/clob/keeper/msg_server_place_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,15 @@ func (k Keeper) HandleMsgPlaceOrder(

// 2. Return an error if an associated cancellation or removal already exists in the current block.
processProposerMatchesEvents := k.GetProcessProposerMatchesEvents(ctx)
if !isInternalOrder { // If vault order, we allow the order to replace a cancelled order with the same order ID
cancelledOrderIds := lib.UniqueSliceToSet(processProposerMatchesEvents.PlacedStatefulCancellationOrderIds)
if _, found := cancelledOrderIds[order.GetOrderId()]; found {
return errorsmod.Wrapf(
types.ErrStatefulOrderPreviouslyCancelled,
"PlaceOrder: order (%+v)",
order,
)
}
cancelledOrderIds := lib.UniqueSliceToSet(processProposerMatchesEvents.PlacedStatefulCancellationOrderIds)
if _, found := cancelledOrderIds[order.GetOrderId()]; found {
return errorsmod.Wrapf(
types.ErrStatefulOrderPreviouslyCancelled,
"PlaceOrder: order (%+v)",
order,
)
}

removedOrderIds := lib.UniqueSliceToSet(processProposerMatchesEvents.RemovedStatefulOrderIds)
if _, found := removedOrderIds[order.GetOrderId()]; found {
return errorsmod.Wrapf(
Expand Down
3 changes: 2 additions & 1 deletion protocol/x/clob/keeper/msg_server_place_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,13 @@ func TestHandleMsgPlaceOrder(t *testing.T) {
removalExists: false,
equityTierLimitExists: true,
},
"Success - Place an Internal Order, Order Already Cancelled": {
"Error - Place an Internal Order, Order Already Cancelled": {
isInternalOrder: true,
assetQuantums: -1_000_000_000,
cancellationExists: true,
removalExists: false,
equityTierLimitExists: true,
expectedError: types.ErrStatefulOrderPreviouslyCancelled,
},
"Error - Place an Internal Order, Order Already Removed": {
isInternalOrder: true,
Expand Down

0 comments on commit e4bb2dd

Please sign in to comment.