diff --git a/.circleci/config.yml b/.circleci/config.yml index a75e372ae..d42021373 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -582,6 +582,12 @@ defaults: binary_type: native nodejs_version: '16' resource_class: medium + - job_native_test_ext_brink: &job_native_test_ext_brink + <<: *workflow_ubuntu2004_static + name: t_native_test_ext_brink + project: brink + binary_type: native + nodejs_version: '16' - job_ems_test_ext_colony: &job_ems_test_ext_colony <<: *workflow_emscripten name: t_ems_test_ext_colony @@ -1470,6 +1476,7 @@ workflows: - t_ems_ext: *job_native_test_ext_uniswap - t_ems_ext: *job_native_test_ext_prb_math - t_ems_ext: *job_native_test_ext_elementfi + - t_ems_ext: *job_native_test_ext_brink - c_ext_benchmarks: <<: *workflow_trigger_on_tags @@ -1487,6 +1494,7 @@ workflows: - t_native_test_ext_uniswap - t_native_test_ext_prb_math - t_native_test_ext_elementfi + - t_native_test_ext_brink # Windows build and tests - b_win: *workflow_trigger_on_tags diff --git a/test/externalTests.sh b/test/externalTests.sh index 89e7515d4..8c581a165 100755 --- a/test/externalTests.sh +++ b/test/externalTests.sh @@ -50,3 +50,4 @@ printTask "Running external tests..." "${REPO_ROOT}/test/externalTests/uniswap.sh" "$@" "${REPO_ROOT}/test/externalTests/prb-math.sh" "$@" "${REPO_ROOT}/test/externalTests/elementfi.sh" "$@" +"${REPO_ROOT}/test/externalTests/brink.sh" "$@" diff --git a/test/externalTests/brink.sh b/test/externalTests/brink.sh new file mode 100755 index 000000000..1513350bb --- /dev/null +++ b/test/externalTests/brink.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +# ------------------------------------------------------------------------------ +# This file is part of solidity. +# +# solidity is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# solidity is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with solidity. If not, see +# +# (c) 2022 solidity contributors. +#------------------------------------------------------------------------------ + +set -e + +source scripts/common.sh +source test/externalTests/common.sh + +REPO_ROOT=$(realpath "$(dirname "$0")/../..") + +verify_input "$@" +BINARY_TYPE="$1" +BINARY_PATH="$2" +SELECTED_PRESETS="$3" + +function compile_fn { yarn compile; } +function test_fn { SNAPSHOT_UPDATE=1 npx --no hardhat test; } + +function brink_test +{ + local repo="https://github.com/brinktrade/brink-core" + local ref_type=branch + local ref=master + local config_file="hardhat.config.js" + local config_var="" + local extra_settings="metadata: {bytecodeHash: 'none'}" + local extra_optimizer_settings="runs: 800" + + local compile_only_presets=( + #ir-no-optimize # Compilation fails with "YulException: Variable var_signature_127_offset is 2 slot(s) too deep inside the stack." + #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_signature_127_offset is 2 slot(s) too deep inside the stack." + ir-optimize-evm+yul # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. + legacy-optimize-evm+yul # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. + legacy-no-optimize # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. + legacy-optimize-evm-only # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. + ) + local settings_presets=( + "${compile_only_presets[@]}" + ) + + [[ $SELECTED_PRESETS != "" ]] || SELECTED_PRESETS=$(circleci_select_steps_multiarg "${settings_presets[@]}") + print_presets_or_exit "$SELECTED_PRESETS" + + setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH" + download_project "$repo" "$ref_type" "$ref" "$DIR" + + neutralize_package_lock + neutralize_package_json_hooks + force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH" + force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var" "$CURRENT_EVM_VERSION" "$extra_settings" "$extra_optimizer_settings" + yarn install + yarn add hardhat-gas-reporter + + # TODO: Remove when https://github.com/brinktrade/brink-core/issues/48 is fixed. + yarn add chai + + replace_version_pragmas + + for preset in $SELECTED_PRESETS; do + hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn "$config_var" "$extra_settings" "$extra_optimizer_settings" + store_benchmark_report hardhat brink "$repo" "$preset" + done +} + +external_test Brink brink_test