rpcpool / yellowstone-faithful

Project Yellowstone Old Faithful is the project to make all of Solana's history accessible, content addressable and available via a variety of means.
https://old-faithful.net/
GNU Affero General Public License v3.0
59 stars 11 forks source link

Error message for missing transactions #55

Open linuskendall opened 10 months ago

linuskendall commented 10 months ago

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".

gagliardetto commented 10 months ago

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"
}
gagliardetto commented 10 months ago

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".