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

Fix redundant provider call when nonce=0 is specified #282

Closed
wants to merge 1 commit into from

Conversation

nikitaeverywhere
Copy link

@nikitaeverywhere nikitaeverywhere commented Sep 19, 2018

Hello!

I've noticed a redundant call to providers when nonce = 0 (as a number) is specified explicitly in contract transactions, for example:

await tokenContract.functions.transfer("0x...", "10000000", {
  gasPrice: "1000000000",
  nonce: 0
});

Nonce can be 0 when it's the first transaction from the account. In the previous code,

                    if (transaction.nonce) {
                        noncePromise = Promise.resolve(transaction.nonce)
                    } else if (signer.getTransactionCount) {

It didn't resolve immediately because of if (0) { ... } gives false.

Thanks for your work!

@nikitaeverywhere
Copy link
Author

nikitaeverywhere commented Sep 19, 2018

Some tests timeout Timeout of 2000ms exceeded, looks like it's not caused by this PR.

@ricmoo
Copy link
Member

ricmoo commented Sep 19, 2018

Ah! Good catch!

Timeouts are often ok, but depends on the test. If you re-run it, it should work. Usually it’s a sign that Etherscan is under heavier than usual load, but the timeout should be increased for that test case anyways if it is hitting 2s.

@nikitaeverywhere
Copy link
Author

nikitaeverywhere commented Sep 19, 2018

If you re-run it

@ricmoo Unfortunately I can't re-run it as I don't have permissions to do so. Would you try please? Or should I also submit PR which increases timeouts? :) 2 seconds is pretty strict I would say by the way.

@ricmoo
Copy link
Member

ricmoo commented Sep 19, 2018

No worries. I’ll check it out when I get home tonight. :)

@nikitaeverywhere
Copy link
Author

Thanks man! :)

ricmoo added a commit that referenced this pull request Sep 20, 2018
@ricmoo
Copy link
Member

ricmoo commented Sep 20, 2018

This has been updated in v3.0.29.

Thanks! :)

@ricmoo ricmoo closed this Sep 20, 2018
@nikitaeverywhere
Copy link
Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants