go icon indicating copy to clipboard operation
go copied to clipboard

Filter Soroban Transactions from `fee_stats`

Open sydneynotthecity opened this issue 11 months ago • 5 comments

What problem does your feature solve?

Since fee_stats profiles the inclusion fee over all transactions in a ledger, the data is skewed if a Soroban transaction is present in the ledger range. Soroban transactions have a different fee model and separate auction ,which should not be considered alongside classic transactions.

For example, this response from fee_stats includes Soroban transaction data, which artificially inflates the max inclusion fee:

{
  "last_ledger": "50944799",
  "last_ledger_base_fee": "100",
  "ledger_capacity_usage": "0.69",
  "fee_charged": {
    "max": "118842", <-- Soroban transaction
    "min": "100",
    "mode": "100",
    "p10": "100",
    "p20": "100",
    "p30": "100",
    "p40": "100",
    "p50": "100",
    "p60": "100",
    "p70": "100",
    "p80": "100",
    "p90": "100",
    "p95": "100",
    "p99": "100"
  },
  "max_fee": {
    "max": "369981750",
    "min": "100",
    "mode": "51234",
    "p10": "100",
    "p20": "101",
    "p30": "1000",
    "p40": "2073",
    "p50": "51234",
    "p60": "51234",
    "p70": "51234",
    "p80": "100159",
    "p90": "100772",
    "p95": "250005",
    "p99": "353225214"
  }
}

Soroban transaction: 03c05276692f663c5cb7d0cf8c3b25245b820a83fdc39bbb02b2ae85b3c2fe3a which was charged a fee of 118842 even though surge pricing did not occur for classic or Soroban tx during this ledger range. Since Horizon uses fee_charged, it does not calculate an accurate inclusion fee for the tx.

What would you like to see?

The current fee_stats endpoint should filter out Soroban transactions so that the statistics represent inclusion fee for classic transactions only. RPC or another service should provide a separate endpoint for Soroban fee_stats, and that should not be included in Horizon.

Example filters:

select *
from history_transactions
where resource_fee <= 0

What alternatives are there?

None, keep the Soroban transactions in the aggregate.

sydneynotthecity avatar Mar 25 '24 16:03 sydneynotthecity