From 2f3df8cce0711ad33ecf1b5c9fe056c2f85a0f06 Mon Sep 17 00:00:00 2001 From: Sebastian Bor Date: Thu, 22 Jul 2021 16:28:04 +0100 Subject: [PATCH] Explorer: Show simulation error for Upgrade instruction with none existing buffer (#18838) --- explorer/src/pages/inspector/SimulatorCard.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/explorer/src/pages/inspector/SimulatorCard.tsx b/explorer/src/pages/inspector/SimulatorCard.tsx index c55194dad3..62b8341d62 100644 --- a/explorer/src/pages/inspector/SimulatorCard.tsx +++ b/explorer/src/pages/inspector/SimulatorCard.tsx @@ -247,6 +247,15 @@ function useSimulator(message: Message) { } }); + // If the instruction's simulation returned an error without any logs then add an empty log entry for Runtime error + // For example BpfUpgradableLoader fails without returning any logs for Upgrade instruction with buffer that doesn't exist + if (instructionError && instructionLogs.length === 0) { + instructionLogs.push({ + logs: [], + failed: true, + }); + } + if ( instructionError && instructionError.index === instructionLogs.length - 1