truffle icon indicating copy to clipboard operation
truffle copied to clipboard

Configure Web3 to use WebsocketProvider when connecting to ganache

Open cds-amal opened this issue 3 years ago • 2 comments

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.

cds-amal avatar Jan 21 '22 21:01 cds-amal

#5065 should be taken into consideration for this PR

cds-amal avatar Apr 28 '22 15:04 cds-amal

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.

eggplantzzz avatar Jul 12 '22 19:07 eggplantzzz

We should see how the test suite fares after rebasing against develop.

eggplantzzz avatar Sep 27 '22 17:09 eggplantzzz

closing this as we switched the testing framework to use "eager" instamine mode which is not technically correct behavior but speeds up tests significantly.

eggplantzzz avatar Oct 11 '22 17:10 eggplantzzz