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

Include tx cost in transaction receipts #1507

Open
hstove opened this issue Jul 16, 2024 · 1 comment
Open

Include tx cost in transaction receipts #1507

hstove opened this issue Jul 16, 2024 · 1 comment

Comments

@hstove
Copy link
Contributor

hstove commented Jul 16, 2024

One handy feature in Clarinet v1 was the inclusion of costs in the return type of function calls (both public and read-only). It would be great if this was included in the Clarinet v2. Specifically, I'm referring to writing unit tests and the JS return type. I wouldn't consider this a "must have", so if it's a huge effort, it's probably not worth prioritization. But if it's relatively easy to add, I'd appreciate considering it as a feature.

@hugocaillard
Copy link
Collaborator

Definitely easy to add.
The interface could be

const { result, events, costs } = simnet.callReadOnlyFn(...)

console.log(costs)
/*
{
    total: {
      write_length: 19,
      write_count: 2,
      read_length: 1137,
      read_count: 8,
      runtime: 8882
    },
    limit: {
      write_length: 15000000,
      write_count: 15000,
      read_length: 100000000,
      read_count: 15000,
      runtime: 5000000000
    },
    memory: 393,
    memory_limit: 100000000
  }
*/

Is that what you have in mind?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants