Skip to content

Commit 0a04199

Browse files
committed
Handle revert in create2 with message
1 parent a402acc commit 0a04199

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/opFns.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ function makeCall (runState, callOptions, localOpts, cb) {
10111011
if (results.vm.return && (!results.vm.exceptionError || results.vm.exceptionError.error === ERROR.REVERT)) {
10121012
memStore(runState, localOpts.outOffset, results.vm.return, new BN(0), localOpts.outLength, false)
10131013

1014-
if (results.vm.exceptionError && results.vm.exceptionError.error === ERROR.REVERT && runState.opName === 'CREATE') {
1014+
if (results.vm.exceptionError && results.vm.exceptionError.error === ERROR.REVERT && isCreateOpCode(runState.opName)) {
10151015
runState.lastReturned = results.vm.return
10161016
}
10171017

@@ -1049,6 +1049,10 @@ function makeCall (runState, callOptions, localOpts, cb) {
10491049
}
10501050
}
10511051

1052+
function isCreateOpCode (opName) {
1053+
return opName === 'CREATE' || opName === 'CREATE2'
1054+
}
1055+
10521056
function getContractStorage (runState, address, key, cb) {
10531057
if (runState._common.gteHardfork('constantinople')) {
10541058
async.parallel({

lib/runCall.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ module.exports = function (opts, cb) {
221221
var totalGas = results.gasUsed
222222
if (!results.runState.vmError) {
223223
var returnFee = new BN(results.return.length * self._common.param('gasPrices', 'createData'))
224-
225224
totalGas = totalGas.add(returnFee)
226225
}
227226
// if not enough gas

0 commit comments

Comments
 (0)