Skip to content

Commit

Permalink
Merge pull request #454 from ethereumjs/fix/call-id-test
Browse files Browse the repository at this point in the history
Fix longer output than return length in call opcode
  • Loading branch information
holgerd77 authored Feb 26, 2019
2 parents 3a06f0c + 2fab756 commit ea0e29e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/vm/opFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,9 +1047,12 @@ function makeCall (runState, callOptions, localOpts, cb) {
// save results to memory
if (results.vm.return && (!results.vm.exceptionError || results.vm.exceptionError.error === ERROR.REVERT)) {
if (results.vm.return.length > 0) {
const data = getDataSlice(results.vm.return, new BN(0), localOpts.outLength)
const memOffset = localOpts.outOffset.toNumber()
const dataLength = localOpts.outLength.toNumber()
let dataLength = localOpts.outLength.toNumber()
if (results.vm.return.length < dataLength) {
dataLength = results.vm.return.length
}
const data = getDataSlice(results.vm.return, new BN(0), new BN(dataLength))
runState.memory.extend(memOffset, dataLength)
runState.memory.write(memOffset, dataLength, data)
}
Expand Down
1 change: 0 additions & 1 deletion tests/tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const {
} = require('./util')
// tests which should be fixed
const skipBroken = [
'CallIdentity_6_inputShorterThanOutput', // temporary till fixed (2018-11-14)
'ecmul_0-3_5616_28000_96', // temporary till fixed (2018-09-20)
'dynamicAccountOverwriteEmpty' // temporary till fixed (2019-01-30), skipped along constantinopleFix work time constraints
]
Expand Down

0 comments on commit ea0e29e

Please sign in to comment.