fix(instant): catch errors coming from calls to the orderValidator contract
This commit is contained in:
parent
4fc457b78b
commit
af6aa2df93
@ -44,9 +44,8 @@ export const orderProviderResponseProcessor = {
|
|||||||
let unsortedOrders = filteredOrders;
|
let unsortedOrders = filteredOrders;
|
||||||
// if an orderValidator is provided, use on chain information to calculate remaining fillable makerAsset amounts
|
// if an orderValidator is provided, use on chain information to calculate remaining fillable makerAsset amounts
|
||||||
if (!_.isUndefined(orderValidator)) {
|
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 takerAddresses = _.map(filteredOrders, () => constants.NULL_ADDRESS);
|
||||||
|
try {
|
||||||
const ordersAndTradersInfo = await orderValidator.getOrdersAndTradersInfoAsync(
|
const ordersAndTradersInfo = await orderValidator.getOrdersAndTradersInfoAsync(
|
||||||
filteredOrders,
|
filteredOrders,
|
||||||
takerAddresses,
|
takerAddresses,
|
||||||
@ -57,6 +56,12 @@ export const orderProviderResponseProcessor = {
|
|||||||
ordersAndTradersInfo,
|
ordersAndTradersInfo,
|
||||||
isMakerAssetZrxToken,
|
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
|
// sort orders by rate
|
||||||
// TODO(bmillman): optimization
|
// TODO(bmillman): optimization
|
||||||
|
Loading…
x
Reference in New Issue
Block a user