-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Truffle test is spamming node with hundreds of eth_getBlockByNumber requests per second #3522
Comments
Checked different versions: Truffle prior to But from (Btw |
There's something interacting weirdly with the version of web3 we upgraded to in 5.1.50. We're looking into the problem but don't have any leads yet. If anyone can help figure out what's causing this, it'd be much appreciated. cc @cgewecke since I believe you brought this to our attention elsewhere |
Yes, I was suspecting the web3 1.2.9 too, cause there are some issues here and there about it causing some weird behaviour (including getBlock failure). I've tried downgrading the web3 back to 1.2.1, but the behaviour didn't change. Same with upgrading it to 1.3.0 - no positive result. Although I did it via |
Truffle bundles its dependencies for portability reasons, so that won't help. Your option at this point is to downgrade to v5.1.49, unfortunately, until we can figure this out. If we can't figure this out, Truffle might be forced to downgrade web3 itself, but I'd really like to avoid that because it took forever to upgrade in the first place :/ |
Root cause is discussed/diagnosed in #2688. Idea for simple, more or less non-breaking fix in 3446 comment |
Workaround has been released: https://github.com/trufflesuite/truffle/releases/tag/v5.1.55 |
Closing this as a workaround has been released with version 5.1.55. The workaround - quoting from #2688:
|
@eggplantzzz Would it be advisable to use this workaround for the default |
I searched for truffle calling lots of superflous My truffle version is
and my ganache version is
so at first I thought it cannot be this bug, because as far as I understood the linked threads it sounded like it was fixed by now. Anyway, I proceeded to use the workaround, e.g. using the above mentioned setting in
and it reduced the time that my |
@kiview When you send a transaction, web3 provides a listener for the "confirmation" event which I believe fires when the tx is included in a block and then again for every new block where that the transaction is part of the history. If you don't use the "confirmation" listener then I think you should be fine disabling it. The whole reason this causes slowness is because web3 polls over and over to check for these new blocks if it knows you are listening for the event. |
Set disableConfirmationListener: true to avoid spamming ganache during tests. trufflesuite/truffle#3522
* Anderson/remove deposit record (#382) * remove DepositRecord in every handler, modify event in Bridge, modify IDepositExecute interface * modify test files based on removing deposit records * add handlerResponse to deposit event and modify test files based on the event * Rename chainID to domainID (#384) * Add admin set deposit nonce (#385) * Сombine vote and execute [Breaking] (#389) * Remove resources from handler constructors (#393) * Update dependencies and bump version (#394) Set disableConfirmationListener: true to avoid spamming ganache during tests. trufflesuite/truffle#3522 * Remove fund functions (#412) Co-authored-by: andersonlee725 <86676141+andersonlee725@users.noreply.github.com> Co-authored-by: Oleksii Matiiasevych <oleksii@chainsafe.io>
* Anderson/remove deposit record (#382) * remove DepositRecord in every handler, modify event in Bridge, modify IDepositExecute interface * modify test files based on removing deposit records * add handlerResponse to deposit event and modify test files based on the event * Rename chainID to domainID (#384) * Add admin set deposit nonce (#385) * Сombine vote and execute [Breaking] (#389) * Remove resources from handler constructors (#393) * Update dependencies and bump version (#394) Set disableConfirmationListener: true to avoid spamming ganache during tests. trufflesuite/truffle#3522 * Remove fund functions (#412) Co-authored-by: andersonlee725 <86676141+andersonlee725@users.noreply.github.com> Co-authored-by: Oleksii Matiiasevych <oleksii@chainsafe.io>
* Anderson/remove deposit record (#382) * remove DepositRecord in every handler, modify event in Bridge, modify IDepositExecute interface * modify test files based on removing deposit records * add handlerResponse to deposit event and modify test files based on the event * Rename chainID to domainID (#384) * Add admin set deposit nonce (#385) * Сombine vote and execute [Breaking] (#389) * Remove resources from handler constructors (#393) * Update dependencies and bump version (#394) Set disableConfirmationListener: true to avoid spamming ganache during tests. trufflesuite/truffle#3522 * Remove fund functions (#412) Co-authored-by: andersonlee725 <86676141+andersonlee725@users.noreply.github.com> Co-authored-by: Oleksii Matiiasevych <oleksii@chainsafe.io>
Issue
Truffle sends hundreds of eth_getBlockByNumbers requests per second, and the number grows along with how long the tests go (making it closer to thousands in big test scripts). Probably that is somehow related to txReceipt, await, or smth - I'm not sure.
The result of this is node getting incredibly slow, and finally the connection crashes.
Tried with different nodes (Ganache, Hardhat, Nethermind) - the behaviour is the same.
Steps to Reproduce
truffle test
(It was reproducible on my project too, just giving xDAI as an open-sourced example anyone can clone and reproduce)
Expected Behavior
I have no idea why truffle would need so many eth_getBlockByNumber requests for one receipt.
Actual Results
Environment
truffle version
): v5.1.52 (core: 5.1.52)node --version
): v12.19.0npm --version
): 6.14.8The text was updated successfully, but these errors were encountered: