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

Do not increment NonceManager delta if transaction send fails #4811

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wille
Copy link

@wille wille commented Aug 21, 2024

If the sendTransaction call fails for any reason like your node/provider going down, subsequent calls to sendTransaction will fail until the user manually calls reset in their catch clause wrapping sendTransaction which I would assume not many people do.

Automatically handling this would save people lots of headache and outages.

return await this.signer.sendTransaction(tx);
return await this.signer.sendTransaction(tx);
} catch (err) {
this.#delta--;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the error happens in getNonce, we shouldn't reduce #delta.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore previous comment. The noncePromise is awaited after we increment, so we should always decrease upon error.

@kallerosenbaum
Copy link

Related discussion: #972

@kallerosenbaum
Copy link

I don't agree with this comment. #972 (comment)

If the documentation of NonceManager.sendTransaction clearly explains that all calls to the function must be in a serial fashion, we should be good.

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