Links

Network Fees and Gas Estimates

When Rango API provides a quote response, we try to provide an accurate estimation of fees. For the actual transaction creation however, especially EVM transactions, we suggest higher gaslimits and bridge fees in order to make sure the transaction is not processed by the network (or bridge). To achieve this goal, we apply safety factor multipliers to network fees and some bridge fees to reduce transaction failure rate.
Does this mean the user pays higher fees? No.
There are multiple reasons for using higher gaslimits and fees. EVM RPCs are not very good at estimating gas for complex transactions. The problem becomes even more complex if we consider gas refunds and net gas estimates.
For example imagine a transaction consumes 800k gas, but during the execution, the gas consumption up goes to 900k and at the end of the transaction 100k gas is refunded, netting the predicted 800k gas consumption. However, if the user sets 800k gas on transaction, the tx will fail because it cannot consume more than 800k to reach the 900k gas consumption, even if the user will be refunded 100k. Therefore, for this example, when we estimate the fees, we use 800k gas, but when we create the transaction, we use 900k gas.
As an example, you can take a look at this tx that has ran out of gas with a gaslimit of 695,624. (Link) But if we simulate the same transaction with a higher gasLimit, in this example, 795,624, we see that the transaction is successful and the gas used is 641,006 which is even lower than the original tx that failed. (Simulation Link)
Some bridges have a similar model and we apply a safety factor for the bridge fee. In such cases, the user is refunded if the it has paid more fees than neccessary.
Note: In the future we will provide the safety factors that we use in the APIs. This way, third parties can have a better estimate of the actual costs and what is safe to use for transaction execution.
Some useful links: