fix transacation status check

pull/3262/head^2
yann300 2 years ago committed by Aniket
parent a11d2a0d88
commit d00a84079d
  1. 2
      apps/remix-ide/src/blockchain/blockchain.js
  2. 2
      libs/remix-lib/src/execution/txListener.ts
  3. 5
      libs/remix-lib/src/execution/txRunnerVM.ts
  4. 2
      libs/remix-simulator/src/methods/transactions.ts
  5. 4
      libs/remix-ui/terminal/src/lib/components/ChechTxStatus.tsx
  6. 4
      libs/remix-ui/terminal/src/lib/components/Table.tsx

@ -295,7 +295,7 @@ export class Blockchain extends Plugin {
if (error) {
return finalCb(`creation of ${selectedContract.name} errored: ${error.message ? error.message : error}`)
}
if (txResult.receipt.status === false || txResult.receipt.status === '0x0') {
if (txResult.receipt.status === false || txResult.receipt.status === '0x0' || txResult.receipt.status === 0) {
return finalCb(`creation of ${selectedContract.name} errored: transaction execution failed`)
}
finalCb(null, selectedContract, address)

@ -104,7 +104,7 @@ export class TxListener {
addExecutionCosts(txResult, tx, execResult)
tx.envMode = this.executionContext.getProvider()
tx.status = txResult.receipt.status // 0x0 or 0x1
tx.status = txResult.receipt.status
this._resolve([tx])
})
})

@ -137,11 +137,6 @@ export class TxRunnerVM {
runBlockInVm (tx, block, callback) {
this.getVMObject().vm.runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false, skipNonce: true }).then((results: RunBlockResult) => {
const result: RunTxResult = results.results[0]
/*if (result) {
const status = result.execResult.exceptionError ? 0 : 1
result.receipt.status
result.status = `0x${status}`
}*/
callback(null, {
result,
transactionHash: bufferToHex(Buffer.from(tx.hash())),

@ -158,7 +158,7 @@ export class Transactions {
processTx(this.txRunnerInstance, payload, true, (error, value: VMxecutionResult) => {
const result: RunTxResult = value.result
if (error) return cb(error)
if ((result as any).receipt === '0x0') {
if ((result as any).receipt?.status === '0x0' || (result as any).receipt?.status === 0) {
try {
const msg = `0x${result.execResult.returnValue.toString('hex') || '0'}`
const abiCoder = new ethers.utils.AbiCoder()

@ -1,12 +1,12 @@
import React from 'react' // eslint-disable-line
const CheckTxStatus = ({ tx, type }) => {
if (tx.status === '0x1' || tx.status === true) {
if (tx.status === 1 || tx.status === '0x1' || tx.status === true) {
return (<i className='remix_ui_terminal_txStatus remix_ui_terminal_succeeded fas fa-check-circle'></i>)
}
if (type === 'call' || type === 'unknownCall' || type === 'unknown') {
return (<i className='remix_ui_terminal_txStatus remix_ui_terminal_call'>call</i>)
} else if (tx.status === '0x0' || tx.status === false) {
} else if (tx.status === 0 || tx.status === '0x0' || tx.status === false) {
return (<i className='remix_ui_terminal_txStatus remix_ui_terminal_failed fas fa-times-circle'></i>)
} else {
return (<i className='remix_ui_terminal_txStatus fas fa-circle-thin' title='Status not available' ></i>)

@ -19,9 +19,9 @@ const showTable = (opts, showTableHash) => {
}
if (!opts.isCall) {
if (opts.status !== undefined && opts.status !== null) {
if (opts.status === '0x0' || opts.status === false) {
if (opts.status === 0 || opts.status === '0x0' || opts.status === false) {
msg = 'Transaction mined but execution failed'
} else if (opts.status === '0x1' || opts.status === true) {
} else if (opts.status === 1 || opts.status === '0x1' || opts.status === true) {
msg = 'Transaction mined and execution succeed'
}
} else {

Loading…
Cancel
Save