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

Refactor gas profiles to store call counts #8795

Closed
aborg-dev opened this issue Mar 24, 2023 · 1 comment
Closed

Refactor gas profiles to store call counts #8795

aborg-dev opened this issue Mar 24, 2023 · 1 comment
Assignees
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc C-housekeeping Category: Refactoring, cleanups, code quality

Comments

@aborg-dev
Copy link
Contributor

At the moment the ProfileDataV3 stores the total consumed gas for each host function and action. This makes Compute Cost calculation harder than necessary because we need to divide the total consumed gas by the host function call before multiplying it by the corresponding compute cost.

We could simplify this by instead storing the call count for each ExtCost inside the profile as it can be used to derive both resulting gas usage and compute usage.

Relatedly, we also store a counter EXT_COSTS_COUNTER alongside GasCounter for the use in parameter estimator. We should consider whether it should be merged directly into GasCounter to eliminate duplication with Profiles that we track anyway unconditionally.

@aborg-dev aborg-dev added C-housekeeping Category: Refactoring, cleanups, code quality A-contract-runtime Area: contract compilation and execution, virtual machines, etc labels Mar 24, 2023
@aborg-dev aborg-dev self-assigned this Mar 24, 2023
aborg-dev added a commit to aborg-dev/nearcore that referenced this issue Mar 24, 2023
This seemed like the simplest approach that introduces minimal overhead
and code changes (as opposed to introducing a dedicated field in the
GasCounter).

Some follow-up work is planned in near#8795
near-bulldozer bot pushed a commit that referenced this issue Mar 24, 2023
This seemed like the simplest approach that introduced minimal runtime overhead and code changes (as opposed to introducing a dedicated field in the GasCounter). Happy to consider the alternatives though.

Part of #8032

Some follow-up work is planned in #8795
nikurt pushed a commit to nikurt/nearcore that referenced this issue Apr 5, 2023
This seemed like the simplest approach that introduced minimal runtime overhead and code changes (as opposed to introducing a dedicated field in the GasCounter). Happy to consider the alternatives though.

Part of near#8032

Some follow-up work is planned in near#8795
@aborg-dev
Copy link
Contributor Author

This is no longer feasible as we need to store fractional gas usage for #8914. See #8908 for more context

@aborg-dev aborg-dev closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contract-runtime Area: contract compilation and execution, virtual machines, etc C-housekeeping Category: Refactoring, cleanups, code quality
Projects
None yet
Development

No branches or pull requests

1 participant