Skip to content

Commit eff76f0

Browse files
authored
Merge pull request #12195 from ethereum/update-gnosis-ext-test
Run GnosisSafe external tests with Hardhat and directly on upstream
2 parents bebdccc + 438c082 commit eff76f0

File tree

4 files changed

+29
-120
lines changed

4 files changed

+29
-120
lines changed

.circleci/config.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -504,28 +504,14 @@ defaults:
504504
binary_type: solcjs
505505
compile_only: 1
506506
nodejs_version: '14'
507-
- job_native_compile_ext_gnosis: &job_native_compile_ext_gnosis
508-
<<: *workflow_ubuntu2004_static
509-
name: t_native_compile_ext_gnosis
510-
project: gnosis
511-
binary_type: native
512-
compile_only: 1
513-
nodejs_version: '14'
514507

515508
- job_native_test_ext_gnosis: &job_native_test_ext_gnosis
516-
<<: *workflow_emscripten
509+
<<: *workflow_ubuntu2004_static
517510
name: t_native_test_ext_gnosis
518511
project: gnosis
519512
binary_type: native
520-
# NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1").
521-
nodejs_version: '12'
522-
- job_native_test_ext_gnosis_v2: &job_native_test_ext_gnosis_v2
523-
<<: *workflow_ubuntu2004_static
524-
name: t_native_test_ext_gnosis_v2
525-
project: gnosis-v2
526-
binary_type: native
527-
# NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1").
528-
nodejs_version: '12'
513+
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
514+
nodejs_version: '16'
529515
- job_native_test_ext_zeppelin: &job_native_test_ext_zeppelin
530516
<<: *workflow_ubuntu2004_static
531517
name: t_native_test_ext_zeppelin
@@ -1466,12 +1452,8 @@ workflows:
14661452
- t_ems_ext_hardhat: *workflow_emscripten
14671453

14681454
- t_ems_ext: *job_ems_compile_ext_colony
1469-
- t_ems_ext: *job_native_compile_ext_gnosis
14701455

1471-
# FIXME: Gnosis tests are pretty flaky right now. They often fail on CircleCI due to random ProviderError
1472-
# and there are also other less frequent problems. See https://github.com/gnosis/safe-contracts/issues/216.
1473-
#-t_ems_ext: *job_native_test_ext_gnosis
1474-
- t_ems_ext: *job_native_test_ext_gnosis_v2
1456+
- t_ems_ext: *job_native_test_ext_gnosis
14751457
- t_ems_ext: *job_native_test_ext_zeppelin
14761458
- t_ems_ext: *job_native_test_ext_ens
14771459
- t_ems_ext: *job_native_test_ext_trident
@@ -1488,8 +1470,7 @@ workflows:
14881470
<<: *workflow_trigger_on_tags
14891471
requires:
14901472
- t_ems_compile_ext_colony
1491-
- t_native_compile_ext_gnosis
1492-
- t_native_test_ext_gnosis_v2
1473+
- t_native_test_ext_gnosis
14931474
- t_native_test_ext_zeppelin
14941475
- t_native_test_ext_ens
14951476
- t_native_test_ext_trident

test/externalTests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ printTask "Running external tests..."
3939

4040
"{$REPO_ROOT}/test/externalTests/zeppelin.sh" "$@"
4141
"{$REPO_ROOT}/test/externalTests/gnosis.sh" "$@"
42-
"{$REPO_ROOT}/test/externalTests/gnosis-v2.sh" "$@"
4342
"{$REPO_ROOT}/test/externalTests/colony.sh" "$@"
4443
"{$REPO_ROOT}/test/externalTests/ens.sh" "$@"
4544
"{$REPO_ROOT}/test/externalTests/trident.sh" "$@"

test/externalTests/gnosis-v2.sh

Lines changed: 0 additions & 81 deletions
This file was deleted.

test/externalTests/gnosis.sh

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,26 @@ BINARY_TYPE="$1"
3131
BINARY_PATH="$2"
3232
SELECTED_PRESETS="$3"
3333

34-
function compile_fn { npx truffle compile; }
34+
function compile_fn { npm run build; }
3535
function test_fn { npm test; }
3636

3737
function gnosis_safe_test
3838
{
39-
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
39+
local repo="https://github.com/gnosis/safe-contracts.git"
4040
local ref_type=branch
41-
local ref="development_080"
42-
local config_file="truffle-config.js"
41+
local ref=main
42+
local config_file="hardhat.config.ts"
43+
local config_var=userConfig
4344

44-
local compile_only_presets=()
45+
local compile_only_presets=(
46+
ir-optimize-evm+yul # Compiles but tests fail. See https://github.com/nomiclabs/hardhat/issues/2115
47+
)
4548
local settings_presets=(
4649
"${compile_only_presets[@]}"
4750
#ir-no-optimize # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
4851
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
49-
ir-optimize-evm+yul
50-
#legacy-no-optimize # Compilation fails with "Stack too deep" error
51-
#legacy-optimize-evm-only # Compilation fails with "Stack too deep" error
52+
legacy-no-optimize
53+
legacy-optimize-evm-only
5254
legacy-optimize-evm+yul
5355
)
5456

@@ -59,20 +61,28 @@ function gnosis_safe_test
5961
download_project "$repo" "$ref_type" "$ref" "$DIR"
6062
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
6163

62-
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
64+
# NOTE: The patterns below intentionally have hard-coded versions.
65+
# When the upstream updates them, there's a chance we can just remove the regex.
66+
sed -i 's|"@gnosis\.pm/mock-contract": "\^4\.0\.0"|"@gnosis.pm/mock-contract": "github:solidity-external-tests/mock-contract#master_080"|g' package.json
67+
sed -i 's|"@openzeppelin/contracts": "\^3\.4\.0"|"@openzeppelin/contracts": "^4.0.0"|g' package.json
68+
69+
# Disable two tests failing due to Hardhat's heuristics not yet updated to handle solc 0.8.10.
70+
# TODO: Remove this when Hardhat implements them (https://github.com/nomiclabs/hardhat/issues/2051).
71+
sed -i "s|\(it\)\(('should revert if called directly', async () => {\)|\1.skip\2|g" test/handlers/CompatibilityFallbackHandler.spec.ts
6372

6473
neutralize_package_lock
6574
neutralize_package_json_hooks
66-
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc/dist" "$(first_word "$SELECTED_PRESETS")"
67-
npm install --package-lock
68-
npm install eth-gas-reporter
75+
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
76+
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var"
77+
npm install
78+
npm install hardhat-gas-reporter
6979

7080
replace_version_pragmas
7181
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc/dist"
7282

7383
for preset in $SELECTED_PRESETS; do
74-
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc/dist" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
75-
store_benchmark_report truffle gnosis "$repo" "$preset"
84+
hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn "$config_var"
85+
store_benchmark_report hardhat gnosis "$repo" "$preset"
7686
done
7787
}
7888

0 commit comments

Comments
 (0)