interface.jsView |
---|
172 | 172 | */ |
173 | 173 | callDataCopy256 (offset, dataOffset) { |
174 | 174 | this.takeGas(3) |
175 | 175 | const callData = this.environment.callData.slice(dataOffset, dataOffset + 32) |
176 | | - this.setMemory(offset, 32, callData) |
| 176 | + this.setMemory(offset, constants.U256_SIZE_BYTES, callData) |
177 | 177 | } |
178 | 178 | |
179 | 179 | |
180 | 180 | * Gets the size of code running in current environment. |
253 | 253 | hash = new U256(0) |
254 | 254 | } else { |
255 | 255 | hash = new U256(this.environment.getBlockHash(number)) |
256 | 256 | } |
257 | | - this.setMemory(offset, 32, hash.toMemory()) |
| 257 | + this.setMemory(offset, constants.U256_SIZE_BYTES, hash.toMemory()) |
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | 261 | * Gets the block’s beneficiary address and loads into memory. |
293 | 293 | */ |
294 | 294 | getBlockDifficulty (offset) { |
295 | 295 | this.takeGas(2) |
296 | 296 | |
297 | | - this.setMemory(offset, 32, this.environment.block.difficulty.toMemory()) |
| 297 | + this.setMemory(offset, constants.U256_SIZE_BYTES, this.environment.block.difficulty.toMemory()) |
298 | 298 | } |
299 | 299 | |
300 | 300 | |
301 | 301 | * Get the block’s gas limit. |
418 | 418 | * @param {interger} pathOffest the memory offset to load the the path from |
419 | 419 | * @param {interger} valueOffset the memory offset to load the value from |
420 | 420 | */ |
421 | 421 | storageStore (pathOffset, valueOffset) { |
422 | | - const path = new Buffer(this.getMemory(pathOffset, 32)).toString('hex') |
| 422 | + const path = new Buffer(this.getMemory(pathOffset, constants.U256_SIZE_BYTES)).toString('hex') |
423 | 423 | |
424 | | - const value = this.getMemory(valueOffset, 32).slice(0) |
| 424 | + const value = this.getMemory(valueOffset, constants.U256_SIZE_BYTES).slice(0) |
425 | 425 | const oldValue = this.environment.state.get(path) |
426 | 426 | const valIsZero = value.every((i) => i === 0) |
427 | 427 | |
428 | 428 | this.takeGas(5000) |
448 | 448 | */ |
449 | 449 | storageLoad (pathOffset, resultOffset) { |
450 | 450 | this.takeGas(50) |
451 | 451 | |
452 | | - const path = new Buffer(this.getMemory(pathOffset, 32)).toString('hex') |
| 452 | + const path = new Buffer(this.getMemory(pathOffset, constants.U256_SIZE_BYTES)).toString('hex') |
453 | 453 | const result = this.environment.state.get(path) |
454 | | - this.setMemory(resultOffset, 32, result) |
| 454 | + this.setMemory(resultOffset, constants.U256_SIZE_BYTES, result) |
455 | 455 | } |
456 | 456 | |
457 | 457 | |
458 | 458 | * Halt execution returning output data. |