mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Issue warning if codesize exceeds EIP-170 limits
This commit is contained in:
parent
07a56625e4
commit
4d791b2679
@ -4,7 +4,7 @@ Language Features:
|
|||||||
|
|
||||||
|
|
||||||
Compiler Features:
|
Compiler Features:
|
||||||
|
* General: Raise warning if runtime bytecode exceeds 24576 bytes (a limit introduced in Spurious Dragon).
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
||||||
|
@ -1046,6 +1046,21 @@ void CompilerStack::compileContract(
|
|||||||
solAssert(false, "Assembly exception for deployed bytecode");
|
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;
|
_otherCompilers[compiledContract.contract] = compiler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
test/libsolidity/syntaxTests/bytecode_too_large.sol
Normal file
10
test/libsolidity/syntaxTests/bytecode_too_large.sol
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user