From 8fba0477a69317c19b3446c76a17cb3adbf447d7 Mon Sep 17 00:00:00 2001
From: Leonid Logvinov <logvinov.leon@gmail.com>
Date: Wed, 7 Feb 2018 20:58:19 +0100
Subject: Remove hash from signatureData

---
 packages/website/ts/components/fill_order.tsx | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

(limited to 'packages/website/ts/components/fill_order.tsx')

diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx
index d2c36ff0c..4252747ec 100644
--- a/packages/website/ts/components/fill_order.tsx
+++ b/packages/website/ts/components/fill_order.tsx
@@ -404,6 +404,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
     private async _validateFillOrderFireAndForgetAsync(orderJSON: string) {
         let orderJSONErrMsg = '';
         let parsedOrder: Order;
+        let orderHash: string;
         try {
             const order = JSON.parse(orderJSON);
             const validationResult = this._validator.validate(order, orderSchema);
@@ -438,16 +439,13 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
                 takerTokenAddress: parsedOrder.signedOrder.takerTokenAddress,
                 takerTokenAmount: takerAmount,
             };
-            const orderHash = ZeroEx.getOrderHashHex(zeroExOrder);
+            orderHash = ZeroEx.getOrderHashHex(zeroExOrder);
 
             const signature = parsedOrder.signedOrder.ecSignature;
-            const isValidSignature = ZeroEx.isValidSignature(signature.hash, signature, parsedOrder.signedOrder.maker);
+            const isValidSignature = ZeroEx.isValidSignature(orderHash, signature, parsedOrder.signedOrder.maker);
             if (exchangeContractAddr !== parsedOrder.signedOrder.exchangeContractAddress) {
                 orderJSONErrMsg = 'This order was made on another network or using a deprecated Exchange contract';
                 parsedOrder = undefined;
-            } else if (orderHash !== signature.hash) {
-                orderJSONErrMsg = 'Order hash does not match supplied plaintext values';
-                parsedOrder = undefined;
             } else if (!isValidSignature) {
                 orderJSONErrMsg = 'Order signature is invalid';
                 parsedOrder = undefined;
@@ -477,7 +475,6 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
             // Clear cache entry if user updates orderJSON to invalid entry
             this.props.dispatcher.updateUserSuppliedOrderCache(undefined);
         } else {
-            const orderHash = parsedOrder.signedOrder.ecSignature.hash;
             unavailableTakerAmount = await this.props.blockchain.getUnavailableTakerAmountAsync(orderHash);
             const isMakerTokenAddressInRegistry = await this.props.blockchain.isAddressInTokenRegistryAsync(
                 parsedOrder.signedOrder.makerTokenAddress,
@@ -617,7 +614,6 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
         });
 
         const parsedOrder = this.state.parsedOrder;
-        const orderHash = parsedOrder.signedOrder.ecSignature.hash;
         const takerAddress = this.props.userAddress;
 
         if (_.isUndefined(takerAddress)) {
@@ -645,6 +641,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
             parsedOrder.signedOrder.ecSignature,
             new BigNumber(parsedOrder.signedOrder.salt),
         );
+        const orderHash = ZeroEx.getOrderHashHex(signedOrder);
         const unavailableTakerAmount = await this.props.blockchain.getUnavailableTakerAmountAsync(orderHash);
         const availableTakerTokenAmount = takerTokenAmount.minus(unavailableTakerAmount);
         try {
-- 
cgit v1.2.3

