git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 346aa8e29c19c848a5fa994e486e5bd6f5842c44

check if results exist before writting to mem

wanderer committed on 11/14/2016, 10:44:36 AM
Parent: f85a2907f19ae1a49abac80203e35a39f173123d

Files changed

EVMinterface.jschanged
EVMinterface.jsView
@@ -1,9 +1,8 @@
11 /**
22 * This is the Ethereum interface that is exposed to the WASM instance which
33 * enables to interact with the Ethereum Environment
44 */
5-
65 const fs = require('fs')
76 const path = require('path')
87 const ethUtil = require('ethereumjs-util')
98 const Vertex = require('merkle-trie')
@@ -241,10 +240,12 @@
241240 }
242241
243242 // wait for all the prevouse async ops to finish before running the callback
244243 this.kernel.pushOpsQueue(opPromise, cbIndex, code => {
245- code = code.slice(codeOffset, codeOffset + length)
246- this.setMemory(resultOffset, length, code)
244+ if (code.length) {
245+ code = code.slice(codeOffset, codeOffset + length)
246+ this.setMemory(resultOffset, length, code)
247+ }
247248 })
248249 }
249250
250251 /**
@@ -286,10 +287,12 @@
286287 }
287288
288289 // wait for all the prevouse async ops to finish before running the callback
289290 this.kernel.pushOpsQueue(opPromise, cbIndex, code => {
290- code = code.slice(codeOffset, codeOffset + length)
291- this.setMemory(resultOffset, length, code)
291+ if (code.length) {
292+ code = code.slice(codeOffset, codeOffset + length)
293+ this.setMemory(resultOffset, length, code)
294+ }
292295 })
293296 }
294297
295298 /**
@@ -557,9 +560,8 @@
557560 * @param {interger} pathOffest the memory offset to load the the path from
558561 * @param {interger} valueOffset the memory offset to load the value from
559562 */
560563 storageStore (pathOffset, valueOffset, cbIndex) {
561- console.log('storage store');
562564 this.takeGas(5000)
563565 const path = ['storage', ...this.getMemory(pathOffset, U256_SIZE_BYTES)]
564566 // copy the value
565567 const value = this.getMemory(valueOffset, U256_SIZE_BYTES).slice(0)

Built with git-ssb-web