git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 92b25513d4a47b5f802137f167db1b71bb72a64b

fix the interface

wanderer committed on 1/26/2017, 6:03:09 PM
Parent: b4f2286715e5d94ee25ada50027f1690079cca1b

Files changed

EVMinterface.jschanged
index.jschanged
EVMinterface.jsView
@@ -159,9 +159,10 @@
159159 */
160160 getTxOrigin (offset) {
161161 this.takeGas(2)
162162
163- this.setMemory(offset, ADDRESS_SIZE_BYTES, this.message.origin.toMemory())
163+ const origin = new Buffer(this.message.from[0].slice(2), 'hex')
164+ this.setMemory(offset, ADDRESS_SIZE_BYTES, origin)
164165 }
165166
166167 /**
167168 * Gets caller address and loads it into memory at the given offset. This is
@@ -232,9 +233,9 @@
232233 getCodeSize (cbIndex) {
233234 this.takeGas(2)
234235
235236 // wait for all the prevouse async ops to finish before running the callback
236- this.kernel.pushOpsQueue(this.kernel.code.length, cbIndex, length => length)
237+ this.api.pushOpsQueue(this.kernel.code.length, cbIndex, length => length)
237238 }
238239
239240 /**
240241 * Copys the code running in current environment to memory.
@@ -245,9 +246,10 @@
245246 codeCopy (resultOffset, codeOffset, length, cbIndex) {
246247 this.takeGas(3 + Math.ceil(length / 32) * 3)
247248
248249 // wait for all the prevouse async ops to finish before running the callback
249- this.kernel.pushOpsQueue(this.kernel.code, cbIndex, code => {
250+ // console.log(this.kernel)
251+ this.api.pushOpsQueue(this.kernel.code, cbIndex, code => {
250252 if (code.length) {
251253 code = code.slice(codeOffset, codeOffset + length)
252254 this.setMemory(resultOffset, length, code)
253255 }
@@ -266,9 +268,9 @@
266268 .then(vertex => vertex.value.length)
267269 .catch(() => 0)
268270
269271 // wait for all the prevouse async ops to finish before running the callback
270- this.kernel.pushOpsQueue(opPromise, cbOffset, length => length)
272+ this.api.pushOpsQueue(opPromise, cbOffset, length => length)
271273 }
272274
273275 /**
274276 * Copys the code of an account to memory.
@@ -292,9 +294,9 @@
292294 opPromise = Promise.resolve([])
293295 }
294296
295297 // wait for all the prevouse async ops to finish before running the callback
296- this.kernel.pushOpsQueue(opPromise, cbIndex, code => {
298+ this.api.pushOpsQueue(opPromise, cbIndex, code => {
297299 if (code.length) {
298300 code = code.slice(codeOffset, codeOffset + length)
299301 this.setMemory(resultOffset, length, code)
300302 }
@@ -328,9 +330,9 @@
328330 opPromise = this.state.get(['blockchain', number]).then(vertex => vertex.hash())
329331 }
330332
331333 // wait for all the prevouse async ops to finish before running the callback
332- this.kernel.pushOpsQueue(opPromise, cbOffset, hash => {
334+ this.api.pushOpsQueue(opPromise, cbOffset, hash => {
333335 this.setMemory(offset, U256_SIZE_BYTES, hash.toMemory())
334336 })
335337 }
336338
@@ -447,9 +449,9 @@
447449 opPromise = Promise.resolve(ethUtil.generateAddress(this.kernel.environment.address, this.kernel.environment.nonce))
448450 }
449451
450452 // wait for all the prevouse async ops to finish before running the callback
451- this.kernel.pushOpsQueue(opPromise, cbIndex, address => {
453+ this.api.pushOpsQueue(opPromise, cbIndex, address => {
452454 this.setMemory(resultOffset, ADDRESS_SIZE_BYTES, address)
453455 })
454456 }
455457
index.jsView
@@ -28,9 +28,8 @@
2828 // if (!result.execption) {
2929 // // update the state
3030 // this.state.set([], state)
3131 // }
32- //
3332 message.finished()
3433 return result
3534 }
3635

Built with git-ssb-web