Skip to content

Commit

Permalink
fix: return a new tenderly simulation status in case of tenderly down…
Browse files Browse the repository at this point in the history
…time
  • Loading branch information
jsy1218 committed Oct 30, 2024
1 parent 8bfec29 commit c0c0d64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/providers/simulation-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export enum SimulationStatus {
Succeeded = 2,
InsufficientBalance = 3,
NotApproved = 4,
SystemDown = 5,
}

/**
Expand Down
8 changes: 7 additions & 1 deletion src/providers/tenderly-simulation-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export class FallbackTenderlySimulator extends Simulator {
MetricLoggerUnit.Count
);
}
return { ...swapRoute, simulationStatus: SimulationStatus.Failed };
return { ...swapRoute, simulationStatus: SimulationStatus.SystemDown };
}
}
}
Expand Down Expand Up @@ -440,6 +440,12 @@ export class TenderlySimulator extends Simulator {
1,
MetricLoggerUnit.Count
);
// technically, we can also early return SimulationStatus.SystemDown when http status is not 200.
// in reality, when tenderly is down for whatever reason, i see it always throw during axios http request
// so that it hits the catch block in https://github.com/Uniswap/smart-order-router/blob/8bfec299001d3204483f761f57a38be04512a948/src/providers/tenderly-simulation-provider.ts#L226
// which is where we want to actually return SimulationStatus.SystemDown
// in other words, I've never see a TenderlySimulationUniversalRouterResponseStatus metric with a non-200 status
// if there's downtime, it won't log metric at https://github.com/Uniswap/smart-order-router/blob/8bfec299001d3204483f761f57a38be04512a948/src/providers/tenderly-simulation-provider.ts#L434

// Validate tenderly response body
if (
Expand Down

0 comments on commit c0c0d64

Please sign in to comment.