diff --git a/src/web3Provider/web3VmProvider.js b/src/web3Provider/web3VmProvider.js index 0aef043d66..e1f23d4a86 100644 --- a/src/web3Provider/web3VmProvider.js +++ b/src/web3Provider/web3VmProvider.js @@ -212,8 +212,13 @@ function getSha3Input (stack, memory) { memoryStart = parseInt(memStartDec) * 2 var memLengthDec = (new ethutil.BN(memoryLength.replace('0x', ''), 16).toString(10)) memoryLength = parseInt(memLengthDec) * 2 - var memoryHex = memory.join('') - var sha3Input = memoryHex.substr(memoryStart, memoryLength) + + var subMemoryIndex = Math.floor(memoryStart / 32) + var sha3Input = '' + while (sha3Input.length < memoryLength) { + sha3Input += memory[subMemoryIndex] + subMemoryIndex++ + } return sha3Input }