diff --git a/.circleci/soltest_all.sh b/.circleci/soltest_all.sh index e069c0f6b..353d81cd6 100755 --- a/.circleci/soltest_all.sh +++ b/.circleci/soltest_all.sh @@ -29,7 +29,7 @@ set -e REPODIR="$(realpath "$(dirname "$0")"/..)" EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london) -DEFAULT_EVM=berlin +DEFAULT_EVM=london [[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]] OPTIMIZE_VALUES=(0 1) STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} )) diff --git a/Changelog.md b/Changelog.md index 3939681b0..5a272b061 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ Language Features: Compiler Features: * AssemblyStack: Also run opcode-based optimizer when compiling Yul code. + * EVM: Set the default EVM version to "London". * Yul EVM Code Transform: Do not reuse stack slots that immediately become unreachable. * Yul EVM Code Transform: Also pop unused argument slots for functions without return variables (under the same restrictions as for functions with return variables). * Yul Optimizer: Move function arguments and return variables to memory with the experimental Stack Limit Evader (which is not enabled by default). diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index c4ffe6770..2ca338041 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -169,10 +169,12 @@ at each version. Backward compatibility is not guaranteed between each version. - The compiler behaves the same way as with constantinople. - ``istanbul`` - Opcodes ``chainid`` and ``selfbalance`` are available in assembly. -- ``berlin`` (**default**) +- ``berlin`` - Gas costs for ``SLOAD``, ``*CALL``, ``BALANCE``, ``EXT*`` and ``SELFDESTRUCT`` increased. The compiler assumes cold gas costs for such operations. This is relevant for gas estimation and the optimizer. +- ``london`` (**default**) + - The block's base fee (`EIP-3198 `_ and `EIP-1559 `_) can be accessed via the global ``block.basefee`` or ``basefee()`` in inline assembly. .. index:: ! standard JSON, ! --standard-json diff --git a/liblangutil/EVMVersion.h b/liblangutil/EVMVersion.h index bbb4200b1..bb6971ae3 100644 --- a/liblangutil/EVMVersion.h +++ b/liblangutil/EVMVersion.h @@ -102,7 +102,7 @@ private: EVMVersion(Version _version): m_version(_version) {} - Version m_version = Version::Berlin; + Version m_version = Version::London; }; } diff --git a/scripts/tests.sh b/scripts/tests.sh index d0c1da8f2..1dcf2ae01 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -86,7 +86,7 @@ EVM_VERSIONS="homestead byzantium" if [ -z "$CI" ] then - EVM_VERSIONS+=" constantinople petersburg istanbul berlin" + EVM_VERSIONS+=" constantinople petersburg istanbul berlin london" fi # And then run the Solidity unit-tests in the matrix combination of optimizer / no optimizer @@ -96,9 +96,9 @@ do for vm in $EVM_VERSIONS do FORCE_ABIV1_RUNS="no" - if [[ "$vm" == "berlin" ]] + if [[ "$vm" == "london" ]] then - FORCE_ABIV1_RUNS="no yes" # run both in berlin + FORCE_ABIV1_RUNS="no yes" # run both in london fi for abiv1 in $FORCE_ABIV1_RUNS do diff --git a/solc/CommandLineParser.cpp b/solc/CommandLineParser.cpp index e962a3b1c..f23865c2f 100644 --- a/solc/CommandLineParser.cpp +++ b/solc/CommandLineParser.cpp @@ -523,7 +523,7 @@ General Information)").c_str(), g_strEVMVersion.c_str(), po::value()->value_name("version")->default_value(EVMVersion{}.name()), "Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, " - "byzantium, constantinople, petersburg, istanbul or berlin." + "byzantium, constantinople, petersburg, istanbul, berlin or london." ) ( g_strExperimentalViaIR.c_str(), diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index 8b49ae6c8..9de4b5a42 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -173,7 +173,7 @@ function run_install replace_version_pragmas force_truffle_solc_modules "$soljson" - force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$OPTIMIZER_LEVEL" berlin + force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$OPTIMIZER_LEVEL" london $init_fn } @@ -234,7 +234,7 @@ function truffle_run_test for level in $(seq "$OPTIMIZER_LEVEL" 3) do clean - force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$level" berlin + force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$level" london printLog "Running compile function..." $compile_fn diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 0dce223ba..8787d1173 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -1067,9 +1067,11 @@ BOOST_AUTO_TEST_CASE(evm_version) BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos); result = compile(inputForVersion("\"evmVersion\": \"berlin\",")); BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"berlin\"") != string::npos); + result = compile(inputForVersion("\"evmVersion\": \"london\",")); + BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos); // test default result = compile(inputForVersion("")); - BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"berlin\"") != string::npos); + BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos); // test invalid result = compile(inputForVersion("\"evmVersion\": \"invalid\",")); BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");