Output actual invocation cost and not just simulation cost

Open
#1,223 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
cli

Research direction

Start with the verbose soroban contract invoke command and the soroban_cli::log::cost output shown in the issue. Trace where the simulated cost is logged and where submitted transaction metadata becomes available. Done means verbose output clearly labels simulated cost and also reports the network’s actual final cost.

Written by the indexing model from the issue text.

Description

When running commands that simulate and submit a transaction, the verbose logs output the cost that simulation estimates, but not the actual final cost that the network reports.

❯ soroban -v contract invoke --network local --source me --id CCKBGX3XBPEDYWSI7RTYGLUVGITKVYNBQKBQCMXH7IRBUJJRZ2K5AATN -- f
2024-02-27T03:59:47.912590Z DEBUG soroban_cli::log::cost: cost===================== Cost ====================
CPU used: 6104747
Bytes read: 6976
Bytes written: 0
==============================================
...

Looking at the logs can be misleading, because it can look like that is the actual cost incurred, but the cost being outputted is only the simulated cost.

I think two changes would be beneficial:

  1. The verbose output should be clear that the cost being outputted is simulated cost.

  2. The verbose output should include the actual cost as reported by the transaction meta.

Dominant language
Rust
Stars
123
Forks
141
Avg merge
2d 21h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stellar/stellar-cli

All issues in stellar/stellar-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.