Skip to content
Snippets Groups Projects
Unverified Commit 6c8285aa authored by Silas Davis's avatar Silas Davis Committed by GitHub
Browse files

Merge pull request #901 from seanyoung/deploy-revert

burrow deploy should show revert message and fail job
parents a5d41863 81e65288
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ import (
compilers "github.com/hyperledger/burrow/deploy/compile"
"github.com/hyperledger/burrow/deploy/def"
"github.com/hyperledger/burrow/deploy/util"
"github.com/hyperledger/burrow/execution/errors"
"github.com/hyperledger/burrow/execution/evm/abi"
"github.com/hyperledger/burrow/txs/payload"
log "github.com/sirupsen/logrus"
......@@ -390,6 +391,14 @@ func CallJob(call *def.Call, do *def.Packages) (string, []*abi.Variable, error)
return "", nil, err
}
if txe.Exception != nil && txe.Exception.ErrorCode() == errors.ErrorCodeExecutionReverted {
message, err := abi.UnpackRevert(txe.Result.Return)
if err != nil {
return "", nil, err
}
log.WithField("Revert Message", message).Error("transaction reverted")
return message, nil, txe.Exception.AsError()
}
var result string
log.Debug(txe.Result.Return)
......
jobs:
- name: deployRevert
deploy:
contract: revert.sol
- name: doNotRevert
call:
destination: $deployRevert
function: RevertIf0
data:
- 1
- name: doRevert
call:
destination: $deployRevert
function: RevertIf0
data:
- 0
pragma solidity ^0.4.16;
contract Revert {
function RevertIf0(uint32 i) public pure
{
if (i == 0) {
revert("arbeidsongeschiktheidsverzekeringsmaatschappij");
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment