Set default EVM version to London.

This commit is contained in:
hrkrshnn 2021-08-09 10:06:53 +02:00
parent 43605d9299
commit 79733fca48
8 changed files with 15 additions and 10 deletions

View File

@ -29,7 +29,7 @@ set -e
REPODIR="$(realpath "$(dirname "$0")"/..)" REPODIR="$(realpath "$(dirname "$0")"/..)"
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london) EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london)
DEFAULT_EVM=berlin DEFAULT_EVM=london
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]] [[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
OPTIMIZE_VALUES=(0 1) OPTIMIZE_VALUES=(0 1)
STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} )) STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))

View File

@ -7,6 +7,7 @@ Language Features:
Compiler Features: Compiler Features:
* AssemblyStack: Also run opcode-based optimizer when compiling Yul code. * 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: 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 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). * Yul Optimizer: Move function arguments and return variables to memory with the experimental Stack Limit Evader (which is not enabled by default).

View File

@ -169,10 +169,12 @@ at each version. Backward compatibility is not guaranteed between each version.
- The compiler behaves the same way as with constantinople. - The compiler behaves the same way as with constantinople.
- ``istanbul`` - ``istanbul``
- Opcodes ``chainid`` and ``selfbalance`` are available in assembly. - Opcodes ``chainid`` and ``selfbalance`` are available in assembly.
- ``berlin`` (**default**) - ``berlin``
- Gas costs for ``SLOAD``, ``*CALL``, ``BALANCE``, ``EXT*`` and ``SELFDESTRUCT`` increased. The - 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 compiler assumes cold gas costs for such operations. This is relevant for gas estimation and
the optimizer. the optimizer.
- ``london`` (**default**)
- The block's base fee (`EIP-3198 <https://eips.ethereum.org/EIPS/eip-3198>`_ and `EIP-1559 <https://eips.ethereum.org/EIPS/eip-1559>`_) can be accessed via the global ``block.basefee`` or ``basefee()`` in inline assembly.
.. index:: ! standard JSON, ! --standard-json .. index:: ! standard JSON, ! --standard-json

View File

@ -102,7 +102,7 @@ private:
EVMVersion(Version _version): m_version(_version) {} EVMVersion(Version _version): m_version(_version) {}
Version m_version = Version::Berlin; Version m_version = Version::London;
}; };
} }

View File

@ -86,7 +86,7 @@ EVM_VERSIONS="homestead byzantium"
if [ -z "$CI" ] if [ -z "$CI" ]
then then
EVM_VERSIONS+=" constantinople petersburg istanbul berlin" EVM_VERSIONS+=" constantinople petersburg istanbul berlin london"
fi fi
# And then run the Solidity unit-tests in the matrix combination of optimizer / no optimizer # 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 for vm in $EVM_VERSIONS
do do
FORCE_ABIV1_RUNS="no" FORCE_ABIV1_RUNS="no"
if [[ "$vm" == "berlin" ]] if [[ "$vm" == "london" ]]
then then
FORCE_ABIV1_RUNS="no yes" # run both in berlin FORCE_ABIV1_RUNS="no yes" # run both in london
fi fi
for abiv1 in $FORCE_ABIV1_RUNS for abiv1 in $FORCE_ABIV1_RUNS
do do

View File

@ -523,7 +523,7 @@ General Information)").c_str(),
g_strEVMVersion.c_str(), g_strEVMVersion.c_str(),
po::value<string>()->value_name("version")->default_value(EVMVersion{}.name()), po::value<string>()->value_name("version")->default_value(EVMVersion{}.name()),
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, " "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(), g_strExperimentalViaIR.c_str(),

View File

@ -173,7 +173,7 @@ function run_install
replace_version_pragmas replace_version_pragmas
force_truffle_solc_modules "$soljson" 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 $init_fn
} }
@ -234,7 +234,7 @@ function truffle_run_test
for level in $(seq "$OPTIMIZER_LEVEL" 3) for level in $(seq "$OPTIMIZER_LEVEL" 3)
do do
clean clean
force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$level" berlin force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$level" london
printLog "Running compile function..." printLog "Running compile function..."
$compile_fn $compile_fn

View File

@ -1067,9 +1067,11 @@ BOOST_AUTO_TEST_CASE(evm_version)
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos); BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos);
result = compile(inputForVersion("\"evmVersion\": \"berlin\",")); result = compile(inputForVersion("\"evmVersion\": \"berlin\","));
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"berlin\"") != string::npos); 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 // test default
result = compile(inputForVersion("")); 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 // test invalid
result = compile(inputForVersion("\"evmVersion\": \"invalid\",")); result = compile(inputForVersion("\"evmVersion\": \"invalid\","));
BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested."); BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");