Merge pull request #800 from ethereum/fixDebugger

Small Fixes
pull/1/head
yann300 7 years ago committed by GitHub
commit 08e13f1f72
  1. 4
      src/app.js
  2. 8
      src/app/execution/txLogger.js
  3. 2
      src/app/panels/editor-panel.js
  4. 2
      src/app/panels/terminal.js
  5. 4
      src/execution-context.js
  6. 9
      src/lib/typeConversion.js

@ -536,8 +536,8 @@ function run () {
}
var transactionDebugger = new Debugger('#debugger', debugAPI, editor.event)
transactionDebugger.addProvider('vm', executionContext.vm())
transactionDebugger.addProvider('injected', executionContext.web3())
transactionDebugger.addProvider('web3', executionContext.web3())
transactionDebugger.addProvider('injected', executionContext.internalWeb3())
transactionDebugger.addProvider('web3', executionContext.internalWeb3())
transactionDebugger.switchProvider(executionContext.getProvider())
var txLogger = new TxLogger({

@ -263,13 +263,13 @@ function context (self, opts) {
var block = data.tx.blockNumber || ''
var i = data.tx.transactionIndex
if (executionContext.getProvider() === 'vm') {
return yo`<span><span class=${css.tx}>[vm]</span> from:${from}, to:${to}, value:${typeConversion.hexToInt(val)} wei, data:${input}, ${logs} logs, hash:${hash}</span>`
return yo`<span><span class=${css.tx}>[vm]</span> from:${from}, to:${to}, value:${typeConversion.toInt(val)} wei, data:${input}, ${logs} logs, hash:${hash}</span>`
} else if (executionContext.getProvider() !== 'vm' && data.resolvedData) {
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.hexToInt(val)} wei, ${logs} logs, data:${input}, hash:${hash}</span>`
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.toInt(val)} wei, ${logs} logs, data:${input}, hash:${hash}</span>`
} else {
to = helper.shortenHexData(to)
hash = helper.shortenHexData(data.tx.blockHash)
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.hexToInt(val)} wei</span>`
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.toInt(val)} wei</span>`
}
}
@ -367,7 +367,7 @@ function createTable (opts) {
`
if (opts.logs) table.appendChild(logs)
var val = typeConversion.hexToInt(opts.val)
var val = typeConversion.toInt(opts.val)
val = yo`
<tr class="${css.tr}">
<td class="${css.td}"> value </td>

@ -178,7 +178,7 @@ class EditorPanel {
}
}
_adjustLayout (direction, delta) {
var limitUp = 36
var limitUp = 0
var limitDown = 20
var containerHeight = window.innerHeight - limitUp // - menu bar containerHeight
var self = this

@ -81,6 +81,8 @@ var css = csjs`
.prompt {
margin-right : 0.5em;
font-family : monospace;
font-weight : bold;
font-size : large;
}
.input {
word-break : break-all;

@ -92,6 +92,10 @@ function ExecutionContext () {
return this.isVM() ? web3VM : web3
}
this.internalWeb3 = function () {
return web3
}
this.blankWeb3 = function () {
return blankWeb3
}

@ -3,8 +3,13 @@ var ethJSUtil = require('ethereumjs-util')
var BN = ethJSUtil.BN
module.exports = {
hexToInt: (h) => {
return (new BN(h.replace('0x', ''), 16)).toString(10)
toInt: (h) => {
if (h.indexOf && h.indexOf('0x') === 0) {
return (new BN(h.replace('0x', ''), 16)).toString(10)
} else if (h.constructor && h.constructor.name === 'BigNumber' || BN.isBN(h)) {
return h.toString(10)
}
return h
},
stringify: stringify
}

Loading…
Cancel
Save