Skip to content

Commit 1b5775a

Browse files
authored
Merge pull request #14591 from ethereum/old-evm-deprecation-warning
Deprecate support for `byzantium` and older EVM versions
2 parents 1b7652e + 127a390 commit 1b5775a

File tree

28 files changed

+154
-8
lines changed

28 files changed

+154
-8
lines changed

Changelog.md

+1
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

+6-6
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.
@@ -175,7 +175,7 @@ at each version. Backward compatibility is not guaranteed between each version.
175175
- ``paris``
176176
- Introduces ``prevrandao()`` and ``block.prevrandao``, and changes the semantics of the now deprecated ``block.difficulty``, disallowing ``difficulty()`` in inline assembly (see `EIP-4399 <https://eips.ethereum.org/EIPS/eip-4399>`_).
177177
- ``shanghai`` (**default**)
178-
- Smaller code size and gas savings due to the introduction of ``push0`` (see `EIP-3855 <https://eips.ethereum.org/EIPS/eip-3855>`_).
178+
- Smaller code size and gas savings due to the introduction of ``push0`` (see `EIP-3855 <https://eips.ethereum.org/EIPS/eip-3855>`_).
179179

180180
.. index:: ! standard JSON, ! --standard-json
181181
.. _compiler-api:
@@ -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

+6
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

+6
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:

test/cmdlineTests.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ EOF
240240
sed -i.bak -e 's/\(\\"version\\":[ ]*\\"\)[^"\\]*\(\\"\)/\1<VERSION REMOVED>\2/' "$stdout_path"
241241
rm "$stdout_path.bak"
242242
else
243-
sed -i.bak -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
243+
sed -i.bak -e '/^Warning: This is a pre-release compiler version, please do not use it in production./,+1d' "$stderr_path"
244244
sed -i.bak -e '/^Compiler run successful, no output requested\.$/d' "$stderr_path"
245-
sed -i.bak -e '/^Warning (3805): This is a pre-release compiler version, please do not use it in production./d' "$stderr_path"
245+
sed -i.bak -e '/^Warning (3805): This is a pre-release compiler version, please do not use it in production./,+1d' "$stderr_path"
246246
sed -i.bak -e 's/\(^[ ]*auxdata: \)0x[0-9a-f]*$/\1<AUXDATA REMOVED>/' "$stdout_path"
247247
sed -i.bak -e 's/ Consider adding "pragma .*$//' "$stderr_path"
248248
sed -i.bak -e 's/\(Unimplemented feature error.* in \).*$/\1<FILENAME REMOVED>/' "$stderr_path"
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!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--evm-version byzantium
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// SPDX-License-Identifier: GPL-3.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--evm-version constantinople
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// SPDX-License-Identifier: GPL-3.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"language": "Solidity",
3+
"sources": {
4+
"input.sol": {"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
5+
},
6+
"settings": {
7+
"evmVersion": "byzantium"
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"errors":
3+
[
4+
{
5+
"component": "general",
6+
"formattedMessage": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
7+
"message": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
8+
"severity": "warning",
9+
"type": "Warning"
10+
}
11+
],
12+
"sources":
13+
{
14+
"input.sol":
15+
{
16+
"id": 0
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"language": "Solidity",
3+
"sources": {
4+
"input.sol": {"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
5+
},
6+
"settings": {
7+
"evmVersion": "constantinople"
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"sources":
3+
{
4+
"input.sol":
5+
{
6+
"id": 0
7+
}
8+
}
9+
}

test/cmdlineTests/standard_missing_key_useLiteralContent/output.json

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
2+
"errors":
3+
[
4+
{
5+
"component": "general",
6+
"formattedMessage": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
7+
"message": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
8+
"severity": "warning",
9+
"type": "Warning"
10+
}
11+
],
212
"sources":
313
{
414
"A":
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"language": "Yul",
3+
"sources": {
4+
"input.yul": {"content": "{}"}
5+
},
6+
"settings": {
7+
"evmVersion": "byzantium"
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"errors":
3+
[
4+
{
5+
"component": "general",
6+
"formattedMessage": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
7+
"message": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
8+
"severity": "warning",
9+
"type": "Warning"
10+
}
11+
]
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"language": "Yul",
3+
"sources": {
4+
"input.yul": {"content": "{}"}
5+
},
6+
"settings": {
7+
"evmVersion": "constantinople"
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--strict-assembly --evm-version byzantium
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Warning: Support for EVM versions older than constantinople is deprecated and will be removed in the future.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
======= strict_asm_evm_version_byzantium/input.yul (EVM) =======
3+
4+
Pretty printed source:
5+
object "object" {
6+
code { { } }
7+
}
8+
9+
10+
Binary representation:
11+
00
12+
13+
Text representation:
14+
/* "strict_asm_evm_version_byzantium/input.yul":0:2 */
15+
stop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--strict-assembly --evm-version constantinople
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
======= strict_asm_evm_version_constantinople/input.yul (EVM) =======
3+
4+
Pretty printed source:
5+
object "object" {
6+
code { { } }
7+
}
8+
9+
10+
Binary representation:
11+
00
12+
13+
Text representation:
14+
/* "strict_asm_evm_version_constantinople/input.yul":0:2 */
15+
stop

0 commit comments

Comments
 (0)