Skip to content

Extension ignores TransactionRequest.nonce passed from dapp #12907

Open
@Velenir

Description

@Velenir

Describe the bug
I want to be able to initate transaction cancellation from inside the dapp. So I pass a transaction with nonce = pendingTx.nonce to provider.sendTransaction. But Metamask extension ignores it and uses its internally tracked nonce.

Steps to reproduce (REQUIRED)

  1. Enable custom nonce in Metamask (optional, so you see what it uses)
  2. Get a few txs pending, so we have legitimate nonces to cancel
  3. In browser console
let [acc] = await window.ethereum.enable()
// send 0 ETH from yourself to yourself, give it nonce of one of the pending txs
window.ethereum.request({method: "eth_sendTransaction", params:[{value: 0, to:acc, from:acc, nonce: '0x'+22..toString(16) }]})
  1. In Metamask popup (and when executing tx) it still has its internal nonce

Expected behavior
Metamask uses what nonce dapp passes to it

Browser details (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser: Chrome 96.0.4664.45
  • MetaMask Version: 10.6.1

Additional context (Error Messages, etc.)

According to #2699 PR we should be able to specify nonce as long as it's not higher than latest confirmed nonce, so passing nonce of a pending transaction should work, but doesn't.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions