-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix: set block gas meter on prepare/process proposal #15012
Conversation
@@ -625,8 +625,10 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte) (gInfo sdk.GasInfo, re | |||
}() | |||
|
|||
blockGasConsumed := false |
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.
This files contains cosmetic changes only FYI.
}() | ||
|
||
blockGasConsumed := false | ||
// consumeBlockGas makes sure block gas is consumed at most once. It must happen after | ||
// tx processing, and must be executed even if tx processing fails. Hence, we use trick with `defer` | ||
|
||
// consumeBlockGas makes sure block gas is consumed at most once. It must | ||
// happen after tx processing, and must be executed even if tx processing | ||
// fails. Hence, it's execution is deferred. | ||
consumeBlockGas := func() { | ||
if !blockGasConsumed { |
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.
Change potentially affects state.
Call sequence:
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).runTx (baseapp/baseapp.go:604)
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).DeliverTx (baseapp/baseapp.go:385)
Thanks, @alexanderbez. I've tried PR #14984 to address the new handler issue. But I am unsure of the goal of ABCI 1.0 after phase 1. Maybe it needs a broad discussion, but the goal will be to fix #2150 and the block fills issue with gas transactions. |
I don't understand why the gas meter uses |
Yes, so the goal of ABCI++ integration is as follows:
Yes, you're right, it was a bug and I didn't have my coffee yet lol |
Pushed fixes. |
Thanks for the explanation! |
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.
lgtm!
nit: Unrelated to this PR but maybe this can be updated for style consistency: Lines 179 to 185 in 80dd55f
|
Good idea. I'll be sure to make them consistent! |
Mmmh, this is still failing: https://github.com/cosmos/cosmos-sdk/actions/runs/4168353062/jobs/7215053213 |
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.
lgtm
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.
lgtm!
I can't run localnet locally to figure out what's up... :( |
(cherry picked from commit b3f9506) # Conflicts: # baseapp/abci.go
#15040) Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
Description
Closes: #14998
Set block gas meter on the
Context
provided toPrepareProposal
andProcessProposal
handlers.Note, @JayT106, this only allows gas consumption checks up and until the AnteHandler phase, since in the SDK's default handlers of Prepare/Process proposal we do NOT execute messages. So it would be equivalent to calling
CheckTx
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.md
Reviewers 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