Truffle proxy contract test fails with PollingBlock ETIMEDOUT

Truffle Tests of UUPS proxy smart-contract fails with ETIMEDOUT

My test for UUPS proxy contract fails with:
Uncaught PollingBlockTracker - encountered an error while attempting to update latest block: Error: ETIMEDOUT
I'm running truffle test test/<my-file>, thus I'm not connecting to any RPC and don't understand how that could possibly fail.
Non-upgradable tests don't suffer.

  1) Contract: MyContract
       "before all" hook: prepare suite for "should fail to deploy if unstake timestamp is bigger than end timestamp":
     Uncaught PollingBlockTracker - encountered an error while attempting to update latest block:
Error: ETIMEDOUT
    at Timeout.<anonymous> (/Users/.../node_modules/request/request.js:848:19)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)
  Error: PollingBlockTracker - encountered an error while attempting to update latest block:
  Error: ETIMEDOUT
      at Timeout.<anonymous> (node_modules/request/request.js:848:19)
      at listOnTimeout (node:internal/timers:557:17)
      at processTimers (node:internal/timers:500:7)
      at PollingBlockTracker._performSync (node_modules/eth-block-tracker/src/polling.js:51:24)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

  2) Contract: MyContract
       "before all" hook: prepare suite for "should fail to deploy if unstake timestamp is bigger than end timestamp":
     Error: done() called multiple times in hook <Contract: MyContract "before all" hook: prepare suite for "should fail to deploy if unstake timestamp is bigger than end timestamp"> of file /Users/.../test/MyContract.js
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)


And in another case, I get next error:

 1) Contract: MyContract
       should fail to deploy if unstake timestamp is bigger than end timestamp:
     Error: Invalid JSON RPC response: ""
      at Object.InvalidResponse (node_modules/web3/node_modules/web3-core-helpers/lib/errors.js:43:16)
      at XMLHttpRequest.request.onreadystatechange (node_modules/web3/node_modules/web3-providers-http/lib/index.js:95:32)
      at XMLHttpRequestEventTarget.dispatchEvent (node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
      at XMLHttpRequest._setReadyState (node_modules/xhr2-cookies/xml-http-request.ts:219:8)
      at XMLHttpRequest._onHttpRequestError (node_modules/xhr2-cookies/xml-http-request.ts:379:8)
      at ClientRequest.<anonymous> (node_modules/xhr2-cookies/xml-http-request.ts:266:37)
      at ClientRequest.emit (node:events:390:28)
      at Socket.socketErrorListener (node:_http_client:447:9)
      at Socket.emit (node:events:390:28)
      at emitErrorNT (node:internal/streams/destroy:164:8)
      at emitErrorCloseNT (node:internal/streams/destroy:129:3)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

  2) Contract: MyContract
       with deployed contract which has unavailable unstake
         should fail to unstake:
     Error: Invalid JSON RPC response: ""
      at Object.InvalidResponse (node_modules/web3/node_modules/web3-core-helpers/lib/errors.js:43:16)
      at XMLHttpRequest.request.onreadystatechange (node_modules/web3/node_modules/web3-providers-http/lib/index.js:95:32)
      at XMLHttpRequestEventTarget.dispatchEvent (node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
      at XMLHttpRequest._setReadyState (node_modules/xhr2-cookies/xml-http-request.ts:219:8)
      at XMLHttpRequest._onHttpRequestError (node_modules/xhr2-cookies/xml-http-request.ts:379:8)
      at ClientRequest.<anonymous> (node_modules/xhr2-cookies/xml-http-request.ts:266:37)
      at ClientRequest.emit (node:events:390:28)
      at Socket.socketErrorListener (node:_http_client:447:9)
      at Socket.emit (node:events:390:28)
      at emitErrorNT (node:internal/streams/destroy:164:8)
      at emitErrorCloseNT (node:internal/streams/destroy:129:3)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

:computer: Environment

Truffle v5.4.23 (core: 5.4.23)
Solidity - 0.8.3 (solc-js)
Node v17.0.1
Web3.js v1.5.3

Does this happen consistently?

Yes it does. The issue is only with upgradable contracts.

Hi @vlad1, Truffle has a dependency on Ganache, and Ganache only supports Node 17 as of its v7.0.0 release today https://github.com/trufflesuite/ganache/releases. Can you try a different version of Node or try again after Truffle is updated with the latest version of Ganache?

Hey there!

Sorry for long delay.
All of my tests with proxy become legacy and were smoke-tested as truffle test didn't work.

I've upgraded truffle globally, truffle version now is next:

Truffle v5.4.31 (core: 5.4.31)
Solidity - 0.8.3 (solc-js)
Node v17.0.1
Web3.js v1.5.3

I will need some time, one week approx. in order to test if the issue still persists.
I would like to stay with Proxy pattern and keep it test-coveraged, so I will reply back asap.

Alternatively just downgrade to Node 16.

I found out that the issue is with expectRevert:
Stack trace is next:

Error: Invalid JSON RPC response: ""
      at Object.InvalidResponse (node_modules/web3/node_modules/web3-core-helpers/lib/errors.js:43:16)
      at XMLHttpRequest.request.onreadystatechange (node_modules/web3/node_modules/web3-providers-http/lib/index.js:95:32)
      at XMLHttpRequestEventTarget.dispatchEvent (node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
      at XMLHttpRequest._setReadyState (node_modules/xhr2-cookies/xml-http-request.ts:219:8)
      at XMLHttpRequest._onHttpRequestError (node_modules/xhr2-cookies/xml-http-request.ts:379:8)
      at ClientRequest.<anonymous> (node_modules/xhr2-cookies/xml-http-request.ts:266:37)
      at ClientRequest.emit (node:events:390:28)
      at Socket.socketErrorListener (node:_http_client:447:9)
      at Socket.emit (node:events:390:28)
      at emitErrorNT (node:internal/streams/destroy:164:8)
      at emitErrorCloseNT (node:internal/streams/destroy:129:3)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

Moved to this Invalid JSON RPC response when using Test Helpers expectRevert OpenZeppelin Test Environment - #4 by MichaelKashofer issue