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

[Bug]: nonce is incorrect because eth_getTransactionCount is not called before eth_sendRawTransaction #29787

Open
cristiam86 opened this issue Jan 17, 2025 · 0 comments

Comments

@cristiam86
Copy link

Describe the bug

In the previous version, before calling the eth_sendRawTransaction method, Metamask also called eth_getTransactionCount to update its account nonce.
Since Version 12.10.1, this no longer happens, and the transaction fails because of wrong nonce.

Expected behavior

eth_getTransactionCount should be called before eth_sendRawTransaction to update Metamask's account nonce

Screenshots/Recordings

No response

Steps to reproduce

Send two transactions with the code provided. The first one succeeds if the account is new because the nonce is 0.
The following transactions fail because the nonce sent by Metamask is always 0.

Error messages or log output

Detection stage

In production (default)

Version

12.10.1

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

This is how I'm calling the eth_sendTransaction from my JavaScript code:

const transaction = {
  from: senderAccount?.address,
  to: address,
  data: serializedData,
  value: `0x${value.toString(16)}`,
};

const result = await client.request({
  method: "eth_sendTransaction",
  params: [transaction as any],
});

In previous versions of Metamask, this opened the browser extension, I confirmed, and the transaction got sent to the node accordingly.

Severity

This bug doesn't allow users to send any transaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To be fixed
Status: To be fixed
Development

No branches or pull requests

2 participants