git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 000f34b577eb112f2692b0c577052f065087f96c

fix sstore

wanderer committed on 8/1/2016, 12:03:15 AM
Parent: 6c97c88b95f43dea4cf265dbbc93e6e3cc5cba97

Files changed

interface.jschanged
interface.jsView
@@ -3,17 +3,15 @@
33 * enables to interact with the Ethereum Environment
44 */
55 const constants = require('./constants.js')
66 // const Graph = require('generic-digraph')
7-
87 // function.bind is not working corretly whith Wasm imports. So instead create
98 // a global for now. TODO REMOVE
109 let ENV
1110 let MOD
1211 // The interface exposed to the WebAessembly Core
1312 module.exports = class Interface {
14-
15- debugPrint (a) {
13+ print (a) {
1614 console.log(a)
1715 }
1816
1917 memPrint () {
@@ -316,9 +314,9 @@
316314 * @param {interger} pathOffest the memory offset to load the the path from
317315 * @param {interger} valueOffset the memory offset to load the value from
318316 */
319317 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')
321319 const value = new Uint8Array(MOD.exports.memory, valueOffset, 32)
322320 const oldValue = ENV.state.get(path)
323321 const valIsZero = value.every((i) => i === 0)
324322
@@ -341,9 +339,9 @@
341339 * @param {interger} pathOffest the memory offset to load the the path from
342340 * @param {interger} resultOffset the memory offset to load the value from
343341 */
344342 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')
346344 const result = ENV.state.get(path)
347345 const memory = new Uint8Array(MOD.exports.memory, resultOffset, 32)
348346 memory.set(result)
349347 }

Built with git-ssb-web