Merge pull request #870 from ethereum/byzFeature

Byzantium features
pull/1/head
yann300 7 years ago committed by GitHub
commit 7987632ffc
  1. 2
      package.json
  2. 21
      src/app/execution/txExecution.js
  3. 1
      src/app/execution/txListener.js
  4. 20
      src/app/execution/txLogger.js
  5. 1
      src/app/execution/txRunner.js

@ -23,7 +23,7 @@
"ethereumjs-block": "^1.6.0",
"ethereumjs-tx": "^1.3.3",
"ethereumjs-util": "^5.1.2",
"ethereumjs-vm": "2.2.2",
"ethereumjs-vm": "2.3.1",
"execr": "^1.0.1",
"exorcist": "^0.4.0",
"fast-async": "^6.1.2",

@ -38,6 +38,15 @@ module.exports = {
* @return {Object} - { error: true/false, message: DOMNode }
*/
checkVMError: function (txResult) {
var errorCode = {
OUT_OF_GAS: 'out of gas',
STACK_UNDERFLOW: 'stack underflow',
STACK_OVERFLOW: 'stack overflow',
INVALID_JUMP: 'invalid JUMP',
INVALID_OPCODE: 'invalid opcode',
REVERT: 'revert',
STATIC_STATE_CHANGE: 'static state change'
}
var ret = {
error: false,
message: ''
@ -47,14 +56,20 @@ module.exports = {
}
var error = `VM error: ${txResult.result.vm.exceptionError}.\n`
var msg
if (txResult.result.vm.exceptionError === 'invalid opcode') {
if (txResult.result.vm.exceptionError === errorCode.INVALID_OPCODE) {
msg = `\tThe constructor should be payable if you send value.\n\tThe execution might have thrown.\n`
ret.error = true
} else if (txResult.result.vm.exceptionError === 'out of gas') {
} else if (txResult.result.vm.exceptionError === errorCode.OUT_OF_GAS) {
msg = `\tThe transaction ran out of gas. Please increase the Gas Limit.\n`
ret.error = true
} else if (txResult.result.vm.exceptionError === errorCode.REVERT) {
msg = `\tThe transaction has been reverted to the initial state.\n`
ret.error = true
} else if (txResult.result.vm.exceptionError === errorCode.STATIC_STATE_CHANGE) {
msg = `\tState changes is not allowed in Static Call context\n`
ret.error = true
}
ret.message = `${error}${msg}\tDebug the transaction to get more information.`
ret.message = `${error}${txResult.result.vm.exceptionError}${msg}\tDebug the transaction to get more information.`
return ret
}
}

@ -76,6 +76,7 @@ class TxListener {
}
tx.envMode = executionContext.getProvider()
tx.status = txResult.result.status // 0x0 or 0x1
this._resolve([tx], () => {
})
})

@ -182,7 +182,8 @@ function renderKnownTransaction (self, data) {
logs: data.logs,
val: data.tx.value,
transactionCost: data.tx.transactionCost,
executionCost: data.tx.executionCost
executionCost: data.tx.executionCost,
status: data.tx.status
})
tx.appendChild(table)
}
@ -248,7 +249,8 @@ function renderUnknownTransaction (self, data) {
gas: data.tx.gas,
logs: data.logs,
transactionCost: data.tx.transactionCost,
executionCost: data.tx.executionCost
executionCost: data.tx.executionCost,
status: data.tx.status
})
tx.appendChild(table)
}
@ -289,6 +291,20 @@ module.exports = TxLogger
function createTable (opts) {
var table = yo`<table class="${css.txTable}" id="txTable"></table>`
if (opts.status) {
var msg = ''
if (opts.status === '0x0') {
msg = ' Transaction mined but execution failed'
} else if (opts.status === '0x1') {
msg = ' Transaction mined and execution succeed'
}
table.appendChild(yo`
<tr class="${css.tr}">
<td class="${css.td}"> status </td>
<td class="${css.td}">${opts.status}${msg}</td>
</tr class="${css.tr}">`)
}
var contractAddress = yo`
<tr class="${css.tr}">
<td class="${css.td}"> contractAddress </td>

@ -120,6 +120,7 @@ TxRunner.prototype.execute = function (args, callback) {
executionContext.vm().stateManager.revert(function () {})
}
err = err ? err.message : err
result.status = '0x' + result.vm.exception.toString(16)
callback(err, {
result: result,
transactionHash: ethJSUtil.bufferToHex(new Buffer(tx.hash()))

Loading…
Cancel
Save