Commit 000f34b577eb112f2692b0c577052f065087f96c
fix sstore
wanderer committed on 8/1/2016, 12:03:15 AMParent: 6c97c88b95f43dea4cf265dbbc93e6e3cc5cba97
Files changed
interface.js | changed |
interface.js | ||
---|---|---|
@@ -3,17 +3,15 @@ | ||
3 | 3 | * enables to interact with the Ethereum Environment |
4 | 4 | */ |
5 | 5 | const constants = require('./constants.js') |
6 | 6 | // const Graph = require('generic-digraph') |
7 | - | |
8 | 7 | // function.bind is not working corretly whith Wasm imports. So instead create |
9 | 8 | // a global for now. TODO REMOVE |
10 | 9 | let ENV |
11 | 10 | let MOD |
12 | 11 | // The interface exposed to the WebAessembly Core |
13 | 12 | module.exports = class Interface { |
14 | - | |
15 | - debugPrint (a) { | |
13 | + print (a) { | |
16 | 14 | console.log(a) |
17 | 15 | } |
18 | 16 | |
19 | 17 | memPrint () { |
@@ -316,9 +314,9 @@ | ||
316 | 314 | * @param {interger} pathOffest the memory offset to load the the path from |
317 | 315 | * @param {interger} valueOffset the memory offset to load the value from |
318 | 316 | */ |
319 | 317 | sstore (pathOffest, valueOffset) { |
320 | - const path = new Uint8Array(MOD.exports.memory, pathOffest, 32).join('') | |
318 | + const path = new Buffer(MOD.exports.memory, pathOffest, 32).toString('hex') | |
321 | 319 | const value = new Uint8Array(MOD.exports.memory, valueOffset, 32) |
322 | 320 | const oldValue = ENV.state.get(path) |
323 | 321 | const valIsZero = value.every((i) => i === 0) |
324 | 322 | |
@@ -341,9 +339,9 @@ | ||
341 | 339 | * @param {interger} pathOffest the memory offset to load the the path from |
342 | 340 | * @param {interger} resultOffset the memory offset to load the value from |
343 | 341 | */ |
344 | 342 | sload (pathOffest, resultOffset) { |
345 | - const path = new Uint8Array(MOD.exports.memory, pathOffest, 32).join('') | |
343 | + const path = new Buffer(MOD.exports.memory, pathOffest, 32).toString('hex') | |
346 | 344 | const result = ENV.state.get(path) |
347 | 345 | const memory = new Uint8Array(MOD.exports.memory, resultOffset, 32) |
348 | 346 | memory.set(result) |
349 | 347 | } |
Built with git-ssb-web