Skip to content

Commit 304c398

Browse files
committed
Update gnosis external test to use upstream directly and use Hardhat
1 parent efc00be commit 304c398

File tree

4 files changed

+29
-111
lines changed

4 files changed

+29
-111
lines changed

.circleci/config.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -513,19 +513,12 @@ defaults:
513513
nodejs_version: '14'
514514

515515
- job_native_test_ext_gnosis: &job_native_test_ext_gnosis
516-
<<: *workflow_emscripten
516+
<<: *workflow_ubuntu2004_static
517517
name: t_native_test_ext_gnosis
518518
project: gnosis
519519
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'
520+
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
521+
nodejs_version: '16'
529522
- job_native_test_ext_zeppelin: &job_native_test_ext_zeppelin
530523
<<: *workflow_ubuntu2004_static
531524
name: t_native_test_ext_zeppelin
@@ -1468,10 +1461,7 @@ workflows:
14681461
- t_ems_ext: *job_ems_compile_ext_colony
14691462
- t_ems_ext: *job_native_compile_ext_gnosis
14701463

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
1464+
- t_ems_ext: *job_native_test_ext_gnosis
14751465
- t_ems_ext: *job_native_test_ext_zeppelin
14761466
- t_ems_ext: *job_native_test_ext_ens
14771467
- t_ems_ext: *job_native_test_ext_trident
@@ -1489,7 +1479,7 @@ workflows:
14891479
requires:
14901480
- t_ems_compile_ext_colony
14911481
- t_native_compile_ext_gnosis
1492-
- t_native_test_ext_gnosis_v2
1482+
- t_native_test_ext_gnosis
14931483
- t_native_test_ext_zeppelin
14941484
- t_native_test_ext_ens
14951485
- 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)