Commit 92b25513d4a47b5f802137f167db1b71bb72a64b
fix the interface
wanderer committed on 1/26/2017, 6:03:09 PMParent: b4f2286715e5d94ee25ada50027f1690079cca1b
Files changed
EVMinterface.js | changed |
index.js | changed |
EVMinterface.js | ||
---|---|---|
@@ -159,9 +159,10 @@ | ||
159 | 159 | */ |
160 | 160 | getTxOrigin (offset) { |
161 | 161 | this.takeGas(2) |
162 | 162 | |
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) | |
164 | 165 | } |
165 | 166 | |
166 | 167 | /** |
167 | 168 | * Gets caller address and loads it into memory at the given offset. This is |
@@ -232,9 +233,9 @@ | ||
232 | 233 | getCodeSize (cbIndex) { |
233 | 234 | this.takeGas(2) |
234 | 235 | |
235 | 236 | // 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) | |
237 | 238 | } |
238 | 239 | |
239 | 240 | /** |
240 | 241 | * Copys the code running in current environment to memory. |
@@ -245,9 +246,10 @@ | ||
245 | 246 | codeCopy (resultOffset, codeOffset, length, cbIndex) { |
246 | 247 | this.takeGas(3 + Math.ceil(length / 32) * 3) |
247 | 248 | |
248 | 249 | // 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 => { | |
250 | 252 | if (code.length) { |
251 | 253 | code = code.slice(codeOffset, codeOffset + length) |
252 | 254 | this.setMemory(resultOffset, length, code) |
253 | 255 | } |
@@ -266,9 +268,9 @@ | ||
266 | 268 | .then(vertex => vertex.value.length) |
267 | 269 | .catch(() => 0) |
268 | 270 | |
269 | 271 | // 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) | |
271 | 273 | } |
272 | 274 | |
273 | 275 | /** |
274 | 276 | * Copys the code of an account to memory. |
@@ -292,9 +294,9 @@ | ||
292 | 294 | opPromise = Promise.resolve([]) |
293 | 295 | } |
294 | 296 | |
295 | 297 | // 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 => { | |
297 | 299 | if (code.length) { |
298 | 300 | code = code.slice(codeOffset, codeOffset + length) |
299 | 301 | this.setMemory(resultOffset, length, code) |
300 | 302 | } |
@@ -328,9 +330,9 @@ | ||
328 | 330 | opPromise = this.state.get(['blockchain', number]).then(vertex => vertex.hash()) |
329 | 331 | } |
330 | 332 | |
331 | 333 | // 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 => { | |
333 | 335 | this.setMemory(offset, U256_SIZE_BYTES, hash.toMemory()) |
334 | 336 | }) |
335 | 337 | } |
336 | 338 | |
@@ -447,9 +449,9 @@ | ||
447 | 449 | opPromise = Promise.resolve(ethUtil.generateAddress(this.kernel.environment.address, this.kernel.environment.nonce)) |
448 | 450 | } |
449 | 451 | |
450 | 452 | // 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 => { | |
452 | 454 | this.setMemory(resultOffset, ADDRESS_SIZE_BYTES, address) |
453 | 455 | }) |
454 | 456 | } |
455 | 457 |
Built with git-ssb-web