|
|
@ -39,24 +39,26 @@ export default class gasCosts implements AnalyzerModule { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
for (const method of methodsWithSignature) { |
|
|
|
for (const method of methodsWithSignature) { |
|
|
|
for (const contractName in compilationResults.contracts[filename]) { |
|
|
|
for (const filename in compilationResults.contracts) { |
|
|
|
const contract = compilationResults.contracts[filename][contractName] |
|
|
|
for (const contractName in compilationResults.contracts[filename]) { |
|
|
|
const methodGas: any = this.checkMethodGas(contract, method.signature) |
|
|
|
const contract = compilationResults.contracts[filename][contractName] |
|
|
|
if(methodGas && methodGas.isInfinite) { |
|
|
|
const methodGas: any = this.checkMethodGas(contract, method.signature) |
|
|
|
if(methodGas.isFallback) { |
|
|
|
if(methodGas && methodGas.isInfinite) { |
|
|
|
report.push({ |
|
|
|
if(methodGas.isFallback) { |
|
|
|
warning: `Fallback function of contract ${contractName} requires too much gas (${methodGas.msg}).
|
|
|
|
report.push({ |
|
|
|
If the fallback function requires more than 2300 gas, the contract cannot receive Ether.` |
|
|
|
warning: `Fallback function of contract ${contractName} requires too much gas (${methodGas.msg}).
|
|
|
|
}) |
|
|
|
If the fallback function requires more than 2300 gas, the contract cannot receive Ether.` |
|
|
|
} else { |
|
|
|
}) |
|
|
|
report.push({ |
|
|
|
} else { |
|
|
|
warning: `Gas requirement of function ${contractName}.${method.name} ${methodGas.msg}.
|
|
|
|
report.push({ |
|
|
|
If the gas requirement of a function is higher than the block gas limit, it cannot be executed. |
|
|
|
warning: `Gas requirement of function ${contractName}.${method.name} ${methodGas.msg}.
|
|
|
|
Please avoid loops in your functions or actions that modify large areas of storage |
|
|
|
If the gas requirement of a function is higher than the block gas limit, it cannot be executed. |
|
|
|
(this includes clearing or copying arrays in storage)` |
|
|
|
Please avoid loops in your functions or actions that modify large areas of storage |
|
|
|
}) |
|
|
|
(this includes clearing or copying arrays in storage)` |
|
|
|
}
|
|
|
|
}) |
|
|
|
} else continue |
|
|
|
}
|
|
|
|
|
|
|
|
} else continue |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return report |
|
|
|
return report |
|
|
|