Commit f51dc0dfc7b37b0d369c1f9a552d6ab0e1129055
fix a few bugs in EVMinterface
wanderer committed on 1/26/2017, 11:36:09 PMParent: 92b25513d4a47b5f802137f167db1b71bb72a64b
Files changed
EVMinterface.js | changed |
wasmAgent.js | changed |
wasmDebugAgent.js | changed |
EVMinterface.js | ||
---|---|---|
@@ -120,12 +120,10 @@ | ||
120 | 120 | * @param {integer} offset |
121 | 121 | */ |
122 | 122 | getAddress (offset) { |
123 | 123 | 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')) | |
128 | 126 | } |
129 | 127 | |
130 | 128 | /** |
131 | 129 | * Gets balance of the given account and loads it into memory at the given |
@@ -159,9 +157,9 @@ | ||
159 | 157 | */ |
160 | 158 | getTxOrigin (offset) { |
161 | 159 | this.takeGas(2) |
162 | 160 | |
163 | - const origin = new Buffer(this.message.from[0].slice(2), 'hex') | |
161 | + const origin = new Buffer(this.message.from[1].slice(2), 'hex') | |
164 | 162 | this.setMemory(offset, ADDRESS_SIZE_BYTES, origin) |
165 | 163 | } |
166 | 164 | |
167 | 165 | /** |
wasmAgent.js | ||
---|---|---|
@@ -26,9 +26,9 @@ | ||
26 | 26 | return importMap |
27 | 27 | } |
28 | 28 | |
29 | 29 | let instance |
30 | - const interfaceApi = this.api = { | |
30 | + const interfaceApi = { | |
31 | 31 | /** |
32 | 32 | * adds an aync operation to the operations queue |
33 | 33 | */ |
34 | 34 | pushOpsQueue: (promise, callbackIndex, intefaceCallback) => { |
wasmDebugAgent.js | ||
---|---|---|
@@ -4,9 +4,9 @@ | ||
4 | 4 | /** |
5 | 5 | * Runs the core VM with a given environment and imports |
6 | 6 | */ |
7 | 7 | async run (message, kernel, imports) { |
8 | - const responses = {} | |
8 | + const responses = this.responses = {} | |
9 | 9 | /** |
10 | 10 | * Builds a import map with an array of given interfaces |
11 | 11 | */ |
12 | 12 | async function buildImports (kernelApi, kernel, imports) { |
@@ -21,9 +21,9 @@ | ||
21 | 21 | return importMap |
22 | 22 | } |
23 | 23 | |
24 | 24 | let instance |
25 | - const interfaceApi = { | |
25 | + const interfaceApi = this.api = { | |
26 | 26 | /** |
27 | 27 | * adds an aync operation to the operations queue |
28 | 28 | */ |
29 | 29 | pushOpsQueue: (promise, callbackIndex, intefaceCallback) => { |
Built with git-ssb-web