mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12195 from ethereum/update-gnosis-ext-test
Run GnosisSafe external tests with Hardhat and directly on upstream
This commit is contained in:
commit
eff76f0f82
@ -504,28 +504,14 @@ defaults:
|
|||||||
binary_type: solcjs
|
binary_type: solcjs
|
||||||
compile_only: 1
|
compile_only: 1
|
||||||
nodejs_version: '14'
|
nodejs_version: '14'
|
||||||
- job_native_compile_ext_gnosis: &job_native_compile_ext_gnosis
|
|
||||||
<<: *workflow_ubuntu2004_static
|
|
||||||
name: t_native_compile_ext_gnosis
|
|
||||||
project: gnosis
|
|
||||||
binary_type: native
|
|
||||||
compile_only: 1
|
|
||||||
nodejs_version: '14'
|
|
||||||
|
|
||||||
- job_native_test_ext_gnosis: &job_native_test_ext_gnosis
|
- job_native_test_ext_gnosis: &job_native_test_ext_gnosis
|
||||||
<<: *workflow_emscripten
|
<<: *workflow_ubuntu2004_static
|
||||||
name: t_native_test_ext_gnosis
|
name: t_native_test_ext_gnosis
|
||||||
project: gnosis
|
project: gnosis
|
||||||
binary_type: native
|
binary_type: native
|
||||||
# NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1").
|
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
|
||||||
nodejs_version: '12'
|
nodejs_version: '16'
|
||||||
- job_native_test_ext_gnosis_v2: &job_native_test_ext_gnosis_v2
|
|
||||||
<<: *workflow_ubuntu2004_static
|
|
||||||
name: t_native_test_ext_gnosis_v2
|
|
||||||
project: gnosis-v2
|
|
||||||
binary_type: native
|
|
||||||
# NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1").
|
|
||||||
nodejs_version: '12'
|
|
||||||
- job_native_test_ext_zeppelin: &job_native_test_ext_zeppelin
|
- job_native_test_ext_zeppelin: &job_native_test_ext_zeppelin
|
||||||
<<: *workflow_ubuntu2004_static
|
<<: *workflow_ubuntu2004_static
|
||||||
name: t_native_test_ext_zeppelin
|
name: t_native_test_ext_zeppelin
|
||||||
@ -1466,12 +1452,8 @@ workflows:
|
|||||||
- t_ems_ext_hardhat: *workflow_emscripten
|
- t_ems_ext_hardhat: *workflow_emscripten
|
||||||
|
|
||||||
- t_ems_ext: *job_ems_compile_ext_colony
|
- t_ems_ext: *job_ems_compile_ext_colony
|
||||||
- t_ems_ext: *job_native_compile_ext_gnosis
|
|
||||||
|
|
||||||
# FIXME: Gnosis tests are pretty flaky right now. They often fail on CircleCI due to random ProviderError
|
- t_ems_ext: *job_native_test_ext_gnosis
|
||||||
# and there are also other less frequent problems. See https://github.com/gnosis/safe-contracts/issues/216.
|
|
||||||
#-t_ems_ext: *job_native_test_ext_gnosis
|
|
||||||
- t_ems_ext: *job_native_test_ext_gnosis_v2
|
|
||||||
- t_ems_ext: *job_native_test_ext_zeppelin
|
- t_ems_ext: *job_native_test_ext_zeppelin
|
||||||
- t_ems_ext: *job_native_test_ext_ens
|
- t_ems_ext: *job_native_test_ext_ens
|
||||||
- t_ems_ext: *job_native_test_ext_trident
|
- t_ems_ext: *job_native_test_ext_trident
|
||||||
@ -1488,8 +1470,7 @@ workflows:
|
|||||||
<<: *workflow_trigger_on_tags
|
<<: *workflow_trigger_on_tags
|
||||||
requires:
|
requires:
|
||||||
- t_ems_compile_ext_colony
|
- t_ems_compile_ext_colony
|
||||||
- t_native_compile_ext_gnosis
|
- t_native_test_ext_gnosis
|
||||||
- t_native_test_ext_gnosis_v2
|
|
||||||
- t_native_test_ext_zeppelin
|
- t_native_test_ext_zeppelin
|
||||||
- t_native_test_ext_ens
|
- t_native_test_ext_ens
|
||||||
- t_native_test_ext_trident
|
- t_native_test_ext_trident
|
||||||
|
@ -39,7 +39,6 @@ printTask "Running external tests..."
|
|||||||
|
|
||||||
"{$REPO_ROOT}/test/externalTests/zeppelin.sh" "$@"
|
"{$REPO_ROOT}/test/externalTests/zeppelin.sh" "$@"
|
||||||
"{$REPO_ROOT}/test/externalTests/gnosis.sh" "$@"
|
"{$REPO_ROOT}/test/externalTests/gnosis.sh" "$@"
|
||||||
"{$REPO_ROOT}/test/externalTests/gnosis-v2.sh" "$@"
|
|
||||||
"{$REPO_ROOT}/test/externalTests/colony.sh" "$@"
|
"{$REPO_ROOT}/test/externalTests/colony.sh" "$@"
|
||||||
"{$REPO_ROOT}/test/externalTests/ens.sh" "$@"
|
"{$REPO_ROOT}/test/externalTests/ens.sh" "$@"
|
||||||
"{$REPO_ROOT}/test/externalTests/trident.sh" "$@"
|
"{$REPO_ROOT}/test/externalTests/trident.sh" "$@"
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# This file is part of solidity.
|
|
||||||
#
|
|
||||||
# solidity is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# solidity is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with solidity. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
#
|
|
||||||
# (c) 2020 solidity contributors.
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
source scripts/common.sh
|
|
||||||
source test/externalTests/common.sh
|
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
|
||||||
|
|
||||||
verify_input "$@"
|
|
||||||
BINARY_TYPE="$1"
|
|
||||||
BINARY_PATH="$2"
|
|
||||||
SELECTED_PRESETS="$3"
|
|
||||||
|
|
||||||
function compile_fn { npx truffle compile; }
|
|
||||||
function test_fn { npm test; }
|
|
||||||
|
|
||||||
function gnosis_safe_test
|
|
||||||
{
|
|
||||||
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
|
||||||
local ref_type=branch
|
|
||||||
local ref="v2_080"
|
|
||||||
local config_file="truffle-config.js"
|
|
||||||
|
|
||||||
local compile_only_presets=(
|
|
||||||
legacy-no-optimize # Compiles but migrations run out of gas: "Error: while migrating GnosisSafe: Returned error: base fee exceeds gas limit"
|
|
||||||
)
|
|
||||||
local settings_presets=(
|
|
||||||
"${compile_only_presets[@]}"
|
|
||||||
#ir-no-optimize # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
|
||||||
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
|
||||||
ir-optimize-evm+yul
|
|
||||||
legacy-optimize-evm-only
|
|
||||||
legacy-optimize-evm+yul
|
|
||||||
)
|
|
||||||
|
|
||||||
[[ $SELECTED_PRESETS != "" ]] || SELECTED_PRESETS=$(circleci_select_steps_multiarg "${settings_presets[@]}")
|
|
||||||
print_presets_or_exit "$SELECTED_PRESETS"
|
|
||||||
|
|
||||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
|
||||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
|
||||||
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
|
||||||
|
|
||||||
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
|
|
||||||
sed -i -E 's|"@gnosis.pm/util-contracts": "[^"]+"|"@gnosis.pm/util-contracts": "github:solidity-external-tests/util-contracts#solc-7_080"|g' package.json
|
|
||||||
|
|
||||||
neutralize_package_lock
|
|
||||||
neutralize_package_json_hooks
|
|
||||||
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc/dist" "$(first_word "$SELECTED_PRESETS")"
|
|
||||||
npm install --package-lock
|
|
||||||
npm install eth-gas-reporter
|
|
||||||
|
|
||||||
replace_version_pragmas
|
|
||||||
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc/dist"
|
|
||||||
|
|
||||||
for preset in $SELECTED_PRESETS; do
|
|
||||||
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc/dist" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
|
|
||||||
store_benchmark_report truffle gnosis2 "$repo" "$preset"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
external_test Gnosis-Safe-V2 gnosis_safe_test
|
|
@ -31,24 +31,26 @@ BINARY_TYPE="$1"
|
|||||||
BINARY_PATH="$2"
|
BINARY_PATH="$2"
|
||||||
SELECTED_PRESETS="$3"
|
SELECTED_PRESETS="$3"
|
||||||
|
|
||||||
function compile_fn { npx truffle compile; }
|
function compile_fn { npm run build; }
|
||||||
function test_fn { npm test; }
|
function test_fn { npm test; }
|
||||||
|
|
||||||
function gnosis_safe_test
|
function gnosis_safe_test
|
||||||
{
|
{
|
||||||
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
local repo="https://github.com/gnosis/safe-contracts.git"
|
||||||
local ref_type=branch
|
local ref_type=branch
|
||||||
local ref="development_080"
|
local ref=main
|
||||||
local config_file="truffle-config.js"
|
local config_file="hardhat.config.ts"
|
||||||
|
local config_var=userConfig
|
||||||
|
|
||||||
local compile_only_presets=()
|
local compile_only_presets=(
|
||||||
|
ir-optimize-evm+yul # Compiles but tests fail. See https://github.com/nomiclabs/hardhat/issues/2115
|
||||||
|
)
|
||||||
local settings_presets=(
|
local settings_presets=(
|
||||||
"${compile_only_presets[@]}"
|
"${compile_only_presets[@]}"
|
||||||
#ir-no-optimize # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
#ir-no-optimize # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
||||||
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
||||||
ir-optimize-evm+yul
|
legacy-no-optimize
|
||||||
#legacy-no-optimize # Compilation fails with "Stack too deep" error
|
legacy-optimize-evm-only
|
||||||
#legacy-optimize-evm-only # Compilation fails with "Stack too deep" error
|
|
||||||
legacy-optimize-evm+yul
|
legacy-optimize-evm+yul
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -59,20 +61,28 @@ function gnosis_safe_test
|
|||||||
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
download_project "$repo" "$ref_type" "$ref" "$DIR"
|
||||||
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
||||||
|
|
||||||
sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_080|g' package.json
|
# NOTE: The patterns below intentionally have hard-coded versions.
|
||||||
|
# When the upstream updates them, there's a chance we can just remove the regex.
|
||||||
|
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
|
||||||
|
sed -i 's|"@openzeppelin/contracts": "\^3\.4\.0"|"@openzeppelin/contracts": "^4.0.0"|g' package.json
|
||||||
|
|
||||||
|
# Disable two tests failing due to Hardhat's heuristics not yet updated to handle solc 0.8.10.
|
||||||
|
# TODO: Remove this when Hardhat implements them (https://github.com/nomiclabs/hardhat/issues/2051).
|
||||||
|
sed -i "s|\(it\)\(('should revert if called directly', async () => {\)|\1.skip\2|g" test/handlers/CompatibilityFallbackHandler.spec.ts
|
||||||
|
|
||||||
neutralize_package_lock
|
neutralize_package_lock
|
||||||
neutralize_package_json_hooks
|
neutralize_package_json_hooks
|
||||||
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc/dist" "$(first_word "$SELECTED_PRESETS")"
|
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
|
||||||
npm install --package-lock
|
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var"
|
||||||
npm install eth-gas-reporter
|
npm install
|
||||||
|
npm install hardhat-gas-reporter
|
||||||
|
|
||||||
replace_version_pragmas
|
replace_version_pragmas
|
||||||
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc/dist"
|
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc/dist"
|
||||||
|
|
||||||
for preset in $SELECTED_PRESETS; do
|
for preset in $SELECTED_PRESETS; do
|
||||||
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc/dist" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
|
hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn "$config_var"
|
||||||
store_benchmark_report truffle gnosis "$repo" "$preset"
|
store_benchmark_report hardhat gnosis "$repo" "$preset"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user