fix: x/capability InitMemStore should not consume gas#15030
Merged
amaury1093 merged 4 commits intoFeb 15, 2023
Merged
Conversation
Contributor
Author
|
I am not sure what is going on with the |
alexanderbez
approved these changes
Feb 14, 2023
alexanderbez
left a comment
Contributor
There was a problem hiding this comment.
👏
Thanks @prettymuchbryce!
Yeah, you can ignore the lint stuff for now...not sure what's up with that.
atheeshp
approved these changes
Feb 15, 2023
Contributor
There was a problem hiding this comment.
Suggested change
| suite.Require().Equal(prevBlockGas, blockGasUsed, "beginblocker consumed block gas during execution") | |
| suite.Require().Equal(prevBlockGas, blockGasUsed, "ensure beginblocker consume no block gas during execution") |
can you update the below check's description as well.
julienrbrt
approved these changes
Feb 15, 2023
likhita-809
approved these changes
Feb 15, 2023
Contributor
|
@prettymuchbryce could you merge/rebase main so that our bot automerges this PR? Or altnertively give write access to maintainers |
auto-merge was automatically disabled
February 15, 2023 15:11
Head branch was pushed to by a user without write access
0a6c7ae to
ca7706b
Compare
Contributor
Author
|
@AmauryM I rebased onto |
9 tasks
19 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes: #15015
The
capabilitymodule'sInitMemStorefunction incrementsgasMeternon-deterministically across validators.When a validator is restarted, InitMemStore is called during
BeginBlockof the next committed block. This function performs some store operations which incrementGasUsedon theGasMeterhere.So long as
SetGasMeteris always called as part of the AnteHandler chain (which is the current behavior of the default AnteHandler chain here), then this is not an issue as theGasMeterwill be reset betweenBeginBlockand the firstDeliverTxcall.However, if the application uses a custom AnteHandler chain that omits this behavior, the
GasUsedwithin each transaction will vary, as theGasMeterwill be the initial meter set duringBeginBlockhere which increments gas differently if the capability module'sMemStorehas not yet been initialized.As a solution, this PR adds
WithGasMeterto thenoGasCtxhere which ensures thatInitMemStoreconsumes no gas fromGasMeter.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.mdReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!in the type prefix if API or client breaking change