-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cpu and store gas updates (#3054)
<!-- please provide a detailed description of the changes made in this pull request. --> ## Summary: This PR updates the CPU and Store gas based on results from the benchmarking tool:#2241 For CPU gas, the measurement is in nanoseconds per opcode execution. For storage gas, the measurement is in nanoseconds per byte for each type of Gno store access. ## Changes: We moved the gas meter from the underlying store to the upper Gno store to capture accurate resource consumption for VM transactions. At the same time, we retain the original gas store and gas meter for the Auth Keeper to handle regular blockchain transactions that do not necessarily involve the VM. We also updated the gas-wanted in the integration test to reflect actual gas usage. This can serve as a flag to alert us to future changes that might increase gas assumptions. Additional reasons for these changes include: - The Gno VM store processes additional complex encoding and decoding of data structures, rather than simply reading and writing bytes to disk. - For the above reason, we benchmarked gas for store access at the Gno store level. - We want to avoid consuming gas at two points for a single store access during a VM transaction. Here are the diagrams to explain the store access gas before and after changes #### Before: ![image](https://github.com/user-attachments/assets/7f1f7361-623d-4bdf-ba28-9b337da649fc) #### After: ![image](https://github.com/user-attachments/assets/c5ce6e36-e2f7-4f10-bebf-4278f9d16e47) <details><summary>Contributors' checklist...</summary> - [x] Added new tests - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details>
- Loading branch information
Showing
29 changed files
with
346 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.