node icon indicating copy to clipboard operation
node copied to clipboard

Incorrect `transactionIndex` and `logIndex` for Transactions in Block 1444795

Open JasoonS opened this issue 1 year ago • 0 comments

Describe the Bug Hello Zeta Chain team,

I've encountered an issue when querying transaction receipts for block 1444795 on the Zeta Chain. Specifically, all transactions in this block are returning a transactionIndex and logIndex of 0x0, which seems incorrect given that the block contains multiple transactions.

This issue is affecting our ability to ingest the chain data for HyperSync, as we're encountering validation issues at this block.


Issue Details:

  • Block Number: 1444795

  • Affected Transactions:

    • 0x63a059fe618ff66cefdba8f3df4db0307d2d02a1e43d6a1d2caa9d1a3c070793
    • 0x95417c16f886ea709ee5c510cfb195431538b083ff9c6c37f1b88e15ce302ce3
    • 0xefd40be2660466ce39a229033f40263958bc74700971ec44545166a4bb824ef6
    • 0x8d174e8abdec300d7f33c2ce09b634c8c723bd6ef7b0cd5996fcf31536c3b443
    • 0x757bb76d1103c2133f39b084c73d9e8efbd415a738b90edd36f7a75873762eb8
    • 0xc8881d4690507c3dee8b851157bdf873b8807460e9f64b91cac370801b8028db
  • RPC Endpoints Tested:

    • All available on chainlist.org: https://zeta-chain.drpc.org, https://zetachain-evm.blockpi.network/v1/rpc/publi, https://7000.rpc.thirdweb.co, https://zetachain-mainnet.public.blastapi.i, https://zetachain-mainnet.g.allthatnode.com/archive/evm
    • Paid BLAST API RPC Endpoint (same result)

Steps to Reproduce:

I used the following Bash script to query the transaction receipts and extract the transactionIndex and logIndex:

#!/bin/bash

# RPC endpoint
RPC_ENDPOINT="https://zetachain-evm.blockpi.network/v1/rpc/public"

# Block number
BLOCK_NUMBER=1444795
BLOCK_NUMBER_HEX=$(printf "0x%X" $BLOCK_NUMBER)

# Get block data with transactions included
BLOCK_DATA=$(curl -s -X POST \
  -H "Content-Type: application/json" \
  --data '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": ["'"$BLOCK_NUMBER_HEX"'", true],
    "id": 1
  }' \
  "$RPC_ENDPOINT")

# Check if block data was retrieved successfully
if [ -z "$BLOCK_DATA" ]; then
    echo "Error: Failed to retrieve block data."
    exit 1
fi

# Extract transaction hashes using jq
TX_HASHES=$(echo "$BLOCK_DATA" | jq -r '.result.transactions[].hash')

# Check if there are any transactions in the block
if [ -z "$TX_HASHES" ]; then
    echo "No transactions found in block $BLOCK_NUMBER."
    exit 0
fi

echo "Transaction hashes in block $BLOCK_NUMBER:"

# Loop through each transaction hash and get its receipt
for TX_HASH in $TX_HASHES; do
    echo "Fetching receipt for transaction: $TX_HASH"
    TX_RECEIPT=$(curl -s -X POST \
      -H "Content-Type: application/json" \
      --data '{
        "jsonrpc": "2.0",
        "method": "eth_getTransactionReceipt",
        "params": ["'"$TX_HASH"'"],
        "id": 1
      }' \
      "$RPC_ENDPOINT")

    # Extract and print transactionIndex and logIndex from logs
    echo "Logs with transactionIndex and logIndex:"
    LOGS=$(echo "$TX_RECEIPT" | jq -c '.result.logs[]')
    if [ -z "$LOGS" ]; then
        echo "No logs found for transaction $TX_HASH."
    else
        echo "$LOGS" | while read -r LOG; do
            TX_INDEX=$(echo "$LOG" | jq -r '.transactionIndex')
            LOG_INDEX=$(echo "$LOG" | jq -r '.logIndex')
            echo "  Transaction Index: $TX_INDEX, Log Index: $LOG_INDEX"
        done
    fi
    echo "========================================"
done

Script Output:

Transaction hashes in block 1444795:
Fetching receipt for transaction: 0x63a059fe618ff66cefdba8f3df4db0307d2d02a1e43d6a1d2caa9d1a3c070793
Logs with transactionIndex and logIndex:
  Transaction Index: 0x0, Log Index: 0x0
========================================
Fetching receipt for transaction: 0x95417c16f886ea709ee5c510cfb195431538b083ff9c6c37f1b88e15ce302ce3
Logs with transactionIndex and logIndex:
  Transaction Index: 0x0, Log Index: 0x0
========================================
Fetching receipt for transaction: 0xefd40be2660466ce39a229033f40263958bc74700971ec44545166a4bb824ef6
Logs with transactionIndex and logIndex:
  Transaction Index: 0x0, Log Index: 0x0
========================================
Fetching receipt for transaction: 0x8d174e8abdec300d7f33c2ce09b634c8c723bd6ef7b0cd5996fcf31536c3b443
Logs with transactionIndex and logIndex:
  Transaction Index: 0x0, Log Index: 0x0
========================================
Fetching receipt for transaction: 0x757bb76d1103c2133f39b084c73d9e8efbd415a738b90edd36f7a75873762eb8
Logs with transactionIndex and logIndex:
  Transaction Index: 0x0, Log Index: 0x0
========================================
Fetching receipt for transaction: 0xc8881d4690507c3dee8b851157bdf873b8807460e9f64b91cac370801b8028db
Logs with transactionIndex and logIndex:
  Transaction Index: 0x0, Log Index: 0x0
========================================

Problem Description:

  • Unexpected Behavior: All transactions in block 1444795 have their transactionIndex and all log entries have their logIndex set to 0x0.
  • Impact: This causes validation issues when attempting to ingest the chain data for HyperSync, as the indices are critical for proper transaction ordering and log processing.
  • Consistency Across Endpoints: The issue persists across multiple RPC endpoints, including public and paid RPC endpoints.

Questions:

  1. Is this expected behavior for block 1444795, or is there an issue with the node software or RPC responses?
  2. Why are all transactionIndex and logIndex values set to zero despite multiple transactions in the block?
  3. Is there a known workaround or fix for this issue?

If you require any additional information, please let me know, and I'll be happy to provide it. (note - I have not tried to run a node locally)

JasoonS avatar Oct 28 '24 17:10 JasoonS