Commit 346aa8e29c19c848a5fa994e486e5bd6f5842c44
check if results exist before writting to mem
wanderer committed on 11/14/2016, 10:44:36 AMParent: f85a2907f19ae1a49abac80203e35a39f173123d
Files changed
EVMinterface.js | changed |
EVMinterface.js | ||
---|---|---|
@@ -1,9 +1,8 @@ | ||
1 | 1 | /** |
2 | 2 | * This is the Ethereum interface that is exposed to the WASM instance which |
3 | 3 | * enables to interact with the Ethereum Environment |
4 | 4 | */ |
5 | - | |
6 | 5 | const fs = require('fs') |
7 | 6 | const path = require('path') |
8 | 7 | const ethUtil = require('ethereumjs-util') |
9 | 8 | const Vertex = require('merkle-trie') |
@@ -241,10 +240,12 @@ | ||
241 | 240 | } |
242 | 241 | |
243 | 242 | // wait for all the prevouse async ops to finish before running the callback |
244 | 243 | 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 | + } | |
247 | 248 | }) |
248 | 249 | } |
249 | 250 | |
250 | 251 | /** |
@@ -286,10 +287,12 @@ | ||
286 | 287 | } |
287 | 288 | |
288 | 289 | // wait for all the prevouse async ops to finish before running the callback |
289 | 290 | 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 | + } | |
292 | 295 | }) |
293 | 296 | } |
294 | 297 | |
295 | 298 | /** |
@@ -557,9 +560,8 @@ | ||
557 | 560 | * @param {interger} pathOffest the memory offset to load the the path from |
558 | 561 | * @param {interger} valueOffset the memory offset to load the value from |
559 | 562 | */ |
560 | 563 | storageStore (pathOffset, valueOffset, cbIndex) { |
561 | - console.log('storage store'); | |
562 | 564 | this.takeGas(5000) |
563 | 565 | const path = ['storage', ...this.getMemory(pathOffset, U256_SIZE_BYTES)] |
564 | 566 | // copy the value |
565 | 567 | const value = this.getMemory(valueOffset, U256_SIZE_BYTES).slice(0) |
Built with git-ssb-web