Skip to content

Commit

Permalink
Merge pull request #15552 from ethereum/soltest-pass-for-eof
Browse files Browse the repository at this point in the history
soltest pass for EOF
  • Loading branch information
cameel authored Oct 29, 2024
2 parents 91f319f + 1f2c531 commit 2486a8c
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ jobs:
environment:
<<: *base_osx_env
EVM: << pipeline.parameters.evm-version >>
EOF_VERSION: 0
OPTIMIZE: 0
steps:
- checkout
Expand Down Expand Up @@ -1233,6 +1234,7 @@ jobs:
environment:
<<: *base_archlinux_env
EVM: << pipeline.parameters.evm-version >>
EOF_VERSION: 0
OPTIMIZE: 0
# For Archlinux we do not have prebuilt docker images and we would need to build evmone from source,
# thus we forgo semantics tests to speed things up.
Expand All @@ -1250,6 +1252,7 @@ jobs:
environment:
<<: *base_ubuntu2404_clang_env
EVM: << pipeline.parameters.evm-version >>
EOF_VERSION: 0
OPTIMIZE: 0
# The high parallelism in this job is causing the SMT tests to run out of memory,
# so disabling for now.
Expand Down Expand Up @@ -1299,6 +1302,7 @@ jobs:
environment:
<<: *base_ubuntu2404_env
EVM: << pipeline.parameters.evm-version >>
EOF_VERSION: 0
OPTIMIZE: 0
SOLTEST_FLAGS: --no-smt
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
Expand All @@ -1314,6 +1318,7 @@ jobs:
environment:
<<: *base_ubuntu2404_clang_env
EVM: << pipeline.parameters.evm-version >>
EOF_VERSION: 0
OPTIMIZE: 0
SOLTEST_FLAGS: --no-smt
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
Expand All @@ -1326,6 +1331,7 @@ jobs:
environment:
<<: *base_ubuntu2404_clang_env
EVM: << pipeline.parameters.evm-version >>
EOF_VERSION: 0
SOLTEST_FLAGS: --no-smt
steps:
- soltest
Expand Down
35 changes: 35 additions & 0 deletions .circleci/soltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,44 @@ set -e

OPTIMIZE=${OPTIMIZE:-"0"}
EVM=${EVM:-"invalid"}
EOF_VERSION=${EOF_VERSION:-0}
CPUs=${CPUs:-3}
REPODIR="$(realpath "$(dirname "$0")/..")"

IFS=" " read -r -a BOOST_TEST_ARGS <<< "$BOOST_TEST_ARGS"
IFS=" " read -r -a SOLTEST_FLAGS <<< "$SOLTEST_FLAGS"

# TODO: [EOF] These won't pass on EOF yet. Reenable them when the implementation is complete.
EOF_EXCLUDES=(
--run_test='!Assembler/all_assembly_items'
--run_test='!Assembler/immutable'
--run_test='!Assembler/immutables_and_its_source_maps'
--run_test='!Optimiser/jumpdest_removal_subassemblies'
--run_test='!Optimiser/jumpdest_removal_subassemblies/*'
--run_test='!SolidityCompiler/does_not_include_creation_time_only_internal_functions'
--run_test='!SolidityInlineAssembly/Analysis/create2'
--run_test='!SolidityInlineAssembly/Analysis/inline_assembly_shadowed_instruction_declaration'
--run_test='!SolidityInlineAssembly/Analysis/large_constant'
--run_test='!SolidityInlineAssembly/Analysis/staticcall'
--run_test='!ViewPureChecker/assembly_staticcall'
--run_test='!functionSideEffects/otherImmovables'
--run_test='!functionSideEffects/state'
--run_test='!functionSideEffects/storage'
--run_test='!gasTests/abiv2'
--run_test='!gasTests/abiv2_optimised'
--run_test='!gasTests/data_storage'
--run_test='!gasTests/dispatch_large'
--run_test='!gasTests/dispatch_large_optimised'
--run_test='!gasTests/dispatch_medium'
--run_test='!gasTests/dispatch_medium_optimised'
--run_test='!gasTests/dispatch_small'
--run_test='!gasTests/dispatch_small_optimised'
--run_test='!gasTests/exp'
--run_test='!gasTests/exp_optimized'
--run_test='!gasTests/storage_costs'
--run_test='!yulStackLayout/literal_loop'
)

