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

Add automated resource cost reports #1319

Open
leighmcculloch opened this issue Aug 16, 2024 · 0 comments
Open

Add automated resource cost reports #1319

leighmcculloch opened this issue Aug 16, 2024 · 0 comments
Assignees

Comments

@leighmcculloch
Copy link
Member

What problem does your feature solve?

For a developer who has invested in significant test coverage, they should be able to, through the execution of those tests, get a good signal for the costs their contract is expected require.

What would you like to see?

An option when running tests, maybe enabled by default if there is no significant performance issue with having it enabled, where a summary of every contract function that was executed along with it's range of costs.

An option for a detailed view where costs are shown per test.

What alternatives are there?

Developers can get this themselves on each test, but it's difficult to get that broad overview.

Caveat

The budget in the unit tests is not as accurate to when txs are submitted, and this issue is probably of very low impact unless that accuracy is improved in the Soroban Env when simulating in tests.

@leighmcculloch leighmcculloch changed the title Add automated gas reports Add automated resource cost reports Aug 16, 2024
github-merge-queue bot pushed a commit to stellar/rs-soroban-env that referenced this issue Nov 7, 2024
… per-invocation (#1482)

### What

This is an opt-in feature that will reset the budget and take a storage
snapshot for every 'logical' invocation (such as `call` or a lifecycle
operation). Then when the invocation is done we use the snapshot and
current budget to produce the estimate for the resources consumed by the
invocation (budget-related, IO-related and rent bumps).

This also provides a rough estimation for the respective fee breakdown
given a fee config.

### Why

Make unit tests more useful for rough performance evaluation. This is
the initial env-side implementation for
stellar/rs-soroban-sdk#1319

### Known limitations

Some of the resources are tricky to model. Specifically, this omits:

- transaction size
- return value size
- some XDR roundtrips that always happen for production scenarios

These shouldn't be too significant though and are likely better
addressed via e2e runs (like simulation or some `e2e_invoke`-based
mechanism)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@leighmcculloch @dmkozh and others