From dc792748712fd6b652fd8f92a52359b4fa24860d Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 4 Dec 2019 10:42:14 +0100 Subject: [PATCH] Set default EVM version to Istanbul. --- .circleci/soltest_all.sh | 2 +- Changelog.md | 1 + docs/using-the-compiler.rst | 4 ++-- liblangutil/EVMVersion.h | 2 +- solc/CommandLineInterface.cpp | 3 ++- test/libsolidity/StandardCompiler.cpp | 4 +++- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.circleci/soltest_all.sh b/.circleci/soltest_all.sh index 3a2acd1ac..74b3f1197 100755 --- a/.circleci/soltest_all.sh +++ b/.circleci/soltest_all.sh @@ -34,4 +34,4 @@ for OPTIMIZE in 0 1; do done done -EVM=constantinople OPTIMIZE=1 ABI_ENCODER_V2=1 ${REPODIR}/.circleci/soltest.sh \ No newline at end of file +EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 ${REPODIR}/.circleci/soltest.sh diff --git a/Changelog.md b/Changelog.md index b95736856..f3aa6d0fb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ Language Features: Compiler Features: + * Set the default EVM version to "Istanbul". * Commandline Interface: Allow translation from yul / strict assembly to EWasm using ``solc --yul --yul-dialect evm --machine eWasm`` * SMTChecker: Add support to constructors including constructor inheritance. * Yul: When compiling via Yul, string literals from the Solidity code are kept as string literals if every character is safely printable. diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 2a02322cf..fe2d316ba 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -120,9 +120,9 @@ at each version. Backward compatibility is not guaranteed between each version. - ``constantinople`` - Opcodes ``create2`, ``extcodehash``, ``shl``, ``shr`` and ``sar`` are available in assembly. - Shifting operators use shifting opcodes and thus need less gas. -- ``petersburg`` (**default**) +- ``petersburg`` - The compiler behaves the same way as with constantinople. -- ``istanbul`` +- ``istanbul`` (**default**) - Opcodes ``chainid`` and ``selfbalance`` are available in assembly. - ``berlin`` (**experimental**) diff --git a/liblangutil/EVMVersion.h b/liblangutil/EVMVersion.h index 95a9eb089..5151d85a9 100644 --- a/liblangutil/EVMVersion.h +++ b/liblangutil/EVMVersion.h @@ -98,7 +98,7 @@ private: EVMVersion(Version _version): m_version(_version) {} - Version m_version = Version::Petersburg; + Version m_version = Version::Istanbul; }; } diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 48f04d564..05b021379 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -656,7 +656,8 @@ Allowed options)", ( g_strEVMVersion.c_str(), po::value()->value_name("version"), - "Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg (default), istanbul or berlin." + "Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, " + "byzantium, constantinople, petersburg, istanbul (default) or berlin." ) (g_argOptimize.c_str(), "Enable bytecode optimizer.") ( diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index f737ac99d..17b39b2e6 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -900,9 +900,11 @@ BOOST_AUTO_TEST_CASE(evm_version) BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"constantinople\"") != string::npos); result = compile(inputForVersion("\"evmVersion\": \"petersburg\",")); BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos); + result = compile(inputForVersion("\"evmVersion\": \"istanbul\",")); + BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos); // test default result = compile(inputForVersion("")); - BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos); + BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos); // test invalid result = compile(inputForVersion("\"evmVersion\": \"invalid\",")); BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");