Skip to content

Commit b28cd00

Browse files
authored
Merge pull request #12198 from ethereum/switch-ens-ext-test-to-ens-contracts
Switch ENS external test to ens-contracts repo
2 parents 1582682 + 7e91dba commit b28cd00

File tree

3 files changed

+38
-22
lines changed

3 files changed

+38
-22
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,8 +1363,8 @@ workflows:
13631363
name: t_native_test_ext_ens
13641364
project: ens
13651365
binary_type: native
1366-
# NOTE: One of the dependencies (fsevents) fails to build its native extension on node.js 12+.
1367-
nodejs_version: '10'
1366+
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
1367+
nodejs_version: '16'
13681368

13691369
# Windows build and tests
13701370
- b_win: *workflow_trigger_on_tags

test/externalTests/common.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ function neutralize_package_json_hooks
117117
sed -i 's|"prepare": *".*"|"prepare": ""|g' package.json
118118
}
119119

120+
function neutralize_packaged_contracts
121+
{
122+
# Frameworks will build contracts from any package that contains a configuration file.
123+
# This is both unnecessary (any files imported from these packages will get compiled again as a
124+
# part of the main project anyway) and trips up our version check because it won't use our
125+
# custom compiler binary.
126+
printLog "Removing framework config and artifacts from npm packages..."
127+
find node_modules/ -type f '(' -name 'hardhat.config.*' -o -name 'truffle-config.*' ')' -delete
128+
129+
# Some npm packages also come packaged with pre-built artifacts.
130+
find node_modules/ -path '*artifacts/build-info/*.json' -delete
131+
}
132+
120133
function force_solc_modules
121134
{
122135
local custom_solcjs_path="${1:-solc/}"
@@ -216,8 +229,12 @@ function hardhat_verify_compiler_version
216229
local full_solc_version="$2"
217230

218231
printLog "Verify that the correct version (${solc_version}/${full_solc_version}) of the compiler was used to compile the contracts..."
219-
grep '"solcVersion": "'"${solc_version}"'"' --with-filename artifacts/build-info/*.json || fail "Wrong compiler version detected."
220-
grep '"solcLongVersion": "'"${full_solc_version}"'"' --with-filename artifacts/build-info/*.json || fail "Wrong compiler version detected."
232+
local build_info_files
233+
build_info_files=$(find . -path '*artifacts/build-info/*.json')
234+
for build_info_file in $build_info_files; do
235+
grep '"solcVersion": "'"${solc_version}"'"' --with-filename "$build_info_file" || fail "Wrong compiler version detected in ${build_info_file}."
236+
grep '"solcLongVersion": "'"${full_solc_version}"'"' --with-filename "$build_info_file" || fail "Wrong compiler version detected in ${build_info_file}."
237+
done
221238
}
222239

223240
function truffle_clean

test/externalTests/ens.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,23 @@ verify_input "$@"
2828
BINARY_TYPE="$1"
2929
BINARY_PATH="$2"
3030

31-
function compile_fn { npx truffle compile; }
32-
function test_fn { npm run test; }
31+
function compile_fn { yarn build; }
32+
function test_fn { yarn test; }
3333

3434
function ens_test
3535
{
36-
local repo="https://github.com/ensdomains/ens.git"
37-
local branch=master
38-
local config_file="truffle.js"
36+
local repo="https://github.com/ensdomains/ens-contracts.git"
37+
local branch="v0.0.8" # The project is in flux right now and master might be too unstable for us
38+
local config_file="hardhat.config.js"
3939

40-
local compile_only_presets=()
40+
local compile_only_presets=(
41+
legacy-no-optimize # Compiles but tests fail to deploy GovernorCompatibilityBravo (code too large).
42+
)
4143
local settings_presets=(
4244
"${compile_only_presets[@]}"
43-
#ir-no-optimize # "YulException: Variable var_ttl_236 is 1 slot(s) too deep inside the stack."
44-
#ir-optimize-evm-only # "YulException: Variable var_ttl_236 is 1 slot(s) too deep inside the stack."
45-
ir-optimize-evm+yul
46-
legacy-no-optimize
45+
#ir-no-optimize # Compilation fails with "YulException: Variable var__945 is 1 slot(s) too deep inside the stack."
46+
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var__945 is 1 slot(s) too deep inside the stack."
47+
#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 ]"
4748
legacy-optimize-evm-only
4849
legacy-optimize-evm+yul
4950
)
@@ -56,20 +57,18 @@ function ens_test
5657
download_project "$repo" "$branch" "$DIR"
5758
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
5859

59-
# Use latest Truffle. Older versions crash on the output from 0.8.0.
60-
force_truffle_version ^5.1.55
61-
6260
neutralize_package_lock
6361
neutralize_package_json_hooks
64-
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$(first_word "$selected_optimizer_presets")"
65-
npm install
62+
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
63+
force_hardhat_compiler_settings "$config_file" "$(first_word "$selected_optimizer_presets")"
64+
yarn install
6665

6766
replace_version_pragmas
68-
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
67+
neutralize_packaged_contracts
6968

7069
for preset in $selected_optimizer_presets; do
71-
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
70+
hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
7271
done
7372
}
7473

75-
external_test Ens ens_test
74+
external_test ENS ens_test

0 commit comments

Comments
 (0)