git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit f51dc0dfc7b37b0d369c1f9a552d6ab0e1129055

fix a few bugs in EVMinterface

wanderer committed on 1/26/2017, 11:36:09 PM
Parent: 92b25513d4a47b5f802137f167db1b71bb72a64b

Files changed

EVMinterface.jschanged
wasmAgent.jschanged
wasmDebugAgent.jschanged
EVMinterface.jsView
@@ -120,12 +120,10 @@
120120 * @param {integer} offset
121121 */
122122 getAddress (offset) {
123123 this.takeGas(2)
124- const path = this.message.to
125- path.pop()
126- const address = path.pop()
127- this.setMemory(offset, ADDRESS_SIZE_BYTES, new Buffer(address.slice(2), 'hex'))
124+ const path = this.kernel.path
125+ this.setMemory(offset, ADDRESS_SIZE_BYTES, new Buffer(path[1].slice(2), 'hex'))
128126 }
129127
130128 /**
131129 * Gets balance of the given account and loads it into memory at the given
@@ -159,9 +157,9 @@
159157 */
160158 getTxOrigin (offset) {
161159 this.takeGas(2)
162160
163- const origin = new Buffer(this.message.from[0].slice(2), 'hex')
161+ const origin = new Buffer(this.message.from[1].slice(2), 'hex')
164162 this.setMemory(offset, ADDRESS_SIZE_BYTES, origin)
165163 }
166164
167165 /**
wasmAgent.jsView
@@ -26,9 +26,9 @@
2626 return importMap
2727 }
2828
2929 let instance
30- const interfaceApi = this.api = {
30+ const interfaceApi = {
3131 /**
3232 * adds an aync operation to the operations queue
3333 */
3434 pushOpsQueue: (promise, callbackIndex, intefaceCallback) => {
wasmDebugAgent.jsView
@@ -4,9 +4,9 @@
44 /**
55 * Runs the core VM with a given environment and imports
66 */
77 async run (message, kernel, imports) {
8- const responses = {}
8+ const responses = this.responses = {}
99 /**
1010 * Builds a import map with an array of given interfaces
1111 */
1212 async function buildImports (kernelApi, kernel, imports) {
@@ -21,9 +21,9 @@
2121 return importMap
2222 }
2323
2424 let instance
25- const interfaceApi = {
25+ const interfaceApi = this.api = {
2626 /**
2727 * adds an aync operation to the operations queue
2828 */
2929 pushOpsQueue: (promise, callbackIndex, intefaceCallback) => {

Built with git-ssb-web