# shellcheck source=scripts/common.sh
source "${REPODIR}/scripts/common.sh"
# Test result output directory (CircleCI is reading test results from here)
Expand All @@ -55,6 +87,7 @@ get_logfile_basename() {
local filename="${EVM}"
test "${OPTIMIZE}" = "1" && filename="${filename}_opt"
test "${ABI_ENCODER_V1}" = "1" && filename="${filename}_abiv1"
(( EOF_VERSION != 0 )) && filename="${filename}_eofv${EOF_VERSION}"
filename="${filename}_${run}"

echo -ne "${filename}"
Expand All @@ -78,10 +111,12 @@ do
"--logger=HRF,error,stdout"
"${BOOST_TEST_ARGS[@]}"
)
(( EOF_VERSION != 0 )) && BOOST_TEST_ARGS_RUN+=("${EOF_EXCLUDES[@]}")
SOLTEST_ARGS=("--evm-version=$EVM" "${SOLTEST_FLAGS[@]}")

test "${OPTIMIZE}" = "1" && SOLTEST_ARGS+=(--optimize)
test "${ABI_ENCODER_V1}" = "1" && SOLTEST_ARGS+=(--abiencoderv1)
(( EOF_VERSION != 0 )) && SOLTEST_ARGS+=(--eof-version "$EOF_VERSION")

BATCH_ARGS=("--batches" "$((CPUs * CIRCLE_NODE_TOTAL))" "--selected-batch" "$((CPUs * CIRCLE_NODE_INDEX + run))")

Expand Down
35 changes: 23 additions & 12 deletions .circleci/soltest_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ REPODIR="$(realpath "$(dirname "$0")"/..)"
source "${REPODIR}/scripts/common.sh"

DEFAULT_EVM_VALUES=(constantinople petersburg istanbul berlin london paris shanghai cancun prague)
EVMS_WITH_EOF=(prague)

# Deserialize the EVM_VALUES array if it was provided as argument or
# set EVM_VALUES to the default values.
IFS=" " read -ra EVM_VALUES <<< "${1:-${DEFAULT_EVM_VALUES[@]}}"

DEFAULT_EVM=cancun
OPTIMIZE_VALUES=(0 1)
EOF_VERSIONS=(0 1)

# Run for ABI encoder v1, without SMTChecker tests.
EVM="${DEFAULT_EVM}" \
Expand All @@ -53,19 +56,27 @@ for OPTIMIZE in "${OPTIMIZE_VALUES[@]}"
do
for EVM in "${EVM_VALUES[@]}"
do
ENFORCE_GAS_ARGS=""
[ "${EVM}" = "${DEFAULT_EVM}" ] && ENFORCE_GAS_ARGS="--enforce-gas-cost"
# Run SMTChecker tests only when OPTIMIZE == 0
DISABLE_SMTCHECKER=""
[ "${OPTIMIZE}" != "0" ] && DISABLE_SMTCHECKER="-t !smtCheckerTests"
for EOF_VERSION in "${EOF_VERSIONS[@]}"
do
if (( EOF_VERSION > 0 )) && [[ ! " ${EVMS_WITH_EOF[*]} " == *" $EVM "* ]]; then
continue
fi

ENFORCE_GAS_ARGS=""
[ "${EVM}" = "${DEFAULT_EVM}" ] && ENFORCE_GAS_ARGS="--enforce-gas-cost"
# Run SMTChecker tests only when OPTIMIZE == 0
DISABLE_SMTCHECKER=""
[ "${OPTIMIZE}" != "0" ] && DISABLE_SMTCHECKER="-t !smtCheckerTests"

EVM="$EVM" \
OPTIMIZE="$OPTIMIZE" \
SOLTEST_FLAGS="$SOLTEST_FLAGS $ENFORCE_GAS_ARGS" \
BOOST_TEST_ARGS="-t !@nooptions $DISABLE_SMTCHECKER" \
INDEX_SHIFT="$INDEX_SHIFT" \
"${REPODIR}/.circleci/soltest.sh"
EVM="$EVM" \
EOF_VERSION="$EOF_VERSION" \
OPTIMIZE="$OPTIMIZE" \
SOLTEST_FLAGS="$SOLTEST_FLAGS $ENFORCE_GAS_ARGS" \
BOOST_TEST_ARGS="-t !@nooptions $DISABLE_SMTCHECKER" \
INDEX_SHIFT="$INDEX_SHIFT" \
"${REPODIR}/.circleci/soltest.sh"

INDEX_SHIFT=$((INDEX_SHIFT + 1))
INDEX_SHIFT=$((INDEX_SHIFT + 1))
done
done
done
2 changes: 1 addition & 1 deletion test/cmdlineTests/~via_ir_equivalence/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ requiresOptimizer=(

for contractFile in "${externalContracts[@]}"
do
if ! [[ "${requiresOptimizer[*]}" =~ $contractFile ]]
if ! [[ " ${requiresOptimizer[*]} " == *" $contractFile "* ]]
then
printTask " - ${contractFile}"
test_via_ir_equivalence "${REPO_ROOT}/test/${contractFile}"
Expand Down

0 comments on commit 2486a8c

Please sign in to comment.