mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add warning for EIP-3860 enforced initcode limits
This commit is contained in:
parent
f0c0df2d8c
commit
3edcfce478
@ -1322,7 +1322,7 @@ void CompilerStack::assemble(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Throw a warning if EIP-170 limits are exceeded:
|
// 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.
|
// contract creation fails with an out of gas error.
|
||||||
if (
|
if (
|
||||||
m_evmVersion >= langutil::EVMVersion::spuriousDragon() &&
|
m_evmVersion >= langutil::EVMVersion::spuriousDragon() &&
|
||||||
@ -1338,6 +1338,24 @@ void CompilerStack::assemble(
|
|||||||
"Consider enabling the optimizer (with a low \"runs\" value!), "
|
"Consider enabling the optimizer (with a low \"runs\" value!), "
|
||||||
"turning off revert strings, or using libraries."
|
"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(
|
void CompilerStack::compileContract(
|
||||||
|
Loading…
Reference in New Issue
Block a user