Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Parse revert reason strings if present #106

Merged
merged 1 commit into from Aug 13, 2018

Conversation

dekz
Copy link
Contributor

@dekz dekz commented Apr 28, 2018

Parse the revert strings now that Solidity support this in 0.4.22.

ethereum/solidity#3364

Copy link
Contributor

@mikeseese mikeseese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! I'll let @benjamincburns chime in on this one before merging

@fabioberger
Copy link

@seesemichaelj Ping on this.

@mikeseese
Copy link
Contributor

@fabioberger Sorry, @benjamincburns was in India for a training event for the last ~6 days and is back today. Hasn't fallen off our radar!

@@ -52,6 +52,7 @@ RuntimeError.prototype.combine = function(transactions, vm_output) {
this.results[hash] = {
error: result.vm.exceptionError.error || result.vm.exceptionError,
program_counter: result.vm.runState.programCounter,
return: to.hex(result.vm.return),
reason: reason
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@benjamincburns benjamincburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dekz can you please add a test for this?

Also be aware that this only provides a benefit when options.vmErrorsOnRPCResponse is true. This is the default today.

However as soon as geth/parity get their act together on how to handle reason string reporting for transactions, we'll probably adopt that mechanism and make options.vmErrorsOnRPCResponse default to false.

Why? Imagine writing a large dapp thinking that you'll get an RPC error back when a transaction fails, then discovering the whole eth_getTransactionReceipt/status field flow once you get to a testnet, or worse, mainnet. Your app won't fail when it should, and things will just behave wonky. Fortunately this is less of a problem with web3.js 1.0 and truffle-contract, as both check the receipt for you, but I believe there are a number of devs out there still using old versions of web3.js without truffle-contract.

@dekz
Copy link
Contributor Author

dekz commented Jul 9, 2018

@benjamincburns added test and rebased off of develop.

@dekz dekz force-pushed the feature/revert-strings branch 2 times, most recently from f6ac71f to 884f5a5 Compare July 9, 2018 08:18
@benjamincburns
Copy link
Contributor

@seesemichaelj will merge this one manually to take care of the conflicts.

@mikeseese mikeseese merged commit a04585c into trufflesuite:develop Aug 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants