You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The BaseApp has two gas-meters in state blockGasMeter, gasMeter
blockGasMeter - Should track all gas consumed across block execution
gasMeter - Should track gas consumed in tx-execution
Bug
expected behavior
The blockGasMeter tracks gas consumed across the block's executon (BeginBlock, DeliverTx, EndBlock)
The gasMeter in runTx is 0 before tx-execution occurs
actual behavior
Gas is not consumed in BeginBlock, instead, the gas consumed from BeginBlock exists on the gasMeter that runs into runTx, and is reset by the SetupDecorator in the execution of the first tx's AnteHandler sequence.
Simplest Fix
The simplest fix (not necessarily correct)
Consume blockGas in BeginBlock from the gasMeter
After consumption, reset the gasMeter at the end of BeginBlock
Cosmos SDK Version
0.47
How to reproduce?
No response
The text was updated successfully, but these errors were encountered:
The blockGasMeter tracks gas consumed across the block's executon (BeginBlock, DeliverTx, EndBlock)
I just want to clarify something. The BlockGasMeter is only meant to track the cumulative gas consumed across all txs in a block. I.e. it should ignore BeginBlock and EndBlock.
The fix should actually be to ensure the GasMeter is 0 when processing the 1st tx in each block. This could simply be done at the end of BeginBlock.
Regardless, I'd like to write a unit test to reproduce it.
Is there an existing issue for this?
What happened?
Context
BaseApp
has two gas-meters in stateblockGasMeter
,gasMeter
blockGasMeter
- Should track all gas consumed across block executiongasMeter
- Should track gas consumed in tx-executionBug
blockGasMeter
tracks gas consumed across the block's executon (BeginBlock, DeliverTx, EndBlock)gasMeter
inrunTx
is 0 before tx-execution occursBeginBlock
, instead, the gas consumed fromBeginBlock
exists on thegasMeter
that runs intorunTx
, and is reset by the SetupDecorator in the execution of the first tx's AnteHandler sequence.Simplest Fix
blockGas
inBeginBlock
from thegasMeter
gasMeter
at the end ofBeginBlock
Cosmos SDK Version
0.47
How to reproduce?
No response
The text was updated successfully, but these errors were encountered: