Merge pull request #12198 from ethereum/switch-ens-ext-test-to-ens-contracts

Switch ENS external test to ens-contracts repo
This commit is contained in:
Kamil Śliwak 2021-12-22 16:38:15 +01:00 committed by GitHub
commit b28cd00aa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 22 deletions

View File

@ -1363,8 +1363,8 @@ workflows:
name: t_native_test_ext_ens
project: ens
binary_type: native
# NOTE: One of the dependencies (fsevents) fails to build its native extension on node.js 12+.
nodejs_version: '10'
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
nodejs_version: '16'
# Windows build and tests
- b_win: *workflow_trigger_on_tags

View File

@ -117,6 +117,19 @@ function neutralize_package_json_hooks
sed -i 's|"prepare": *".*"|"prepare": ""|g' package.json
}
function neutralize_packaged_contracts
{
# Frameworks will build contracts from any package that contains a configuration file.
# This is both unnecessary (any files imported from these packages will get compiled again as a
# part of the main project anyway) and trips up our version check because it won't use our
# custom compiler binary.
printLog "Removing framework config and artifacts from npm packages..."
find node_modules/ -type f '(' -name 'hardhat.config.*' -o -name 'truffle-config.*' ')' -delete
# Some npm packages also come packaged with pre-built artifacts.
find node_modules/ -path '*artifacts/build-info/*.json' -delete
}
function force_solc_modules
{
local custom_solcjs_path="${1:-solc/}"
@ -216,8 +229,12 @@ function hardhat_verify_compiler_version
local full_solc_version="$2"
printLog "Verify that the correct version (${solc_version}/${full_solc_version}) of the compiler was used to compile the contracts..."
grep '"solcVersion": "'"${solc_version}"'"' --with-filename artifacts/build-info/*.json || fail "Wrong compiler version detected."
grep '"solcLongVersion": "'"${full_solc_version}"'"' --with-filename artifacts/build-info/*.json || fail "Wrong compiler version detected."
local build_info_files
build_info_files=$(find . -path '*artifacts/build-info/*.json')
for build_info_file in $build_info_files; do
grep '"solcVersion": "'"${solc_version}"'"' --with-filename "$build_info_file" || fail "Wrong compiler version detected in ${build_info_file}."
grep '"solcLongVersion": "'"${full_solc_version}"'"' --with-filename "$build_info_file" || fail "Wrong compiler version detected in ${build_info_file}."
done
}
function truffle_clean

View File

@ -28,22 +28,23 @@ verify_input "$@"
BINARY_TYPE="$1"
BINARY_PATH="$2"
function compile_fn { npx truffle compile; }
function test_fn { npm run test; }
function compile_fn { yarn build; }
function test_fn { yarn test; }
function ens_test
{
local repo="https://github.com/ensdomains/ens.git"
local branch=master
local config_file="truffle.js"
local repo="https://github.com/ensdomains/ens-contracts.git"
local branch="v0.0.8" # The project is in flux right now and master might be too unstable for us
local config_file="hardhat.config.js"
local compile_only_presets=()
local compile_only_presets=(
legacy-no-optimize # Compiles but tests fail to deploy GovernorCompatibilityBravo (code too large).
)
local settings_presets=(
"${compile_only_presets[@]}"
#ir-no-optimize # "YulException: Variable var_ttl_236 is 1 slot(s) too deep inside the stack."
#ir-optimize-evm-only # "YulException: Variable var_ttl_236 is 1 slot(s) too deep inside the stack."
ir-optimize-evm+yul
legacy-no-optimize
#ir-no-optimize # Compilation fails with "YulException: Variable var__945 is 1 slot(s) too deep inside the stack."
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var__945 is 1 slot(s) too deep inside the stack."
#ir-optimize-evm+yul # Compilation fails with "YulException: Variable _5 is 1 too deep in the stack [ _5 usr$i usr$h _7 usr$scratch usr$k usr$f _4 usr$len usr$j_2 RET _2 _1 var_data_mpos usr$totallen usr$x _12 ]"
legacy-optimize-evm-only
legacy-optimize-evm+yul
)
@ -56,20 +57,18 @@ function ens_test
download_project "$repo" "$branch" "$DIR"
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
# Use latest Truffle. Older versions crash on the output from 0.8.0.
force_truffle_version ^5.1.55
neutralize_package_lock
neutralize_package_json_hooks
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$(first_word "$selected_optimizer_presets")"
npm install
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
force_hardhat_compiler_settings "$config_file" "$(first_word "$selected_optimizer_presets")"
yarn install
replace_version_pragmas
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
neutralize_packaged_contracts
for preset in $selected_optimizer_presets; do
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
done
}
external_test Ens ens_test
external_test ENS ens_test