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

[BUG] eth_getTransactionByBlockNumberAndIndex The specified block height and index cannot obtain transaction information #2101

Open
0x-wen opened this issue Mar 13, 2025 · 2 comments
Labels
bug Something isn't working linear Created by Linear-GitHub Sync

Comments

@0x-wen
Copy link

0x-wen commented Mar 13, 2025

Seid version

Chain ID
chain_id : 1329

Describe the bug
Request data through an rpc interface

#!/bin/bash

RPC_URL="https://evm-rpc.sei-apis.com"
BLOCK_NUMBER=136337023
TRANSACTION_INDEX=3

BLOCK_NUMBER_HEX="0x$(printf %x $BLOCK_NUMBER)"
TRANSACTION_INDEX_HEX="0x$(printf %x $TRANSACTION_INDEX)"
echo "BLOCK_NUMBER_HEX: $BLOCK_NUMBER_HEX, TRANSACTION_INDEX_HEX: $TRANSACTION_INDEX_HEX"

# 1. w3.eth.get_block_receipts(BLOCK_NUMBER)
GET_BLOCK_RECEIPTS_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockReceipts\",\"params\":[\"$BLOCK_NUMBER_HEX\"],\"id\":1}" "$RPC_URL")
echo "eth_getBlockReceipts Response: $GET_BLOCK_RECEIPTS_RESPONSE"

# 2. w3.eth.get_transaction_by_block(BLOCK_NUMBER, TRANSACTION_INDEX)
GET_TRANSACTION_BY_BLOCK_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"$BLOCK_NUMBER_HEX\", \"$TRANSACTION_INDEX_HEX\"],\"id\":1}" "$RPC_URL")
echo "eth_getTransactionByBlockNumberAndIndex Response: $GET_TRANSACTION_BY_BLOCK_RESPONSE"

# eth_getTransactionByBlockNumberAndIndex 
# Response: {"jsonrpc":"2.0","id":1,"result":null}

To Reproduce

  1. Specify block height and transaction index
  2. BLOCK_NUMBER_HEX: 0x820567f, TRANSACTION_INDEX_HEX: 0x3
  3. eth_getTransactionByBlockNumberAndIndex
  4. Response: {"jsonrpc":"2.0","id":1,"result":null}

Expected behavior
Get the transaction information correctly

Screenshots

Additional context

@0x-wen 0x-wen added bug Something isn't working linear Created by Linear-GitHub Sync labels Mar 13, 2025
@0x-wen
Copy link
Author

0x-wen commented Mar 18, 2025

Title : Inconsistent transactionIndex between eth_getBlockReceipts and eth_getTransactionByBlockNumberAndIndex

Description :
We've identified a data inconsistency in transaction indexing when using different JSON-RPC methods on Sei Network

  1. Via eth_getBlockReceipts (block receipts response):
{
  "transactionHash": "0x2d934f14a93abafc8f894fd48dbc9a88f31c4a193aa2247f46225df878305510",
  "transactionIndex": "0x3"  // Index 3
}
  1. Via eth_getTransactionByBlockNumberAndIndex (direct transaction query):
{
  "hash": "0x2d934f14a93abafc8f894fd48dbc9a88f31c4a193aa2247f46225df878305510",
  "input": "0x",
  "nonce": "0x145",
  "to": "0x863221244596659ae10c4383021b4da3ace907c1",
  "transactionIndex": "0x9"  // Index 9
}

Impact:
This discrepancy breaks the fundamental assumption that a transaction's index should be immutable and consistent across all block-related queries. This may cause errors in:

  • Block explorers
  • DApps relying on transaction ordering
  • Indexing services

Expected Behavior:
Both methods should return identical transactionIndex values for the same transaction hash.

Additional Context:

  • Observed in block: 136337023
  • Potential root cause: Suspect block processing logic inconsistency between transaction execution context and post-block indexing.

@cordt-sei
Copy link
Contributor

Please try to recheck this on atlantic-2 testnet. The logIndex was not being set correctly. Historical data will not be fixed retroactively however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

3 participants
@0x-wen @cordt-sei and others