rpcpool/yellowstone-faithful

Error message for missing transactions

Opened this issue · 2 comments

If the transaction can't be looked up we get this error:

Err: Error { request: Some(GetTransaction), kind: RpcError(RpcResponseError { code: -32009, message: "Epoch 0 is not available from this RPC", data: Empty }) }

would be good to say "This transaction is not available from this RPC".

Solana, when a transaction is missing:

curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc": "2.0", "id": "99", "method": "getTransaction", "params": ["3ZoKehx5haKmM1r74Ni9Ezxc6Sa2vLqRQgKisETGUjLK3KX45yRTAbN4xZ4LXt9jXBBozvjQ4qTz5eJtq3PD6j2A", {"encoding":"json","maxSupportedTransactionVersion": 0}]}' | jq

{
  "jsonrpc": "2.0",
  "result": null,
  "id": "99"
}

Solana, when a block is missing:

curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc": "2.0", "id": "77", "method": "getBlock", "params": [55728000,{"maxSupportedTransactionVersion":0,"encoding":"base64"}]}' | jq


{
  "jsonrpc": "2.0",
  "error": {
    "code": -32009,
    "message": "Slot 55728000 was skipped, or missing in long-term storage"
  },
  "id": "77"
}

Faithful, when a transaction is not found:

curl http://127.0.0.1:8899 -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc": "2.0", "id": "99", "method": "getTransaction", "params": ["3ZoKehx5haKmM1r74Ni9Ezxc6Sa2vLqRQgKisETGUjLK3KX45yRTAbN4xZ4LXt9jXBBozvjQ4qTz5eJtq3PD6j2A", {"encoding":"json","maxSupportedTransactionVersion": 0}]}' | jq


{
  "id": "99",
  "error": {
    "code": -32009,
    "message": "Transaction not found"
  },
  "jsonrpc": "2.0"
}

Faithful, when a block is not found because we don't have the epoch (and if we have the epoch, but can't find the block, then it replies same as solana):

curl http://127.0.0.1:8899 -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc": "2.0", "id": "77", "method": "getBlock", "params": [210384444,{"maxSupportedTransactionVersion":0,"encoding":"base64"}]}' | jq


{
  "id": "77",
  "error": {
    "code": -32009,
    "message": "Epoch 487 is not available"
  },
  "jsonrpc": "2.0"
}

Faithful, when it has the epoch, but the block is missing:

curl http://127.0.0.1:8899 -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc": "2.0", "id": "77", "method": "getBlock", "params": [52271969,{"maxSupportedTransactionVersion":0,"encoding":"base64"}]}' | jq


{
  "id": "77",
  "error": {
    "code": -32009,
    "message": "Slot 52271969 was skipped, or missing in long-term storage"
  },
  "jsonrpc": "2.0"
}

I think it can be useful to be able to distinguish between "this block was never produced" and "this rpc can't know anything about this block because it doesn't have that specific epoch".