@@ -31,24 +31,26 @@ BINARY_TYPE="$1"
31
31
BINARY_PATH=" $2 "
32
32
SELECTED_PRESETS=" $3 "
33
33
34
- function compile_fn { npx truffle compile ; }
34
+ function compile_fn { npm run build ; }
35
35
function test_fn { npm test ; }
36
36
37
37
function gnosis_safe_test
38
38
{
39
- local repo=" https://github.com/solidity-external-tests /safe-contracts.git"
39
+ local repo=" https://github.com/gnosis /safe-contracts.git"
40
40
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
43
44
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
+ )
45
48
local settings_presets=(
46
49
" ${compile_only_presets[@]} "
47
50
# ir-no-optimize # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
48
51
# 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
52
54
legacy-optimize-evm+yul
53
55
)
54
56
@@ -59,20 +61,28 @@ function gnosis_safe_test
59
61
download_project " $repo " " $ref_type " " $ref " " $DIR "
60
62
[[ $BINARY_TYPE == native ]] && replace_global_solc " $BINARY_PATH "
61
63
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
63
72
64
73
neutralize_package_lock
65
74
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
69
79
70
80
replace_version_pragmas
71
81
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules " ${DIR} /solc/dist"
72
82
73
83
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 "
76
86
done
77
87
}
78
88
0 commit comments