Skip to content

Commit

Permalink
Handle revert in create2 with message
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeissner committed Nov 4, 2018
1 parent a402acc commit 0a04199
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/opFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ function makeCall (runState, callOptions, localOpts, cb) {
if (results.vm.return && (!results.vm.exceptionError || results.vm.exceptionError.error === ERROR.REVERT)) {
memStore(runState, localOpts.outOffset, results.vm.return, new BN(0), localOpts.outLength, false)

if (results.vm.exceptionError && results.vm.exceptionError.error === ERROR.REVERT && runState.opName === 'CREATE') {
if (results.vm.exceptionError && results.vm.exceptionError.error === ERROR.REVERT && isCreateOpCode(runState.opName)) {
runState.lastReturned = results.vm.return
}

Expand Down Expand Up @@ -1049,6 +1049,10 @@ function makeCall (runState, callOptions, localOpts, cb) {
}
}

function isCreateOpCode (opName) {
return opName === 'CREATE' || opName === 'CREATE2'
}

function getContractStorage (runState, address, key, cb) {
if (runState._common.gteHardfork('constantinople')) {
async.parallel({
Expand Down
1 change: 0 additions & 1 deletion lib/runCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ module.exports = function (opts, cb) {
var totalGas = results.gasUsed
if (!results.runState.vmError) {
var returnFee = new BN(results.return.length * self._common.param('gasPrices', 'createData'))

totalGas = totalGas.add(returnFee)
}
// if not enough gas
Expand Down

0 comments on commit 0a04199

Please sign in to comment.