Skip to content

Commit 9f2a7ed

Browse files
authored
Merge pull request ethereumjs#282 from seesemichaelj/ignore-eip-170
Add option to ignore EIP 170 for debugging purposes
2 parents 9bc99c3 + ad20751 commit 9f2a7ed

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Creates a new VM object
6060
- `state` - A merkle-patricia-tree instance for the state tree (ignored if `stateManager` is passed)
6161
- `blockchain` - A blockchain object for storing/retrieving blocks (ignored if `stateManager` is passed)
6262
- `activatePrecompiles` - Create entries in the state tree for the precompiled contracts
63+
- `allowUnlimitedContractSize` - Allows unlimited contract sizes while debugging. By setting this to `true`, the check for contract size limit of 2KB (see [EIP-170](https://git.io/vxZkK)) is bypassed. (default: `false`; **ONLY** set to `true` during debugging).
6364

6465
### `VM` methods
6566

lib/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ VM.deps = {
3232
* @param {Trie} [opts.state] A merkle-patricia-tree instance for the state tree (ignored if stateManager is passed)
3333
* @param {Blockchain} [opts.blockchain] A blockchain object for storing/retrieving blocks (ignored if stateManager is passed)
3434
* @param {Boolean} [opts.activatePrecompiles] Create entries in the state tree for the precompiled contracts
35+
* @param {Boolean} [opts.allowUnlimitedContractSize] Allows unlimited contract sizes while debugging (default: false; ONLY use during debugging)
3536
*/
3637
function VM (opts = {}) {
3738
this.opts = opts
@@ -45,6 +46,8 @@ function VM (opts = {}) {
4546
})
4647
}
4748

49+
this.allowUnlimitedContractSize = opts.allowUnlimitedContractSize === undefined ? false : opts.allowUnlimitedContractSize
50+
4851
// temporary
4952
// this is here for a gradual transition to StateManager
5053
this.blockchain = this.stateManager.blockchain

lib/runCall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ module.exports = function (opts, cb) {
164164
totalGas = totalGas.add(returnFee)
165165
}
166166
// if not enough gas
167-
if (totalGas.lte(gasLimit) && results.return.length <= 24576) {
167+
if (totalGas.lte(gasLimit) && (self.allowUnlimitedContractSize || results.return.length <= 24576)) {
168168
results.gasUsed = totalGas
169169
} else {
170170
results.return = Buffer.alloc(0)

0 commit comments

Comments
 (0)