Merge pull request #14127 from ethereum/eip-3860

Add warning for EIP-3860 enforced initcode limits
This commit is contained in:
Daniel 2023-04-17 17:42:55 +02:00 committed by GitHub
commit c6aab84a0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 141 additions and 1 deletions

View File

@ -1322,7 +1322,7 @@ void CompilerStack::assemble(
}
// Throw a warning if EIP-170 limits are exceeded:
// If contract creation returns data with length greater than 0x6000 (214 + 213) bytes,
// If contract creation returns data with length greater than 0x6000 (2^14 + 2^13) bytes,
// contract creation fails with an out of gas error.
if (
m_evmVersion >= langutil::EVMVersion::spuriousDragon() &&
@ -1338,6 +1338,24 @@ void CompilerStack::assemble(
"Consider enabling the optimizer (with a low \"runs\" value!), "
"turning off revert strings, or using libraries."
);
// Throw a warning if EIP-3860 limits are exceeded:
// If initcode is larger than 0xC000 bytes (twice the runtime code limit),
// then contract creation fails with an out of gas error.
if (
m_evmVersion >= langutil::EVMVersion::shanghai() &&
compiledContract.object.bytecode.size() > 0xC000
)
m_errorReporter.warning(
3860_error,
_contract.location(),
"Contract initcode size is "s +
to_string(compiledContract.object.bytecode.size()) +
" bytes and exceeds 49152 bytes (a limit introduced in Shanghai). "
"This contract may not be deployable on Mainnet. "
"Consider enabling the optimizer (with a low \"runs\" value!), "
"turning off revert strings, or using libraries."
);
}
void CompilerStack::compileContract(

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long