-
Notifications
You must be signed in to change notification settings - Fork 389
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
feat: cpu and store gas updates #3054
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the PR looks fine, apart from the comments left by @thehowl, which should be addressed about the global gas meter setting in the VM keeper 🙏
I'm temporarily just putting a pause on the PR, to allow for us to discuss whether these new gas values make sense, since they are a huge change. I also want to see some more reasoning and gas comparisons, apart from #2241
If we're fine with the bumps, I am also cool with the PR moving forward as is ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it looks good. In this PR or a future one, I suggest we:
- Add a global multiplier/divider parameter to avoid using
ngnot
while keeping the numbers relatively readable. - Create a benchmarking tool that runs all the gnocode in the repository and generates a CSV or TXT file with the gas details we commit periodically (there's no need for this on every commit, in my opinion). This way, whenever we want to fine-tune a parameter, we can run the same script again and compare the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unblocking after @moul is fine with the bumps
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
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:
Here are the diagrams to explain the store access gas before and after changes
Before:
After:
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description