Commit 1cb861903ccb26cbd39eaad7ab6060463380986e
Environment: use Uint8Array and not ArrayBuffer
Alex Beregszaszi committed on 8/13/2016, 2:53:15 AMParent: b09ae9b9bed2be0a68c73659b7f9b4befa8a5c8b
Files changed
environment.js | changed |
interface.js | changed |
environment.js | ||
---|---|---|
@@ -14,16 +14,16 @@ | ||
14 | 14 | coinbase: new Uint8Array(constants.ADDRESS_SIZE_BYTES), |
15 | 15 | difficulty: 0, |
16 | 16 | caller: new Uint8Array(constants.ADDRESS_SIZE_BYTES), |
17 | 17 | callValue: new U256(0), |
18 | - callData: new ArrayBuffer(), | |
18 | + callData: new Uint8Array(), | |
19 | 19 | // the ROM |
20 | - code: new ArrayBuffer(), // the current running code | |
20 | + code: new Uint8Array(), // the current running code | |
21 | 21 | // output calls |
22 | 22 | logs: [], |
23 | - selfDestructAddress: new ArrayBuffer(), | |
23 | + selfDestructAddress: new Uint8Array(constants.ADDRESS_SIZE_BYTES), | |
24 | 24 | // more output calls |
25 | - returnValue: new ArrayBuffer() | |
25 | + returnValue: new Uint8Array() | |
26 | 26 | } |
27 | 27 | |
28 | 28 | const self = this |
29 | 29 | this.state = new Map() |
interface.js | ||
---|---|---|
@@ -135,9 +135,9 @@ | ||
135 | 135 | * data passed with the message call instruction or transaction. |
136 | 136 | * @return {integer} |
137 | 137 | */ |
138 | 138 | callDataSize () { |
139 | - return this.environment.callData.byteLength | |
139 | + return this.environment.callData.length | |
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | 143 | * Copys the input data in current environment to memory. This pertains to |
@@ -155,9 +155,9 @@ | ||
155 | 155 | * Gets the size of code running in current environment. |
156 | 156 | * @return {interger} |
157 | 157 | */ |
158 | 158 | codeSize () { |
159 | - return this.environment.code.byteLength | |
159 | + return this.environment.code.length | |
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Copys the code running in current environment to memory. |
@@ -177,9 +177,9 @@ | ||
177 | 177 | */ |
178 | 178 | extCodeSize (addressOffset) { |
179 | 179 | const address = this.getMemory(addressOffset, constants.ADDRESS_SIZE_BYTES) |
180 | 180 | const code = this.environment.getCode(address) |
181 | - return code.byteLength | |
181 | + return code.length | |
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Copys the code of an account to memory. |
Built with git-ssb-web