Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal process hangs indefinitely after running tests with numerous contract calls #78

Open
Confucian-e opened this issue Aug 15, 2024 · 3 comments

Comments

@Confucian-e
Copy link

Confucian-e commented Aug 15, 2024

Description

When running tests using the test --v command (regardless of the number of v flags), the terminal process fails to terminate if there are numerous contract calls during the test execution. This issue persists even when attempting to close the terminal using Ctrl + C.

Steps to Reproduce

Set up a Hardhat project with multiple tests involving numerous contract calls.
Run the tests using npx hardhat test --v (or --vv, --vvv, etc.).
Wait for the tests to complete.
Attempt to end the process or close the terminal.

Expected Behavior

The terminal process should end immediately after the tests complete or when interrupted with Ctrl + C.

Actual Behavior

The terminal process continues to run indefinitely, and Ctrl + C does not terminate it. The only way to end the process is to forcibly close the terminal window.

Environment

Operating System: MacOS
Node.js version: v20.15.0

package.json

{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
    "@nomicfoundation/hardhat-ethers": "^3.0.0",
    "@nomicfoundation/hardhat-ignition": "^0.15.0",
    "@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
    "@nomicfoundation/hardhat-network-helpers": "^1.0.0",
    "@nomicfoundation/hardhat-toolbox": "^5.0.0",
    "@nomicfoundation/hardhat-verify": "^2.0.0",
    "@openzeppelin/hardhat-upgrades": "^3.2.1",
    "@openzeppelin/merkle-tree": "^1.0.7",
    "@typechain/ethers-v6": "^0.5.0",
    "@typechain/hardhat": "^9.0.0",
    "@types/chai": "^4.2.0",
    "@types/mocha": ">=9.1.0",
    "@types/node": ">=18.0.0",
    "chai": "^4.2.0",
    "ethers": "^6.4.0",
    "hardhat": "^2.22.6",
    "hardhat-abi-exporter": "^2.10.1",
    "hardhat-deal": "^3.1.1",
    "hardhat-gas-reporter": "^1.0.8",
    "hardhat-tracer": "^3.1.0",
    "ohash": "^1.1.3",
    "solidity-coverage": "^0.8.0",
    "ts-node": ">=8.0.0",
    "typechain": "^8.3.0",
    "typescript": ">=4.5.0"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^5.0.2",
    "@openzeppelin/contracts-upgradeable": "^5.0.2"
  },
  "optionalDependencies": {
    "viem": "^2.18.8"
  }
}

Additional Context

This issue has been reproduced on multiple machines with different configurations.
The problem seems to occur only when there are many contract calls during test execution.
The issue is consistent across different levels of verbosity (-v, -vv, -vvv).

Possible Related Factors

High volume of contract calls during tests
Interaction between hardhat-tracer and the test runner
Potential memory leak or unhandled asynchronous operations

Any assistance in resolving this issue would be greatly appreciated. Please let me know if you need any additional information or if you'd like me to run any specific diagnostics.

@Confucian-e
Copy link
Author

This is the first time using hardhat-tracer and hardhat-deal plugins together in this project.
The tests make use of the deal(token, account, amount) function provided by hardhat-deal.

@Rubilmax
Copy link
Contributor

Hi @Confucian-e , could you provide a minimal test case to reproduce the bug pls?

Something where deal is used and a contract call is made, leaving the process hanging. My first lead is to test whether the process still hangs if deal usage is removed

@zemse
Copy link
Owner

zemse commented Sep 1, 2024

I tried using both hardhat-deal along with hardhat-tracer in a fresh project. It seems to work, I do notice that deal function makes a bunch of balanceOf calls, but couldn't reproduce the hanging.

A repro would definitely help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants