Skip to content

Commit

Permalink
Issue a deprecation warning for byzantium and older EVM versions
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Oct 23, 2023
1 parent f0f2393 commit 2f01aa3
Show file tree
Hide file tree
Showing 27 changed files with 151 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Language Features:
Compiler Features:
* 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.
* Commandline Interface: Use proper severity and coloring also for error messages produced outside of the compilation pipeline.
* EVM: Deprecate support for "homestead", "tangerineWhistle", "spuriousDragon" and "byzantium" EVM versions.
* Parser: Remove the experimental error recovery mode (``--error-recovery`` / ``settings.parserErrorRecovery``).
* SMTChecker: Support user-defined operators.
* Yul Optimizer: If ``PUSH0`` is supported, favor zero literals over storing zero values in variables.
Expand Down
10 changes: 5 additions & 5 deletions docs/using-the-compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ Target Options
Below is a list of target EVM versions and the compiler-relevant changes introduced
at each version. Backward compatibility is not guaranteed between each version.

- ``homestead``
- ``homestead`` (*support deprecated*)
- (oldest version)
- ``tangerineWhistle``
- ``tangerineWhistle`` (*support deprecated*)
- Gas cost for access to other accounts increased, relevant for gas estimation and the optimizer.
- All gas sent by default for external calls, previously a certain amount had to be retained.
- ``spuriousDragon``
- ``spuriousDragon`` (*support deprecated*)
- Gas cost for the ``exp`` opcode increased, relevant for gas estimation and the optimizer.
- ``byzantium``
- ``byzantium`` (*support deprecated*)
- Opcodes ``returndatacopy``, ``returndatasize`` and ``staticcall`` are available in assembly.
- 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.
- It is possible to access dynamic data returned from function calls.
Expand Down Expand Up @@ -318,7 +318,7 @@ Input Description
// Affects type checking and code generation. Can be homestead,
// tangerineWhistle, spuriousDragon, byzantium, constantinople,
// petersburg, istanbul, berlin, london, paris or shanghai (default)
"evmVersion": "byzantium",
"evmVersion": "shanghai",
// Optional: Change compilation pipeline to go through the Yul intermediate representation.
// This is false by default.
"viaIR": true,
Expand Down
6 changes: 6 additions & 0 deletions libsolidity/interface/StandardCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,12 @@ std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler:
std::optional<langutil::EVMVersion> version = langutil::EVMVersion::fromString(settings["evmVersion"].asString());
if (!version)
return formatFatalError(Error::Type::JSONError, "Invalid EVM version requested.");
if (version < EVMVersion::constantinople())
ret.errors.append(formatError(
Error::Type::Warning,
"general",
"Support for EVM versions older than constantinople is deprecated and will be removed in the future."
));
ret.evmVersion = *version;
}

Expand Down
6 changes: 6 additions & 0 deletions solc/CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,12 @@ bool CommandLineInterface::parseArguments(int _argc, char const* const* _argv)

void CommandLineInterface::processInput()
{
if (m_options.output.evmVersion < EVMVersion::constantinople())
report(
Error::Severity::Warning,
"Support for EVM versions older than constantinople is deprecated and will be removed in the future."
);

switch (m_options.input.mode)
{
case InputMode::Help:
Expand Down
1 change: 1 addition & 0 deletions test/cmdlineTests/ast_json_import_wrong_evmVersion/err
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Warning: Support for EVM versions older than constantinople is deprecated and will be removed in the future.
Error: Failed to import AST: Imported tree evm version differs from configured evm version!
1 change: 1 addition & 0 deletions test/cmdlineTests/evm_version_byzantium/args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--evm-version byzantium
3 changes: 3 additions & 0 deletions test/cmdlineTests/evm_version_byzantium/err
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Warning: Support for EVM versions older than constantinople is deprecated and will be removed in the future.
Warning: Source file does not specify required compiler version!
--> evm_version_byzantium/input.sol
1 change: 1 addition & 0 deletions test/cmdlineTests/evm_version_byzantium/input.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// SPDX-License-Identifier: GPL-3.0
1 change: 1 addition & 0 deletions test/cmdlineTests/evm_version_constantinople/args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--evm-version constantinople
2 changes: 2 additions & 0 deletions test/cmdlineTests/evm_version_constantinople/err
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Warning: Source file does not specify required compiler version!
--> evm_version_constantinople/input.sol
1 change: 1 addition & 0 deletions test/cmdlineTests/evm_version_constantinople/input.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// SPDX-License-Identifier: GPL-3.0
9 changes: 9 additions & 0 deletions test/cmdlineTests/standard_evm_version_byzantium/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"language": "Solidity",
"sources": {
"input.sol": {"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
},
"settings": {
"evmVersion": "byzantium"
}
}
19 changes: 19 additions & 0 deletions test/cmdlineTests/standard_evm_version_byzantium/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"errors":
[
{
"component": "general",
"formattedMessage": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
"message": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
"severity": "warning",
"type": "Warning"
}
],
"sources":
{
"input.sol":
{
"id": 0
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"language": "Solidity",
"sources": {
"input.sol": {"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
},
"settings": {
"evmVersion": "constantinople"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sources":
{
"input.sol":
{
"id": 0
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"errors":
[
{
"component": "general",
"formattedMessage": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
"message": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
"severity": "warning",
"type": "Warning"
}
],
"sources":
{
"A":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"language": "Yul",
"sources": {
"input.yul": {"content": "{}"}
},
"settings": {
"evmVersion": "byzantium"
}
}
12 changes: 12 additions & 0 deletions test/cmdlineTests/standard_yul_evm_version_byzantium/output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"errors":
[
{
"component": "general",
"formattedMessage": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
"message": "Support for EVM versions older than constantinople is deprecated and will be removed in the future.",
"severity": "warning",
"type": "Warning"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"language": "Yul",
"sources": {
"input.yul": {"content": "{}"}
},
"settings": {
"evmVersion": "constantinople"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
1 change: 1 addition & 0 deletions test/cmdlineTests/strict_asm_evm_version_byzantium/args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--strict-assembly --evm-version byzantium
1 change: 1 addition & 0 deletions test/cmdlineTests/strict_asm_evm_version_byzantium/err
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warning: Support for EVM versions older than constantinople is deprecated and will be removed in the future.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
15 changes: 15 additions & 0 deletions test/cmdlineTests/strict_asm_evm_version_byzantium/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

======= strict_asm_evm_version_byzantium/input.yul (EVM) =======

Pretty printed source:
object "object" {
code { { } }
}


Binary representation:
00

Text representation:
/* "strict_asm_evm_version_byzantium/input.yul":0:2 */
stop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--strict-assembly --evm-version constantinople
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
15 changes: 15 additions & 0 deletions test/cmdlineTests/strict_asm_evm_version_constantinople/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

======= strict_asm_evm_version_constantinople/input.yul (EVM) =======

Pretty printed source:
object "object" {
code { { } }
}


Binary representation:
00

Text representation:
/* "strict_asm_evm_version_constantinople/input.yul":0:2 */
stop

0 comments on commit 2f01aa3

Please sign in to comment.