Web3.js: Can't get tx receipt of reverted transaction

Created on 29 Mar 2019  路  2Comments  路  Source: ChainSafe/web3.js

Description

A tx which reverted never resolves and I can't get the receipt of the reverted transaction: receipt is not available neither in catch args or in error event args

Expected behavior

In case a transaction reverts or runs out of gas:

const receipt = await dummyContract.methods.revertMe().send()
  .on("transactionHash", <should be triggered with tx hash>)
  .on("receipt", 
     <should be triggered with tx receipt , receipt.status set to false>)
  .on("confirmation", 
      <should be triggered for each confirmation with 
             confirmation number and with tx receipt, receipt.status set to false>)
  .on("error", <should be triggered with error and receipt>)
  .catch( <IMHO it should NOT be triggered in VM reverts or out of gas
     rather resolve the call and let the caller handle it on error event or based on 
      resolved receipt's status 
      or at least should be triggered with (error, receipt)  )

Actual behavior

on VM error I can't retrieve the receipt in any of these ways:

  • it's not passed to error event
  • it's not passed to catch block (although I think catch block shouldn't be reached in this scenario)
  • no receipt or confirmation event called
  • the tx never resolves so even the resolved so returned receipt can't be used

Steps to reproduce the behavior

https://github.com/Augmint/web3js_integration_tests/blob/master/test/fails.js

Error Logs

N/A

Gists

https://github.com/Augmint/web3js_integration_tests/blob/master/test/fails.js

Versions

  • web3.js: beta51
  • nodejs: 8.15.3
  • browser: N/A
  • ethereum node: ganache-cli v6.4.1
bug

Most helpful comment

Thanks for opening this issue! I will fix this and probably release it on Tuesday.

All 2 comments

The latest release breaks the receipt event see https://github.com/ethereum/web3.js/issues/2601

Thanks for opening this issue! I will fix this and probably release it on Tuesday.

Was this page helpful?
0 / 5 - 0 ratings