Merge pull request #812 from 0xProject/fix/revert-assertions-improvements
Improve robustness of revert reason assertions
This commit is contained in:
		@@ -5,7 +5,7 @@ import * as chai from 'chai';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mixin_authorizable';
 | 
					import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mixin_authorizable';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
					import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
				
			||||||
@@ -44,7 +44,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
    describe('addAuthorizedAddress', () => {
 | 
					    describe('addAuthorizedAddress', () => {
 | 
				
			||||||
        it('should throw if not called by owner', async () => {
 | 
					        it('should throw if not called by owner', async () => {
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.addAuthorizedAddress.sendTransactionAsync(notOwner, { from: notOwner }),
 | 
					                authorizable.addAuthorizedAddress.sendTransactionAsync(notOwner, { from: notOwner }),
 | 
				
			||||||
                RevertReason.OnlyContractOwner,
 | 
					                RevertReason.OnlyContractOwner,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -62,7 +62,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
                await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
 | 
					                await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
 | 
				
			||||||
                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
					                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
 | 
					                authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
 | 
				
			||||||
                RevertReason.TargetAlreadyAuthorized,
 | 
					                RevertReason.TargetAlreadyAuthorized,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -75,7 +75,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
                await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
 | 
					                await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
 | 
				
			||||||
                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
					                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
 | 
					                authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
 | 
				
			||||||
                    from: notOwner,
 | 
					                    from: notOwner,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -99,7 +99,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it('should throw if owner attempts to remove an address that is not authorized', async () => {
 | 
					        it('should throw if owner attempts to remove an address that is not authorized', async () => {
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
 | 
					                authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
 | 
				
			||||||
                    from: owner,
 | 
					                    from: owner,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -115,7 +115,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
					                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            const index = new BigNumber(0);
 | 
					            const index = new BigNumber(0);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
 | 
					                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
 | 
				
			||||||
                    from: notOwner,
 | 
					                    from: notOwner,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -128,7 +128,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
					                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            const index = new BigNumber(1);
 | 
					            const index = new BigNumber(1);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
 | 
					                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
 | 
				
			||||||
                    from: owner,
 | 
					                    from: owner,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -137,7 +137,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should throw if owner attempts to remove an address that is not authorized', async () => {
 | 
					        it('should throw if owner attempts to remove an address that is not authorized', async () => {
 | 
				
			||||||
            const index = new BigNumber(0);
 | 
					            const index = new BigNumber(0);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
 | 
					                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
 | 
				
			||||||
                    from: owner,
 | 
					                    from: owner,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -156,7 +156,7 @@ describe('Authorizable', () => {
 | 
				
			|||||||
                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
					                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            const address1Index = new BigNumber(0);
 | 
					            const address1Index = new BigNumber(0);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, {
 | 
					                authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, {
 | 
				
			||||||
                    from: owner,
 | 
					                    from: owner,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_pr
 | 
				
			|||||||
import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
					import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
				
			||||||
import { IAssetProxyContract } from '../../generated_contract_wrappers/i_asset_proxy';
 | 
					import { IAssetProxyContract } from '../../generated_contract_wrappers/i_asset_proxy';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
					import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
				
			||||||
@@ -184,7 +184,7 @@ describe('Asset Transfer Proxies', () => {
 | 
				
			|||||||
                    constants.AWAIT_TRANSACTION_MINED_MS,
 | 
					                    constants.AWAIT_TRANSACTION_MINED_MS,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                // Perform a transfer; expect this to fail.
 | 
					                // Perform a transfer; expect this to fail.
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                await expectTransactionFailedAsync(
 | 
				
			||||||
                    web3Wrapper.sendTransactionAsync({
 | 
					                    web3Wrapper.sendTransactionAsync({
 | 
				
			||||||
                        to: erc20Proxy.address,
 | 
					                        to: erc20Proxy.address,
 | 
				
			||||||
                        data,
 | 
					                        data,
 | 
				
			||||||
@@ -205,7 +205,7 @@ describe('Asset Transfer Proxies', () => {
 | 
				
			|||||||
                    takerAddress,
 | 
					                    takerAddress,
 | 
				
			||||||
                    amount,
 | 
					                    amount,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                await expectTransactionFailedAsync(
 | 
				
			||||||
                    web3Wrapper.sendTransactionAsync({
 | 
					                    web3Wrapper.sendTransactionAsync({
 | 
				
			||||||
                        to: erc20Proxy.address,
 | 
					                        to: erc20Proxy.address,
 | 
				
			||||||
                        data,
 | 
					                        data,
 | 
				
			||||||
@@ -344,7 +344,7 @@ describe('Asset Transfer Proxies', () => {
 | 
				
			|||||||
                    erc20Proxy.address, // the ERC20 proxy does not have an ERC721 receiver
 | 
					                    erc20Proxy.address, // the ERC20 proxy does not have an ERC721 receiver
 | 
				
			||||||
                    amount,
 | 
					                    amount,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    web3Wrapper.sendTransactionAsync({
 | 
					                    web3Wrapper.sendTransactionAsync({
 | 
				
			||||||
                        to: erc721Proxy.address,
 | 
					                        to: erc721Proxy.address,
 | 
				
			||||||
                        data,
 | 
					                        data,
 | 
				
			||||||
@@ -369,7 +369,7 @@ describe('Asset Transfer Proxies', () => {
 | 
				
			|||||||
                    takerAddress,
 | 
					                    takerAddress,
 | 
				
			||||||
                    amount,
 | 
					                    amount,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    web3Wrapper.sendTransactionAsync({
 | 
					                    web3Wrapper.sendTransactionAsync({
 | 
				
			||||||
                        to: erc721Proxy.address,
 | 
					                        to: erc721Proxy.address,
 | 
				
			||||||
                        data,
 | 
					                        data,
 | 
				
			||||||
@@ -393,7 +393,7 @@ describe('Asset Transfer Proxies', () => {
 | 
				
			|||||||
                    takerAddress,
 | 
					                    takerAddress,
 | 
				
			||||||
                    amount,
 | 
					                    amount,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    web3Wrapper.sendTransactionAsync({
 | 
					                    web3Wrapper.sendTransactionAsync({
 | 
				
			||||||
                        to: erc721Proxy.address,
 | 
					                        to: erc721Proxy.address,
 | 
				
			||||||
                        data,
 | 
					                        data,
 | 
				
			||||||
@@ -421,7 +421,7 @@ describe('Asset Transfer Proxies', () => {
 | 
				
			|||||||
                    takerAddress,
 | 
					                    takerAddress,
 | 
				
			||||||
                    amount,
 | 
					                    amount,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    web3Wrapper.sendTransactionAsync({
 | 
					                    web3Wrapper.sendTransactionAsync({
 | 
				
			||||||
                        to: erc721Proxy.address,
 | 
					                        to: erc721Proxy.address,
 | 
				
			||||||
                        data,
 | 
					                        data,
 | 
				
			||||||
@@ -442,7 +442,7 @@ describe('Asset Transfer Proxies', () => {
 | 
				
			|||||||
                    takerAddress,
 | 
					                    takerAddress,
 | 
				
			||||||
                    amount,
 | 
					                    amount,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    web3Wrapper.sendTransactionAsync({
 | 
					                    web3Wrapper.sendTransactionAsync({
 | 
				
			||||||
                        to: erc721Proxy.address,
 | 
					                        to: erc721Proxy.address,
 | 
				
			||||||
                        data,
 | 
					                        data,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_pr
 | 
				
			|||||||
import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
					import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
				
			||||||
import { CancelContractEventArgs, ExchangeContract } from '../../generated_contract_wrappers/exchange';
 | 
					import { CancelContractEventArgs, ExchangeContract } from '../../generated_contract_wrappers/exchange';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
					import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
				
			||||||
@@ -144,7 +144,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            const invalidSigBuff = Buffer.concat([v, invalidR, invalidS, signatureType]);
 | 
					            const invalidSigBuff = Buffer.concat([v, invalidR, invalidS, signatureType]);
 | 
				
			||||||
            const invalidSigHex = `0x${invalidSigBuff.toString('hex')}`;
 | 
					            const invalidSigHex = `0x${invalidSigBuff.toString('hex')}`;
 | 
				
			||||||
            signedOrder.signature = invalidSigHex;
 | 
					            signedOrder.signature = invalidSigHex;
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
 | 
				
			||||||
                RevertReason.InvalidOrderSignature,
 | 
					                RevertReason.InvalidOrderSignature,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -153,7 +153,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
        it('should throw if no value is filled', async () => {
 | 
					        it('should throw if no value is filled', async () => {
 | 
				
			||||||
            signedOrder = orderFactory.newSignedOrder();
 | 
					            signedOrder = orderFactory.newSignedOrder();
 | 
				
			||||||
            await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
 | 
					            await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -167,7 +167,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it('should throw if not sent by maker', async () => {
 | 
					        it('should throw if not sent by maker', async () => {
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress),
 | 
					                exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress),
 | 
				
			||||||
                RevertReason.InvalidMaker,
 | 
					                RevertReason.InvalidMaker,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -178,7 +178,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
                makerAssetAmount: new BigNumber(0),
 | 
					                makerAssetAmount: new BigNumber(0),
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
					                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -189,7 +189,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
                takerAssetAmount: new BigNumber(0),
 | 
					                takerAssetAmount: new BigNumber(0),
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
					                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -197,7 +197,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        it('should be able to cancel a full order', async () => {
 | 
					        it('should be able to cancel a full order', async () => {
 | 
				
			||||||
            await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
 | 
					            await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
 | 
				
			||||||
                    takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
 | 
					                    takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -222,7 +222,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        it('should throw if already cancelled', async () => {
 | 
					        it('should throw if already cancelled', async () => {
 | 
				
			||||||
            await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
 | 
					            await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
					                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -232,7 +232,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            signedOrder = orderFactory.newSignedOrder({
 | 
					            signedOrder = orderFactory.newSignedOrder({
 | 
				
			||||||
                expirationTimeSeconds: new BigNumber(Math.floor((Date.now() - 10000) / 1000)),
 | 
					                expirationTimeSeconds: new BigNumber(Math.floor((Date.now() - 10000) / 1000)),
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
					                exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -250,7 +250,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const fillTakerAssetAmount2 = new BigNumber(1);
 | 
					            const fillTakerAssetAmount2 = new BigNumber(1);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
 | 
				
			||||||
                    takerAssetFillAmount: fillTakerAssetAmount2,
 | 
					                    takerAssetFillAmount: fillTakerAssetAmount2,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -264,7 +264,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            const orderEpoch = new BigNumber(1);
 | 
					            const orderEpoch = new BigNumber(1);
 | 
				
			||||||
            await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
 | 
					            await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
 | 
				
			||||||
            const lesserOrderEpoch = new BigNumber(0);
 | 
					            const lesserOrderEpoch = new BigNumber(0);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.cancelOrdersUpToAsync(lesserOrderEpoch, makerAddress),
 | 
					                exchangeWrapper.cancelOrdersUpToAsync(lesserOrderEpoch, makerAddress),
 | 
				
			||||||
                RevertReason.InvalidNewOrderEpoch,
 | 
					                RevertReason.InvalidNewOrderEpoch,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -273,7 +273,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
        it('should fail to set orderEpoch equal to existing orderEpoch', async () => {
 | 
					        it('should fail to set orderEpoch equal to existing orderEpoch', async () => {
 | 
				
			||||||
            const orderEpoch = new BigNumber(1);
 | 
					            const orderEpoch = new BigNumber(1);
 | 
				
			||||||
            await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
 | 
					            await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress),
 | 
					                exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress),
 | 
				
			||||||
                RevertReason.InvalidNewOrderEpoch,
 | 
					                RevertReason.InvalidNewOrderEpoch,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -363,7 +363,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
					            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
				
			||||||
            // Call Exchange
 | 
					            // Call Exchange
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
				
			||||||
                RevertReason.TransferFailed,
 | 
					                RevertReason.TransferFailed,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -386,7 +386,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            expect(initialOwnerTakerAsset).to.be.bignumber.not.equal(takerAddress);
 | 
					            expect(initialOwnerTakerAsset).to.be.bignumber.not.equal(takerAddress);
 | 
				
			||||||
            // Call Exchange
 | 
					            // Call Exchange
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
				
			||||||
                RevertReason.TransferFailed,
 | 
					                RevertReason.TransferFailed,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -409,7 +409,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
					            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
				
			||||||
            // Call Exchange
 | 
					            // Call Exchange
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
				
			||||||
                RevertReason.InvalidAmount,
 | 
					                RevertReason.InvalidAmount,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -432,7 +432,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
					            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
				
			||||||
            // Call Exchange
 | 
					            // Call Exchange
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
				
			||||||
                RevertReason.InvalidAmount,
 | 
					                RevertReason.InvalidAmount,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -449,7 +449,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
            // Call Exchange
 | 
					            // Call Exchange
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
				
			||||||
                RevertReason.RoundingError,
 | 
					                RevertReason.RoundingError,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -475,7 +475,7 @@ describe('Exchange core', () => {
 | 
				
			|||||||
            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
					            expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
 | 
				
			||||||
            // Call Exchange
 | 
					            // Call Exchange
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
					                exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
 | 
				
			||||||
                RevertReason.LengthGreaterThan131Required,
 | 
					                RevertReason.LengthGreaterThan131Required,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ import {
 | 
				
			|||||||
    TestAssetProxyDispatcherContract,
 | 
					    TestAssetProxyDispatcherContract,
 | 
				
			||||||
} from '../../generated_contract_wrappers/test_asset_proxy_dispatcher';
 | 
					} from '../../generated_contract_wrappers/test_asset_proxy_dispatcher';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
					import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
				
			||||||
@@ -129,7 +129,7 @@ describe('AssetProxyDispatcher', () => {
 | 
				
			|||||||
                txDefaults,
 | 
					                txDefaults,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            // Register new ERC20 Transfer Proxy contract
 | 
					            // Register new ERC20 Transfer Proxy contract
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(newErc20TransferProxy.address, {
 | 
					                assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(newErc20TransferProxy.address, {
 | 
				
			||||||
                    from: owner,
 | 
					                    from: owner,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -138,7 +138,7 @@ describe('AssetProxyDispatcher', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it('should throw if requesting address is not owner', async () => {
 | 
					        it('should throw if requesting address is not owner', async () => {
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: notOwner }),
 | 
					                assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: notOwner }),
 | 
				
			||||||
                RevertReason.OnlyContractOwner,
 | 
					                RevertReason.OnlyContractOwner,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -210,7 +210,7 @@ describe('AssetProxyDispatcher', () => {
 | 
				
			|||||||
            const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
 | 
					            const encodedAssetData = assetProxyUtils.encodeERC20AssetData(zrxToken.address);
 | 
				
			||||||
            // Perform a transfer from makerAddress to takerAddress
 | 
					            // Perform a transfer from makerAddress to takerAddress
 | 
				
			||||||
            const amount = new BigNumber(10);
 | 
					            const amount = new BigNumber(10);
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
 | 
					                assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
 | 
				
			||||||
                    encodedAssetData,
 | 
					                    encodedAssetData,
 | 
				
			||||||
                    makerAddress,
 | 
					                    makerAddress,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_pr
 | 
				
			|||||||
import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
					import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
				
			||||||
import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
 | 
					import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
					import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
				
			||||||
@@ -602,7 +602,7 @@ describe('matchOrders', () => {
 | 
				
			|||||||
            // Cancel left order
 | 
					            // Cancel left order
 | 
				
			||||||
            await exchangeWrapper.cancelOrderAsync(signedOrderLeft, signedOrderLeft.makerAddress);
 | 
					            await exchangeWrapper.cancelOrderAsync(signedOrderLeft, signedOrderLeft.makerAddress);
 | 
				
			||||||
            // Match orders
 | 
					            // Match orders
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
					                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -627,7 +627,7 @@ describe('matchOrders', () => {
 | 
				
			|||||||
            // Cancel right order
 | 
					            // Cancel right order
 | 
				
			||||||
            await exchangeWrapper.cancelOrderAsync(signedOrderRight, signedOrderRight.makerAddress);
 | 
					            await exchangeWrapper.cancelOrderAsync(signedOrderRight, signedOrderRight.makerAddress);
 | 
				
			||||||
            // Match orders
 | 
					            // Match orders
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
					                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -650,7 +650,7 @@ describe('matchOrders', () => {
 | 
				
			|||||||
                feeRecipientAddress: feeRecipientAddressRight,
 | 
					                feeRecipientAddress: feeRecipientAddressRight,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            // Match orders
 | 
					            // Match orders
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
					                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
				
			||||||
                RevertReason.NegativeSpreadRequired,
 | 
					                RevertReason.NegativeSpreadRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -673,7 +673,7 @@ describe('matchOrders', () => {
 | 
				
			|||||||
                feeRecipientAddress: feeRecipientAddressRight,
 | 
					                feeRecipientAddress: feeRecipientAddressRight,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            // Match orders
 | 
					            // Match orders
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
					                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
				
			||||||
                // We are assuming assetData fields of the right order are the
 | 
					                // We are assuming assetData fields of the right order are the
 | 
				
			||||||
                // reverse of the left order, rather than checking equality. This
 | 
					                // reverse of the left order, rather than checking equality. This
 | 
				
			||||||
@@ -702,7 +702,7 @@ describe('matchOrders', () => {
 | 
				
			|||||||
                feeRecipientAddress: feeRecipientAddressRight,
 | 
					                feeRecipientAddress: feeRecipientAddressRight,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            // Match orders
 | 
					            // Match orders
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
					                exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
 | 
				
			||||||
                RevertReason.InvalidOrderSignature,
 | 
					                RevertReason.InvalidOrderSignature,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import { TestValidatorContract } from '../../generated_contract_wrappers/test_va
 | 
				
			|||||||
import { TestWalletContract } from '../../generated_contract_wrappers/test_wallet';
 | 
					import { TestWalletContract } from '../../generated_contract_wrappers/test_wallet';
 | 
				
			||||||
import { addressUtils } from '../utils/address_utils';
 | 
					import { addressUtils } from '../utils/address_utils';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertOrOtherErrorAsync } from '../utils/assertions';
 | 
					import { expectContractCallFailed } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { LogDecoder } from '../utils/log_decoder';
 | 
					import { LogDecoder } from '../utils/log_decoder';
 | 
				
			||||||
@@ -101,7 +101,7 @@ describe('MixinSignatureValidator', () => {
 | 
				
			|||||||
        it('should revert when signature is empty', async () => {
 | 
					        it('should revert when signature is empty', async () => {
 | 
				
			||||||
            const emptySignature = '0x';
 | 
					            const emptySignature = '0x';
 | 
				
			||||||
            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
					            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                signatureValidator.publicIsValidSignature.callAsync(
 | 
					                signatureValidator.publicIsValidSignature.callAsync(
 | 
				
			||||||
                    orderHashHex,
 | 
					                    orderHashHex,
 | 
				
			||||||
                    signedOrder.makerAddress,
 | 
					                    signedOrder.makerAddress,
 | 
				
			||||||
@@ -115,7 +115,7 @@ describe('MixinSignatureValidator', () => {
 | 
				
			|||||||
            const unsupportedSignatureType = SignatureType.NSignatureTypes;
 | 
					            const unsupportedSignatureType = SignatureType.NSignatureTypes;
 | 
				
			||||||
            const unsupportedSignatureHex = `0x${unsupportedSignatureType}`;
 | 
					            const unsupportedSignatureHex = `0x${unsupportedSignatureType}`;
 | 
				
			||||||
            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
					            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                signatureValidator.publicIsValidSignature.callAsync(
 | 
					                signatureValidator.publicIsValidSignature.callAsync(
 | 
				
			||||||
                    orderHashHex,
 | 
					                    orderHashHex,
 | 
				
			||||||
                    signedOrder.makerAddress,
 | 
					                    signedOrder.makerAddress,
 | 
				
			||||||
@@ -128,7 +128,7 @@ describe('MixinSignatureValidator', () => {
 | 
				
			|||||||
        it('should revert when SignatureType=Illegal', async () => {
 | 
					        it('should revert when SignatureType=Illegal', async () => {
 | 
				
			||||||
            const unsupportedSignatureHex = `0x${SignatureType.Illegal}`;
 | 
					            const unsupportedSignatureHex = `0x${SignatureType.Illegal}`;
 | 
				
			||||||
            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
					            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                signatureValidator.publicIsValidSignature.callAsync(
 | 
					                signatureValidator.publicIsValidSignature.callAsync(
 | 
				
			||||||
                    orderHashHex,
 | 
					                    orderHashHex,
 | 
				
			||||||
                    signedOrder.makerAddress,
 | 
					                    signedOrder.makerAddress,
 | 
				
			||||||
@@ -155,7 +155,7 @@ describe('MixinSignatureValidator', () => {
 | 
				
			|||||||
            const signatureBuffer = Buffer.concat([fillerData, signatureType]);
 | 
					            const signatureBuffer = Buffer.concat([fillerData, signatureType]);
 | 
				
			||||||
            const signatureHex = ethUtil.bufferToHex(signatureBuffer);
 | 
					            const signatureHex = ethUtil.bufferToHex(signatureBuffer);
 | 
				
			||||||
            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
					            const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                signatureValidator.publicIsValidSignature.callAsync(
 | 
					                signatureValidator.publicIsValidSignature.callAsync(
 | 
				
			||||||
                    orderHashHex,
 | 
					                    orderHashHex,
 | 
				
			||||||
                    signedOrder.makerAddress,
 | 
					                    signedOrder.makerAddress,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
 | 
				
			|||||||
import { ExchangeWrapperContract } from '../../generated_contract_wrappers/exchange_wrapper';
 | 
					import { ExchangeWrapperContract } from '../../generated_contract_wrappers/exchange_wrapper';
 | 
				
			||||||
import { WhitelistContract } from '../../generated_contract_wrappers/whitelist';
 | 
					import { WhitelistContract } from '../../generated_contract_wrappers/whitelist';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
					import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
				
			||||||
@@ -134,7 +134,7 @@ describe('Exchange transactions', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            it('should throw if not called by specified sender', async () => {
 | 
					            it('should throw if not called by specified sender', async () => {
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapper.executeTransactionAsync(signedTx, takerAddress),
 | 
					                    exchangeWrapper.executeTransactionAsync(signedTx, takerAddress),
 | 
				
			||||||
                    RevertReason.FailedExecution,
 | 
					                    RevertReason.FailedExecution,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
@@ -177,7 +177,7 @@ describe('Exchange transactions', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            it('should throw if the a 0x transaction with the same transactionHash has already been executed', async () => {
 | 
					            it('should throw if the a 0x transaction with the same transactionHash has already been executed', async () => {
 | 
				
			||||||
                await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
 | 
					                await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapper.executeTransactionAsync(signedTx, senderAddress),
 | 
					                    exchangeWrapper.executeTransactionAsync(signedTx, senderAddress),
 | 
				
			||||||
                    RevertReason.InvalidTxHash,
 | 
					                    RevertReason.InvalidTxHash,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
@@ -197,7 +197,7 @@ describe('Exchange transactions', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            it('should throw if not called by specified sender', async () => {
 | 
					            it('should throw if not called by specified sender', async () => {
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapper.executeTransactionAsync(signedTx, makerAddress),
 | 
					                    exchangeWrapper.executeTransactionAsync(signedTx, makerAddress),
 | 
				
			||||||
                    RevertReason.FailedExecution,
 | 
					                    RevertReason.FailedExecution,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
@@ -205,7 +205,7 @@ describe('Exchange transactions', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            it('should cancel the order when signed by maker and called by sender', async () => {
 | 
					            it('should cancel the order when signed by maker and called by sender', async () => {
 | 
				
			||||||
                await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
 | 
					                await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapper.fillOrderAsync(signedOrder, senderAddress),
 | 
					                    exchangeWrapper.fillOrderAsync(signedOrder, senderAddress),
 | 
				
			||||||
                    RevertReason.OrderUnfillable,
 | 
					                    RevertReason.OrderUnfillable,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
@@ -250,7 +250,7 @@ describe('Exchange transactions', () => {
 | 
				
			|||||||
                    signedOrder.signature,
 | 
					                    signedOrder.signature,
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                const signedFillTx = takerTransactionFactory.newSignedTransaction(fillData);
 | 
					                const signedFillTx = takerTransactionFactory.newSignedTransaction(fillData);
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapperContract.fillOrder.sendTransactionAsync(
 | 
					                    exchangeWrapperContract.fillOrder.sendTransactionAsync(
 | 
				
			||||||
                        orderWithoutExchangeAddress,
 | 
					                        orderWithoutExchangeAddress,
 | 
				
			||||||
                        takerAssetFillAmount,
 | 
					                        takerAssetFillAmount,
 | 
				
			||||||
@@ -370,7 +370,7 @@ describe('Exchange transactions', () => {
 | 
				
			|||||||
            orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
 | 
					            orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
				
			||||||
            const salt = generatePseudoRandomSalt();
 | 
					            const salt = generatePseudoRandomSalt();
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
 | 
					                whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
 | 
				
			||||||
                    orderWithoutExchangeAddress,
 | 
					                    orderWithoutExchangeAddress,
 | 
				
			||||||
                    takerAssetFillAmount,
 | 
					                    takerAssetFillAmount,
 | 
				
			||||||
@@ -392,7 +392,7 @@ describe('Exchange transactions', () => {
 | 
				
			|||||||
            orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
 | 
					            orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
 | 
				
			||||||
            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
					            const takerAssetFillAmount = signedOrder.takerAssetAmount;
 | 
				
			||||||
            const salt = generatePseudoRandomSalt();
 | 
					            const salt = generatePseudoRandomSalt();
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
 | 
					                whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
 | 
				
			||||||
                    orderWithoutExchangeAddress,
 | 
					                    orderWithoutExchangeAddress,
 | 
				
			||||||
                    takerAssetFillAmount,
 | 
					                    takerAssetFillAmount,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ import { ERC20ProxyContract } from '../../generated_contract_wrappers/e_r_c20_pr
 | 
				
			|||||||
import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
					import { ERC721ProxyContract } from '../../generated_contract_wrappers/e_r_c721_proxy';
 | 
				
			||||||
import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
 | 
					import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
					import { ERC20Wrapper } from '../utils/erc20_wrapper';
 | 
				
			||||||
@@ -174,7 +174,7 @@ describe('Exchange wrappers', () => {
 | 
				
			|||||||
                expirationTimeSeconds: new BigNumber(Math.floor((Date.now() - 10000) / 1000)),
 | 
					                expirationTimeSeconds: new BigNumber(Math.floor((Date.now() - 10000) / 1000)),
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
 | 
					                exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
 | 
				
			||||||
                RevertReason.OrderUnfillable,
 | 
					                RevertReason.OrderUnfillable,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -187,7 +187,7 @@ describe('Exchange wrappers', () => {
 | 
				
			|||||||
                takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
 | 
					                takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
 | 
					                exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
 | 
				
			||||||
                RevertReason.CompleteFillFailed,
 | 
					                RevertReason.CompleteFillFailed,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -500,7 +500,7 @@ describe('Exchange wrappers', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                await exchangeWrapper.fillOrKillOrderAsync(signedOrders[0], takerAddress);
 | 
					                await exchangeWrapper.fillOrKillOrderAsync(signedOrders[0], takerAddress);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
 | 
					                    exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
 | 
				
			||||||
                        takerAssetFillAmounts,
 | 
					                        takerAssetFillAmounts,
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -703,7 +703,7 @@ describe('Exchange wrappers', () => {
 | 
				
			|||||||
                    orderFactory.newSignedOrder(),
 | 
					                    orderFactory.newSignedOrder(),
 | 
				
			||||||
                ];
 | 
					                ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
 | 
					                    exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
 | 
				
			||||||
                        takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
 | 
					                        takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -921,7 +921,7 @@ describe('Exchange wrappers', () => {
 | 
				
			|||||||
                    orderFactory.newSignedOrder(),
 | 
					                    orderFactory.newSignedOrder(),
 | 
				
			||||||
                ];
 | 
					                ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedAsync(
 | 
				
			||||||
                    exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
 | 
					                    exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
 | 
				
			||||||
                        makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
 | 
					                        makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import * as _ from 'lodash';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { TestLibBytesContract } from '../../generated_contract_wrappers/test_lib_bytes';
 | 
					import { TestLibBytesContract } from '../../generated_contract_wrappers/test_lib_bytes';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertOrOtherErrorAsync } from '../utils/assertions';
 | 
					import { expectContractCallFailed } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
					import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
				
			||||||
@@ -100,7 +100,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    describe('popLastByte', () => {
 | 
					    describe('popLastByte', () => {
 | 
				
			||||||
        it('should revert if length is 0', async () => {
 | 
					        it('should revert if length is 0', async () => {
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES),
 | 
					                libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES),
 | 
				
			||||||
                RevertReason.LibBytesGreaterThanZeroLengthRequired,
 | 
					                RevertReason.LibBytesGreaterThanZeroLengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -116,7 +116,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    describe('popLast20Bytes', () => {
 | 
					    describe('popLast20Bytes', () => {
 | 
				
			||||||
        it('should revert if length is less than 20', async () => {
 | 
					        it('should revert if length is less than 20', async () => {
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes),
 | 
					                libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -184,7 +184,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    describe('deepCopyBytes', () => {
 | 
					    describe('deepCopyBytes', () => {
 | 
				
			||||||
        it('should revert if dest is shorter than source', async () => {
 | 
					        it('should revert if dest is shorter than source', async () => {
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes),
 | 
					                libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -237,7 +237,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the byte array is too short to hold an address', async () => {
 | 
					        it('should fail if the byte array is too short to hold an address', async () => {
 | 
				
			||||||
            const shortByteArray = '0xabcdef';
 | 
					            const shortByteArray = '0xabcdef';
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadAddress.callAsync(shortByteArray, offset),
 | 
					                libBytes.publicReadAddress.callAsync(shortByteArray, offset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -245,7 +245,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
 | 
				
			||||||
            const byteArray = testAddress;
 | 
					            const byteArray = testAddress;
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadAddress.callAsync(byteArray, badOffset),
 | 
					                libBytes.publicReadAddress.callAsync(byteArray, badOffset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -281,7 +281,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the byte array is too short to hold an address', async () => {
 | 
					        it('should fail if the byte array is too short to hold an address', async () => {
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress),
 | 
					                libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -289,7 +289,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
 | 
				
			||||||
            const byteArray = byteArrayLongerThan32Bytes;
 | 
					            const byteArray = byteArrayLongerThan32Bytes;
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress),
 | 
					                libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -313,14 +313,14 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the byte array is too short to hold a bytes32', async () => {
 | 
					        it('should fail if the byte array is too short to hold a bytes32', async () => {
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset),
 | 
					                libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadBytes32.callAsync(testBytes32, badOffset),
 | 
					                libBytes.publicReadBytes32.callAsync(testBytes32, badOffset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -356,7 +356,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the byte array is too short to hold a bytes32', async () => {
 | 
					        it('should fail if the byte array is too short to hold a bytes32', async () => {
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32),
 | 
					                libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -364,7 +364,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
 | 
				
			||||||
            const byteArray = byteArrayLongerThan32Bytes;
 | 
					            const byteArray = byteArrayLongerThan32Bytes;
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32),
 | 
					                libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -392,7 +392,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the byte array is too short to hold a uint256', async () => {
 | 
					        it('should fail if the byte array is too short to hold a uint256', async () => {
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset),
 | 
					                libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -402,7 +402,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
            const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
 | 
					            const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
 | 
				
			||||||
            const byteArray = ethUtil.bufferToHex(testUint256AsBuffer);
 | 
					            const byteArray = ethUtil.bufferToHex(testUint256AsBuffer);
 | 
				
			||||||
            const badOffset = new BigNumber(testUint256AsBuffer.byteLength);
 | 
					            const badOffset = new BigNumber(testUint256AsBuffer.byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadUint256.callAsync(byteArray, badOffset),
 | 
					                libBytes.publicReadUint256.callAsync(byteArray, badOffset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -442,7 +442,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the byte array is too short to hold a uint256', async () => {
 | 
					        it('should fail if the byte array is too short to hold a uint256', async () => {
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256),
 | 
					                libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -450,7 +450,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
 | 
				
			||||||
            const byteArray = byteArrayLongerThan32Bytes;
 | 
					            const byteArray = byteArrayLongerThan32Bytes;
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256),
 | 
					                libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -461,7 +461,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0'
 | 
					        // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0'
 | 
				
			||||||
        it('should revert if byte array has a length < 4', async () => {
 | 
					        it('should revert if byte array has a length < 4', async () => {
 | 
				
			||||||
            const byteArrayLessThan4Bytes = '0x010101';
 | 
					            const byteArrayLessThan4Bytes = '0x010101';
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, new BigNumber(0)),
 | 
					                libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, new BigNumber(0)),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -516,28 +516,28 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
 | 
					        it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
 | 
				
			||||||
            // The length of the nested array is 32 bytes. By storing less than 32 bytes, a length cannot be read.
 | 
					            // The length of the nested array is 32 bytes. By storing less than 32 bytes, a length cannot be read.
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, offset),
 | 
					                libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, offset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if we store a nested byte array length, without a nested byte array', async () => {
 | 
					        it('should fail if we store a nested byte array length, without a nested byte array', async () => {
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadBytesWithLength.callAsync(testBytes32, offset),
 | 
					                libBytes.publicReadBytesWithLength.callAsync(testBytes32, offset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, badOffset),
 | 
					                libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, badOffset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold the nested byte array', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold the nested byte array', async () => {
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset),
 | 
					                libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -649,7 +649,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
 | 
					        it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
 | 
				
			||||||
            const offset = new BigNumber(0);
 | 
					            const offset = new BigNumber(0);
 | 
				
			||||||
            const emptyByteArray = ethUtil.bufferToHex(new Buffer(1));
 | 
					            const emptyByteArray = ethUtil.bufferToHex(new Buffer(1));
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, offset, longData),
 | 
					                libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, offset, longData),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -657,7 +657,7 @@ describe('LibBytes', () => {
 | 
				
			|||||||
        it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array)', async () => {
 | 
					        it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array)', async () => {
 | 
				
			||||||
            const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
 | 
					            const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
 | 
				
			||||||
            const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength);
 | 
					            const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, badOffset, shortData),
 | 
					                libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, badOffset, shortData),
 | 
				
			||||||
                RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
 | 
					                RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,8 +14,9 @@ import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mix
 | 
				
			|||||||
import { TestAssetProxyOwnerContract } from '../../generated_contract_wrappers/test_asset_proxy_owner';
 | 
					import { TestAssetProxyOwnerContract } from '../../generated_contract_wrappers/test_asset_proxy_owner';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    expectRevertOrAlwaysFailingTransactionAsync,
 | 
					    expectContractCallFailedWithoutReasonAsync,
 | 
				
			||||||
    expectRevertOrContractCallFailedAsync,
 | 
					    expectContractCreationFailedWithoutReason,
 | 
				
			||||||
 | 
					    expectTransactionFailedWithoutReasonAsync,
 | 
				
			||||||
} from '../utils/assertions';
 | 
					} from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
@@ -108,7 +109,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        it('should throw if a null address is included in assetProxyContracts', async () => {
 | 
					        it('should throw if a null address is included in assetProxyContracts', async () => {
 | 
				
			||||||
            const assetProxyContractAddresses = [erc20Proxy.address, constants.NULL_ADDRESS];
 | 
					            const assetProxyContractAddresses = [erc20Proxy.address, constants.NULL_ADDRESS];
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					            return expectContractCreationFailedWithoutReason(
 | 
				
			||||||
                AssetProxyOwnerContract.deployFrom0xArtifactAsync(
 | 
					                AssetProxyOwnerContract.deployFrom0xArtifactAsync(
 | 
				
			||||||
                    artifacts.AssetProxyOwner,
 | 
					                    artifacts.AssetProxyOwner,
 | 
				
			||||||
                    provider,
 | 
					                    provider,
 | 
				
			||||||
@@ -150,7 +151,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
    describe('registerAssetProxy', () => {
 | 
					    describe('registerAssetProxy', () => {
 | 
				
			||||||
        it('should throw if not called by multisig', async () => {
 | 
					        it('should throw if not called by multisig', async () => {
 | 
				
			||||||
            const isRegistered = true;
 | 
					            const isRegistered = true;
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                testAssetProxyOwner.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, isRegistered, {
 | 
					                testAssetProxyOwner.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, isRegistered, {
 | 
				
			||||||
                    from: owners[0],
 | 
					                    from: owners[0],
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -277,7 +278,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
                );
 | 
					                );
 | 
				
			||||||
                const log = submitTxRes.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
					                const log = submitTxRes.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
				
			||||||
                const txId = log.args.transactionId;
 | 
					                const txId = log.args.transactionId;
 | 
				
			||||||
                return expectRevertOrContractCallFailedAsync(
 | 
					                return expectContractCallFailedWithoutReasonAsync(
 | 
				
			||||||
                    testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
 | 
					                    testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -312,7 +313,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
                );
 | 
					                );
 | 
				
			||||||
                const log = submitTxRes.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
					                const log = submitTxRes.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
				
			||||||
                const txId = log.args.transactionId;
 | 
					                const txId = log.args.transactionId;
 | 
				
			||||||
                return expectRevertOrContractCallFailedAsync(
 | 
					                return expectContractCallFailedWithoutReasonAsync(
 | 
				
			||||||
                    testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
 | 
					                    testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -332,7 +333,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
                const log = res.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
					                const log = res.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
				
			||||||
                const txId = log.args.transactionId;
 | 
					                const txId = log.args.transactionId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
					                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
				
			||||||
                        from: owners[1],
 | 
					                        from: owners[1],
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -354,7 +355,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
 | 
					                await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
					                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
				
			||||||
                        from: owners[1],
 | 
					                        from: owners[1],
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -376,7 +377,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
 | 
					                await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
					                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
				
			||||||
                        from: owners[1],
 | 
					                        from: owners[1],
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -433,7 +434,7 @@ describe('AssetProxyOwner', () => {
 | 
				
			|||||||
                const isExecuted = tx[3];
 | 
					                const isExecuted = tx[3];
 | 
				
			||||||
                expect(isExecuted).to.equal(true);
 | 
					                expect(isExecuted).to.equal(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
					                    testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
 | 
				
			||||||
                        from: owners[1],
 | 
					                        from: owners[1],
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ import {
 | 
				
			|||||||
    SubmissionContractEventArgs,
 | 
					    SubmissionContractEventArgs,
 | 
				
			||||||
} from '../../generated_contract_wrappers/multi_sig_wallet_with_time_lock';
 | 
					} from '../../generated_contract_wrappers/multi_sig_wallet_with_time_lock';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { increaseTimeAndMineBlockAsync } from '../utils/increase_time';
 | 
					import { increaseTimeAndMineBlockAsync } from '../utils/increase_time';
 | 
				
			||||||
@@ -67,7 +67,7 @@ describe('MultiSigWalletWithTimeLock', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            it('should throw when not called by wallet', async () => {
 | 
					            it('should throw when not called by wallet', async () => {
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    multiSig.changeTimeLock.sendTransactionAsync(SECONDS_TIME_LOCKED, { from: owners[0] }),
 | 
					                    multiSig.changeTimeLock.sendTransactionAsync(SECONDS_TIME_LOCKED, { from: owners[0] }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -78,7 +78,7 @@ describe('MultiSigWalletWithTimeLock', () => {
 | 
				
			|||||||
                const res = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
 | 
					                const res = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
 | 
				
			||||||
                const log = res.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
					                const log = res.logs[0] as LogWithDecodedArgs<SubmissionContractEventArgs>;
 | 
				
			||||||
                const txId = log.args.transactionId;
 | 
					                const txId = log.args.transactionId;
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
 | 
					                    multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -147,7 +147,7 @@ describe('MultiSigWalletWithTimeLock', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            it('should throw if it has enough confirmations but is not past the time lock', async () => {
 | 
					            it('should throw if it has enough confirmations but is not past the time lock', async () => {
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
 | 
					                    multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ import * as _ from 'lodash';
 | 
				
			|||||||
import { TokenRegistryContract } from '../generated_contract_wrappers/token_registry';
 | 
					import { TokenRegistryContract } from '../generated_contract_wrappers/token_registry';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { artifacts } from './utils/artifacts';
 | 
					import { artifacts } from './utils/artifacts';
 | 
				
			||||||
import { expectRevertOrAlwaysFailingTransactionAsync } from './utils/assertions';
 | 
					import { expectTransactionFailedWithoutReasonAsync } from './utils/assertions';
 | 
				
			||||||
import { chaiSetup } from './utils/chai_setup';
 | 
					import { chaiSetup } from './utils/chai_setup';
 | 
				
			||||||
import { constants } from './utils/constants';
 | 
					import { constants } from './utils/constants';
 | 
				
			||||||
import { TokenRegWrapper } from './utils/token_registry_wrapper';
 | 
					import { TokenRegWrapper } from './utils/token_registry_wrapper';
 | 
				
			||||||
@@ -75,7 +75,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    describe('addToken', () => {
 | 
					    describe('addToken', () => {
 | 
				
			||||||
        it('should throw when not called by owner', async () => {
 | 
					        it('should throw when not called by owner', async () => {
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(tokenRegWrapper.addTokenAsync(token1, notOwner));
 | 
					            return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(token1, notOwner));
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it('should add token metadata when called by owner', async () => {
 | 
					        it('should add token metadata when called by owner', async () => {
 | 
				
			||||||
@@ -87,20 +87,18 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
        it('should throw if token already exists', async () => {
 | 
					        it('should throw if token already exists', async () => {
 | 
				
			||||||
            await tokenRegWrapper.addTokenAsync(token1, owner);
 | 
					            await tokenRegWrapper.addTokenAsync(token1, owner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(tokenRegWrapper.addTokenAsync(token1, owner));
 | 
					            return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(token1, owner));
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it('should throw if token address is null', async () => {
 | 
					        it('should throw if token address is null', async () => {
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(tokenRegWrapper.addTokenAsync(nullToken, owner));
 | 
					            return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(nullToken, owner));
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it('should throw if name already exists', async () => {
 | 
					        it('should throw if name already exists', async () => {
 | 
				
			||||||
            await tokenRegWrapper.addTokenAsync(token1, owner);
 | 
					            await tokenRegWrapper.addTokenAsync(token1, owner);
 | 
				
			||||||
            const duplicateNameToken = _.assign({}, token2, { name: token1.name });
 | 
					            const duplicateNameToken = _.assign({}, token2, { name: token1.name });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(duplicateNameToken, owner));
 | 
				
			||||||
                tokenRegWrapper.addTokenAsync(duplicateNameToken, owner),
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        it('should throw if symbol already exists', async () => {
 | 
					        it('should throw if symbol already exists', async () => {
 | 
				
			||||||
@@ -109,7 +107,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
                symbol: token1.symbol,
 | 
					                symbol: token1.symbol,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                tokenRegWrapper.addTokenAsync(duplicateSymbolToken, owner),
 | 
					                tokenRegWrapper.addTokenAsync(duplicateSymbolToken, owner),
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@@ -136,7 +134,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        describe('setTokenName', () => {
 | 
					        describe('setTokenName', () => {
 | 
				
			||||||
            it('should throw when not called by owner', async () => {
 | 
					            it('should throw when not called by owner', async () => {
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: notOwner }),
 | 
					                    tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: notOwner }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -162,13 +160,13 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
            it('should throw if the name already exists', async () => {
 | 
					            it('should throw if the name already exists', async () => {
 | 
				
			||||||
                await tokenRegWrapper.addTokenAsync(token2, owner);
 | 
					                await tokenRegWrapper.addTokenAsync(token2, owner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: owner }),
 | 
					                    tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: owner }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            it('should throw if token does not exist', async () => {
 | 
					            it('should throw if token does not exist', async () => {
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.setTokenName.sendTransactionAsync(nullToken.address, token2.name, { from: owner }),
 | 
					                    tokenReg.setTokenName.sendTransactionAsync(nullToken.address, token2.name, { from: owner }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -176,7 +174,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        describe('setTokenSymbol', () => {
 | 
					        describe('setTokenSymbol', () => {
 | 
				
			||||||
            it('should throw when not called by owner', async () => {
 | 
					            it('should throw when not called by owner', async () => {
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, {
 | 
					                    tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, {
 | 
				
			||||||
                        from: notOwner,
 | 
					                        from: notOwner,
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -202,7 +200,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
            it('should throw if the symbol already exists', async () => {
 | 
					            it('should throw if the symbol already exists', async () => {
 | 
				
			||||||
                await tokenRegWrapper.addTokenAsync(token2, owner);
 | 
					                await tokenRegWrapper.addTokenAsync(token2, owner);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, {
 | 
					                    tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, {
 | 
				
			||||||
                        from: owner,
 | 
					                        from: owner,
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -210,7 +208,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            it('should throw if token does not exist', async () => {
 | 
					            it('should throw if token does not exist', async () => {
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.setTokenSymbol.sendTransactionAsync(nullToken.address, token2.symbol, {
 | 
					                    tokenReg.setTokenSymbol.sendTransactionAsync(nullToken.address, token2.symbol, {
 | 
				
			||||||
                        from: owner,
 | 
					                        from: owner,
 | 
				
			||||||
                    }),
 | 
					                    }),
 | 
				
			||||||
@@ -221,7 +219,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
        describe('removeToken', () => {
 | 
					        describe('removeToken', () => {
 | 
				
			||||||
            it('should throw if not called by owner', async () => {
 | 
					            it('should throw if not called by owner', async () => {
 | 
				
			||||||
                const index = new BigNumber(0);
 | 
					                const index = new BigNumber(0);
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.removeToken.sendTransactionAsync(token1.address, index, { from: notOwner }),
 | 
					                    tokenReg.removeToken.sendTransactionAsync(token1.address, index, { from: notOwner }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -240,7 +238,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            it('should throw if token does not exist', async () => {
 | 
					            it('should throw if token does not exist', async () => {
 | 
				
			||||||
                const index = new BigNumber(0);
 | 
					                const index = new BigNumber(0);
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.removeToken.sendTransactionAsync(nullToken.address, index, { from: owner }),
 | 
					                    tokenReg.removeToken.sendTransactionAsync(nullToken.address, index, { from: owner }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -248,7 +246,7 @@ describe('TokenRegistry', () => {
 | 
				
			|||||||
            it('should throw if token at given index does not match address', async () => {
 | 
					            it('should throw if token at given index does not match address', async () => {
 | 
				
			||||||
                await tokenRegWrapper.addTokenAsync(token2, owner);
 | 
					                await tokenRegWrapper.addTokenAsync(token2, owner);
 | 
				
			||||||
                const incorrectIndex = new BigNumber(0);
 | 
					                const incorrectIndex = new BigNumber(0);
 | 
				
			||||||
                return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					                return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                    tokenReg.removeToken.sendTransactionAsync(token2.address, incorrectIndex, { from: owner }),
 | 
					                    tokenReg.removeToken.sendTransactionAsync(token2.address, incorrectIndex, { from: owner }),
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import * as chai from 'chai';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { WETH9Contract } from '../../generated_contract_wrappers/weth9';
 | 
					import { WETH9Contract } from '../../generated_contract_wrappers/weth9';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectInsufficientFundsAsync, expectRevertOrAlwaysFailingTransactionAsync } from '../utils/assertions';
 | 
					import { expectInsufficientFundsAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
					import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
				
			||||||
@@ -74,7 +74,7 @@ describe('EtherToken', () => {
 | 
				
			|||||||
            const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
 | 
					            const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
 | 
				
			||||||
            const ethTokensToWithdraw = initEthTokenBalance.plus(1);
 | 
					            const ethTokensToWithdraw = initEthTokenBalance.plus(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedWithoutReasonAsync(
 | 
				
			||||||
                etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw),
 | 
					                etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw),
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import * as chai from 'chai';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c20_token';
 | 
					import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_e_r_c20_token';
 | 
				
			||||||
import { artifacts } from '../utils/artifacts';
 | 
					import { artifacts } from '../utils/artifacts';
 | 
				
			||||||
import { expectRevertOrOtherErrorAsync } from '../utils/assertions';
 | 
					import { expectContractCallFailed } from '../utils/assertions';
 | 
				
			||||||
import { chaiSetup } from '../utils/chai_setup';
 | 
					import { chaiSetup } from '../utils/chai_setup';
 | 
				
			||||||
import { constants } from '../utils/constants';
 | 
					import { constants } from '../utils/constants';
 | 
				
			||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
					import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
 | 
				
			||||||
@@ -54,7 +54,7 @@ describe('UnlimitedAllowanceToken', () => {
 | 
				
			|||||||
        it('should throw if owner has insufficient balance', async () => {
 | 
					        it('should throw if owner has insufficient balance', async () => {
 | 
				
			||||||
            const ownerBalance = await token.balanceOf.callAsync(owner);
 | 
					            const ownerBalance = await token.balanceOf.callAsync(owner);
 | 
				
			||||||
            const amountToTransfer = ownerBalance.plus(1);
 | 
					            const amountToTransfer = ownerBalance.plus(1);
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                token.transfer.callAsync(spender, amountToTransfer, { from: owner }),
 | 
					                token.transfer.callAsync(spender, amountToTransfer, { from: owner }),
 | 
				
			||||||
                RevertReason.Erc20InsufficientBalance,
 | 
					                RevertReason.Erc20InsufficientBalance,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
@@ -93,7 +93,7 @@ describe('UnlimitedAllowanceToken', () => {
 | 
				
			|||||||
                await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }),
 | 
					                await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }),
 | 
				
			||||||
                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
					                constants.AWAIT_TRANSACTION_MINED_MS,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                token.transferFrom.callAsync(owner, spender, amountToTransfer, {
 | 
					                token.transferFrom.callAsync(owner, spender, amountToTransfer, {
 | 
				
			||||||
                    from: spender,
 | 
					                    from: spender,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
@@ -109,7 +109,7 @@ describe('UnlimitedAllowanceToken', () => {
 | 
				
			|||||||
            const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
 | 
					            const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
 | 
				
			||||||
            expect(isSpenderAllowanceInsufficient).to.be.true();
 | 
					            expect(isSpenderAllowanceInsufficient).to.be.true();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return expectRevertOrOtherErrorAsync(
 | 
					            return expectContractCallFailed(
 | 
				
			||||||
                token.transferFrom.callAsync(owner, spender, amountToTransfer, {
 | 
					                token.transferFrom.callAsync(owner, spender, amountToTransfer, {
 | 
				
			||||||
                    from: spender,
 | 
					                    from: spender,
 | 
				
			||||||
                }),
 | 
					                }),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,108 +1,159 @@
 | 
				
			|||||||
import { RevertReason } from '@0xproject/types';
 | 
					import { RevertReason } from '@0xproject/types';
 | 
				
			||||||
 | 
					import { logUtils } from '@0xproject/utils';
 | 
				
			||||||
 | 
					import { NodeType } from '@0xproject/web3-wrapper';
 | 
				
			||||||
import * as chai from 'chai';
 | 
					import * as chai from 'chai';
 | 
				
			||||||
import { TransactionReceipt, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
 | 
					import { TransactionReceipt, TransactionReceiptStatus, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
 | 
				
			||||||
import * as _ from 'lodash';
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { constants } from './constants';
 | 
					 | 
				
			||||||
import { web3Wrapper } from './web3_wrapper';
 | 
					import { web3Wrapper } from './web3_wrapper';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const expect = chai.expect;
 | 
					const expect = chai.expect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function _expectEitherErrorAsync<T>(p: Promise<T>, error1: string, error2: string): PromiseLike<void> {
 | 
					let nodeType: NodeType | undefined;
 | 
				
			||||||
    return expect(p)
 | 
					
 | 
				
			||||||
        .to.be.rejected()
 | 
					// Represents the return value of a `sendTransaction` call. The Promise should
 | 
				
			||||||
        .then(e => {
 | 
					// resolve with either a transaction receipt or a transaction hash.
 | 
				
			||||||
            expect(e).to.satisfy(
 | 
					export type sendTransactionResult = Promise<TransactionReceipt | TransactionReceiptWithDecodedLogs | string>;
 | 
				
			||||||
                (err: Error) => _.includes(err.message, error1) || _.includes(err.message, error2),
 | 
					
 | 
				
			||||||
                `expected promise to reject with error message that includes "${error1}" or "${error2}", but got: ` +
 | 
					async function _getGanacheOrGethError(ganacheError: string, gethError: string): Promise<string> {
 | 
				
			||||||
                    `"${e.message}"\n`,
 | 
					    if (_.isUndefined(nodeType)) {
 | 
				
			||||||
            );
 | 
					        nodeType = await web3Wrapper.getNodeTypeAsync();
 | 
				
			||||||
        });
 | 
					    }
 | 
				
			||||||
 | 
					    switch (nodeType) {
 | 
				
			||||||
 | 
					        case NodeType.Ganache:
 | 
				
			||||||
 | 
					            return ganacheError;
 | 
				
			||||||
 | 
					        case NodeType.Geth:
 | 
				
			||||||
 | 
					            return gethError;
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            throw new Error(`Unknown node type: ${nodeType}`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function _getInsufficientFundsErrorMessageAsync(): Promise<string> {
 | 
				
			||||||
 | 
					    return _getGanacheOrGethError("sender doesn't have enough funds", 'insufficient funds');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function _getTransactionFailedErrorMessageAsync(): Promise<string> {
 | 
				
			||||||
 | 
					    return _getGanacheOrGethError('revert', 'always failing transaction');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function _getContractCallFailedErrorMessageAsync(): Promise<string> {
 | 
				
			||||||
 | 
					    return _getGanacheOrGethError('revert', 'Contract call failed');
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Rejects if the given Promise does not reject with an error indicating
 | 
					 * Rejects if the given Promise does not reject with an error indicating
 | 
				
			||||||
 * insufficient funds.
 | 
					 * insufficient funds.
 | 
				
			||||||
 * @param p the Promise which is expected to reject
 | 
					 * @param p a promise resulting from a contract call or sendTransaction call.
 | 
				
			||||||
 * @returns a new Promise which will reject if the conditions are not met and
 | 
					 * @returns a new Promise which will reject if the conditions are not met and
 | 
				
			||||||
 * otherwise resolve with no value.
 | 
					 * otherwise resolve with no value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function expectInsufficientFundsAsync<T>(p: Promise<T>): PromiseLike<void> {
 | 
					export async function expectInsufficientFundsAsync<T>(p: Promise<T>): Promise<void> {
 | 
				
			||||||
    return _expectEitherErrorAsync(p, 'insufficient funds', "sender doesn't have enough funds");
 | 
					    const errMessage = await _getInsufficientFundsErrorMessageAsync();
 | 
				
			||||||
 | 
					    return expect(p).to.be.rejectedWith(errMessage);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Rejects if the given Promise does not reject with a "revert" error or the
 | 
					 * Resolves if the the sendTransaction call fails with the given revert reason.
 | 
				
			||||||
 * given otherError.
 | 
					 * However, since Geth does not support revert reasons for sendTransaction, this
 | 
				
			||||||
 * @param p the Promise which is expected to reject
 | 
					 * falls back to expectTransactionFailedWithoutReasonAsync if the backing
 | 
				
			||||||
 * @param otherError the other error which is accepted as a valid reject error.
 | 
					 * Ethereum node is Geth.
 | 
				
			||||||
 * @returns a new Promise which will reject if the conditions are not met and
 | 
					 * @param p a Promise resulting from a sendTransaction call
 | 
				
			||||||
 * otherwise resolve with no value.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export function expectRevertOrOtherErrorAsync<T>(p: Promise<T>, otherError: string): PromiseLike<void> {
 | 
					 | 
				
			||||||
    return _expectEitherErrorAsync(p, constants.REVERT, otherError);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Rejects if the given Promise does not reject with a "revert" or "always
 | 
					 | 
				
			||||||
 * failing transaction" error.
 | 
					 | 
				
			||||||
 * @param p the Promise which is expected to reject
 | 
					 | 
				
			||||||
 * @returns a new Promise which will reject if the conditions are not met and
 | 
					 | 
				
			||||||
 * otherwise resolve with no value.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export function expectRevertOrAlwaysFailingTransactionAsync<T>(p: Promise<T>): PromiseLike<void> {
 | 
					 | 
				
			||||||
    return expectRevertOrOtherErrorAsync(p, 'always failing transaction');
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Rejects if at least one the following conditions is not met:
 | 
					 | 
				
			||||||
 * 1) The given Promise rejects with the given revert reason.
 | 
					 | 
				
			||||||
 * 2) The given Promise rejects with an error containing "always failing transaction"
 | 
					 | 
				
			||||||
 * 3) The given Promise fulfills with a txReceipt that has a status of 0 or '0', indicating the transaction failed.
 | 
					 | 
				
			||||||
 * 4) The given Promise fulfills with a txHash and corresponding txReceipt has a status of 0 or '0'.
 | 
					 | 
				
			||||||
 * @param p the Promise which is expected to reject
 | 
					 | 
				
			||||||
 * @param reason a specific revert reason
 | 
					 * @param reason a specific revert reason
 | 
				
			||||||
 * @returns a new Promise which will reject if the conditions are not met and
 | 
					 * @returns a new Promise which will reject if the conditions are not met and
 | 
				
			||||||
 * otherwise resolve with no value.
 | 
					 * otherwise resolve with no value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export async function expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					export async function expectTransactionFailedAsync(p: sendTransactionResult, reason: RevertReason): Promise<void> {
 | 
				
			||||||
    p: Promise<string | TransactionReceiptWithDecodedLogs | TransactionReceipt>,
 | 
					    // HACK(albrow): This dummy `catch` should not be necessary, but if you
 | 
				
			||||||
    reason: RevertReason,
 | 
					    // remove it, there is an uncaught exception and the Node process will
 | 
				
			||||||
): Promise<void> {
 | 
					    // forcibly exit. It's possible this is a false positive in
 | 
				
			||||||
 | 
					    // make-promises-safe.
 | 
				
			||||||
 | 
					    p.catch(e => {
 | 
				
			||||||
 | 
					        _.noop(e);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (_.isUndefined(nodeType)) {
 | 
				
			||||||
 | 
					        nodeType = await web3Wrapper.getNodeTypeAsync();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    switch (nodeType) {
 | 
				
			||||||
 | 
					        case NodeType.Ganache:
 | 
				
			||||||
 | 
					            return expect(p).to.be.rejectedWith(reason);
 | 
				
			||||||
 | 
					        case NodeType.Geth:
 | 
				
			||||||
 | 
					            logUtils.warn(
 | 
				
			||||||
 | 
					                'WARNING: Geth does not support revert reasons for sendTransaction. This test will pass if the transaction fails for any reason.',
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					            return expectTransactionFailedWithoutReasonAsync(p);
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            throw new Error(`Unknown node type: ${nodeType}`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Resolves if the transaction fails without a revert reason, or if the
 | 
				
			||||||
 | 
					 * corresponding transactionReceipt has a status of 0 or '0', indicating
 | 
				
			||||||
 | 
					 * failure.
 | 
				
			||||||
 | 
					 * @param p a Promise resulting from a sendTransaction call
 | 
				
			||||||
 | 
					 * @returns a new Promise which will reject if the conditions are not met and
 | 
				
			||||||
 | 
					 * otherwise resolve with no value.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export async function expectTransactionFailedWithoutReasonAsync(p: sendTransactionResult): Promise<void> {
 | 
				
			||||||
    return p
 | 
					    return p
 | 
				
			||||||
        .then(async result => {
 | 
					        .then(async result => {
 | 
				
			||||||
            let txReceiptStatus: string | 0 | 1 | null;
 | 
					            let txReceiptStatus: TransactionReceiptStatus;
 | 
				
			||||||
            if (typeof result === 'string') {
 | 
					            if (_.isString(result)) {
 | 
				
			||||||
                // Result is a txHash. We need to make a web3 call to get the receipt.
 | 
					                // Result is a txHash. We need to make a web3 call to get the
 | 
				
			||||||
 | 
					                // receipt, then get the status from the receipt.
 | 
				
			||||||
                const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(result);
 | 
					                const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(result);
 | 
				
			||||||
                txReceiptStatus = txReceipt.status;
 | 
					                txReceiptStatus = txReceipt.status;
 | 
				
			||||||
            } else if ('status' in result) {
 | 
					            } else if ('status' in result) {
 | 
				
			||||||
                // Result is a TransactionReceiptWithDecodedLogs or TransactionReceipt
 | 
					                // Result is a transaction receipt, so we can get the status
 | 
				
			||||||
                // and status is a field of result.
 | 
					                // directly.
 | 
				
			||||||
                txReceiptStatus = result.status;
 | 
					                txReceiptStatus = result.status;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                throw new Error('Unexpected result type');
 | 
					                throw new Error('Unexpected result type: ' + typeof result);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            expect(_.toString(txReceiptStatus)).to.equal(
 | 
					            expect(_.toString(txReceiptStatus)).to.equal(
 | 
				
			||||||
                '0',
 | 
					                '0',
 | 
				
			||||||
                'transactionReceipt had a non-zero status, indicating success',
 | 
					                'Expected transaction to fail but receipt had a non-zero status, indicating success',
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        .catch(err => {
 | 
					        .catch(async err => {
 | 
				
			||||||
            expect(err.message).to.satisfy(
 | 
					            // If the promise rejects, we expect a specific error message,
 | 
				
			||||||
                (msg: string) => _.includes(msg, reason) || _.includes(msg, 'always failing transaction'),
 | 
					            // depending on the backing Ethereum node type.
 | 
				
			||||||
                `Expected ${reason} or 'always failing transaction' but error message was ${err.message}`,
 | 
					            const errMessage = await _getTransactionFailedErrorMessageAsync();
 | 
				
			||||||
            );
 | 
					            expect(err.message).to.include(errMessage);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Rejects if the given Promise does not reject with a "revert" or "Contract
 | 
					 * Resolves if the the contract call fails with the given revert reason.
 | 
				
			||||||
 * call failed" error.
 | 
					 * @param p a Promise resulting from a contract call
 | 
				
			||||||
 * @param p the Promise which is expected to reject
 | 
					 * @param reason a specific revert reason
 | 
				
			||||||
 * @returns a new Promise which will reject if the conditions are not met and
 | 
					 * @returns a new Promise which will reject if the conditions are not met and
 | 
				
			||||||
 * otherwise resolve with no value.
 | 
					 * otherwise resolve with no value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function expectRevertOrContractCallFailedAsync<T>(p: Promise<T>): PromiseLike<void> {
 | 
					export async function expectContractCallFailed<T>(p: Promise<T>, reason: RevertReason): Promise<void> {
 | 
				
			||||||
    return expectRevertOrOtherErrorAsync<T>(p, 'Contract call failed');
 | 
					    return expect(p).to.be.rejectedWith(reason);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Resolves if the contract call fails without a revert reason.
 | 
				
			||||||
 | 
					 * @param p a Promise resulting from a contract call
 | 
				
			||||||
 | 
					 * @returns a new Promise which will reject if the conditions are not met and
 | 
				
			||||||
 | 
					 * otherwise resolve with no value.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export async function expectContractCallFailedWithoutReasonAsync<T>(p: Promise<T>): Promise<void> {
 | 
				
			||||||
 | 
					    const errMessage = await _getContractCallFailedErrorMessageAsync();
 | 
				
			||||||
 | 
					    return expect(p).to.be.rejectedWith(errMessage);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Resolves if the contract creation/deployment fails without a revert reason.
 | 
				
			||||||
 | 
					 * @param p a Promise resulting from a contract creation/deployment
 | 
				
			||||||
 | 
					 * @returns a new Promise which will reject if the conditions are not met and
 | 
				
			||||||
 | 
					 * otherwise resolve with no value.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export async function expectContractCreationFailedWithoutReason<T>(p: Promise<T>): Promise<void> {
 | 
				
			||||||
 | 
					    const errMessage = await _getTransactionFailedErrorMessageAsync();
 | 
				
			||||||
 | 
					    return expect(p).to.be.rejectedWith(errMessage);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,6 @@ const TESTRPC_PRIVATE_KEYS_STRINGS = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export const constants = {
 | 
					export const constants = {
 | 
				
			||||||
    INVALID_OPCODE: 'invalid opcode',
 | 
					    INVALID_OPCODE: 'invalid opcode',
 | 
				
			||||||
    REVERT: 'revert',
 | 
					 | 
				
			||||||
    TESTRPC_NETWORK_ID: 50,
 | 
					    TESTRPC_NETWORK_ID: 50,
 | 
				
			||||||
    // Note(albrow): In practice V8 and most other engines limit the minimum
 | 
					    // Note(albrow): In practice V8 and most other engines limit the minimum
 | 
				
			||||||
    // interval for setInterval to 10ms. We still set it to 0 here in order to
 | 
					    // interval for setInterval to 10ms. We still set it to 0 here in order to
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ import 'make-promises-safe';
 | 
				
			|||||||
import { ExchangeContract, FillContractEventArgs } from '../../generated_contract_wrappers/exchange';
 | 
					import { ExchangeContract, FillContractEventArgs } from '../../generated_contract_wrappers/exchange';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { artifacts } from './artifacts';
 | 
					import { artifacts } from './artifacts';
 | 
				
			||||||
import { expectRevertReasonOrAlwaysFailingTransactionAsync } from './assertions';
 | 
					import { expectTransactionFailedAsync } from './assertions';
 | 
				
			||||||
import { AssetWrapper } from './asset_wrapper';
 | 
					import { AssetWrapper } from './asset_wrapper';
 | 
				
			||||||
import { chaiSetup } from './chai_setup';
 | 
					import { chaiSetup } from './chai_setup';
 | 
				
			||||||
import { constants } from './constants';
 | 
					import { constants } from './constants';
 | 
				
			||||||
@@ -418,7 +418,7 @@ export class CoreCombinatorialUtils {
 | 
				
			|||||||
        fillRevertReasonIfExists: RevertReason | undefined,
 | 
					        fillRevertReasonIfExists: RevertReason | undefined,
 | 
				
			||||||
    ): Promise<void> {
 | 
					    ): Promise<void> {
 | 
				
			||||||
        if (!_.isUndefined(fillRevertReasonIfExists)) {
 | 
					        if (!_.isUndefined(fillRevertReasonIfExists)) {
 | 
				
			||||||
            return expectRevertReasonOrAlwaysFailingTransactionAsync(
 | 
					            return expectTransactionFailedAsync(
 | 
				
			||||||
                this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { takerAssetFillAmount }),
 | 
					                this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { takerAssetFillAmount }),
 | 
				
			||||||
                fillRevertReasonIfExists,
 | 
					                fillRevertReasonIfExists,
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,6 @@
 | 
				
			|||||||
import { logUtils } from '@0xproject/utils';
 | 
					import { logUtils } from '@0xproject/utils';
 | 
				
			||||||
import { uniqueVersionIds, Web3Wrapper } from '@0xproject/web3-wrapper';
 | 
					import { NodeType, Web3Wrapper } from '@0xproject/web3-wrapper';
 | 
				
			||||||
import { includes } from 'lodash';
 | 
					import * as _ from 'lodash';
 | 
				
			||||||
 | 
					 | 
				
			||||||
enum NodeType {
 | 
					 | 
				
			||||||
    Geth = 'GETH',
 | 
					 | 
				
			||||||
    Ganache = 'GANACHE',
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HACK(albrow): 🐉 We have to do this so that debug.setHead works correctly.
 | 
					// HACK(albrow): 🐉 We have to do this so that debug.setHead works correctly.
 | 
				
			||||||
// (Geth does not seem to like debug.setHead(0), so by sending some transactions
 | 
					// (Geth does not seem to like debug.setHead(0), so by sending some transactions
 | 
				
			||||||
@@ -18,6 +13,7 @@ export class BlockchainLifecycle {
 | 
				
			|||||||
    private _web3Wrapper: Web3Wrapper;
 | 
					    private _web3Wrapper: Web3Wrapper;
 | 
				
			||||||
    private _snapshotIdsStack: number[];
 | 
					    private _snapshotIdsStack: number[];
 | 
				
			||||||
    private _addresses: string[] = [];
 | 
					    private _addresses: string[] = [];
 | 
				
			||||||
 | 
					    private _nodeType: NodeType | undefined;
 | 
				
			||||||
    constructor(web3Wrapper: Web3Wrapper) {
 | 
					    constructor(web3Wrapper: Web3Wrapper) {
 | 
				
			||||||
        this._web3Wrapper = web3Wrapper;
 | 
					        this._web3Wrapper = web3Wrapper;
 | 
				
			||||||
        this._snapshotIdsStack = [];
 | 
					        this._snapshotIdsStack = [];
 | 
				
			||||||
@@ -61,16 +57,6 @@ export class BlockchainLifecycle {
 | 
				
			|||||||
                throw new Error(`Unknown node type: ${nodeType}`);
 | 
					                throw new Error(`Unknown node type: ${nodeType}`);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    private async _getNodeTypeAsync(): Promise<NodeType> {
 | 
					 | 
				
			||||||
        const version = await this._web3Wrapper.getNodeVersionAsync();
 | 
					 | 
				
			||||||
        if (includes(version, uniqueVersionIds.geth)) {
 | 
					 | 
				
			||||||
            return NodeType.Geth;
 | 
					 | 
				
			||||||
        } else if (includes(version, uniqueVersionIds.ganache)) {
 | 
					 | 
				
			||||||
            return NodeType.Ganache;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            throw new Error(`Unknown client version: ${version}`);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    private async _mineMinimumBlocksAsync(): Promise<void> {
 | 
					    private async _mineMinimumBlocksAsync(): Promise<void> {
 | 
				
			||||||
        logUtils.warn('WARNING: minimum block number for tests not met. Mining additional blocks...');
 | 
					        logUtils.warn('WARNING: minimum block number for tests not met. Mining additional blocks...');
 | 
				
			||||||
        if (this._addresses.length === 0) {
 | 
					        if (this._addresses.length === 0) {
 | 
				
			||||||
@@ -92,4 +78,10 @@ export class BlockchainLifecycle {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        logUtils.warn('Done mining the minimum number of blocks.');
 | 
					        logUtils.warn('Done mining the minimum number of blocks.');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    private async _getNodeTypeAsync(): Promise<NodeType> {
 | 
				
			||||||
 | 
					        if (_.isUndefined(this._nodeType)) {
 | 
				
			||||||
 | 
					            this._nodeType = await this._web3Wrapper.getNodeTypeAsync();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return this._nodeType;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,10 @@
 | 
				
			|||||||
            {
 | 
					            {
 | 
				
			||||||
                "note": "Add `TraceParams` interface for `debug_traceTransaction` parameters",
 | 
					                "note": "Add `TraceParams` interface for `debug_traceTransaction` parameters",
 | 
				
			||||||
                "pr": 675
 | 
					                "pr": 675
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                "note": "Add `TransactionReceiptStatus` type",
 | 
				
			||||||
 | 
					                "pr": 812
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -215,6 +215,8 @@ export interface TxDataPayable extends TxData {
 | 
				
			|||||||
    value?: BigNumber;
 | 
					    value?: BigNumber;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export type TransactionReceiptStatus = null | string | 0 | 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface TransactionReceipt {
 | 
					export interface TransactionReceipt {
 | 
				
			||||||
    blockHash: string;
 | 
					    blockHash: string;
 | 
				
			||||||
    blockNumber: number;
 | 
					    blockNumber: number;
 | 
				
			||||||
@@ -222,7 +224,7 @@ export interface TransactionReceipt {
 | 
				
			|||||||
    transactionIndex: number;
 | 
					    transactionIndex: number;
 | 
				
			||||||
    from: string;
 | 
					    from: string;
 | 
				
			||||||
    to: string;
 | 
					    to: string;
 | 
				
			||||||
    status: null | string | 0 | 1;
 | 
					    status: TransactionReceiptStatus;
 | 
				
			||||||
    cumulativeGasUsed: number;
 | 
					    cumulativeGasUsed: number;
 | 
				
			||||||
    gasUsed: number;
 | 
					    gasUsed: number;
 | 
				
			||||||
    contractAddress: string | null;
 | 
					    contractAddress: string | null;
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -1,4 +1,14 @@
 | 
				
			|||||||
[
 | 
					[
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        "timestamp": 1529397769,
 | 
				
			||||||
 | 
					        "version": "0.7.2",
 | 
				
			||||||
 | 
					        "changes": [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                "note": "Add `getNodeTypeAsync` method",
 | 
				
			||||||
 | 
					                "pr": 812
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        "timestamp": 1529397769,
 | 
					        "timestamp": 1529397769,
 | 
				
			||||||
        "version": "0.7.1",
 | 
					        "version": "0.7.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,2 +1,2 @@
 | 
				
			|||||||
export { Web3Wrapper, uniqueVersionIds } from './web3_wrapper';
 | 
					export { Web3Wrapper, uniqueVersionIds, NodeType } from './web3_wrapper';
 | 
				
			||||||
export { Web3WrapperErrors } from './types';
 | 
					export { Web3WrapperErrors } from './types';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,12 @@ export const uniqueVersionIds = {
 | 
				
			|||||||
    ganache: 'EthereumJS TestRPC',
 | 
					    ganache: 'EthereumJS TestRPC',
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// NodeType represents the type of the backing Ethereum node.
 | 
				
			||||||
 | 
					export enum NodeType {
 | 
				
			||||||
 | 
					    Geth = 'GETH',
 | 
				
			||||||
 | 
					    Ganache = 'GANACHE',
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * A wrapper around the Web3.js 0.x library that provides a consistent, clean promise-based interface.
 | 
					 * A wrapper around the Web3.js 0.x library that provides a consistent, clean promise-based interface.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -489,6 +495,20 @@ export class Web3Wrapper {
 | 
				
			|||||||
    public async setHeadAsync(blockNumber: number): Promise<void> {
 | 
					    public async setHeadAsync(blockNumber: number): Promise<void> {
 | 
				
			||||||
        await this._sendRawPayloadAsync<void>({ method: 'debug_setHead', params: [this._web3.toHex(blockNumber)] });
 | 
					        await this._sendRawPayloadAsync<void>({ method: 'debug_setHead', params: [this._web3.toHex(blockNumber)] });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Returns either NodeType.Geth or NodeType.Ganache depending on the type of
 | 
				
			||||||
 | 
					     * the backing Ethereum node. Throws for any other type of node.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public async getNodeTypeAsync(): Promise<NodeType> {
 | 
				
			||||||
 | 
					        const version = await this.getNodeVersionAsync();
 | 
				
			||||||
 | 
					        if (_.includes(version, uniqueVersionIds.geth)) {
 | 
				
			||||||
 | 
					            return NodeType.Geth;
 | 
				
			||||||
 | 
					        } else if (_.includes(version, uniqueVersionIds.ganache)) {
 | 
				
			||||||
 | 
					            return NodeType.Ganache;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            throw new Error(`Unknown client version: ${version}`);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    private async _sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> {
 | 
					    private async _sendRawPayloadAsync<A>(payload: Partial<JSONRPCRequestPayload>): Promise<A> {
 | 
				
			||||||
        const sendAsync = this._web3.currentProvider.sendAsync.bind(this._web3.currentProvider);
 | 
					        const sendAsync = this._web3.currentProvider.sendAsync.bind(this._web3.currentProvider);
 | 
				
			||||||
        const payloadWithDefaults = {
 | 
					        const payloadWithDefaults = {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user