git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 730ac04e07656503bbe553e2c9bf298a7ee53170

set all the block getter's to use the block

wanderer authored on 8/17/2016, 10:26:30 PM
Alex Beregszaszi committed on 8/23/2016, 12:08:55 AM
Parent: 865f135bbd80624eceea4b85923acc13137ffd39

Files changed

environment.jschanged
interface.jschanged
environment.jsView
@@ -10,18 +10,15 @@
1010 const block = new Block()
1111
1212 const defaults = {
1313 block: block,
14- number: ethUtils.bufferToInt(block.header.number),
1514 // gas tank
1615 gasPrice: 0,
1716 gasLimit: 1000000, // The gas limit for the block
1817 gasRefund: 0,
1918 // call infromation
2019 address: new Address('0x0000000000000000000000000000000000000000'),
2120 origin: new Address('0x0000000000000000000000000000000000000000'),
22- coinbase: new Address('0x0000000000000000000000000000000000000000'),
23- difficulty: 0,
2421 caller: new Address('0x0000000000000000000000000000000000000000'),
2522 callValue: new U256(0),
2623 callData: new Uint8Array(),
2724 // the ROM
interface.jsView
@@ -232,9 +232,9 @@
232232 */
233233 getBlockHash (number, offset) {
234234 this.takeGas(20)
235235
236- const diff = this.environment.number - number
236+ const diff = this.environment.block.header.number - number
237237 let hash
238238
239239 if (diff > 256 || diff <= 0) {
240240 hash = new U256(0)
@@ -250,9 +250,9 @@
250250 */
251251 getBlockCoinbase (offset) {
252252 this.takeGas(2)
253253
254- this.setMemory(offset, constants.ADDRESS_SIZE_BYTES, this.environment.coinbase)
254+ this.setMemory(offset, constants.ADDRESS_SIZE_BYTES, this.environment.block.header.coinbase)
255255 }
256256
257257 /**
258258 * Get the block’s timestamp.
@@ -260,9 +260,9 @@
260260 */
261261 getBlockTimestamp () {
262262 this.takeGas(2)
263263
264- return this.environment.timestamp
264+ return this.environment.block.header.timestamp
265265 }
266266
267267 /**
268268 * Get the block’s number.
@@ -270,9 +270,9 @@
270270 */
271271 getBlockNumber () {
272272 this.takeGas(2)
273273
274- return this.environment.number
274+ return this.environment.block.header.number
275275 }
276276
277277 /**
278278 * Get the block’s difficulty.
@@ -280,9 +280,9 @@
280280 */
281281 getBlockDifficulty () {
282282 this.takeGas(2)
283283
284- return this.environment.difficulty
284+ return this.environment.block.header.difficulty
285285 }
286286
287287 /**
288288 * Get the block’s gas limit.
@@ -290,9 +290,9 @@
290290 */
291291 getBlockGasLimit () {
292292 this.takeGas(2)
293293
294- return this.environment.gasLimit
294+ return this.environment.block.header.gasLimit
295295 }
296296
297297 /**
298298 * Creates a new log in the current environment

Built with git-ssb-web