ethereum-optimism / ethereum-optimism/optimism
1-2 Second Latency in Transaction nonce updating
- Dominant language
- Go
- Stars
- 6.5k
- Forks
- 4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 145
Description
**Bug Description**
I’ve noticed that when I send a transaction to the Sequencer there is always a slight delay updating the pending nonce. For example, if I send a transaction with nonce 50 successfully and then make a call for the pending nonce, the returned value will be 50 instead of 51, and will be updated after 1-2 seconds. I’ve tested with different RPCs. On other chains it seems to work as expected.
**Steps to Reproduce**
I tried your public URL: https://sepolia.optimism.io/ and the same thing happened. Here is a snippet of the logs:
```
2024-10-31T11:34:24.213+0200 [INFO] Broadcasted attempt: attempt={"TxID":1,"Hash":"0xd5f96dc6881d234346c52b465bbea8830ddd11b7340355eb7aef774ba14c310c","Fee":{"GasFeeCap":"1.010353 mwei","GasTipCap":"1.010002 mwei"},"GasLimit":50000,"SignedTransaction":{"type":"0x2","chainId":"0xaa37dc","nonce":"0x324","to":"0x8ae79bb7cce2dc3d132c288971b0f74af02a3b4a","gas":"0xc350","gasPrice":null,"maxPriorityFeePerGas":"0xf6952","maxFeePerGas":"0xf6ab1","value":"0x6","input":"0x","accessList":[],"v":"0x1","r":"0xdcd1a62f5f298c9142e03f775b0ab40b42b9fce057edb9c0ee42dd59696c5c13","s":"0x6b90e82f1cbc18523e1b06bdf0980090b3b7d5c5de398097d989976ef7dd73bd","yParity":"0x1","hash":"0xd5f96dc6881d234346c52b465bbea8830ddd11b7340355eb7aef774ba14c310c"},"CreatedAt":"2024-10-31T11:34:24.079307+02:00","BroadcastAt":"0001-01-01T00:00:00Z"}
2024-10-31T11:34:24.349+0200 [INFO] Broadcasted attempt: attempt={"TxID":2,"Hash":"0x67484752c6b453aacada12a8ddd4df96591a210a1e4a7b490922ffa29633491d","Fee":{"GasFeeCap":"1.010353 mwei","GasTipCap":"1.010002 mwei"},"GasLimit":50000,"SignedTransaction":{"type":"0x2","chainId":"0xaa37dc","nonce":"0x325","to":"0x8ae79bb7cce2dc3d132c288971b0f74af02a3b4a","gas":"0xc350","gasPrice":null,"maxPriorityFeePerGas":"0xf6952","maxFeePerGas":"0xf6ab1","value":"0x6","input":"0x","accessList":[],"v":"0x1","r":"0x776cddd1a6e17ae0aa078fbc88e4b612a17982ba24f35a6666fe4a64bb7ea365","s":"0x4849ee5583ebd509b5af1da1dbe025fc17a478227ec25c864279c99e2d80d98d","yParity":"0x1","hash":"0x67484752c6b453aacada12a8ddd4df96591a210a1e4a7b490922ffa29633491d"},"CreatedAt":"2024-10-31T11:34:24.216461+02:00","BroadcastAt":"0001-01-01T00:00:00Z"}
2024-10-31T11:34:24.485+0200 [INFO] Broadcasted attempt: attempt={"TxID":3,"Hash":"0xcfdd06343c13fe5b66587f06ce017fa958d0e73556f19862ed78399c4225e22d","Fee":{"GasFeeCap":"1.010353 mwei","GasTipCap":"1.010002 mwei"},"GasLimit":50000,"SignedTransaction":{"type":"0x2","chainId":"0xaa37dc","nonce":"0x326","to":"0x8ae79bb7cce2dc3d132c288971b0f74af02a3b4a","gas":"0xc350","gasPrice":null,"maxPriorityFeePerGas":"0xf6952","maxFeePerGas":"0xf6ab1","value":"0x6","input":"0x","accessList":[],"v":"0x0","r":"0xc27cb721a12f6c7a27891c2154c3e2257ca10792b58a539e064a6e8026c4527e","s":"0x79fd39f7882b963f9a6f5ca5df10d33f681db3794ba539080bb1c91dca8f2c5b","yParity":"0x0","hash":"0xcfdd06343c13fe5b66587f06ce017fa958d0e73556f19862ed78399c4225e22d"},"CreatedAt":"2024-10-31T11:34:24.353162+02:00","BroadcastAt":"0001-01-01T00:00:00Z"}
2024-10-31T11:34:24.593+0200 [INFO] Broadcasted attempt: attempt={"TxID":4,"Hash":"0xf5fe3507d882bd046e7ee036e3a7a56fedb68bb155db01570f28bd53b3c7637c","Fee":{"GasFeeCap":"1.010353 mwei","GasTipCap":"1.010002 mwei"},"GasLimit":50000,"SignedTransaction":{"type":"0x2","chainId":"0xaa37dc","nonce":"0x327","to":"0x8ae79bb7cce2dc3d132c288971b0f74af02a3b4a","gas":"0xc350","gasPrice":null,"maxPriorityFeePerGas":"0xf6952","maxFeePerGas":"0xf6ab1","value":"0x6","input":"0x","accessList":[],"v":"0x0","r":"0xd875e4fff50c565f2839c984d975dd42ff7e443f7bd6c7ac7b18466e67e2256d","s":"0x15ba1a1436b738f5e02846b3b724c381c1ab486eb6d39d1662814f7e321d1fba","yParity":"0x0","hash":"0xf5fe3507d882bd046e7ee036e3a7a56fedb68bb155db01570f28bd53b3c7637c"},"CreatedAt":"2024-10-31T11:34:24.486178+02:00","BroadcastAt":"0001-01-01T00:00:00Z"}
2024-10-31T11:34:24.719+0200 [INFO] Broadcasted attempt: attempt={"TxID":5,"Hash":"0x471103b34eaa6610befb4f5075a4524b4d9e849311d6675c20520fea8eaf050c","Fee":{"GasFeeCap":"1.010353 mwei","GasTipCap":"1.010002 mwei"},"GasLimit":50000,"SignedTransaction":{"type":"0x2","chainId":"0xaa37dc","nonce":"0x328","to":"0x8ae79bb7cce2dc3d132c288971b0f74af02a3b4a","gas":"0xc350","gasPrice":null,"maxPriorityFeePerGas":"0xf6952","maxFeePerGas":"0xf6ab1","value":"0x6","input":"0x","accessList":[],"v":"0x1","r":"0xf2571280a080a97a4e5d207a8d7a160ce86ffd35d77cfe1a90d4393e6a0a6ac4","s":"0xa2202fde2de0eeb4b85f799619be6c28a00213778212087cf7ee6ba0f492eff","yParity":"0x1","hash":"0x471103b34eaa6610befb4f5075a4524b4d9e849311d6675c20520fea8eaf050c"},"CreatedAt":"2024-10-31T11:34:24.594443+02:00","BroadcastAt":"0001-01-01T00:00:00Z"}
2024-10-31T11:34:24.810+0200 [WARN] Reached transaction limit. LocalNonce: 809, PendingNonce 804, unconfirmedCount: 5
```
As you can see the first transaction uses the pending nonce (804), as it should, and then within 1s I send 4 more transactions and fetch the pending nonce again. Even though the transactions were successful and the nonce should have increased, when I fetch the pending nonce I still get the old value. This resolves after 1-2 seconds.
**Expected behavior**
Nonce updates as soon as transaction hits local mempool of replica
**Additional context**
Issue escalated by a partner team
---
⚠️ **Notice:** Issues that do not include the following sections will be subject to closure:
- Bug Description
- Steps to Reproduce
- Environment Information
Please ensure all required sections are filled out accurately to expedite the debugging process and improve issue resolution efficiency.
Contributor guide
Research direction
Reproduce the issue against https://sepolia.optimism.io/ by submitting transactions and querying the pending nonce through RPC. Trace how the Sequencer and replica local mempool expose pending nonce updates; done means the pending nonce reflects a successfully submitted transaction immediately rather than after 1–2 seconds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100