From 6cb8c1df42d9ef5586524087bb2b28ded7829f52 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 5 Aug 2019 10:10:52 -0700 Subject: [PATCH] Noop on cancel if order is already unfillable --- .../exchange/contracts/src/MixinExchangeCore.sol | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/contracts/exchange/contracts/src/MixinExchangeCore.sol b/contracts/exchange/contracts/src/MixinExchangeCore.sol index 2bd897a76c..298a27dc6b 100644 --- a/contracts/exchange/contracts/src/MixinExchangeCore.sol +++ b/contracts/exchange/contracts/src/MixinExchangeCore.sol @@ -256,6 +256,11 @@ contract MixinExchangeCore is // Validate context _assertValidCancel(order, orderInfo); + // Noop if order is already unfillable + if (orderInfo.orderStatus != OrderStatus.FILLABLE) { + return; + } + // Perform cancel _updateCancelledState(order, orderInfo.orderHash); } @@ -466,15 +471,6 @@ contract MixinExchangeCore is internal view { - // Ensure order is valid - // An order can only be cancelled if its status is FILLABLE. - if (orderInfo.orderStatus != uint8(OrderStatus.FILLABLE)) { - LibRichErrors._rrevert(LibExchangeRichErrors.OrderStatusError( - orderInfo.orderHash, - OrderStatus(orderInfo.orderStatus) - )); - } - // Validate sender is allowed to cancel this order if (order.senderAddress != address(0)) { if (order.senderAddress != msg.sender) {