fix debugging

pull/5370/head
yann300 2 years ago committed by Aniket
parent 3de01e6300
commit 82df9c8bf0
  1. 2
      libs/remix-debug/src/Ethdebugger.ts
  2. 22
      libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx
  3. 22
      libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx

@ -196,6 +196,6 @@ export class Ethdebugger {
if (this.breakpointManager && this.breakpointManager.hasBreakpoint()) { if (this.breakpointManager && this.breakpointManager.hasBreakpoint()) {
this.breakpointManager.jumpNextBreakpoint(false) this.breakpointManager.jumpNextBreakpoint(false)
} }
this.storageResolver = new StorageResolver({ web3: this.traceManager.web3 }) this.storageResolver = new StorageResolver({ web3: this.traceManager.web3 })
} }
} }

@ -319,13 +319,21 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
}) })
}) })
} catch (error) { } catch (error) {
unLoad() try {
setState(prevState => { unLoad()
return { setState(prevState => {
...prevState, let errorMsg = error.message || error
validationError: 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) }, 300)
handleResize() handleResize()

@ -6,19 +6,19 @@ import Web3 from 'web3'
export const GlobalVariables = ({ block, receipt, tx, className }) => { export const GlobalVariables = ({ block, receipt, tx, className }) => {
// see https://docs.soliditylang.org/en/latest/units-and-global-variables.html#block-and-transaction-properties // see https://docs.soliditylang.org/en/latest/units-and-global-variables.html#block-and-transaction-properties
const globals = { const globals = {
'block.chainid': tx.chainId, 'block.chainid': tx && tx.chainId,
'block.coinbase': block.miner, 'block.coinbase': block && block.miner,
'block.difficulty': block.difficulty, 'block.difficulty': block && block.difficulty,
'block.gaslimit': block.gasLimit, 'block.gaslimit': block && block.gasLimit,
'block.number': block.number, 'block.number': block && block.number,
'block.timestamp': block.timestamp, 'block.timestamp': block && block.timestamp,
'msg.sender': tx.from, 'msg.sender': tx && tx.from,
'msg.sig': tx.input.substring(0, 10), 'msg.sig': tx && tx.input && tx.input.substring(0, 10),
'msg.value': tx.value + ' Wei', 'msg.value': tx && (tx.value + ' Wei'),
'tx.origin': tx.from 'tx.origin': tx && tx.from
} }
if (block.baseFeePerGas) { 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 ( return (

Loading…
Cancel
Save