Appease CI

This commit is contained in:
Michael Zhu 2020-08-18 16:56:38 -07:00
parent 89117beda2
commit e078f3d479
12 changed files with 41 additions and 41 deletions

View File

@ -286,11 +286,11 @@ describe('AssetProxyDispatcher', () => {
}); });
const encodedAssetData = encodeERC20AssetData(erc20TokenA.address); const encodedAssetData = encodeERC20AssetData(erc20TokenA.address);
const amount = new BigNumber(1); const amount = new BigNumber(1);
const nestedError = new StringRevertError(RevertReason.TransferFailed).encode(); const nestedError = new StringRevertError(RevertReason.TransferFailed);
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHash, orderHash,
encodedAssetData, encodedAssetData,
nestedError, nestedError.toString(),
); );
const tx = assetProxyDispatcher const tx = assetProxyDispatcher
.dispatchTransferFrom(orderHash, encodedAssetData, makerAddress, takerAddress, amount) .dispatchTransferFrom(orderHash, encodedAssetData, makerAddress, takerAddress, amount)
@ -309,11 +309,11 @@ describe('AssetProxyDispatcher', () => {
from: makerAddress, from: makerAddress,
}); });
const transferIndexAsBytes32 = '0x0000000000000000000000000000000000000000000000000000000000000001'; const transferIndexAsBytes32 = '0x0000000000000000000000000000000000000000000000000000000000000001';
const nestedError = new StringRevertError(RevertReason.TransferFailed).encode(); const nestedError = new StringRevertError(RevertReason.TransferFailed);
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
transferIndexAsBytes32, transferIndexAsBytes32,
assetDataB, assetDataB,
nestedError, nestedError.toString(),
); );
const tx = assetProxyDispatcher const tx = assetProxyDispatcher
.simulateDispatchTransferFromCalls( .simulateDispatchTransferFromCalls(

View File

@ -300,7 +300,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
hashHex, hashHex,
validatorWallet.address, validatorWallet.address,
signatureHex, signatureHex,
new StringRevertError(validatorWalletRevertReason).encode(), new StringRevertError(validatorWalletRevertReason).toString(),
); );
const tx = validateAsync(hashHex, validatorWallet.address, signatureHex, ValidatorWalletAction.Revert); const tx = validateAsync(hashHex, validatorWallet.address, signatureHex, ValidatorWalletAction.Revert);
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
@ -562,7 +562,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
validatorWallet.address, validatorWallet.address,
data, data,
signatureHex, signatureHex,
new StringRevertError(validatorWalletRevertReason).encode(), new StringRevertError(validatorWalletRevertReason).toString(),
); );
const tx = validateAsync(signedOrder, signatureHex, ValidatorWalletAction.Revert); const tx = validateAsync(signedOrder, signatureHex, ValidatorWalletAction.Revert);
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
@ -693,7 +693,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
validatorWallet.address, validatorWallet.address,
data, data,
signatureHex, signatureHex,
new StringRevertError(validatorWalletRevertReason).encode(), new StringRevertError(validatorWalletRevertReason).toString(),
); );
const tx = validateAsync(signedOrder, signatureHex, ValidatorWalletAction.Revert); const tx = validateAsync(signedOrder, signatureHex, ValidatorWalletAction.Revert);
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
@ -916,7 +916,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
validatorWallet.address, validatorWallet.address,
data, data,
signatureHex, signatureHex,
new StringRevertError(validatorWalletRevertReason).encode(), new StringRevertError(validatorWalletRevertReason).toString(),
); );
const tx = validateAsync(signedTransaction, signatureHex, ValidatorWalletAction.Revert); const tx = validateAsync(signedTransaction, signatureHex, ValidatorWalletAction.Revert);
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
@ -1041,7 +1041,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
validatorWallet.address, validatorWallet.address,
data, data,
signatureHex, signatureHex,
new StringRevertError(validatorWalletRevertReason).encode(), new StringRevertError(validatorWalletRevertReason).toString(),
); );
const tx = validateAsync(signedTransaction, signatureHex, ValidatorWalletAction.Revert); const tx = validateAsync(signedTransaction, signatureHex, ValidatorWalletAction.Revert);
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);

View File

