Commit 8666afc1dd3be42258266197d74744366f739564
Rename gasLimit to gasLeft
Alex Beregszaszi committed on 8/23/2016, 12:22:44 AMParent: e3569511d2b9077dbe811b4eb5ac6e9defaf7184
Files changed
debugInterface.js | changed |
environment.js | changed |
interface.js | changed |
testEnvironment.js | changed |
tests/interface/basic_gas_ops.json | changed |
tests/interface/default_enviroment.json | changed |
debugInterface.js | ||
---|---|---|
@@ -31,9 +31,9 @@ | ||
31 | 31 | const opcode = opcodes(op) |
32 | 32 | if (opcode.number) { |
33 | 33 | opcode.name += opcode.number |
34 | 34 | } |
35 | - console.error(`op: ${opcode.name} gas: ${this.environment.gasLimit}`) | |
35 | + console.error(`op: ${opcode.name} gas: ${this.environment.gasLeft}`) | |
36 | 36 | console.log('-------------stack--------------') |
37 | 37 | for (let i = sp; i >= 0; i -= 32) { |
38 | 38 | console.log(`${(sp - i) / 32} ${this.getMemoryBuffer(i).toString('hex')}`) |
39 | 39 | } |
environment.js | ||
---|---|---|
@@ -10,9 +10,9 @@ | ||
10 | 10 | const defaults = { |
11 | 11 | block: block, |
12 | 12 | // gas tank |
13 | 13 | gasPrice: 0, |
14 | - gasLimit: 1000000, // The gas limit for the block | |
14 | + gasLeft: 1000000, | |
15 | 15 | gasRefund: 0, |
16 | 16 | // call infromation |
17 | 17 | address: new Address('0x0000000000000000000000000000000000000000'), |
18 | 18 | origin: new Address('0x0000000000000000000000000000000000000000'), |
interface.js | ||
---|---|---|
@@ -75,9 +75,9 @@ | ||
75 | 75 | */ |
76 | 76 | getGasLeft () { |
77 | 77 | this.takeGas(2) |
78 | 78 | |
79 | - return this.environment.gasLimit | |
79 | + return this.environment.gasLeft | |
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Gets address of currently executing account and loads it into memory at |
@@ -490,12 +490,12 @@ | ||
490 | 490 | * Takes gas from the tank. Only needs to check if there's gas left to be taken, |
491 | 491 | * because every caller of this method is trusted. |
492 | 492 | */ |
493 | 493 | takeGas (amount) { |
494 | - if (this.environment.gasLimit < amount) { | |
494 | + if (this.environment.gasLeft < amount) { | |
495 | 495 | throw new Error('Ran out of gas') |
496 | 496 | } |
497 | - this.environment.gasLimit -= amount | |
497 | + this.environment.gasLeft -= amount | |
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | 501 | // |
Built with git-ssb-web