Set default EVM version to Berlin

This commit is contained in:
hrkrshnn 2021-04-13 09:15:50 +02:00
parent 7d28ea3746
commit d5564a0304
7 changed files with 20 additions and 14 deletions

View File

@ -28,7 +28,9 @@ set -e
REPODIR="$(realpath "$(dirname "$0")"/..)"
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul)
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin)
DEFAULT_EVM=berlin
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
OPTIMIZE_VALUES=(0 1)
STEPS=$(( 1 + ${#EVM_VALUES[@]} * ${#OPTIMIZE_VALUES[@]} ))
@ -45,7 +47,7 @@ STEP=1
# Run for ABI encoder v1, without SMTChecker tests.
[[ " $RUN_STEPS " == *" $STEP "* ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
[[ " $RUN_STEPS " == *" $STEP "* ]] && EVM="${DEFAULT_EVM}" OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
STEP=$((STEP + 1))
for OPTIMIZE in "${OPTIMIZE_VALUES[@]}"
@ -56,7 +58,7 @@ do
EWASM_ARGS=""
[ "${EVM}" = "byzantium" ] && [ "${OPTIMIZE}" = "0" ] && EWASM_ARGS="--ewasm"
ENFORCE_GAS_ARGS=""
[ "${EVM}" = "istanbul" ] && ENFORCE_GAS_ARGS="--enforce-gas-cost"
[ "${EVM}" = "${DEFAULT_EVM}" ] && ENFORCE_GAS_ARGS="--enforce-gas-cost"
# Run SMTChecker tests only when OPTIMIZE == 0
DISABLE_SMTCHECKER=""
[ "${OPTIMIZE}" != "0" ] && DISABLE_SMTCHECKER="-t !smtCheckerTests"

View File

@ -6,6 +6,7 @@ Language Features:
Compiler Features:
* EVM: Set the default EVM version to "Berlin".
* SMTChecker: Function definitions can be annotated with the custom Natspec tag ``custom:smtchecker abstract-function-nondet`` to be abstracted by a nondeterministic value when called.
* Standard JSON / combined JSON: New artifact "functionDebugData" that contains bytecode offsets of entry points of functions and potentially more information in the future.
* Yul Optimizer: Evaluate ``keccak256(a, c)``, when the value at memory location ``a`` is known at compile time and ``c`` is a constant ``<= 32``.

View File

@ -158,9 +158,12 @@ at each version. Backward compatibility is not guaranteed between each version.
- Shifting operators use shifting opcodes and thus need less gas.
- ``petersburg``
- The compiler behaves the same way as with constantinople.
- ``istanbul`` (**default**)
- ``istanbul``
- Opcodes ``chainid`` and ``selfbalance`` are available in assembly.
- ``berlin`` (**experimental**)
- ``berlin`` (**default**)
- 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.
.. _compiler-api:

View File

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

View File

@ -86,7 +86,7 @@ EVM_VERSIONS="homestead byzantium"
if [ -z "$CI" ]
then
EVM_VERSIONS+=" constantinople petersburg istanbul"
EVM_VERSIONS+=" constantinople petersburg istanbul berlin"
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" == "istanbul" ]]
if [[ "$vm" == "berlin" ]]
then
FORCE_ABIV1_RUNS="no yes" # run both in istanbul
FORCE_ABIV1_RUNS="no yes" # run both in berlin
fi
for abiv1 in $FORCE_ABIV1_RUNS
do

View File

@ -46,6 +46,7 @@
#include <libevmasm/GasMeter.h>
#include <liblangutil/Exceptions.h>
#include <liblangutil/EVMVersion.h>
#include <liblangutil/Scanner.h>
#include <liblangutil/SourceReferenceFormatter.h>
@ -872,9 +873,9 @@ General Information)").c_str(),
)
(
g_strEVMVersion.c_str(),
po::value<string>()->value_name("version"),
po::value<string>()->value_name("version")->default_value(EVMVersion{}.name()),
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, "
"byzantium, constantinople, petersburg, istanbul (default) or berlin."
"byzantium, constantinople, petersburg, istanbul or berlin."
)
(
g_strExperimentalViaIR.c_str(),

View File

@ -173,7 +173,7 @@ function run_install
replace_version_pragmas
force_truffle_solc_modules "$soljson"
force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$OPTIMIZER_LEVEL" istanbul
force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$OPTIMIZER_LEVEL" berlin
$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" istanbul
force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$level" berlin
printLog "Running compile function..."
$compile_fn
@ -267,4 +267,3 @@ function external_test
rm -rf "$DIR"
echo "Done."
}