aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer
diff options
context:
space:
mode:
authorBrandon Millman <brandon@0xproject.com>2018-11-15 07:20:31 +0800
committerGitHub <noreply@github.com>2018-11-15 07:20:31 +0800
commit2eef766aff1d0d1b13af9a28f28d38bb722996d1 (patch)
tree008b77679ca189c75b5484377ce1db6801ea636d /packages/asset-buyer
parent504f4d9eb99589b4d9071a6f13cea9dcc11f226d (diff)
parentaf6aa2df93d533293316512c5b724a2fa40315d6 (diff)
downloaddexon-sol-tools-2eef766aff1d0d1b13af9a28f28d38bb722996d1.tar
dexon-sol-tools-2eef766aff1d0d1b13af9a28f28d38bb722996d1.tar.gz
dexon-sol-tools-2eef766aff1d0d1b13af9a28f28d38bb722996d1.tar.bz2
dexon-sol-tools-2eef766aff1d0d1b13af9a28f28d38bb722996d1.tar.lz
dexon-sol-tools-2eef766aff1d0d1b13af9a28f28d38bb722996d1.tar.xz
dexon-sol-tools-2eef766aff1d0d1b13af9a28f28d38bb722996d1.tar.zst
dexon-sol-tools-2eef766aff1d0d1b13af9a28f28d38bb722996d1.zip
Merge pull request #1258 from 0xProject/fix/instant/contract-call
[instant] Catch errors coming from calls to the orderValidator contract
Diffstat (limited to 'packages/asset-buyer')
-rw-r--r--packages/asset-buyer/src/utils/order_provider_response_processor.ts29
1 files changed, 17 insertions, 12 deletions
diff --git a/packages/asset-buyer/src/utils/order_provider_response_processor.ts b/packages/asset-buyer/src/utils/order_provider_response_processor.ts
index 28f684f3c..25e85b2cc 100644
--- a/packages/asset-buyer/src/utils/order_provider_response_processor.ts
+++ b/packages/asset-buyer/src/utils/order_provider_response_processor.ts
@@ -44,19 +44,24 @@ export const orderProviderResponseProcessor = {
let unsortedOrders = filteredOrders;
// if an orderValidator is provided, use on chain information to calculate remaining fillable makerAsset amounts
if (!_.isUndefined(orderValidator)) {
- // TODO(bmillman): improvement
- // try/catch this request and throw a more domain specific error
const takerAddresses = _.map(filteredOrders, () => constants.NULL_ADDRESS);
- const ordersAndTradersInfo = await orderValidator.getOrdersAndTradersInfoAsync(
- filteredOrders,
- takerAddresses,
- );
- // take orders + on chain information and find the valid orders and remaining fillable maker asset amounts
- unsortedOrders = getValidOrdersWithRemainingFillableMakerAssetAmountsFromOnChain(
- filteredOrders,
- ordersAndTradersInfo,
- isMakerAssetZrxToken,
- );
+ try {
+ const ordersAndTradersInfo = await orderValidator.getOrdersAndTradersInfoAsync(
+ filteredOrders,
+ takerAddresses,
+ );
+ // take orders + on chain information and find the valid orders and remaining fillable maker asset amounts
+ unsortedOrders = getValidOrdersWithRemainingFillableMakerAssetAmountsFromOnChain(
+ filteredOrders,
+ ordersAndTradersInfo,
+ isMakerAssetZrxToken,
+ );
+ } catch (err) {
+ // Sometimes we observe this call to orderValidator fail with response `0x`
+ // Because of differences in Parity / Geth implementations, its very hard to tell if this response is a "system error"
+ // or a revert. In this case we just swallow these errors and fallback to partial fill information from the SRA.
+ // TODO(bmillman): report these errors so we have an idea of how often we're getting these failures.
+ }
}
// sort orders by rate
// TODO(bmillman): optimization