Bug Description
In rpc/backend/comet_to_eth.go, ReceiptsFromCometBlock casts TxResult.EthTxIndex directly to uint without resolving the -1 sentinel value:
TransactionIndex: uint(txResult.EthTxIndex), // #nosec G115
When EthTxIndex == -1 (meaning "not yet determined by indexer"), int32(-1) wraps to uint64(18446744073709551615).
Reproduction
- Run a cosmos/evm chain and submit EVM transactions during fast block production
- If the indexer hasn't assigned
EthTxIndex yet, it is stored as -1
- Call
eth_getTransactionReceipt for that transaction
- The
transactionIndex field in the receipt is 0xffffffffffffffff instead of the correct index
Impact
Expected Behavior
The -1 sentinel should be resolved to the correct transaction index (the loop counter), matching the existing fallback pattern in tx_info.go:68-76:
if txResult.EthTxIndex == -1 {
txResult.EthTxIndex = int32(i)
}
Proposed Fix
Add sentinel resolution before the uint cast in ReceiptsFromCometBlock, matching the pattern already used in GetTransactionByHash.
Bug Description
In
rpc/backend/comet_to_eth.go,ReceiptsFromCometBlockcastsTxResult.EthTxIndexdirectly touintwithout resolving the-1sentinel value:When
EthTxIndex == -1(meaning "not yet determined by indexer"),int32(-1)wraps touint64(18446744073709551615).Reproduction
EthTxIndexyet, it is stored as-1eth_getTransactionReceiptfor that transactiontransactionIndexfield in the receipt is0xffffffffffffffffinstead of the correct indexImpact
IntegerOutOfRangeErrorwhen receiving this receiptwaitForTransactionhangs indefinitely because the receipt is unparseableEthTxIndexinstead of loop index, but did not handle the-1sentinel caseExpected Behavior
The
-1sentinel should be resolved to the correct transaction index (the loop counter), matching the existing fallback pattern intx_info.go:68-76:Proposed Fix
Add sentinel resolution before the uint cast in
ReceiptsFromCometBlock, matching the pattern already used inGetTransactionByHash.