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

Incorrect receipt for the tx 0x8b21c385f137ce75b3f2b0ee84040b629208d5037d0101d23c8bd2ce98e3a89b #29550

Closed
AlbertMakhortov opened this issue Apr 16, 2024 · 9 comments
Labels

Comments

@AlbertMakhortov
Copy link

AlbertMakhortov commented Apr 16, 2024

Ethereum sepolia

System information

Geth version: v1.13.11
CL client & version: nimbus amd64-v24.2.0
OS & Version: linux

Expected behaviour

when requesting eth_getTransactionReceipt for 0x8b21c385f137ce75b3f2b0ee84040b629208d5037d0101d23c8bd2ce98e3a89b
expected transactionIndex is 0x26

Actual behaviour

transactionIndex in response is 0x14
full response:

{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0x5b9878a504a93085ae7b240d511d7b7eb64058925fb42dd6470bed9f61341973","blockNumber":"0x56b2d0","contractAddress":null,"cumulativeGasUsed":"0xadc32","effectiveGasPrice":"0xee9ab034","from":"0x3c352ea32dfbb757ccdf4b457e52daf6ecc21917","gasUsed":"0x5208","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0xe078fca4af16626da5f71875f87d891f1b932ad4","transactionHash":"0x7cb724246409190caa7789a29a652948a920ab4d9ed1e0df5aaa9fe615f20564","transactionIndex":"0x14","type":"0x0"}}

We cannot reproduce this issue right now, because it was fixed by restarting the node, but the problem has arisen not for the first time, and we want to understand what is causing it

Backtrace

[backtrace]

When submitting logs: please submit them as text and not screenshots.

@holiman
Copy link
Contributor

holiman commented Apr 16, 2024

Tx: https://sepolia.etherscan.io/tx/0x8b21c385f137ce75b3f2b0ee84040b629208d5037d0101d23c8bd2ce98e3a89b
In block https://sepolia.etherscan.io/block/5681872, blockhash 0x5b9878a504a93085ae7b240d511d7b7eb64058925fb42dd6470bed9f61341973.
Position: 38, should be 0x26.

Yep, confirm that this seems odd. I first thought it was a problem with the index during reorg, that we've recently fixed, but if so I would have expected the blockhash to mismatch. @rjl493456442 any thoughts?

@rjl493456442
Copy link
Member

Probably the block with same transaction set but different order?

@namiloh
Copy link

namiloh commented Apr 16, 2024

Then the blockhash would mismatch. Unless I have misunderstood the bug

@rjl493456442
Copy link
Member

Right, the transactionRoot will be different.

@rjl493456442
Copy link
Member

rjl493456442 commented Apr 17, 2024

{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0x5b9878a504a93085ae7b240d511d7b7eb64058925fb42dd6470bed9f61341973","blockNumber":"0x56b2d0","contractAddress":null,"cumulativeGasUsed":"0xadc32","effectiveGasPrice":"0xee9ab034","from":"0x3c352ea32dfbb757ccdf4b457e52daf6ecc21917","gasUsed":"0x5208","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x1","to":"0xe078fca4af16626da5f71875f87d891f1b932ad4","transactionHash":"0x7cb724246409190caa7789a29a652948a920ab4d9ed1e0df5aaa9fe615f20564","transactionIndex":"0x14","type":"0x0"}}

Apparently the responded transaction hash is 0x7cb724246409190caa7789a29a652948a920ab4d9ed1e0df5aaa9fe615f20564, located at the correct position 0x14.

so, the (a) block number (b) block hash are all correct, but the transaction index is wrong.

but the interesting thing is transaction index is not persisted in the txlookup(only the block number). Index is determined after loading the block body instead.

	body := ReadBody(db, blockHash, *blockNumber)
	if body == nil {
		log.Error("Transaction referenced missing", "number", *blockNumber, "hash", blockHash)
		return nil, common.Hash{}, 0, 0
	}
	for txIndex, tx := range body.Transactions {
		if tx.Hash() == hash {
			return tx, blockHash, *blockNumber, uint64(txIndex)
		}
	}

@AlbertMakhortov could you please restart your geth node and then retrieve the receipt? Just want to confirm it's relevant with a bug we have already fixed.

@AlbertMakhortov
Copy link
Author

@rjl493456442 we have restarted the node, and it helped
but we want to understand what caused it in the first place, because it is not the first time it happened

@avinashbo
Copy link

avinashbo commented Apr 17, 2024

Just want to confirm it's relevant with a bug we have already fixed.

@rjl493456442 Can you please point us to this bug/fix?

@holiman
Copy link
Contributor

holiman commented Apr 18, 2024

Bug: #29261
Fix: #29343

@holiman holiman closed this as completed Apr 18, 2024
@avinashbo
Copy link

Then the blockhash would mismatch. Unless I have misunderstood the bug

@holiman I see the above point discussed. Is this bug the same as #29261 as you see it?

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

No branches or pull requests

5 participants