optimism icon indicating copy to clipboard operation
optimism copied to clipboard

Several blocks with the same tx

Open ninjascant opened this issue 3 years ago • 2 comments

Describe the bug While calling eth_getBlockByNumber on several block numbers, the response shows that the same transaction appears in several blocks

To Reproduce

  1. getBlockByNumber on the block 985:
curl -X POST --data '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x3d9", false], "id": 1}' -H "Content-Type: application/json" https://mainnet.optimism.io

returns: "transactions":["0x9ed8f713b2cc6439657db52dcd2fdb9cc944915428f3c6e2a7703e242b259cb9"]

  1. getBlockByNumber on the block 19022:
curl -X POST --data '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x4a4e", false], "id": 1}' -H "Content-Type: application/json" https://mainnet.optimism.io

shows the same transactions value 3.

Expected behavior A transaction with a given hash can only appear in 1 block

ninjascant avatar Jan 14 '22 12:01 ninjascant

This was the result of a bug within the whitelisting logic. Specifically, if a user attempted to create a smart contract but wasn't whitelisted then the transaction would be executed but the user's nonce would not be incremented. If the user tried to deploy the same contract again, then the nonce would be the same and therefore the transaction hash would also be the same. You can confirm that this is the case by looking at Etherscan.

Are you being impacted by this bug? If this is somehow impacting client-side tooling, we may want to consider our options to remedy this issue after the fact.

smartcontracts avatar Jan 14 '22 18:01 smartcontracts

The database indexes transactions by hash, so only the latest transaction with the matching hash will be accessible via "get transaction by hash".

tynes avatar Jan 18 '22 20:01 tynes

Hey @smartcontracts , I can see this has the P-wontfix label, so does this mean the whitelisting bug hasn't been fixed and won't be fixed? In other words, can we still have duplicated transactions in different blocks in the future?

GCrispino avatar Mar 08 '23 20:03 GCrispino

Bedrock fixes this issue, won't happen again

tynes avatar Jun 16 '23 19:06 tynes