Skip to content

Commit 5499c58

Browse files
authored
Merge pull request #12529 from ethereum/euler-ext-test
External test for Euler
2 parents 7c1daa5 + 054f1cb commit 5499c58

File tree

5 files changed

+102
-1
lines changed

5 files changed

+102
-1
lines changed

.circleci/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,13 @@ workflows:
13811381
binary_type: native
13821382
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
13831383
nodejs_version: '16'
1384+
- t_ems_ext:
1385+
<<: *workflow_ubuntu2004_static
1386+
name: t_native_test_ext_euler
1387+
project: euler
1388+
binary_type: native
1389+
# NOTE: Tests crash on nodejs 17: "Error: error:0308010C:digital envelope routines::unsupported"
1390+
nodejs_version: '16'
13841391

13851392
# Windows build and tests
13861393
- b_win: *workflow_trigger_on_tags

test/externalTests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ printTask "Running external tests..."
4343
"$REPO_ROOT/externalTests/colony.sh" "$@"
4444
"$REPO_ROOT/externalTests/ens.sh" "$@"
4545
"$REPO_ROOT/externalTests/trident.sh" "$@"
46+
"$REPO_ROOT/externalTests/euler.sh" "$@"

test/externalTests/common.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,26 @@ function force_hardhat_compiler_binary
227227
hardhat_solc_build_subtask "$SOLCVERSION_SHORT" "$SOLCVERSION" "$binary_type" "$solc_path" "$language" >> "$config_file"
228228
}
229229

230+
function force_hardhat_unlimited_contract_size
231+
{
232+
local config_file="$1"
233+
local config_var_name="$2"
234+
235+
printLog "Configuring Hardhat..."
236+
echo "-------------------------------------"
237+
echo "Allow unlimited contract size: true"
238+
echo "-------------------------------------"
239+
240+
if [[ $config_file == *\.js ]]; then
241+
[[ $config_var_name == "" ]] || assertFail
242+
echo "module.exports.networks.hardhat.allowUnlimitedContractSize = true" >> "$config_file"
243+
else
244+
[[ $config_file == *\.ts ]] || assertFail
245+
[[ $config_var_name != "" ]] || assertFail
246+
echo "${config_var_name}.networks!.hardhat!.allowUnlimitedContractSize = true" >> "$config_file"
247+
fi
248+
}
249+
230250
function force_hardhat_compiler_settings
231251
{
232252
local config_file="$1"

test/externalTests/ens.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ function ens_test
5656

5757
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
5858
download_project "$repo" "$ref_type" "$ref" "$DIR"
59-
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
6059

6160
neutralize_package_lock
6261
neutralize_package_json_hooks

test/externalTests/euler.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bash
2+
3+
# ------------------------------------------------------------------------------
4+
# This file is part of solidity.
5+
#
6+
# solidity is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# solidity is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with solidity. If not, see <http://www.gnu.org/licenses/>
18+
#
19+
# (c) 2022 solidity contributors.
20+
#------------------------------------------------------------------------------
21+
22+
set -e
23+
24+
source scripts/common.sh
25+
source test/externalTests/common.sh
26+
27+
verify_input "$@"
28+
BINARY_TYPE="$1"
29+
BINARY_PATH="$2"
30+
SELECTED_PRESETS="$3"
31+
32+
function compile_fn { npm run compile; }
33+
function test_fn { npx --no hardhat --no-compile test; }
34+
35+
function euler_test
36+
{
37+
local repo="https://github.com/euler-xyz/euler-contracts"
38+
local ref_type=branch
39+
local ref="master"
40+
local config_file="hardhat.config.js"
41+
42+
local compile_only_presets=()
43+
local settings_presets=(
44+
"${compile_only_presets[@]}"
45+
#ir-no-optimize # Compilation fails with "YulException: Variable var_utilisation_307 is 6 slot(s) too deep inside the stack."
46+
#ir-optimize-evm-only # Compilation fails with "YulException: Variable var_utilisation_307 is 6 slot(s) too deep inside the stack."
47+
#ir-optimize-evm+yul # Compilation fails with "YulException: Variable var_status_mpos is 3 too deep in the stack"
48+
legacy-optimize-evm-only
49+
legacy-optimize-evm+yul
50+
legacy-no-optimize
51+
)
52+
53+
[[ $SELECTED_PRESETS != "" ]] || SELECTED_PRESETS=$(circleci_select_steps_multiarg "${settings_presets[@]}")
54+
print_presets_or_exit "$SELECTED_PRESETS"
55+
56+
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
57+
download_project "$repo" "$ref_type" "$ref" "$DIR"
58+
59+
neutralize_package_lock
60+
neutralize_package_json_hooks
61+
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
62+
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")"
63+
force_hardhat_unlimited_contract_size "$config_file"
64+
npm install
65+
66+
replace_version_pragmas
67+
neutralize_packaged_contracts
68+
69+
for preset in $SELECTED_PRESETS; do
70+
hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
71+
done
72+
}
73+
74+
external_test Euler euler_test

0 commit comments

Comments
 (0)