diff --git a/libs/remix-debug/src/Ethdebugger.ts b/libs/remix-debug/src/Ethdebugger.ts index e3a546b1b4..907d94a5af 100644 --- a/libs/remix-debug/src/Ethdebugger.ts +++ b/libs/remix-debug/src/Ethdebugger.ts @@ -196,6 +196,6 @@ export class Ethdebugger { if (this.breakpointManager && this.breakpointManager.hasBreakpoint()) { this.breakpointManager.jumpNextBreakpoint(false) } - this.storageResolver = new StorageResolver({ web3: this.traceManager.web3 }) + this.storageResolver = new StorageResolver({ web3: this.traceManager.web3 }) } } diff --git a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx index 21c985a236..8b046657c1 100644 --- a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx @@ -319,13 +319,21 @@ export const DebuggerUI = (props: DebuggerUIProps) => { }) }) } catch (error) { - unLoad() - setState(prevState => { - return { - ...prevState, - validationError: error.message || error - } - }) + try { + unLoad() + setState(prevState => { + let errorMsg = error.message || error + if (typeof errorMsg !== 'string') { + errorMsg = JSON.stringify(errorMsg) + '. Possible error: the current endpoint does not support retrieving the trace of a transaction.' + } + return { + ...prevState, + validationError: errorMsg + } + }) + } catch (e) { + console.error(e) + } } }, 300) handleResize() diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx index 2220a01fa2..58c82adedd 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx @@ -6,19 +6,19 @@ import Web3 from 'web3' export const GlobalVariables = ({ block, receipt, tx, className }) => { // see https://docs.soliditylang.org/en/latest/units-and-global-variables.html#block-and-transaction-properties const globals = { - 'block.chainid': tx.chainId, - 'block.coinbase': block.miner, - 'block.difficulty': block.difficulty, - 'block.gaslimit': block.gasLimit, - 'block.number': block.number, - 'block.timestamp': block.timestamp, - 'msg.sender': tx.from, - 'msg.sig': tx.input.substring(0, 10), - 'msg.value': tx.value + ' Wei', - 'tx.origin': tx.from + 'block.chainid': tx && tx.chainId, + 'block.coinbase': block && block.miner, + 'block.difficulty': block && block.difficulty, + 'block.gaslimit': block && block.gasLimit, + 'block.number': block && block.number, + 'block.timestamp': block && block.timestamp, + 'msg.sender': tx && tx.from, + 'msg.sig': tx && tx.input && tx.input.substring(0, 10), + 'msg.value': tx && (tx.value + ' Wei'), + 'tx.origin': tx && tx.from } if (block.baseFeePerGas) { - globals['block.basefee'] = Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})` + globals['block.basefee'] = block && (Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})`) } return (