Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support to estimate the real transaction cost #134

Open
3 tasks
DOBEN opened this issue Oct 18, 2023 · 0 comments
Open
3 tasks

Better support to estimate the real transaction cost #134

DOBEN opened this issue Oct 18, 2023 · 0 comments
Labels
[Type] Task An additional feature or improvement.

Comments

@DOBEN
Copy link
Member

DOBEN commented Oct 18, 2023

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.

GivenEnergy
base_cost

Sub-tasks

  • Expose transaction_size to use the base_cost function.
  • Add base_cost function that given a signed transaction returns the base_cost of that transaction.
  • Add transaction_cost function that given a signed transaction returns the combined energy base_cost + transaction-specific execution cost
@DOBEN DOBEN added the [Type] Task An additional feature or improvement. label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Task An additional feature or improvement.
Projects
None yet
Development

No branches or pull requests

1 participant