truffle
truffle copied to clipboard
Configure Web3 to use WebsocketProvider when connecting to ganache
This PR improves the performance of truffle test on the command line, and test within the console and develop REPL. The speed increase comes from bypassing the web3's polling mechanism, which kicks in after about 1sec. This added delay accumulates in an unpleasant user experience when there are many user tests.
Also note, this PR changes the instamine mode of truffle develop to strict which is consistent with other truffle testing paths.
@davidmurdoch suggested configuring keep-alive and reconnect logic via options to web3, but I'm not sure if it's necessary in our use-cases here, and I still have to grok Web3's implementation and defaults. I propose this as follow-up work if we can gain a better developer experience now.
Status
This PR is currently blocked by an issue with @truffle/db.
#5065 should be taken into consideration for this PR
Currently there seems to be an issue on the Ganache side that is making CI hang during the tests. From @davidmurdoch in a private chat:
The issue is that if a request comes into ganache right after (or during) a disconnect ganache won't
ever respond (it won't even reject/throw)...so the receiving end keeps waiting for ganache to respond.
We'll have to wait until this is resolved and ensure we have the proper setup/teardown on the Truffle side.
We should see how the test suite fares after rebasing against develop.
closing this as we switched the testing framework to use "eager" instamine mode which is not technically correct behavior but speeds up tests significantly.