Skip to content

Commit

Permalink
Merge pull request #14932 from ethereum/add-hardhat-networks-settings…
Browse files Browse the repository at this point in the history
…-ext-tests

Add hardhat networks settings external tests
  • Loading branch information
r0qs committed Mar 13, 2024
2 parents cc79c91 + 6b3ca24 commit 9065a0a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
16 changes: 10 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1919,11 +1919,13 @@ workflows:
- t_ext: *job_native_test_ext_elementfi
- t_ext: *job_native_test_ext_brink
- t_ext: *job_native_compile_ext_gp2
- t_ext: *job_native_compile_ext_trident
- t_ext: *job_native_compile_ext_euler
- t_ext: *job_native_compile_ext_bleeps
- t_ext: *job_native_compile_ext_pool_together
- t_ext: *job_native_compile_ext_chainlink
# TODO: Dropping the external tests below since they are based on old forks and
# fail after update the default evm version to cancun.
#- t_ext: *job_native_compile_ext_trident
#- t_ext: *job_native_compile_ext_chainlink
#- t_ext: *job_native_compile_ext_bleeps

- c_ext_benchmarks:
<<: *requires_nothing
Expand All @@ -1941,11 +1943,13 @@ workflows:
# TODO: Dropping prb-math from the benchmarks since it is not implemented yet
# in the new Foundry external testing infrastructure.
# - t_native_test_ext_prb_math
- t_native_compile_ext_trident
- t_native_compile_ext_euler
- t_native_compile_ext_bleeps
- t_native_compile_ext_pool_together
- t_native_compile_ext_chainlink
# TODO: Dropping the external tests below since they are based on old forks and
# fail after update the default evm version to cancun.
#- t_native_compile_ext_trident
#- t_native_compile_ext_chainlink
#- t_native_compile_ext_bleeps

# Windows build and tests
- b_win: *requires_nothing
Expand Down
4 changes: 4 additions & 0 deletions scripts/externalTests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,16 @@ function force_hardhat_compiler_settings
echo "require('hardhat-gas-reporter');"
echo "module.exports.gasReporter = ${gas_reporter_settings};"
echo "module.exports.solidity = ${compiler_settings};"
echo "module.exports.networks.hardhat = module.exports.networks.hardhat || { hardfork: '${evm_version}' }"
echo "module.exports.networks.hardhat.hardfork = '${evm_version}'"
else
[[ $config_file == *\.ts ]] || assertFail
[[ $config_var_name != "" ]] || assertFail
echo 'import "hardhat-gas-reporter";'
echo "${config_var_name}.gasReporter = ${gas_reporter_settings};"
echo "${config_var_name}.solidity = {compilers: [${compiler_settings}]};"
echo "${config_var_name}.networks!.hardhat = ${config_var_name}.networks!.hardhat ?? { hardfork: '${evm_version}' };"
echo "${config_var_name}.networks!.hardhat!.hardfork = '${evm_version}'"
fi >> "$config_file"
}

Expand Down
1 change: 1 addition & 0 deletions test/externalTests/brink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function brink_test
# TODO: Remove this when Brink merges https://github.com/brinktrade/brink-core/pull/52
sed -i "s|\(function isValidSignature(bytes \)calldata\( _data, bytes \)calldata\( _signature)\)|\1memory\2memory\3|g" src/Test/MockEIP1271Validator.sol

neutralize_package_lock
neutralize_package_json_hooks
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var" "$CURRENT_EVM_VERSION" "$extra_settings" "$extra_optimizer_settings"
Expand Down
4 changes: 1 addition & 3 deletions test/externalTests/elementfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ function elementfi_test
# "ProviderError: Too Many Requests error received from eth-mainnet.alchemyapi.io"
rm test/mockERC20YearnVaultTest.ts

# Several tests fail unless we use the exact versions hard-coded in package-lock.json
#neutralize_package_lock

neutralize_package_lock
neutralize_package_json_hooks
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var"
Expand Down
1 change: 1 addition & 0 deletions test/externalTests/gnosis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function gnosis_safe_test
sed -i "s|\(it\)\((\"can be used only via DELEGATECALL opcode\"\)|\1.skip\2|g" test/libraries/SignMessageLib.spec.ts
sed -i "s|it\((\"can only be called from Safe itself\"\)|it.skip\1|g" test/libraries/Migration.spec.ts

neutralize_package_lock
neutralize_package_json_hooks
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var"
Expand Down
3 changes: 3 additions & 0 deletions test/externalTests/pool-together.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ function pool_together_test
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")" "$config_var"
yarn install
# Hardhat 2.20.0 is the last version that works. Newer versions throw this error:
# Unexpected config HardhatConfig.networks.hardhat.initialBaseFeePerGas found - This field is only valid for networks with EIP-1559. Try a newer hardfork or remove it.
yarn add hardhat@2.20.0

# These come with already compiled artifacts. We want them recompiled with latest compiler.
rm -r node_modules/@pooltogether/yield-source-interface/artifacts/
Expand Down

0 comments on commit 9065a0a

Please sign in to comment.