git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 1cb861903ccb26cbd39eaad7ab6060463380986e

Environment: use Uint8Array and not ArrayBuffer

Alex Beregszaszi committed on 8/13/2016, 2:53:15 AM
Parent: b09ae9b9bed2be0a68c73659b7f9b4befa8a5c8b

Files changed

environment.jschanged
interface.jschanged
environment.jsView
@@ -14,16 +14,16 @@
1414 coinbase: new Uint8Array(constants.ADDRESS_SIZE_BYTES),
1515 difficulty: 0,
1616 caller: new Uint8Array(constants.ADDRESS_SIZE_BYTES),
1717 callValue: new U256(0),
18- callData: new ArrayBuffer(),
18+ callData: new Uint8Array(),
1919 // the ROM
20- code: new ArrayBuffer(), // the current running code
20+ code: new Uint8Array(), // the current running code
2121 // output calls
2222 logs: [],
23- selfDestructAddress: new ArrayBuffer(),
23+ selfDestructAddress: new Uint8Array(constants.ADDRESS_SIZE_BYTES),
2424 // more output calls
25- returnValue: new ArrayBuffer()
25+ returnValue: new Uint8Array()
2626 }
2727
2828 const self = this
2929 this.state = new Map()
interface.jsView
@@ -135,9 +135,9 @@
135135 * data passed with the message call instruction or transaction.
136136 * @return {integer}
137137 */
138138 callDataSize () {
139- return this.environment.callData.byteLength
139+ return this.environment.callData.length
140140 }
141141
142142 /**
143143 * Copys the input data in current environment to memory. This pertains to
@@ -155,9 +155,9 @@
155155 * Gets the size of code running in current environment.
156156 * @return {interger}
157157 */
158158 codeSize () {
159- return this.environment.code.byteLength
159+ return this.environment.code.length
160160 }
161161
162162 /**
163163 * Copys the code running in current environment to memory.
@@ -177,9 +177,9 @@
177177 */
178178 extCodeSize (addressOffset) {
179179 const address = this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES)
180180 const code = this.environment.getCode(address)
181- return code.byteLength
181+ return code.length
182182 }
183183
184184 /**
185185 * Copys the code of an account to memory.

Built with git-ssb-web