Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Ganache rejects transaction replacement with same nonce #569

Closed
monokh opened this issue Apr 22, 2020 · 1 comment
Closed

Ganache rejects transaction replacement with same nonce #569

monokh opened this issue Apr 22, 2020 · 1 comment

Comments

@monokh
Copy link

monokh commented Apr 22, 2020

Expected Behavior

The nonce of the transaction sent should be respected and if appropriate, the transaction should replace the previous transaction.

Geth dev mode functions like this.

Current Behavior

Sending a transaction with a nonce included is not respected. The transaction is refused as the nonce counter of the account is presumed to be incremented.

Possible Solution

Respect the nonce and replace the transaction if fee is higher?

Steps to Reproduce (for bugs)

  1. Run ganache with -b 200 (something high to keep the transaction from being auto mined quickly)
  2. Send a transaction:
{
   "id":1587553532335,
   "method":"eth_sendTransaction",
   "params":[
      {
         "from":"0x625acaedef812d2842efd2fb0294682a868455bd",
         "value":"0x2386f26fc10000",
         "gasPrice":"0x4a817c800",
         "to":"0x93261B4021dbd6200Df9B36B151f4ECF34889e94"
      }
   ]
}
  1. Fetch the transaction and see the nonce
  2. Send a transaction with the same nonce but higher gas price:
{
   "id":1587553532512,
   "method":"eth_sendTransaction",
   "params":[
      {
         "from":"0x625acaedef812d2842efd2fb0294682a868455bd",
         "value":"0x2386f26fc10000",
         "gasPrice":"0x9502f9000",
         "to":"0x93261b4021dbd6200df9b36b151f4ecf34889e94",
         "nonce":"0x2"
      }
   ]
}
  1. Error: the tx doesn't have the correct nonce. account has nonce of: 3 tx has nonce of: 2

Context

Without correct transaction replacement and mempool support it is not possible to work with replacing transactions.

Your Environment

  • Version used: v6.9.1
  • Version of Truffle/Remix/Other tools used:
  • NodeJS Version: [ ] 6.x, [ ] 7.x (unsupported), [x] 8.x, [ ] 9.x
  • Operating System and version (include distro if Linux): MacOS Mojave
  • I intend to submit a pull request to fix this issue: [ ]
@davidmurdoch davidmurdoch transferred this issue from trufflesuite/ganache-cli-archive Apr 22, 2020
@davidmurdoch
Copy link
Member

Thanks for opening this issue, @monokh. I've moved this issue over to ganache-core. Also going to close it as it is a duplicate of #484

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

No branches or pull requests

2 participants