Previously, one could use the Fees
Sysvar, however this has been deprecated since 1.9. What is the current best practice for getting the current cost of a tx on-chain without an external oracle?
1 Answer
The Fees
sysvar was deprecated because transaction fees will not be deterministic anymore. Originally they were calculated based on the amount of signatures required to complete the transaction.
Now transaction fees are based on signatures provided + an additional fee provided in the transaction for prioritization on the cluster.
They may also include write-lock fees in the future, making the fees non-deterministic which cannot be accessed on-chain.