diff --git a/src/pages/ethereum/execution/gas-profiler/SimulatePage.tsx b/src/pages/ethereum/execution/gas-profiler/SimulatePage.tsx index ddf89a2a4..e0b008fbe 100644 --- a/src/pages/ethereum/execution/gas-profiler/SimulatePage.tsx +++ b/src/pages/ethereum/execution/gas-profiler/SimulatePage.tsx @@ -105,6 +105,19 @@ function getDeltaColor(percent: number): string { return 'text-muted'; } +/** Detect backend syncing errors (503 from the proxy). */ +function isSyncingError(error: unknown): boolean { + if (error instanceof Error) { + return error.message.includes('currently syncing'); + } + + if (typeof error === 'string') { + return error.includes('currently syncing'); + } + + return false; +} + function calculateAggregateStats(results: BlockSimulationResult[]): AggregateStats { const stats = results.reduce( (acc, result) => { @@ -824,14 +837,37 @@ export function SimulatePage(): JSX.Element { Loading gas parameters... )} - {defaultsError && ( - - )} + {defaultsError && + (isSyncingError(defaultsError) ? ( +
+
+
+ +
+
+

Backend nodes are syncing

+

+ The nodes serving this network are catching up with the chain. Check back shortly and try again. +

+
+
+
+
+ ) : ( + + ))} {gasWarning && modifiedCount === 0 && ( - + {isSyncingError(simState.error) ? ( + +
+
+
+
+ +
+
+
+

Backend Syncing

+

+ The simulation was interrupted because all backend nodes for this network are currently syncing with + the chain. + {simState.completedBlocks > 0 && + ` ${simState.completedBlocks} of ${simState.totalBlocks} blocks completed before the interruption.`}{' '} + Check back shortly and try again. +

+
+
+
+ + ) : ( + + )}
)}