From 74ef0458f563ab9b82427ce736e90d1e0a922fb3 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 30 Jun 2017 19:08:07 -0700 Subject: Fix test failures caused by testrpc new eth_sign behaviour --- src/0x.ts | 5 +++-- src/utils/utils.ts | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/0x.ts b/src/0x.ts index d7a01ba70..6dfd1a8f5 100644 --- a/src/0x.ts +++ b/src/0x.ts @@ -199,8 +199,9 @@ export class ZeroEx { let msgHashHex; const nodeVersion = await this._web3Wrapper.getNodeVersionAsync(); const isParityNode = utils.isParityNode(nodeVersion); - if (isParityNode) { - // Parity node adds the personalMessage prefix itself + const isTestRpc = utils.isTestRpc(nodeVersion); + if (isParityNode || isTestRpc) { + // Parity and TestRpc nodes add the personalMessage prefix itself msgHashHex = orderHash; } else { const orderHashBuff = ethUtil.toBuffer(orderHash); diff --git a/src/utils/utils.ts b/src/utils/utils.ts index bad5b6498..6f2d02a70 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -22,6 +22,9 @@ export const utils = { isParityNode(nodeVersion: string): boolean { return _.includes(nodeVersion, 'Parity'); }, + isTestRpc(nodeVersion: string): boolean { + return _.includes(nodeVersion, 'TestRPC'); + }, isValidOrderHash(orderHashHex: string): boolean { const isValid = /^0x[0-9A-F]{64}$/i.test(orderHashHex); return isValid; -- cgit