Merge pull request #1445 from ethereum/fixLogUnknownCall

Fix: Error While calling contract Where compilation result not anymore available
pull/1/head
yann300 7 years ago committed by GitHub
commit 9ac7704e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      src/app/execution/txLogger.js
  2. 2
      src/app/panels/editor-panel.js

@ -49,6 +49,8 @@ var css = csjs`
.failed { .failed {
color: ${styles.terminal.icon_Color_Log_Failed}; color: ${styles.terminal.icon_Color_Log_Failed};
} }
.notavailable {
}
.call { .call {
font-size: 7px; font-size: 7px;
background-color: ${styles.terminal.icon_BackgroundColor_Log_Call}; background-color: ${styles.terminal.icon_BackgroundColor_Log_Call};
@ -157,6 +159,7 @@ class TxLogger {
}, { activate: true, filterFn: filterTx }) }, { activate: true, filterFn: filterTx })
this.logUnknownTX = this._deps.editorPanel.registerCommand('unknownTransaction', (args, cmds, append) => { this.logUnknownTX = this._deps.editorPanel.registerCommand('unknownTransaction', (args, cmds, append) => {
// triggered for transaction AND call
var data = args[0] var data = args[0]
var el = renderUnknownTransaction(this, data) var el = renderUnknownTransaction(this, data)
append(el) append(el)
@ -277,11 +280,11 @@ function renderUnknownTransaction (self, data) {
var from = data.tx.from var from = data.tx.from
var to = data.tx.to var to = data.tx.to
var obj = {from, to} var obj = {from, to}
var txType = 'unknownTx' var txType = 'unknown' + (data.tx.isCall ? 'Call' : 'Tx')
var tx = yo` var tx = yo`
<span id="tx${data.tx.hash}"> <span id="tx${data.tx.hash}">
<div class="${css.log}" onclick=${e => txDetails(e, tx, data, obj)}> <div class="${css.log}" onclick=${e => txDetails(e, tx, data, obj)}>
${checkTxStatus(data.receipt, txType)} ${checkTxStatus(data.receipt || data.tx, txType)}
${context(self, {from, to, data})} ${context(self, {from, to, data})}
<div class=${css.buttons}> <div class=${css.buttons}>
<div class=${css.debug} onclick=${(e) => debug(e, data, self)}>Debug</div> <div class=${css.debug} onclick=${(e) => debug(e, data, self)}>Debug</div>
@ -304,10 +307,12 @@ function checkTxStatus (tx, type) {
if (tx.status === '0x1') { if (tx.status === '0x1') {
return yo`<i class="${css.txStatus} ${css.succeeded} fa fa-check-circle"></i>` return yo`<i class="${css.txStatus} ${css.succeeded} fa fa-check-circle"></i>`
} }
if (type === 'call') { if (type === 'call' || type === 'unknownCall') {
return yo`<i class="${css.txStatus} ${css.call}">call</i>` return yo`<i class="${css.txStatus} ${css.call}">call</i>`
} else { } else if (tx.status === '0x0') {
return yo`<i class="${css.txStatus} ${css.failed} fa fa-times-circle"></i>` return yo`<i class="${css.txStatus} ${css.failed} fa fa-times-circle"></i>`
} else {
return yo`<i class="${css.txStatus} ${css.notavailable} fa fa-circle-thin" title='Status not available' ></i>`
} }
} }
@ -406,18 +411,22 @@ function txDetails (e, tx, data, obj) {
function createTable (opts) { function createTable (opts) {
var table = yo`<table class="${css.txTable}" id="txTable"></table>` var table = yo`<table class="${css.txTable}" id="txTable"></table>`
if (opts.status) { if (!opts.isCall) {
var msg = '' var msg = ''
if (opts.status === '0x0') { if (opts.status) {
msg = ' Transaction mined but execution failed' if (opts.status === '0x0') {
} else if (opts.status === '0x1') { msg = ' Transaction mined but execution failed'
msg = ' Transaction mined and execution succeed' } else if (opts.status === '0x1') {
msg = ' Transaction mined and execution succeed'
}
} else {
msg = ' Status not available at the moment'
} }
table.appendChild(yo` table.appendChild(yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> status </td> <td class="${css.td}"> status </td>
<td class="${css.td}">${opts.status}${msg}</td> <td class="${css.td}">${opts.status}${msg}</td>
</tr>`) </tr>`)
} }
var transactionHash = yo` var transactionHash = yo`

@ -24,7 +24,7 @@ class EditorPanel {
var self = this var self = this
self._deps = { self._deps = {
config: self._components.registry.get('config').api, config: self._components.registry.get('config').api,
txlistener: self._components.registry.get('txlistener').api, txListener: self._components.registry.get('txlistener').api,
fileManager: self._components.registry.get('filemanager').api, fileManager: self._components.registry.get('filemanager').api,
udapp: self._components.registry.get('udapp').api udapp: self._components.registry.get('udapp').api
} }

Loading…
Cancel
Save