Add test to exchange-libs to ensure that a different chainId results in a different order hash.

This commit is contained in:
Lawrence Forman
2019-03-28 10:46:49 -04:00
committed by Amir Bandeali
parent 2524e7eea3
commit b380952ff9

View File

@@ -128,6 +128,20 @@ describe('Exchange libs', () => {
const orderHashHex = await libs.publicGetOrderHash.callAsync(signedOrder);
expect(orderHashUtils.getOrderHashHex(signedOrder)).to.be.equal(orderHashHex);
});
it('orderHash should differ if chainId is different', async () => {
// Deploy a version of the contract with a different chain ID.
const newChainId = chainId + 1;
const _libs = await TestLibsContract.deployFrom0xArtifactAsync(
artifacts.TestLibs,
provider,
txDefaults,
new BigNumber(newChainId),
);
signedOrder = await orderFactory.newSignedOrderAsync();
const orderHashHex1 = await _libs.publicGetOrderHash.callAsync(signedOrder);
const orderHashHex2 = await libs.publicGetOrderHash.callAsync(signedOrder);
expect(orderHashHex1).to.be.not.equal(orderHashHex2);
});
});
});
});