Skip to content

Commit 2f01aa3

Browse files
committed
Issue a deprecation warning for byzantium and older EVM versions
1 parent f0f2393 commit 2f01aa3

File tree

27 files changed

+151
-5
lines changed

27 files changed

+151
-5
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Language Features:
77
Compiler Features:
88
* Commandline Interface: Add ``--no-import-callback`` option that prevents the compiler from loading source files not given explicitly on the CLI or in Standard JSON input.
99
* Commandline Interface: Use proper severity and coloring also for error messages produced outside of the compilation pipeline.
10+
* EVM: Deprecate support for "homestead", "tangerineWhistle", "spuriousDragon" and "byzantium" EVM versions.
1011
* Parser: Remove the experimental error recovery mode (``--error-recovery`` / ``settings.parserErrorRecovery``).
1112
* SMTChecker: Support user-defined operators.
1213
* Yul Optimizer: If ``PUSH0`` is supported, favor zero literals over storing zero values in variables.

docs/using-the-compiler.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ Target Options
147147
Below is a list of target EVM versions and the compiler-relevant changes introduced
148148
at each version. Backward compatibility is not guaranteed between each version.
149149

150-
- ``homestead``
150+
- ``homestead`` (*support deprecated*)
151151
- (oldest version)
152-
- ``tangerineWhistle``
152+
- ``tangerineWhistle`` (*support deprecated*)
153153
- Gas cost for access to other accounts increased, relevant for gas estimation and the optimizer.
154154
- All gas sent by default for external calls, previously a certain amount had to be retained.
155-
- ``spuriousDragon``
155+
- ``spuriousDragon`` (*support deprecated*)
156156
- Gas cost for the ``exp`` opcode increased, relevant for gas estimation and the optimizer.
157-
- ``byzantium``
157+
- ``byzantium`` (*support deprecated*)
158158
- Opcodes ``returndatacopy``, ``returndatasize`` and ``staticcall`` are available in assembly.
159159
- The ``staticcall`` opcode is used when calling non-library view or pure functions, which prevents the functions from modifying state at the EVM level, i.e., even applies when you use invalid type conversions.
160160
- It is possible to access dynamic data returned from function calls.
@@ -318,7 +318,7 @@ Input Description
318318
// Affects type checking and code generation. Can be homestead,
319319
// tangerineWhistle, spuriousDragon, byzantium, constantinople,
320320
// petersburg, istanbul, berlin, london, paris or shanghai (default)
321-
"evmVersion": "byzantium",
321+
"evmVersion": "shanghai",
322322
// Optional: Change compilation pipeline to go through the Yul intermediate representation.
323323
// This is false by default.
324324
"viaIR": true,

libsolidity/interface/StandardCompiler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,12 @@ std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler:
787787
std::optional<langutil::EVMVersion> version = langutil::EVMVersion::fromString(settings["evmVersion"].asString());
788788
if (!version)
789789
return formatFatalError(Error::Type::JSONError, "Invalid EVM version requested.");
790+
if (version < EVMVersion::constantinople())
791+
ret.errors.append(formatError(
792+
Error::Type::Warning,
793+
"general",
794+
"Support for EVM versions older than constantinople is deprecated and will be removed in the future."
795+
));
790796
ret.evmVersion = *version;
791797
}
792798

solc/CommandLineInterface.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,12 @@ bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)
681681

682682
void CommandLineInterface::processInput()
683683
{
684+
if (m_options.output.evmVersion < EVMVersion::constantinople())
685+
report(
686+
Error::Severity::Warning,
687+
"Support for EVM versions older than constantinople is deprecated and will be removed in the future."
688+
);
689+
684690
switch (m_options.input.mode)
685691
{
686692
case InputMode::Help:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
Warning: Support for EVM versions older than constantinople is deprecated and will be removed in the future.
12
Error: Failed to import AST: Imported tree evm version differs from configured evm version!
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--evm-version byzantium
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Warning: Support for EVM versions older than constantinople is deprecated and will be removed in the future.
2+
Warning: Source file does not specify required compiler version!
3+
--> evm_version_byzantium/input.sol
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// SPDX-License-Identifier: GPL-3.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--evm-version constantinople
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Warning: Source file does not specify required compiler version!
2+
--> evm_version_constantinople/input.sol

0 commit comments

Comments
 (0)