Skip to content

Commit

Permalink
vm > spuriousDragon: added allowed Code size check to EVM message exe…
Browse files Browse the repository at this point in the history
…cution
  • Loading branch information
holgerd77 committed Jun 25, 2020
1 parent 7af8dd1 commit 7ccb6c3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/vm/lib/evm/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,19 @@ export default class EVM {
totalGas = totalGas.add(returnFee)
}

// if not enough gas
// Check for SpuriousDragon EIP-170 code size limit
const codeSizeLimit = 24576 // 0x600
let allowedCodeSize = true
if (
this._vm._common.gteHardfork('spuriousDragon') &&
result.returnValue.length > codeSizeLimit
) {
allowedCodeSize = false
}
// If enough gas and allowed code size
if (
totalGas.lte(message.gasLimit) &&
(this._vm.allowUnlimitedContractSize || result.returnValue.length <= 24576)
(this._vm.allowUnlimitedContractSize || allowedCodeSize)
) {
result.gasUsed = totalGas
} else {
Expand Down

0 comments on commit 7ccb6c3

Please sign in to comment.