Skip to content

Commit

Permalink
Merge pull request #13810 from ethereum/external-tests-maintenance
Browse files Browse the repository at this point in the history
External tests maintenance
  • Loading branch information
nikola-matic committed Dec 16, 2022
2 parents fcfc965 + 4d627e6 commit 43cc4d0
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ emscripten_build/
/docs/_build
/docs/_static/robots.txt
/deps
/reports

# vim stuff
[._]*.sw[a-p]
Expand Down
4 changes: 2 additions & 2 deletions test/externalTests/chainlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function chainlink_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/2115).
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/3365).
sed -i "s|\(it\)\(('reverts'\)|\1.skip\2|g" test/v0.6/BasicConsumer.test.ts
sed -i "s|\(it\)\(('has a reasonable gas cost \[ @skip-coverage \]'\)|\1.skip\2|g" test/v0.6/BasicConsumer.test.ts
sed -i "s|\(describe\)\(('#add[^']*'\)|\1.skip\2|g" test/v0.6/Chainlink.test.ts
Expand All @@ -78,7 +78,7 @@ function chainlink_test
sed -i "s|\(context\)\(('when permissions are not set'\)|\1.skip\2|g" test/v0.8/KeeperRegistry.test.ts

# In some cases Hardhat does not detect revert reasons properly via IR.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "s|\(it\)\(('does not allow the specified address to start new rounds'\)|\1.skip\2|g" test/v0.6/FluxAggregator.test.ts
sed -i "s|\(describe\)\(('when called by a stranger'\)|\1.skip\2|g" test/v0.6/FluxAggregator.test.ts
sed -i "s|\(describe\)\(('if the access control is turned on'\)|\1.skip\2|g" test/v0.*/Flags.test.ts
Expand Down
2 changes: 1 addition & 1 deletion test/externalTests/elementfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function elementfi_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/2115).
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/3365).
sed -i 's|it(\("fails to withdraw more shares than in balance"\)|it.skip(\1|g' test/compoundAssetProxyTest.ts
sed -i 's|it(\("should prevent withdrawal of Principal Tokens and Interest Tokens before the tranche expires "\)|it.skip(\1|g' test/trancheTest.ts
sed -i 's|it(\("should prevent withdrawal of more Principal Tokens and Interest Tokens than the user has"\)|it.skip(\1|g' test/trancheTest.ts
Expand Down
3 changes: 1 addition & 2 deletions test/externalTests/ens.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ function ens_test
neutralize_packaged_contracts

# In some cases Hardhat does not detect revert reasons properly via IR.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2115 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "s|it\(('Does not allow wrapping a name you do not own',\)|it.skip\1|g" test/wrapper/NameWrapper.js
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
sed -i "s|it\(('can set fuses and then burn ability to burn fuses',\)|it.skip\1|g" test/wrapper/NameWrapper.js
sed -i "s|it\(('can set fuses and burn canSetResolver and canSetTTL',\)|it.skip\1|g" test/wrapper/NameWrapper.js
sed -i "s|it\(('Cannot be called if CANNOT_TRANSFER is burned\.',\)|it.skip\1|g" test/wrapper/NameWrapper.js
Expand Down
6 changes: 1 addition & 5 deletions test/externalTests/euler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function euler_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "/expectError: 'JUNK_UPGRADE_TEST_FAILURE'/d" test/moduleUpgrade.js
sed -i "/et\.expect(errMsg)\.to\.contain('e\/collateral-violation');/d" test/flashLoanNative.js

Expand All @@ -73,10 +73,6 @@ function euler_test
force_hardhat_compiler_settings "$config_file" "$(first_word "$SELECTED_PRESETS")"
force_hardhat_unlimited_contract_size "$config_file"
npm install

# TODO: Remove this when https://github.com/Uniswap/v3-periphery/issues/313 gets fixed.
npm install @uniswap/v3-periphery@1.4.1

replace_version_pragmas
neutralize_packaged_contracts

Expand Down
10 changes: 3 additions & 7 deletions test/externalTests/gnosis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ function gnosis_safe_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/2115).
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/3365).
sed -i "s|\(it\)\(('should not allow to call setup on singleton'\)|\1.skip\2|g" test/core/GnosisSafe.Setup.spec.ts
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i 's|\(it\)\(("changes the expected storage slot without touching the most important ones"\)|\1.skip\2|g' test/libraries/SignMessageLib.spec.ts
sed -i "s|\(it\)\(('can be used only via DELEGATECALL opcode'\)|\1.skip\2|g" test/libraries/SignMessageLib.spec.ts
sed -i 's|\(describe\)\(("Upgrade from Safe 1.1.1"\)|\1.skip\2|g' test/migration/UpgradeFromSafe111.spec.ts
Expand All @@ -82,7 +82,7 @@ function gnosis_safe_test
# TODO: Remove this when Gnosis merges https://github.com/gnosis/safe-contracts/pull/394
sed -i "s|\(function isValidSignature(bytes \)calldata\( _data, bytes \)calldata\( _signature)\)|\1memory\2memory\3|g" contracts/handler/CompatibilityFallbackHandler.sol

# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "s|it\(('should enforce delegatecall'\)|it.skip\1|g" test/accessors/SimulateTxAccessor.spec.ts
sed -i "s|it\(('can only be called from Safe itself'\)|it.skip\1|g" test/libraries/Migration.spec.ts
sed -i "s|it\(('should enforce delegatecall to MultiSend'\)|it.skip\1|g" test/libraries/MultiSend.spec.ts
Expand Down Expand Up @@ -122,10 +122,6 @@ function gnosis_safe_test
# TODO: Remove when https://github.com/safe-global/safe-contracts/issues/436 is resolved.
npx npm install @nomiclabs/hardhat-ethers@2.1.0

# Hardhat 2.9.5 introduced a bug with handling padded arguments to getStorageAt().
# TODO: Remove when https://github.com/NomicFoundation/hardhat/issues/2709 is fixed.
npx npm install hardhat@2.9.4

replace_version_pragmas
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc/dist"

Expand Down
2 changes: 1 addition & 1 deletion test/externalTests/gp2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function gp2_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/2115).
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/3365).
sed -i 's|it\(("should revert when encoding invalid flags"\)|it.skip\1|g' test/GPv2Trade.test.ts

replace_version_pragmas
Expand Down
2 changes: 1 addition & 1 deletion test/externalTests/perpetual-pools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function perpetual_pools_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/2115).
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/3365).
sed -i 's|\(it\)\(("Should not allow commits that are too large"\)|\1.skip\2|g' test/PoolCommitter/commit.spec.ts
sed -i 's|\(it\)\(("Should not allow for too many commitments (that bring amount over a user'\''s balance)"\)|\1.skip\2|g' test/PoolCommitter/commit.spec.ts

Expand Down
2 changes: 1 addition & 1 deletion test/externalTests/pool-together.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function pool_together_test
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
download_project "$repo" "$ref_type" "$ref" "$DIR"

# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "s|it\(('should fail to return value if value passed does not fit in [0-9]\+ bits'\)|it.skip\1|g" test/libraries/ExtendedSafeCast.test.ts
sed -i "s|it\(('should require an rng to be requested'\)|it.skip\1|g" test/DrawBeacon.test.ts

Expand Down
2 changes: 1 addition & 1 deletion test/externalTests/prb-math.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function prb_math_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/2115).
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/3365).
pushd test/contracts/prbMathUd60x18/pure/
sed -i 's|context(\("when the sum overflows"\)|context.skip(\1|g' add.test.ts
sed -i 's|context(\("when the sum does not overflow"\)|context.skip(\1|g' add.test.ts
Expand Down
2 changes: 1 addition & 1 deletion test/externalTests/trident.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function trident_test
sed -i 's|IStrategy(0)|IStrategy(address(0))|g' contracts/flat/BentoBoxV1Flat.sol
find contracts -name "*.sol" -exec sed -i -e 's/^\(\s*\)\(assembly\)/\1\/\/\/ @solidity memory-safe-assembly\n\1\2/' '{}' \;

# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i 's|it\(("Reverts on direct deployment via factory"\)|it.skip\1|g' test/MasterDeployer.test.ts

# @sushiswap/core package contains contracts that get built with 0.6.12 and fail our compiler
Expand Down
2 changes: 1 addition & 1 deletion test/externalTests/uniswap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function uniswap_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2115 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "s|it\(('underpay zero for one and exact in',\)|it.skip\1|g" test/UniswapV3Pool.spec.ts
sed -i "s|it\(('pay in the wrong token zero for one and exact in',\)|it.skip\1|g" test/UniswapV3Pool.spec.ts
sed -i "s|it\(('underpay zero for one and exact out',\)|it.skip\1|g" test/UniswapV3Pool.spec.ts
Expand Down
6 changes: 3 additions & 3 deletions test/externalTests/zeppelin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function zeppelin_test

# Disable tests that won't pass on the ir presets due to Hardhat heuristics. Note that this also disables
# them for other presets but that's fine - we want same code run for benchmarks to be comparable.
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/2115).
# TODO: Remove this when Hardhat adjusts heuristics for IR (https://github.com/nomiclabs/hardhat/issues/3365).
pushd test/utils/
sed -i "s|it(\('reverts \)|it.skip(\1|g" math/SafeMath.test.js
sed -i "s|it(\('reverts \)|it.skip(\1|g" math/SignedSafeMath.test.js
Expand All @@ -75,7 +75,7 @@ function zeppelin_test


# In some cases Hardhat does not detect revert reasons properly via IR.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2453 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "s|it(\('reverts if the current value is 0'\)|it.skip(\1|g" test/utils/Counters.test.js
sed -i "s|it(\('prevent unauthorized maintenance'\)|it.skip(\1|g" test/governance/TimelockController.test.js
sed -i "s|it(\('cannot cancel invalid operation'\)|it.skip(\1|g" test/governance/TimelockController.test.js
Expand Down Expand Up @@ -123,7 +123,7 @@ function zeppelin_test



# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/2115 gets fixed.
# TODO: Remove this when https://github.com/NomicFoundation/hardhat/issues/3365 gets fixed.
sed -i "s|describe\(('Polygon-Child'\)|describe.skip\1|g" test/crosschain/CrossChainEnabled.test.js
sed -i "s|it(\('revert with invalid multi proof #2'\)|it.skip(\1|g" test/utils/cryptography/MerkleProof.test.js
sed -i "s|describe(\('to a receiver contract that panics'\)|describe.skip(\1|g" test/token/ERC721/ERC721.behavior.js
Expand Down

0 comments on commit 43cc4d0

Please sign in to comment.