diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-26 13:50:24 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-26 13:50:24 +0800 |
commit | fb03003b3a9e7beb1054a50bad4320e60ca52e04 (patch) | |
tree | 0523a089bd8b70b2484778f02c42664d6e31b9d3 /packages | |
parent | 8064914bb7f226c98d62357e29581238f0f765e4 (diff) | |
download | dexon-0x-contracts-fb03003b3a9e7beb1054a50bad4320e60ca52e04.tar.gz dexon-0x-contracts-fb03003b3a9e7beb1054a50bad4320e60ca52e04.tar.zst dexon-0x-contracts-fb03003b3a9e7beb1054a50bad4320e60ca52e04.zip |
Fix inconsistency between contract and reference implementation of order validation logic
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/test/exchange/fill_order.ts | 2 | ||||
-rw-r--r-- | packages/order-utils/src/order_validation_utils.ts | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/packages/contracts/test/exchange/fill_order.ts b/packages/contracts/test/exchange/fill_order.ts index 6f57ad9f4..60fe777c3 100644 --- a/packages/contracts/test/exchange/fill_order.ts +++ b/packages/contracts/test/exchange/fill_order.ts @@ -123,6 +123,7 @@ describe('FillOrder Tests', () => { ...defaultFillScenario.orderScenario, makerAssetAmountScenario: OrderAssetAmountScenario.Zero, }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount, }; await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); }); @@ -134,6 +135,7 @@ describe('FillOrder Tests', () => { ...defaultFillScenario.orderScenario, takerAssetAmountScenario: OrderAssetAmountScenario.Zero, }, + takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount, }; await coreCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario); }); diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts index 778556d6a..fb5143d03 100644 --- a/packages/order-utils/src/order_validation_utils.ts +++ b/packages/order-utils/src/order_validation_utils.ts @@ -143,6 +143,9 @@ export class OrderValidationUtils { if (fillTakerAssetAmount.eq(0)) { throw new Error(RevertReasons.InvalidTakerAmount); } + if (signedOrder.makerAssetAmount.eq(0) || signedOrder.takerAssetAmount.eq(0)) { + throw new Error(RevertReasons.OrderUnfillable); + } const orderHash = orderHashUtils.getOrderHashHex(signedOrder); const isValid = await isValidSignatureAsync( provider, |