Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transactionPollingTimeout might not work as documented #3513

Closed
miohtama opened this issue May 12, 2020 · 5 comments
Closed

transactionPollingTimeout might not work as documented #3513

miohtama opened this issue May 12, 2020 · 5 comments
Assignees
Labels
1.x 1.0 related issues Investigate

Comments

@miohtama
Copy link
Contributor

miohtama commented May 12, 2020

Expected behavior

Setting web3.eth.transactionPollingTimeout to a value changees the trasnaction polling timeout.

Actual behavior

await contract.methods.myMethod.send() still uses the default 750 seconds value.

Steps to reproduce the behavior

Trying to change the behavior using the following code.

const web3: any = new Web3(provider);
web3.eth.transactionPollingTimeout = 3600;

... does not seem to work as in here...

https://github.com/ethereum/web3.js/blob/2a5c5cb740ee8962846ac9d5416e6b8cc2e7d95d/packages/web3-core-method/src/index.js#L57

...the config value is read when the Method of eth_getTransactionReceipt is being constructed, which is only when new Web3() constructor is called, which is before you can actually set a value web3.eth.transactionPollingTimeout.

I might be wrong and misunderstanding how is it supposed to work, but this is my initial analysis. Please advise if I misunderstanding and if there is a way to override transactionPollingTimeout easily for the web3 instance and all transactions.

Environment

web3.js 1.2.6

@cgewecke
Copy link
Collaborator

@miohtama

Thanks for reporting, will investigate. Scanning the code in web3-eth, it's possible this isn't wired up correctly.

(related: #3498)

@cgewecke cgewecke added 1.x 1.0 related issues Investigate labels May 12, 2020
@cgewecke cgewecke self-assigned this May 14, 2020
@cgewecke
Copy link
Collaborator

@miohtama I've tried to reproduce this in #3533 but things seem to be working as expected.

Have a couple questions...

  • Is the provider being passed to Web3 definitely http(s)?
  • What error do you see when the timeout occurs?
  • If you have a chance, could you look the tests in Add tests for transactionPollingTimeout #3533 and see if they model your case correctly?

Of necessity they set the polling timeout threshold lower than the default. But the outcome suggests that it's being set and evaluated correctly.

@miohtama
Copy link
Contributor Author

miohtama commented May 27, 2020

It is the default WalletConnect provider, so it is Infura + HTTPS.

I tried to reproduce the issue by setting a timeout to 1 seconds. The timeout is not triggered.

I can try again - but I would first also ask on the advice what is the proper code to configure the timeout for the smart contract interaction, as it is not clear from the document. Then I can write a minimum repeatable example - which hopefully we cannot repeat.

@cgewecke
Copy link
Collaborator

@miohtama

what is the proper code to configure the timeout for the smart contract interaction

The tests written to validate the setting in #3533 use

web3.eth.transactionPollingTimeout = value

If you're experiencing the .on related issue you reported in #3498, the timeout failure could be related. A good test for your case might be to run the setting as above and use the workaround suggested in #3498.

@ryanio ryanio mentioned this issue Jun 2, 2020
13 tasks
@cgewecke
Copy link
Collaborator

cgewecke commented Jun 9, 2020

Closing with 1.2.9...please just ping if this is still happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Investigate
Projects
None yet
Development

No branches or pull requests

2 participants