@ -101,7 +101,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const executableError = new StringRevertError('EXECUTABLE_FAILED'); const executableError = new StringRevertError('EXECUTABLE_FAILED');
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHash, transactionHash,
executableError.encode(), executableError.toString(),
); );
// Call the `batchExecuteTransactions()` function and ensure that it reverts with the expected revert error. // Call the `batchExecuteTransactions()` function and ensure that it reverts with the expected revert error.
@ -123,7 +123,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const executableError = new StringRevertError('EXECUTABLE_FAILED'); const executableError = new StringRevertError('EXECUTABLE_FAILED');
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHash, transactionHash,
executableError.encode(), executableError.toString(),
); );
// Call the `batchExecuteTransactions()` function and ensure that it reverts with the expected revert error. // Call the `batchExecuteTransactions()` function and ensure that it reverts with the expected revert error.
@ -145,7 +145,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const executableError = new StringRevertError('EXECUTABLE_FAILED'); const executableError = new StringRevertError('EXECUTABLE_FAILED');
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHash, transactionHash,
executableError.encode(), executableError.toString(),
); );
// Call the `batchExecuteTransactions()` function and ensure that it reverts with the expected revert error. // Call the `batchExecuteTransactions()` function and ensure that it reverts with the expected revert error.
@ -280,7 +280,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const outerExecuteTransactionHash = transactionHashUtils.getTransactionHashHex(outerExecuteTransaction); const outerExecuteTransactionHash = transactionHashUtils.getTransactionHashHex(outerExecuteTransaction);
const outerExpectedError = new ExchangeRevertErrors.TransactionExecutionError( const outerExpectedError = new ExchangeRevertErrors.TransactionExecutionError(
outerExecuteTransactionHash, outerExecuteTransactionHash,
innerExpectedError.encode(), innerExpectedError.toString(),
); );
const tx = transactionsContract const tx = transactionsContract
.batchExecuteTransactions([outerExecuteTransaction], [randomSignature()]) .batchExecuteTransactions([outerExecuteTransaction], [randomSignature()])
@ -363,7 +363,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const errorData = new ExchangeRevertErrors.TransactionInvalidContextError( const errorData = new ExchangeRevertErrors.TransactionInvalidContextError(
innerTransactionHash, innerTransactionHash,
accounts[0], accounts[0],
).encode(); ).toString();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(outerTransactionHash, errorData); const expectedError = new ExchangeRevertErrors.TransactionExecutionError(outerTransactionHash, errorData);
const tx = transactionsContract const tx = transactionsContract
.executeTransaction(outerTransaction, validSignature) .executeTransaction(outerTransaction, validSignature)
@ -385,7 +385,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const errorData = new ExchangeRevertErrors.TransactionInvalidContextError( const errorData = new ExchangeRevertErrors.TransactionInvalidContextError(
innerTransactionHash, innerTransactionHash,
accounts[0], accounts[0],
).encode(); ).toString();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError(outerTransactionHash, errorData); const expectedError = new ExchangeRevertErrors.TransactionExecutionError(outerTransactionHash, errorData);
const tx = transactionsContract const tx = transactionsContract
.executeTransaction(outerTransaction, validSignature) .executeTransaction(outerTransaction, validSignature)
@ -466,7 +466,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const executableError = new StringRevertError('EXECUTABLE_FAILED'); const executableError = new StringRevertError('EXECUTABLE_FAILED');
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHash, transactionHash,
executableError.encode(), executableError.toString(),
); );
const tx = transactionsContract const tx = transactionsContract
.executeTransaction(transaction, randomSignature()) .executeTransaction(transaction, randomSignature())
@ -486,7 +486,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
const executableError = new StringRevertError('EXECUTABLE_FAILED'); const executableError = new StringRevertError('EXECUTABLE_FAILED');
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHash, transactionHash,
executableError.encode(), executableError.toString(),
); );
const tx = transactionsContract const tx = transactionsContract
.executeTransaction(transaction, validSignature) .executeTransaction(transaction, validSignature)

View File

@ -558,7 +558,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex, orderHashHex,
signedOrder.makerAssetData, signedOrder.makerAssetData,
new StringRevertError(RevertReason.TransferFailed).encode(), new StringRevertError(RevertReason.TransferFailed).toString(),
); );
const tx = exchange const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) .fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -587,7 +587,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex, orderHashHex,
signedOrder.takerAssetData, signedOrder.takerAssetData,
new StringRevertError(RevertReason.TransferFailed).encode(), new StringRevertError(RevertReason.TransferFailed).toString(),
); );
const tx = exchange const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) .fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -616,7 +616,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex, orderHashHex,
signedOrder.makerAssetData, signedOrder.makerAssetData,
new StringRevertError(RevertReason.InvalidAmount).encode(), new StringRevertError(RevertReason.InvalidAmount).toString(),
); );
const tx = exchange const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) .fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -645,7 +645,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex, orderHashHex,
signedOrder.takerAssetData, signedOrder.takerAssetData,
new StringRevertError(RevertReason.InvalidAmount).encode(), new StringRevertError(RevertReason.InvalidAmount).toString(),
); );
const tx = exchange const tx = exchange
.fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature) .fillOrder(signedOrder, takerAssetFillAmount, signedOrder.signature)
@ -980,7 +980,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex, orderHashHex,
assetData, assetData,
new StringRevertError(RevertReason.TargetNotEven).encode(), new StringRevertError(RevertReason.TargetNotEven).toString(),
); );
const tx = exchange const tx = exchange
.fillOrder(signedOrder, signedOrder.takerAssetAmount, signedOrder.signature) .fillOrder(signedOrder, signedOrder.takerAssetAmount, signedOrder.signature)
@ -1015,7 +1015,7 @@ blockchainTests.resets('Exchange core', () => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashHex, orderHashHex,
assetData, assetData,
new StringRevertError(RevertReason.TargetNotEven).encode(), new StringRevertError(RevertReason.TargetNotEven).toString(),
); );
const tx = exchange const tx = exchange
.fillOrder(signedOrder, signedOrder.takerAssetAmount, signedOrder.signature) .fillOrder(signedOrder, signedOrder.takerAssetAmount, signedOrder.signature)

View File

@ -9,7 +9,7 @@ import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { LibMathRevertErrors } from '@0x/contracts-exchange-libs'; import { LibMathRevertErrors } from '@0x/contracts-exchange-libs';
import { blockchainTests, constants, describe, expect, toBaseUnitAmount } from '@0x/contracts-test-utils'; import { blockchainTests, constants, describe, expect, toBaseUnitAmount } from '@0x/contracts-test-utils';
import { SignedOrder } from '@0x/order-utils'; import { SignedOrder } from '@0x/order-utils';
import { BigNumber, RevertError } from '@0x/utils'; import { BigNumber, decodeThrownErrorAsRevertError, StringRevertError } from '@0x/utils';
import { DecodedLogArgs, LogWithDecodedArgs } from 'ethereum-types'; import { DecodedLogArgs, LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash'; import * as _ from 'lodash';
@ -276,9 +276,9 @@ blockchainTests.resets('Exchange fills dydx orders', env => {
try { try {
await txPromise.catch(); await txPromise.catch();
} catch (e) { } catch (e) {
assetProxyError = RevertError.decode(e.values.errorData); assetProxyError = decodeThrownErrorAsRevertError(e).values.errorData;
} }
expect(assetProxyError).to.deep.equal(expectedAssetProxyError); expect(assetProxyError).to.deep.equal(new StringRevertError(expectedAssetProxyError.toString()));
}); });
}); });
}); });

View File

@ -121,7 +121,7 @@ blockchainTests.resets('Transaction <> protocol fee integration tests', env => {
maker.address, maker.address,
wethless.address, wethless.address,
'0x', '0x',
).encode(); ).toString();
return new ExchangeRevertErrors.TransactionExecutionError( return new ExchangeRevertErrors.TransactionExecutionError(
transactionHashUtils.getTransactionHashHex(failedTransaction), transactionHashUtils.getTransactionHashHex(failedTransaction),
nestedError, nestedError,
@ -252,7 +252,7 @@ blockchainTests.resets('Transaction <> protocol fee integration tests', env => {
.awaitTransactionSuccessAsync({ from: alice.address, value: REFUND_AMOUNT }); .awaitTransactionSuccessAsync({ from: alice.address, value: REFUND_AMOUNT });
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashUtils.getTransactionHashHex(recursiveTransaction), transactionHashUtils.getTransactionHashHex(recursiveTransaction),
protocolFeeError(order, transaction).encode(), protocolFeeError(order, transaction).toString(),
); );
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
}); });

View File

@ -280,7 +280,7 @@ blockchainTests.resets('Transaction integration tests', env => {
const noReentrancyError = new ExchangeRevertErrors.TransactionInvalidContextError( const noReentrancyError = new ExchangeRevertErrors.TransactionInvalidContextError(
transactionHashHex, transactionHashHex,
transaction.signerAddress, transaction.signerAddress,
).encode(); ).toString();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
recursiveTransactionHashHex, recursiveTransactionHashHex,
noReentrancyError, noReentrancyError,
@ -330,7 +330,7 @@ blockchainTests.resets('Transaction integration tests', env => {
orderHashUtils.getOrderHashHex(order), orderHashUtils.getOrderHashHex(order),
order.makerAddress, order.makerAddress,
order.signature, order.signature,
).encode(); ).toString();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashHex, transactionHashHex,
nestedError, nestedError,
@ -353,7 +353,7 @@ blockchainTests.resets('Transaction integration tests', env => {
ExchangeRevertErrors.ExchangeContextErrorCodes.InvalidMaker, ExchangeRevertErrors.ExchangeContextErrorCodes.InvalidMaker,
orderHashUtils.getOrderHashHex(order), orderHashUtils.getOrderHashHex(order),
takers[0].address, takers[0].address,
).encode(); ).toString();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashHex, transactionHashHex,
nestedError, nestedError,
@ -403,7 +403,7 @@ blockchainTests.resets('Transaction integration tests', env => {
ExchangeRevertErrors.ExchangeContextErrorCodes.InvalidMaker, ExchangeRevertErrors.ExchangeContextErrorCodes.InvalidMaker,
orderHashUtils.getOrderHashHex(orders[0]), orderHashUtils.getOrderHashHex(orders[0]),
takers[0].address, takers[0].address,
).encode(); ).toString();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashHex, transactionHashHex,
nestedError, nestedError,
@ -771,7 +771,7 @@ blockchainTests.resets('Transaction integration tests', env => {
const nestedError = new ExchangeRevertErrors.OrderStatusError( const nestedError = new ExchangeRevertErrors.OrderStatusError(
orderHashUtils.getOrderHashHex(order), orderHashUtils.getOrderHashHex(order),
OrderStatus.Cancelled, OrderStatus.Cancelled,
).encode(); ).toString();
const expectedError = new ExchangeRevertErrors.TransactionExecutionError( const expectedError = new ExchangeRevertErrors.TransactionExecutionError(
transactionHashUtils.getTransactionHashHex(transaction2), transactionHashUtils.getTransactionHashHex(transaction2),
nestedError, nestedError,

View File

@ -123,7 +123,7 @@ blockchainTests.resets('Chainlink stop-limit order tests', env => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashUtils.getOrderHashHex(order), orderHashUtils.getOrderHashHex(order),
order.makerAssetData, order.makerAssetData,
new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').encode(), new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').toString(),
); );
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
}); });
@ -133,7 +133,7 @@ blockchainTests.resets('Chainlink stop-limit order tests', env => {
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError( const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHashUtils.getOrderHashHex(order), orderHashUtils.getOrderHashHex(order),
order.makerAssetData, order.makerAssetData,
new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').encode(), new StringRevertError('ChainlinkStopLimit/OUT_OF_PRICE_RANGE').toString(),
); );
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
}); });

View File

@ -297,7 +297,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
new ZeroExRevertErrors.MetaTransactions.MetaTransactionCallFailedError( new ZeroExRevertErrors.MetaTransactions.MetaTransactionCallFailedError(
mtxHash, mtxHash,
actualCallData, actualCallData,
new StringRevertError('FAIL').encode(), new StringRevertError('FAIL').toString(),
), ),
); );
}); });
@ -465,7 +465,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
mtxHash, mtxHash,
signers[0], signers[0],
signature, signature,
).encode(), ).toString(),
), ),
); );
}); });

View File

@ -102,7 +102,7 @@ blockchainTests.resets('Ownable feature', env => {
return expect(tx).to.revertWith( return expect(tx).to.revertWith(
new ZeroExRevertErrors.Ownable.MigrateCallFailedError( new ZeroExRevertErrors.Ownable.MigrateCallFailedError(
testMigrator.address, testMigrator.address,
new StringRevertError('OOPSIE').encode(), new StringRevertError('OOPSIE').toString(),
), ),
); );
}); });

View File

@ -98,7 +98,7 @@ blockchainTests.resets('TokenSpender feature', env => {
tokenFrom, tokenFrom,
tokenTo, tokenTo,
tokenAmount, tokenAmount,
new StringRevertError('TestTokenSpenderERC20Token/Revert').encode(), new StringRevertError('TestTokenSpenderERC20Token/Revert').toString(),
); );
return expect(tx).to.revertWith(expectedError); return expect(tx).to.revertWith(expectedError);
}); });

View File

@ -127,7 +127,7 @@ blockchainTests.resets('FlashWallet', env => {
callTarget.address, callTarget.address,
REVERTING_DATA, REVERTING_DATA,
constants.ZERO_AMOUNT, constants.ZERO_AMOUNT,
new StringRevertError('TestCallTarget/REVERT').encode(), new StringRevertError('TestCallTarget/REVERT').toString(),
), ),
); );
}); });
@ -203,7 +203,7 @@ blockchainTests.resets('FlashWallet', env => {
wallet.address, wallet.address,
callTarget.address, callTarget.address,
REVERTING_DATA, REVERTING_DATA,
new StringRevertError('TestCallTarget/REVERT').encode(), new StringRevertError('TestCallTarget/REVERT').toString(),
), ),
); );
}); });