You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
@truffle/contract registers a 'confirmation' event listener, which gets fired every time there is a new block until the number of requested confirmations is reached. The default number of confirmations is 24, and there is no way to configure this value from the outside.
This means that sending a transaction via a @truffle/contract object will spawn a Node timeout object that will not be removed until 24 confirmations arrive, blocking the event loop and preventing the process from exiting. This is not an issue in truffle test because the CLI calls process.exit() directly.
This also causes performance issues, since 25 receipts will be requested to the provider per transaction, while often (e.g. in testing environments) a single confirmation is sufficient.
It'd be great if @truffle/contract had an API exposing the number of confirmations it requires from web3 (probably at the contract abstraction creation level, so that all instances have this same value).
Create a @truffle/contract object and send a transaction from it in a non-truffle environment (outside of truffle test or truffle exec), the process won't end until the contract receives 24 confirmations of the transaction being mined.
Environment
"@truffle/contract": "^4.0.38"
The text was updated successfully, but these errors were encountered:
There might be some work to be done if people still want to be able to configure the number of confirmations (I'm not sure if that is supported yet). Like if someone wanted to specify to wait for 5 confirmations, then maybe they should have this option. I'm not sure if the confirmations property under networks here solves this issue? https://www.trufflesuite.com/docs/truffle/reference/configuration#networks
Issue
@truffle/contract
registers a'confirmation'
event listener, which gets fired every time there is a new block until the number of requested confirmations is reached. The default number of confirmations is 24, and there is no way to configure this value from the outside.This means that sending a transaction via a
@truffle/contract
object will spawn a Node timeout object that will not be removed until 24 confirmations arrive, blocking the event loop and preventing the process from exiting. This is not an issue intruffle test
because the CLI callsprocess.exit()
directly.This also causes performance issues, since 25 receipts will be requested to the provider per transaction, while often (e.g. in testing environments) a single confirmation is sufficient.
It'd be great if
@truffle/contract
had an API exposing the number of confirmations it requires from web3 (probably at the contract abstraction creation level, so that all instances have this same value).Additionally, both
@truffle/contract
and@truffle/interface-adapter
should be upgraded to use web3 v1.2.2, which includes a fix for 'confirmation' events on HttpProviders.Steps to Reproduce
Create a
@truffle/contract
object and send a transaction from it in a non-truffle environment (outside oftruffle test
ortruffle exec
), the process won't end until the contract receives 24 confirmations of the transaction being mined.Environment
"@truffle/contract": "^4.0.38"
The text was updated successfully, but these errors were encountered: