Skip to content
You are reading Codefi Orchestrate development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.

Orchestrate revert reason

Revert reason, if handled by the smart contract, is an information returned by nodes in case of error in the smart contracts execution.

Smart contract have to use the revert or require features to be able to return a revert reason.

The ERC20 token smart contract for instance can return a revert reason when not enough tokens are available at the source address when transferring tokens.

The message “ERC20: transfer amount exceeds allowance” is then returned to the user in the transaction receipt.

Requirements

  • The nodes registered in Orchestrate chain registry have to be able to return revert reason.
  • The revert reason must be configured on nodes. For instance on Hyperledger Besu, the --revert-reason-enabled option must be set.
  • The smart contract to which transaction are sent must implement a revert reason on failure.

Receive revert reason

To receive the revert reason when using Orchestrate, a consumer must be connected to Kafka using Orchestrate SDK.

You can find examples for using a consumer in the Orchestrate SDK documentation examples

Testing with ERC20 smart contract

You can receive a revert reason by calling an ERC20 contract transfer function by asking it to transfer more tokens than what’s available on the sender account.

Important

When trying to transfer too many tokens using ERC20 contract with Orchestrate, you have to define a fixed amount of gas in your transaction. Otherwise Orchestrate will calculate it for you by dry running the transaction and will detect the issue before making the real transaction and you will not trigger the revert reason return.

During regular use, automatic gas setting is a very useful feature, but in this case you have to bypass it if you want to see the revert reason in action.

Revert reason display in transaction receipt

As indicated in the Solidity revert reason documentation, the revert reason is initially returned as an abi-encoded string by the node:

Raw revert reason

0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a4e6f7420656e6f7567682045746865722070726f76696465642e000000000000

A not so easy to read encoded revert reason example.

Orchestrate helps by decoding the revert reason and displays the clear message in the output:

Decoded revert reason

Decoded revert reason in transaction receipt

The revertReason property in the transaction receipt JSON output has the decoded ERC20: transfer amount exceeds allowance string value instead of the encoded raw value.

ConsenSys has acquired Quorum from J.P. Morgan. Please read the FAQ.
Questions or feedback? You can obtain paid professional support by Consensys at orchestrate@consensys.net