Open ekbainova opened 1 month ago
This is what our estimates currently include.
Current idle liquidity of the asset across all routers on the destination chain is the liquidity that should be available for use in fast path. Idle liquidity is the amount deposited - amount removed - amount in flight
. Notice this already subtracts in flight liquidity (liquidity that is currently unavailable because it was used to boost a previous transfer and the funds have yet to reconcile for the router).
Multiple routers can provide liquidity for a single transfer - this is limited to 3 by the network right now. So the max available router liquidity at any time is the idle liquidity of the top 3 routers.
We query our DB for this idle liquidity which refreshes its view every 15 seconds. This can be improved by reading from another indexing layer like a subgraph or reading from a node directly via RPC call. These options will introduce other tradeoffs like cost, uptime, and speed of the estimate being returned.
Routers can provide idle liquidity but experience downtime. When routers are down, we have an incomplete view of the useable idle liquidity that can be used for fast path. We currently use the following logic as a proxy for router availability, overriding a "fast path" estimate if a majority of the recent transfers have actually been slow.
completedSlow
, then display a "slow path" estimate insteadAlong with the fast/slow determination, we also provide a median and a range for fast/slow paths for the last N=20 transfers of each type.
amount
being estimated for (right now we look at last N transfers of any amount)
Background
We need to significantly improve the accuracy of our estimated times to provide users with a clear countdown. Achieving a 99% accurate estimation, whether the path is slow or fast, within 20-30 seconds is crucial.
Current data of the accuracy of our estimated times [NEED TO ADD]
The new estimation time should be calculated based on:
Other ideas: 1) Transfer size 2) Transfers initiated in the past 3-4 days on currently active routers only 3) The available router's liquidity must be adjusted by the volume of transfers currently in processing 4) Difference between estimated and actual time on this route (past 3-4 days) 5) Dummy variable - actual errors
Product Spec: https://www.notion.so/connext/1-ETA-f434c48e3054455da73dc3a560875c32?pvs=4#b1f5b5132d2b41c3aa6b54706dda9924
Linked Issues & Documentation
Connected to #5966 and #5736