Merge pull request #8008 from ethereum/large-code

Issue warning if codesize exceeds EIP-170 limits
This commit is contained in:
chriseth authored and GitHub committed 2020-01-08 09:48:59 +01:00
commit d1a7ff0fbc
3 files changed
+26 -1

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ Language Features:
Compiler Features:
* General: Raise warning if runtime bytecode exceeds 24576 bytes (a limit introduced in Spurious Dragon).
Bugfixes:
+15
View File
@@ -1049,6 +1049,21 @@ void CompilerStack::compileContract(
solAssert(false, "Assembly exception for deployed bytecode");
}
// Throw a warning if EIP-170 limits are exceeded:
// If contract creation initialization returns data with length of more than 0x6000 (214 + 213) bytes,
// contract creation fails with an out of gas error.
if (
m_evmVersion >= langutil::EVMVersion::spuriousDragon() &&
compiledContract.runtimeObject.bytecode.size() > 0x6000
)
m_errorReporter.warning(
_contract.location(),
"Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). "
"This contract may not be deployable on mainnet. "
"Consider enabling the optimizer (with a low \"runs\" value!), "
"turning off revert strings, or using libraries."
);
_otherCompilers[compiledContract.contract] = compiler;
}
@@ -0,0 +1,10 @@
contract test {
function f() public pure returns (string memory ret) {
// 27000 bytes long data
ret = "........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Line truncated
}
}
// ====
// EVMVersion: >=spuriousDragon
// ----
// Warning: (0-27133): Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.