-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Task description
The transaction costs on Concordium have two components, one is based on the size of the transaction and the number of signatures, and then there is a transaction-specific one for executing the transaction.
There is already support to get the transaction-specific execution cost.
https://github.com/Concordium/concordium-rust-smart-contracts/blob/main/templates/default/deploy-scripts/src/deployer.rs#L297
Helper functions to estimate the first component, called the base_cost (mainly the transaction_size needs to be exposed), or the combined cost of base_cost+ transaction-specific execution cost would give better insight into Concordium's transaction cost mechanism. Currently, the GivenEnergy::Add(energy) can automatically handle the base_cost before sending the transaction on chain but for applications that need inside and visibility (e.g. for cost optimization or some checks) that is not a good option.
Sub-tasks
- Expose transaction_size to use the
base_costfunction. - Add
base_costfunction that given a signed transaction returns thebase_costof that transaction. - Add
transaction_costfunction that given a signed transaction returns the combined energybase_cost+transaction-specific execution cost